\HeaderA{Rd2HTML}{Work with an Rd object}{Rd2HTML}
\aliasA{checkRd}{Rd2HTML}{checkRd}
\aliasA{findHTMLlinks}{Rd2HTML}{findHTMLlinks}
\aliasA{Rd2ex}{Rd2HTML}{Rd2ex}
\aliasA{Rd2latex}{Rd2HTML}{Rd2latex}
\aliasA{Rd2txt}{Rd2HTML}{Rd2txt}
\keyword{documentation}{Rd2HTML}
\begin{Description}\relax
These experimental functions take the output of the
\code{\LinkA{parse\_Rd}{parse.Rul.Rd}} function and check it or produce a help
page from it.  Their interfaces (and existence!) are subject to
change.
\end{Description}
\begin{Usage}
\begin{verbatim}
Rd2HTML(Rd, out = "", package = "", defines = .Platform$OS.type,
        encoding = "unknown", Links = NULL, CHM = FALSE)

Rd2txt(Rd, out = "", package = "", defines = .Platform$OS.type)

Rd2latex(Rd, out = "", defines = .Platform$OS.type, encoding = "unknown")

Rd2ex(Rd, out = "", defines = .Platform$OS.type, encoding = "unknown")

checkRd(Rd, defines = .Platform$OS.type, encoding = "unknown",
        unknownOK = FALSE, listOK = TRUE)

findHTMLlinks(pkgDir = "", lib.loc = NULL)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{Rd}] the \code{Rd} object. 
\item[\code{out}] a filename or connection object to which to write the output. 
\item[\code{package}] the package to list in the output. 
\item[\code{defines}] string(s) to use in \code{"\#ifdef"} tests. 
\item[\code{encoding}] encoding to use if the file does not specify one. 
\item[\code{Links}] \code{NULL} or a named (by topics) character vector of
links, as returned by \code{findHTMLlinks}.
\item[\code{CHM}] logical: prepare HTML suitable for Compiled HTML?
\item[\code{unknownOK}] unrecognized macros are treated as errors if
\code{FALSE}, otherwise warnings. 
\item[\code{listOK}] unnecessary non-empty braces (e.g. around text, not
as an argument) are treated as errors if \code{FALSE}, otherwise warnings. 
\item[\code{pkgDir}] The top-level directory of an installed package.
\item[\code{lib.loc}] character vector describing the location of \R{} library trees
to scan: the default indicates \code{\LinkA{.libPaths}{.libPaths}()}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The \code{Rd2HTML} converter is still in development, and currently
has the following known deficiencies:
\Itemize{
\item \code{"\bsl{}enc"} is not supported.
\item Error messages are not as informative as they could be.  Often
using \code{parse\_Rd(..., verbose = TRUE)} will give a better idea
of what is wrong.
\item Formatting is not always optimal.
}

\code{Rd2ex} extracts the examples in the format used by
\code{\LinkA{example}{example}} and \R{} utilities.  it reproduces the previous
version up to
\Itemize{
\item The parser does not interpret markup in \R{} comments: this used
to be done.
\item Small improvements in layout.
}

\code{findHTMLlinks} uses in decreasing priority
\Itemize{
\item The package in \code{pkgDir}: this is used when converting
HTML help for that package.
\item The packages that are loaded in a vanilla \R{} session.
\item Other packages found in the library trees specified by
\code{lib.loc} in the order of the trees and alphabetically within a
library tree.
}
\end{Details}
\begin{Value}
\code{Rd2*} are executed mainly for the side effect of writing the
converted help page.  Its value is the name of that page.

\code{checkRd} returns \code{TRUE} if the file has no errors; it
generates an R error otherwise.

\code{findHTMLlinks} returns a named character vector of relative
file paths, in the same package or in a package in the same library tree.
\end{Value}
\begin{Author}\relax
Duncan Murdoch, Brian Ripley
\end{Author}
\begin{References}\relax
\url{http://developer.r-project.org/parseRd.pdf}
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{parse\_Rd}{parse.Rul.Rd}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

toolsRd <- Rd_db("tools")
con <- textConnection(toolsRd[[grep("Rd2HTML.Rd", names(toolsRd))]], "rt")
outfile <- paste(tempfile(), ".html", sep="")
browseURL(Rd2HTML(con, outfile, package="tools"))
close(con)
 
con <- textConnection(toolsRd[["Rd2HTML.Rd"]], "rt")
checkRd(con) # A stricter test than Rd2HTML uses
close(con)

\end{ExampleCode}
\end{Examples}

