[Roxygen-commits] r212 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 20 09:02:45 CET 2009
Author: manuel
Date: 2009-01-20 09:02:41 +0100 (Tue, 20 Jan 2009)
New Revision: 212
Modified:
pkg/R/Rd.R
Log:
Add experimental noRd tag and change logic that only for exported objects an Rd-file is created.
Modified: pkg/R/Rd.R
===================================================================
--- pkg/R/Rd.R 2008-11-04 14:04:06 UTC (rev 211)
+++ pkg/R/Rd.R 2009-01-20 08:02:41 UTC (rev 212)
@@ -5,6 +5,9 @@
#' @include parse.R
roxygen()
+register.preref.parsers(parse.default,
+ 'noRd')
+
register.preref.parsers(parse.value,
'name',
'aliases',
@@ -155,6 +158,7 @@
#' @aliases name aliases title usage references concept
#' note seealso example examples keywords return author
#' TODO param method setClass setGeneric setMethod
+#' TODO exportOnly parameter to handle createRd
#' make.Rd.roclet
make.Rd.roclet <- function(subdir=NULL,
verbose=TRUE) {
@@ -177,9 +181,12 @@
#' @param key the expression's key
#' @param \dots the arguments
#' @return \code{NULL}
- parse.expression <- function(key, ...)
- cat(Rd.expression(key, c(...)), file=filename, append=TRUE)
+ parse.expression <- function(key, ...) {
+ if ( createRd )
+ cat(Rd.expression(key, c(...)), file=filename, append=TRUE)
+ }
+ createRd <- FALSE
filename <- ''
reset.filename <- function()
@@ -251,6 +258,9 @@
#' @param partitum the pre-parsed elements
#' @return \code{NULL}
parse.name <- function(partitum) {
+ if ( !createRd )
+ return;
+
name <- guess.name(partitum)
if (is.null(name) && !is.null(subdir)) {
filename <- partitum$srcref$filename
@@ -336,6 +346,10 @@
#' @param partitum the pre-parsed elements
#' @return \code{NULL}
pre.parse <- function(partitum) {
+ #' Create Rd files of exported functions only.
+ if ( is.null(partitum$noRd) & !is.null(partitum$export) )
+ createRd <<- TRUE
+
assign.parent('params', NULL, environment())
assign.parent('examples', NULL, environment())
parse.name(partitum)
@@ -352,6 +366,7 @@
## if not, it will destroy the sink stack.
## (Should fail if unwritable, anyway.)
reset.filename()
+ createRd <<- FALSE
}
roclet <- make.roclet(parse.expression,
More information about the Roxygen-commits
mailing list