[inlinedocs] code reorganization
Toby Dylan Hocking
Toby.Hocking at inria.fr
Mon May 3 20:48:18 CEST 2010
Thomas, you asked...
>Is it possible to use the information from the parsed file also in the
>inspection of the source code?
>The information of the two parts is already extracted.
I added some features to inlinedocs this weekend, which should make it
a lot easier to add new features. Essentially I modularized the
process of constructing the "docs" list in package.skeleton.dx, so
that instead of using extract.docs.fun and friends directly, I provide
a new "parsers" argument to package.skeleton.dx that is a list of
functions that will be sequentially applied to the code to generate
the list of docs. It seems to be working, but please test to see if
this has introduced any bugs. I have also tried to explain the new
features on the website, so please have a look and feel free to
clarify yourself or ask if something seems unclear.
So to answer your question, yes, it should be possible, if you write a
new parser function like this:
object.parser <- forfun(function(o,name,src,...){
... o is the R function, name is its name,
... src is its source code from the "source" attribute
list(examples="foo",author="bar")
})
and more generally...
package.parser <- function(objs,code,...){
docs <- list()
for(N in names(objs)){
.. search for N in code, which is all the source code of the package.
.. do something with the code you found
docs[[N]] <- list(title=N,value="bar")
}
docs
}
More information about the Inlinedocs-support
mailing list