SCM

SCM Repository

[inlinedocs] Diff of /pkg/inlinedocs/R/parsers.R
ViewVC logotype

Diff of /pkg/inlinedocs/R/parsers.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 335, Thu Apr 5 12:08:07 2012 UTC revision 336, Thu Apr 5 12:44:33 2012 UTC
# Line 1  Line 1 
1  do.not.generate <- function  do.not.generate <- structure(function
2  ### Make a Parser Function used to indicate that certain Rd files  ### Make a Parser Function used to indicate that certain Rd files
3  ### should not be generated.  ### should not be generated.
4  (...  (...
# Line 14  Line 14 
14    }    }
15  ### A Parser Function that will delete items from the outer  ### A Parser Function that will delete items from the outer
16  ### Documentation List.  ### Documentation List.
17  }  },ex=function(){
18      silly.pkg <- system.file("silly",package="inlinedocs")
19      owd <- setwd(tempdir())
20      file.copy(silly.pkg,".",recursive=TRUE)
21    
22      ## define a custom Parser Function that will not generate some Rd
23      ## files
24      custom <- do.not.generate("silly-package","Silly-class")
25      parsers <- c(default.parsers,list(exclude=custom))
26    
27      ## At first, no Rd files in the man subdirectory.
28      man.dir <- file.path("silly","man")
29      dir(man.dir)
30    
31      ## Running package.skeleton.dx will generate bare-bones files for
32      ## those specified in do.not.generate, if they do not exist.
33      package.skeleton.dx("silly",parsers)
34      Rd.files <- c("silly-package.Rd","Silly-class.Rd","silly.example.Rd")
35      Rd.paths <- file.path(man.dir,Rd.files)
36      stopifnot(all(file.exists(Rd.paths)))
37    
38      ## Save the modification times of the Rd files
39      old <- file.info(Rd.paths)$mtime
40    
41      ## However, it will NOT generate Rd for files specified in
42      ## do.not.generate, if they DO exist already.
43      package.skeleton.dx("silly",parsers)
44      mtimes <- data.frame(old,new=file.info(Rd.paths)$mtime)
45      rownames(mtimes) <- Rd.files
46      mtimes$changed <- mtimes$old != mtimes$new
47      print(mtimes)
48      stopifnot(mtimes["silly-package.Rd","changed"]==FALSE)
49      stopifnot(mtimes["Silly-class.Rd","changed"]==FALSE)
50      stopifnot(mtimes["silly.example.Rd","changed"]==TRUE)
51    
52      unlink("silly",recursive=TRUE)
53      setwd(owd)
54    })
55    
56  ### combine lists or character strings  ### combine lists or character strings
57  combine <- function(x,y)UseMethod("combine")  combine <- function(x,y)UseMethod("combine")
# Line 161  Line 198 
198        arg <- gsub("^([^=,]*)[=,].*", "\\1", arg)        arg <- gsub("^([^=,]*)[=,].*", "\\1", arg)
199        ##twutz: remove trailing whitespaces        ##twutz: remove trailing whitespaces
200        arg <- gsub("^([^ \t]*)([ \t]+)$","\\1",arg)        arg <- gsub("^([^ \t]*)([ \t]+)$","\\1",arg)
201        arg <- gsub("...", "\\dots", arg, fix = TRUE)        arg <- gsub("...", "\\dots", arg, fixed = TRUE)
202        paste("item{",arg,"}",sep="")        paste("item{",arg,"}",sep="")
203      } else {      } else {
204        next;        next;
# Line 382  Line 419 
419          ## TDH 2010-06-18 For item{}s in the documentation list names,          ## TDH 2010-06-18 For item{}s in the documentation list names,
420          ## we don't need to have a backslash before, so delete it.          ## we don't need to have a backslash before, so delete it.
421          arg <- gsub("^[\\]+","",arg)          arg <- gsub("^[\\]+","",arg)
422          cur.field <- gsub("...","\\dots",arg,fix=TRUE) ##special case for dots          cur.field <- gsub("...","\\dots",arg,fixed=TRUE) ##special case for dots
423          payload <- comment          payload <- comment
424        } else {        } else {
425          ## this is a describe block, so we need to paste with existing          ## this is a describe block, so we need to paste with existing

Legend:
Removed from v.335  
changed lines
  Added in v.336

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge