-
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
Failures with inline R code in multiline @param tags #1112
Comments
Reprex: roxygen2::roc_proc_text(roxygen2::rd_roclet(), "
#' Title
#'
#' @param some_param Foo
#' bar 12`r paste0(\"test\")`
#' @md
foo <- function(some_param) {}
")
#> $foo.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{Title}
#> \usage{
#> foo(some_param)
#> }
#> \arguments{
#> \item{some_param}{Foo
#> bar test)`}
#> }
#> \description{
#> Title
#> } Created on 2020-06-14 by the reprex package (v0.3.0) |
Update: I just realized that the indentation of the second line is central to the bug. No indentation, no problem: roxygen2::roc_proc_text(roxygen2::rd_roclet(), "
#' Title
#'
#' @param some_param Foo
#' bar 12`r paste0(\"test\")`
#' @md
foo <- function(some_param) {}
")
#> $foo.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{Title}
#> \usage{
#> foo(some_param)
#> }
#> \arguments{
#> \item{some_param}{Foo
#> bar 12test}
#> }
#> \description{
#> Title
#> } Created on 2021-09-09 by the reprex package (v2.0.1) OTOH, we can escalate the problem with more indentation: roxygen2::roc_proc_text(roxygen2::rd_roclet(), "
#' Title
#'
#' @param some_param Foo
#' bar 12`r paste0(\"test\")`
#' @md
foo <- function(some_param) {}
")
#> $foo.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{Title}
#> \usage{
#> foo(some_param)
#> }
#> \arguments{
#> \item{some_param}{Foo
#> test bar 12\verb{r "test"}}
#> }
#> \description{
#> Title
#> } Created on 2021-09-09 by the reprex package (v2.0.1) Appears to me there's some erroneous whitespace stripping or the like involved when inline code is replaced with the evaluated strings. |
Fixed in #1391 |
Consider the following
@param
tag:When roxygen2 (latest 7.1.1.9001) renders this to
.Rd
, it swallows the last two "static" characters (12
) and outputs two additional characters ()`
) at the end of the parsed inline R code which shouldn't be there:Instead, it should actually produce this
.Rd
:The underlying issue looks like some "off-by-two"-error. The inline R code
should be parsed to:
but wrongly becomes:
The text was updated successfully, but these errors were encountered: