This function blanks out all non-text in an Rd file, for spell checking or other uses.
RdTextFilter(ifile, encoding = "unknown", keepSpacing = TRUE, drop = character(), keep = character(), macros = file.path(R.home("share"), "Rd", "macros", "system.Rd"))
An input file specified as a filename or connection, or an
An encoding name to pass to
Whether to try to leave the text in the same lines and columns as in the original file.
Additional sections of the Rd to drop.
Sections of the Rd file to keep.
Macro definitions to assume when parsing. See
A character vector which if written to a file, one element per line, would duplicate the text elements of the original Rd file.
This function parses the Rd file, then walks through it, element by
element. Items with tag
"TEXT" are kept in the same position as
they appeared in the original file, while other parts of the file are
replaced with blanks, so a spell checker such as
can check only the text and report the position in the original file.
FALSE, blank filling will not occur,
and text will not be output in its original location.)
By default, the tags
\var are skipped. Additional
tags can be skipped by listing them in the
listing tags in the
keep argument will stop them from being
skipped. It is also possible to
keep any of the
c("RCODE", "COMMENT", "VERB") tags, which correspond to R-like
code, comments, and verbatim text respectively, or to drop
aspell, for which this is an acceptable