[Roxygen-commits] r53 - in pkg: R sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jul 19 23:06:42 CEST 2008


Author: pcd
Date: 2008-07-19 23:06:42 +0200 (Sat, 19 Jul 2008)
New Revision: 53

Modified:
   pkg/R/Rd.R
   pkg/R/parse.R
   pkg/sandbox/example-Rd-nlm.R
Log:
passable first Rd roclet


Modified: pkg/R/Rd.R
===================================================================
--- pkg/R/Rd.R	2008-07-19 21:06:32 UTC (rev 52)
+++ pkg/R/Rd.R	2008-07-19 21:06:42 UTC (rev 53)
@@ -6,7 +6,7 @@
     sprintf('\\%s{%s}\n', key, expression)
 
   parse.default <- function(key, expression)
-    cat(Rd.expression(key, expression))
+    cat(Rd.expression(key, trim(expression)))
 
   parse.name <- Curry(parse.default, key='name')
 
@@ -43,16 +43,7 @@
   parse.description <- function(expressions) {
     paragraphs <- car(strsplit(expressions, '\n\n', fixed=T))
     description <- car(paragraphs)
-    details <- do.call(paste, list(cdr(paragraphs), sep='\n\n'))
-    print(expressions)
-###     matter <- '[^\n]+'
-###     words <- Curry(words.default, matter=matter)
-###     nwords <- Curry(nwords.default, words=words)
-###     word.ref <- Curry(word.ref.default, words=words)
-###     strcar <- Curry(strcar.default, word.ref=word.ref)
-###     strcdr <- Curry(strcdr.default, nwords=nwords, word.ref=word.ref)
-###     description <- strcar(expressions)
-###     details <- strcdr(expressions)
+    details <- do.call(paste, append(cdr(paragraphs), list(sep='\n\n')))
     parse.default('description', description)
     if (!is.null.string(details))
       parse.default('details', details)

Modified: pkg/R/parse.R
===================================================================
--- pkg/R/parse.R	2008-07-19 21:06:32 UTC (rev 52)
+++ pkg/R/parse.R	2008-07-19 21:06:42 UTC (rev 53)
@@ -1,5 +1,5 @@
 #' @include string.R list.R
-LINE.DELIMITER <- '#\' '
+LINE.DELIMITER <- '#\''
 TAG.DELIMITER <- '@'
 
 #' Comment blocks (possibly null) that precede a file's expressions.
@@ -180,17 +180,15 @@
                        caddr(preref))
   delimited.lines <-
     Filter(function(line) grep(LINE.DELIMITER, line), lines)
+  ## Trim LINE.DELIMITER + one space
   trimmed.lines <-
-    Map(function(line) substr(line, nchar(LINE.DELIMITER) + 1, nchar(line)),
+    Map(function(line) substr(line, nchar(LINE.DELIMITER) + 2, nchar(line)),
         delimited.lines)
   joined.lines <- do.call(paste, c(trimmed.lines, sep='\n'))
   if (is.nil(joined.lines))
     nil
   else {
-###     print(joined.lines)
     elements <- car(strsplit(joined.lines, TAG.DELIMITER, fixed=T))
-###     elements <- car(strsplit(joined.lines, TAG.DELIMITER, fixed=T))
-###     print(str(elements))
     description <- car(elements)
     parsed.elements <- Reduce(function(parsed, element)
                               append(parsed, parse.element(element)),

Modified: pkg/sandbox/example-Rd-nlm.R
===================================================================
--- pkg/sandbox/example-Rd-nlm.R	2008-07-19 21:06:32 UTC (rev 52)
+++ pkg/sandbox/example-Rd-nlm.R	2008-07-19 21:06:42 UTC (rev 53)
@@ -1,7 +1,6 @@
 #' This function carries out a minimization of the function \code{f}
 #' using a Newton-type algorithm.  See the references for details.
 #'
-#'
 #' Note that arguments after \code{\dots} must be matched exactly.
 #'
 #' If a gradient or hessian is supplied but evaluates to the wrong mode



More information about the Roxygen-commits mailing list