RdTextFilter | R Documentation |
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"))
ifile |
An input file specified as a filename or connection, or an |
encoding |
An encoding name to pass to |
keepSpacing |
Whether to try to leave the text in the same lines and columns as in the original file. |
drop |
Additional sections of the Rd to drop. |
keep |
Sections of the Rd file to keep. |
macros |
Macro definitions to assume when parsing. See |
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 aspell
can check only the text and report the position in the original file.
(If keepSpacing
is FALSE
, blank filling will not occur,
and text will not be output in its original location.)
By default, the tags \S3method
, \S4method
,
\command
, \docType
, \email
, \encoding
,
\file
, \keyword
, \link
, \linkS4class
,
\method
, \pkg
, and \var
are skipped. Additional
tags can be skipped by listing them in the drop
argument;
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
"TEXT"
.
A character vector which if written to a file, one element per line, would duplicate the text elements of the original Rd file.
The filter attempts to merge text elements into single words when markup in the Rd file is used to highlight just the start of a word.
Duncan Murdoch
aspell
, for which this is an acceptable filter
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.