vignetteEngine
Set or Get a Vignette Processing Engine
Description
Sets or gets a vignette engine for non-Sweave vignettes.
Usage
vignetteEngine(name, weave, tangle, pattern = NULL, package = NULL)
Arguments
name |
the name of vignette engine to set or get.
|
weave |
the function to convert the vignette source file to LaTeX format.
|
tangle |
the function to produce R code from the vignette source file.
|
pattern |
a regular expression pattern specifying the file names to be processed by
this engine. If NULL (the default), the default pattern is "[.][rRsS](nw|tex)$".
|
package |
the package registering the vignette engine. If NULL (the default),
the package that calls this function.
|
Details
Package vignettes can be processed by means of vignette engines other
than Sweave. A package writer can register a vignette
engine by calling the function vignetteEngine to define customized
Sweave and Stangle functions. TIBCO Enterprise Runtime for R uses the
registered engine to process the package vignettes.
The system uses an engine key to identify each vignette engine. Typcially, the engine key
is in the format "package::name".
If weave is missing, vignetteEngine returns the current registered vignette engine
that matches name and package. If weave is NULL, the current
registered engine is deleted. For other cases, a new engine is registered.
The system registers at least one engine named "Sweave", which uses
utils::Sweave() and utils::Stangle().
This design is for backward compatibility with those
package vignettes that are processed by Sweave by default.
Value
- returns a list object with the components "name", "package",
"pattern", "weave", and "tangle" if called to set
or get an engine.
- returns NULL if an engine is removed.
References
2013. Writing package vignettes. Writing R Extensions. R Project. Volume 3.01, Chapter 1.4.
See Also
Sweave
Examples
vignetteEngine() # List all registered engines.
vignetteEngine("Sweave") # List "Sweave" engine.
# Set a new engine.
vignetteEngine(name = "My_Sweave", weave = function(...) utils::Sweave(...),
tangle = function(...) utils::Stangle(...), package = "utils")
## Not run:
# Set a new engine. Here "weave" and "tangle" are fake functions and cannot be used
# for actual package vignette processing.
vignetteEngine("My_engine", weave = function(...){tempfile()},
tangle = function(...){tempfile()}, package = "My_package")
str(vignetteEngine())
# Delete this engine
vignetteEngine("My_engine", package = "My_package", weave = NULL)
str(vignetteEngine())
## End(Not run)