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

Double backslashes in examples render differently with 7.0.1 #990

Closed
wch opened this issue Nov 25, 2019 · 2 comments
Closed

Double backslashes in examples render differently with 7.0.1 #990

wch opened this issue Nov 25, 2019 · 2 comments

Comments

@wch
Copy link
Member

wch commented Nov 25, 2019

I'm actually not sure if this is intentional or not. But in roxygen2 <= 7.0.0, given this input in the examples section:

#' "\\alpha" \\

It would produce this output:

"\\\\alpha" \\\\

In 7.0.1, it produces this:

"\\alpha" \\

Reprex (note that there are extra backslashes in the input for escaping):

library(roxygen2)
roc_proc_text(rd_roclet(), "
#' Example
#' @examples
#' \"\\\\alpha\" \\\\
f <- function() {}
")
#> $f.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{f}
#> \alias{f}
#> \title{Example}
#> \usage{
#> f()
#> }
#> \description{
#> Example
#> }
#> \examples{
#> "\\alpha" \\
#> }

For a real-life example, the upgrade to 7.0.1 resulted in this change, which led to a R CMD check failure:

rstudio/shiny@0cbe4bb#diff-fd9eb6354a4cc65e5016dd2dd015e7d4R20

If this is the intended behavior, then that's fine; we can change the .R files to match.

@gaborcsardi
Copy link
Member

Not intended. @hadley is aware of it, and I believe that there will be another patch version soon.

@hadley
Copy link
Member

hadley commented Nov 26, 2019

Now I see

library(roxygen2)

roc_proc_text(rd_roclet(), "
#' Example
#' @examples
#' \"\\\\alpha\" \\\\
f <- function() {}
")[[1]]$get_section("examples")
#> \examples{
#> "\\\\alpha" \\
#> }

Created on 2019-11-26 by the reprex package (v0.3.0)

@hadley hadley closed this as completed in 6187636 Nov 26, 2019
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

3 participants