parse_Rd
function
and produce a help page from it. As they are mainly
intended for internal use, their interfaces are subject to change.Rd2HTML(Rd, out = "", package = "", defines = .Platform$OS.type,
Links = NULL, Links2 = NULL,
stages = "render", outputEncoding = "UTF-8",
dynamic = FALSE, no_links = FALSE, fragment = FALSE,
stylesheet = "R.css", ...)Rd2txt(Rd, out = "", package = "", defines = .Platform$OS.type,
stages = "render", outputEncoding = "",
fragment = FALSE, options, ...)
Rd2latex(Rd, out = "", defines = .Platform$OS.type,
stages = "render", outputEncoding = "ASCII",
fragment = FALSE, ..., writeEncoding = TRUE)
Rd2ex(Rd, out = "", defines = .Platform$OS.type,
stages = "render", outputEncoding = "UTF-8",
commentDontrun = TRUE, commentDonttest = FALSE, ...)
Rd
object to use as input."build"
, "install"
, or
"render"
) should NULL
or a named (by topics) character vector of
links, as returned by findHTMLlinks
.Rd2txt_options
.parse_Rd
when
Rd
is a filename.Rd2HTML
produces HTML,
Rd2txt
produces plain text, Rd2latex
produces LaTeX.
Rd2ex
extracts the examples in the format used by
example
and Rutilities. Each of the functions accepts a filename for an Rd file, and
will use parse_Rd
to parse it before applying the
conversions or checks.
The difference between arguments Link
and Link2
is that
links are looked in them in turn, so lazy-evaluation can be used to
only do a second-level search for links if required.
Note that the default for Rd2latex
is to output ASCII,
including using the second option of
Rd2txt
will format text paragraphs to a width determined by
width
, with appropriate margins. The default is to be close to
the rendering in versions of R< 2.10.0.
Rd2txt
will use directional quotes (see sQuote
)
if option "useFancyQuotes"
is true (the default) and
#ifdef unix
the current encoding is UTF-8.
#endif
#ifdef windows
the current locale uses a single-byte encoding (except C).
(Directional quotes are not attempted in East Asian locales as they are
usually double-width, which looks wrong with English text.)
#endif
Various aspects of formatting by Rd2txt
are controlled by the
options
argument, documented with the Rd2txt_options
function. Changes made using options
are temporary, those
made with Rd2txt_options
are persistent.
When fragment = TRUE
, the Rd
file will be rendered
with no processing of
For output, the outputEncoding
argument will be used:
outputEncoding = ""
will choose the native encoding for the
current system.
If the text cannot be converted to the outputEncoding
, byte
substitution will be used (see iconv
): Rd2latex
and Rd2ex
give a warning.
}
For example, this man page was:
Rd2latex
, the output name is given an
attribute "latexEncoding"
giving the encoding of the file in a
form suitable for use with the LaTeX inputenc package.parse_Rd
, checkRd
,
findHTMLlinks
, Rd2txt_options
.
Rd <- file.path("src/library/tools/man/Rd2HTML.Rd")
outfile <- tempfile(fileext = ".html") browseURL(Rd2HTML(Rd, outfile, package = "tools", stages = c("install", "render")))
outfile <- tempfile(fileext = ".txt") file.show(Rd2txt(Rd, outfile, package = "tools", stages = c("install", "render")))
checkRd(Rd) # A stricter test than Rd2HTML uses
}