[Rd] HTML documentation check: 'condition must be plain text'

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Mon Jun 20 17:06:02 CEST 2022


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



More information about the R-devel mailing list