Skip to content
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

Unnecessary escaping of % inside multi-line character in R #1616

Open
eitsupi opened this issue Apr 28, 2024 · 0 comments
Open

Unnecessary escaping of % inside multi-line character in R #1616

eitsupi opened this issue Apr 28, 2024 · 0 comments

Comments

@eitsupi
Copy link

eitsupi commented Apr 28, 2024

From pola-rs/r-polars#1065, maybe related to #904

I noticed that Rd files are not generated correctly when % is included within a multi-line string in the example.
I want to examples include % inside multi-line characters something like this:

a <- "%"
b <- "
%
"

For this, the following Rd file is in the correct format.
Note that the second % is not escaped.

\examples{
a <- "\%"
b <- "
%
"
}

However, when roxygen2 generates an Rd file from a comment, the second % is also escaped, so the original example is not restored when converted to another format, such as Rd2txt().

roxygen2::roc_proc_text(
  roxygen2::rd_roclet(),
  r"(
#' sample
#' @examples
#' a <- "%"
#' b <- "
#' %
#' "
foo <- function() 1
)"
)
#> $foo.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{sample}
#> \usage{
#> foo()
#> }
#> \description{
#> sample
#> }
#> \examples{
#> a <- "\%"
#> b <- "
#> \%
#> "
#> }

Created on 2024-04-28 with reprex v2.1.0

@eitsupi eitsupi changed the title Unnecessary escaping of % Unnecessary escaping of % inside multi-line character in R Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant