diff --git a/autotests/folding/test.Rd.fold b/autotests/folding/test.Rd.fold new file mode 100644 --- /dev/null +++ b/autotests/folding/test.Rd.fold @@ -0,0 +1,44 @@ +% Single-line comment +\name{foo} +#ifdef unix +\alias{bar} +#endif ignored +\title{Foo} +\description{ + We have a list + \itemize error{ + \item foo, + \item bar. + } + Also a table: \tabular{lr}{ + foo \tab \code{foo} \cr + bar \tab \preformatted{bar} + } +} +\section{Section}{ + Escaped braces don't need balance \} + \subsection{Subsection}{ + \subsection{Subsubsection}{ + Sections can be nested. + } + } +} +\usage{ +foo(a, b = default) +} +\newcommand{\macro}{Test#1} +\arguments{ + \item{a}{\if{html}{π =} \Sexpr[stage=build]error{4*atan(1)}} + \item{b}{\macro{text} \link[pkg:bar]{fooo}} +} +\seealso{ + \code{\link{bar}} +} +\examples{ +# R comment +% Rdoc comment +foo(1) +for (i in 1:10) + foo(i) +} +\keyword{foo} diff --git a/autotests/html/test.Rd.html b/autotests/html/test.Rd.html new file mode 100644 --- /dev/null +++ b/autotests/html/test.Rd.html @@ -0,0 +1,51 @@ + + + +test.Rd + +
+% Single-line comment
+\name{foo}
+#ifdef unix
+\alias{bar}
+#endif ignored
+\title{Foo}
+\description{
+    We have a list
+    \itemize error{
+        \item foo,
+        \item bar.
+    }
+    Also a table: \tabular{lr}{
+        foo \tab \code{foo} \cr
+        bar \tab \preformatted{bar}
+    }
+}
+\section{Section}{
+    Escaped braces don't need balance \}
+    \subsection{Subsection}{
+        \subsection{Subsubsection}{
+            Sections can be nested.
+        }
+    }
+}
+\usage{
+foo(a, b = default)
+}
+\newcommand{\macro}{Test#1}
+\arguments{
+  \item{a}{\if{html}{π =} \Sexpr[stage=build]error{4*atan(1)}}
+  \item{b}{\macro{text} \link[pkg:bar]{fooo}}
+}
+\seealso{
+  \code{\link{bar}}
+}
+\examples{
+# R comment
+% Rdoc comment
+foo(1)
+for (i in 1:10)
+    foo(i)
+}
+\keyword{foo}
+
diff --git a/autotests/input/test.Rd b/autotests/input/test.Rd new file mode 100644 --- /dev/null +++ b/autotests/input/test.Rd @@ -0,0 +1,44 @@ +% Single-line comment +\name{foo} +#ifdef unix +\alias{bar} +#endif ignored +\title{Foo} +\description{ + We have a list + \itemize error{ + \item foo, + \item bar. + } + Also a table: \tabular{lr}{ + foo \tab \code{foo} \cr + bar \tab \preformatted{bar} + } +} +\section{Section}{ + Escaped braces don't need balance \} + \subsection{Subsection}{ + \subsection{Subsubsection}{ + Sections can be nested. + } + } +} +\usage{ +foo(a, b = default) +} +\newcommand{\macro}{Test#1} +\arguments{ + \item{a}{\if{html}{π =} \Sexpr[stage=build]error{4*atan(1)}} + \item{b}{\macro{text} \link[pkg:bar]{fooo}} +} +\seealso{ + \code{\link{bar}} +} +\examples{ +# R comment +% Rdoc comment +foo(1) +for (i in 1:10) + foo(i) +} +\keyword{foo} diff --git a/autotests/reference/test.Rd.ref b/autotests/reference/test.Rd.ref new file mode 100644 --- /dev/null +++ b/autotests/reference/test.Rd.ref @@ -0,0 +1,44 @@ +% Single-line comment
+
\name
{foo}
+#ifdef unix
+
\alias
{bar}
+#endif ignored
+
\title
{Foo}
+
\description
{
+ We have a list
+ \itemize error{
+ \item foo,
+ \item bar.
+ }
+ Also a table: \tabular{lr}{
+ foo \tab \code{foo} \cr
+ bar \tab \preformatted{bar}
+ }
+}
+
\section
{Section}{
+ Escaped braces don't need balance \}
+
\subsection
{Subsection}{
+
\subsection
{Subsubsection}{
+ Sections can be nested.
+ }
+ }
+}
+
\usage
{
+foo(a, b = default)
+}
+\newcommand{\macro}{Test#1}
+
\arguments
{
+ \item{a}{\if{html}{π =} \Sexpr[stage=build]error{4*atan(1)}}
+ \item{b}{\macro{text} \link[pkg:bar]{fooo}}
+}
+
\seealso
{
+ \code{\link{bar}}
+}
+
\examples
{
+# R comment
+% Rdoc comment
+foo(1)
+for (i in 1:10)
+ foo(i)
+}
+
\keyword
{foo}
diff --git a/data/syntax/rdoc.xml b/data/syntax/rdoc.xml new file mode 100644 --- /dev/null +++ b/data/syntax/rdoc.xml @@ -0,0 +1,326 @@ + + + + + + unix + windows + + + example + html + latex + text + TRUE + FALSE + + + + \author + \concept + \description + \details + \docType + \encoding + \format + \keyword + \name + \note + \references + \seealso + \source + \title + + + \section + + + \newcommand + \renewcommand + + + \examples + \usage + + + \alias + \Rdversion + \synopsis + \RdOpts + + + \arguments + \value + + + + + \acronym + \bold + \cite + \command + \dfn + \dQuote + \email + \emph + \file + \linkS4class + \pkg + \sQuote + \strong + \var + + + \enc + \method + \S3method + \S4method + + + \subsection + + + \newcommand + \renewcommand + + + \enumerate + \itemize + + + \describe + + + \if + \ifelse + + + \code + \dontshow + \donttest + \testonly + + + \dontrun + \env + \kbd + \option + \out + \preformatted + \samp + \special + \url + \deqn + \eqn + + + \tabular + \href + + + \link + + + \Sexpr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +