[inlinedocs] tabs before comments and symbols, S3 methods

Thomas Wutzler twutz at bgc-jena.mpg.de
Fri Apr 16 19:41:31 CEST 2010


Dear Keith Ponting and Toby Dylan Hocking

thanks very much for this package!
It reduces redundancies and helps very much to keep documentation and
code consistent.

I two questions or a feature suggestions:

1) I use source formatting that uses tabs and and current version bof
inlinedocs reaks when trying to extract the parameter names with tabs
before, because the label is not correctly parsed. Also I would like to
allow indented comments like

traceback.curr <- function(
	### prints the current function calls, deepest on top
	collapse=NULL
	### an optional character string to separate the results.
	,someOtherArgument
){}

(there are tabs not spaces in the real file)

Therefore, I suggest the following changes
prefix <- "^[ \t]*###[ \t]" #changed the pattern to handle tabs

in extract_doc_chunk, line 14 in the stable version
add support for \t and , and remove trainling spaces

lab <- if (end + 1 == length(code))
            "value"
        else if (start == 2)
            "description"
        else if (0 == length(grep("^\\s*#", code[start - 1], perl =
TRUE))) {
	    #strip leading white spaces and brackets and ,
            arg <- gsub("^[ \t(,]*", "", code[start - 1])
            arg <- gsub("^([^=,]*)[=,].*", "\\1", arg)
	    #remove trailing whitespaces
            arg <- gsub("^(.*)[ \t]+$*", "\\1", arg)
            arg <- gsub("...", "\\dots", arg, fix = TRUE)
            paste("item{", arg, "}", sep = "")
        }
        else {
            next
        }


2) Is it already possible somehow to parse for S3 methods and insert the
\method markup instead of the full name.

R CMD check  on 2.10.1 complains:
The \usage entries for S3 methods should use the \method markup and not
their full name.


Thanks again for your work !!

Best regards
Thomas Wutzler



More information about the Inlinedocs-support mailing list