-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escaped quote not parsed correctly #873
Comments
The problem is specifically with the mismatched braces or quotes; it seems like roxygen2 is failing to handle the escape correctly. Slightly more minimal reprex: library(roxygen2)
out <- roc_proc_text(rd_roclet(), "
#' with escaped quotation mark
#' @examples
#' '34.00\''
h <- function() {}
")
#> Warning: @examples [/tmp/Rtmpvb1beU/filef5c3560a55d6#4]: mismatched braces
#> or quotes Created on 2019-07-21 by the reprex package (v0.3.0) |
Oops my reprex was slightly off — It should be: library(roxygen2)
out <- roc_proc_text(rd_roclet(), "
#' with escaped quotation mark
#' @examples
#' '34.00\\''
h <- function() {}
")
#> Warning: @examples [/tmp/RtmpVuA2Uf/file90ef5044bb20#4]: mismatched braces
#> or quotes
roxygen2:::rdComplete("'34.00'", is_code = TRUE)
#> [1] TRUE
roxygen2:::rdComplete("'34.00\\''", is_code = TRUE)
#> [1] TRUE |
Ah, the problem is x1 <- "'34.00\\''\n"
cat(x1)
#> '34.00\''
x2 <- roxygen2:::escape_examples(x1)
cat(x2)
#> '34.00\\''
roxygen2:::rdComplete(x2, is_code = TRUE)
#> [1] FALSE Maybe |
Examples with strings containing quoted quotation marks (char ", ASCII 34) are not parsed correctly and do not show up in the output
.Rd
file.A simplified reproducible example is shown at the bottom.
A realistic one from my code (containing strings with both quotation mark character (" or ASCII 34) and apostrophe character (' or ASCII 39)) is the following:
Here is a reprex for a simplified case:
Created on 2019-06-19 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: