-
Notifications
You must be signed in to change notification settings - Fork 236
Closed
Labels
Milestone
Description
I am currently documenting a function, which takes as input another function. When the body of the default value of that other function is too long, it looks like roxygen suppress a line break in the \usage
section, making the R code invalid.
For my own project, I solved the problem by using the @usage
command to supply the proper value manually, but I think this could be a bug in roxygen.
Below is a reprex with two functions at the limiting point : the second function is only two characters longer than the first one, but its \usage
section is not valid anymore (while it was the case for the first function).
library(roxygen2)
roc_proc_text(rd_roclet(), "
#' A test function
#'
#' @param f a function
#'
#' @return nothing
MyFunc1 <- function(
f = function(x){print(x)
return (1+2+3+4+5+6+7) } )
{
return ()
}
#' A test function 2
#'
#' @param f a function
#'
#' @return nothing
MyFunc2 <- function(
f = function(x){print(x)
return (1+2+3+4+5+6+7+8) } )
{
return ()
}
" )
#> $MyFunc1.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{MyFunc1}
#> \alias{MyFunc1}
#> \title{A test function}
#> \usage{
#> MyFunc1(f = function(x) {
#> print(x)
#> return(1 + 2 + 3 + 4 + 5 + 6 + 7)
#> })
#> }
#> \arguments{
#> \item{f}{a function}
#> }
#> \value{
#> nothing
#> }
#> \description{
#> A test function
#> }
#>
#> $MyFunc2.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{MyFunc2}
#> \alias{MyFunc2}
#> \title{A test function 2}
#> \usage{
#> MyFunc2(
#> f = function(x) { print(x) return(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8) }
#> )
#> }
#> \arguments{
#> \item{f}{a function}
#> }
#> \value{
#> nothing
#> }
#> \description{
#> A test function 2
#> }