Skip to content

Commit

Permalink
Teach splitByWhitespace() about backticks
Browse files Browse the repository at this point in the history
Fixes #1257
  • Loading branch information
hadley committed Apr 5, 2022
1 parent 5e19448 commit 4283f59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# roxygen2 (development version)

* Arguments containing non-syntactic values surrounded by back ticks are now
wrapped correctly (#1257).

* DOIs in the `URL` field of the `DESCRIPTION` are now converted to Rd's special
`\doi{}` tag (@ThierryO, #1296).

Expand Down
2 changes: 1 addition & 1 deletion src/wrapUsage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ std::vector<std::string> splitByWhitespace(std::string string) {
} else if (*cur == ' ' || *cur == '\t' || *cur == '\n') {
out.push_back(acc);
acc = "";
} else if (*cur == '"' || *cur == '\'') {
} else if (*cur == '"' || *cur == '\'' || *cur == '`') {
in_string = *cur;
acc += *cur;
} else {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/rd-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
x,
y,
xy = "abcdef",
xyz = c(`word word word word` = "abcdef", `word word word` = "abcdef", `word word
word` = "abcdef", `word word word` = "abcdef")
xyz = c(`word word word word` = "abcdef", `word word word` = "abcdef",
`word word word` = "abcdef", `word word word` = "abcdef")
)


Expand Down

0 comments on commit 4283f59

Please sign in to comment.