Ivan Krylov
2022-Jun-20 15:06 UTC
[Rd] HTML documentation check: 'condition must be plain text'
Hi, Use of \Sexpr in an \if condition in R documentation results in a NOTE, but only during HTML documentation check, not any of the previous Rd checks: \if{\Sexpr{'TRUE'}}{The condition evaluates to true.} * checking HTML version of manual ... NOTE Encountered the following conversion/validation errors: foo.Rd:10: condition must be plain text Is this supported? "Writing R documentation" ?2.11 seems to agree:>> Also accepted [as a condition] are TRUE (matching all formats) and >> FALSE (matching no formats). These could be the output of the \Sexpr >> macro.In order to check the HTML documentation, check_Rd2HTML() runs tools::Rd2HTML() on the results of tools::Rd_db() [1]. The former runs \Sexpr[stage=render] macros and the latter runs \Sexpr[stage=build] macros, leaving \Sexpr[stage=install] macros unevaluated. The NOTE goes away if I switch the "stage" argument to anything but "install". Is there any downside to adding stages = c('build', 'install') to the Rd_db call or stages = c('install', 'render') to the Rd2HTML call in order to make this NOTE go away? -- Best regards, Ivan [1] https://github.com/r-devel/r-svn/blob/d25e77715164e39c96baae4c180d8f980ec93932/src/library/tools/R/check.R#L4911-L4939
Kurt Hornik
2022-Jun-23 10:37 UTC
[Rd] HTML documentation check: 'condition must be plain text'
>>>>> Ivan Krylov writes:> Hi, > Use of \Sexpr in an \if condition in R documentation results in a NOTE, > but only during HTML documentation check, not any of the previous Rd > checks:> \if{\Sexpr{'TRUE'}}{The condition evaluates to true.}> * checking HTML version of manual ... NOTE > Encountered the following conversion/validation errors: > foo.Rd:10: condition must be plain text> Is this supported? "Writing R documentation" ?2.11 seems to agree:>>> Also accepted [as a condition] are TRUE (matching all formats) and >>> FALSE (matching no formats). These could be the output of the \Sexpr >>> macro.> In order to check the HTML documentation, check_Rd2HTML() runs > tools::Rd2HTML() on the results of tools::Rd_db() [1]. The former runs > \Sexpr[stage=render] macros and the latter runs \Sexpr[stage=build] > macros, leaving \Sexpr[stage=install] macros unevaluated. The NOTE goes > away if I switch the "stage" argument to anything but "install".> Is there any downside to adding stages = c('build', 'install') to the > Rd_db call or stages = c('install', 'render') to the Rd2HTML call in > order to make this NOTE go away?Thanks for spotting this. There is in the current check code which builds the Rd db from the package sources in which case one cannot safely assume that install (as well as render) stage Sexprs can be processed. I'll try to change this so that we use the installed package if possible etc. Best -k> -- > Best regards, > Ivan> [1] > https://github.com/r-devel/r-svn/blob/d25e77715164e39c96baae4c180d8f980ec93932/src/library/tools/R/check.R#L4911-L4939> ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel