22# # by Henrik Bengtsson licensend under LPGL (>= 2.1) and somewhat simplified / shortened
33# # feature-reduced here. Please the R.rsp for a full-featured version and documentation
44
5+ # #' Simple \sQuote{asis} Vignette Processor
6+ # #'
7+ # #' To pass pre-made pdf vignette vignettes through \dQuote{as is}, a simple vignette
8+ # #' process is added. It is derived from the more feature-complete one in the \pkg{R.rsp}
9+ # #' package. To use it, add files named like the pdf file plus an appended \code{.asis}
10+ # #' with the vignette metainformation and register the vignette processor, see the examples.
11+ # #'
12+ # #' @title Process pdf vignettes \sQuote{asis}
13+ # #' @name asisWeave
14+ # #' @param file character Filename to be processed
15+ # #' @param ... dots Currently ignored
16+ # #' @param pattern character A regular expression describing the filename pattern
17+ # #' @return The respective filename is returned, invisibly
18+ # #' @author Henrik Bengtsson for the original versions in package \pkg{R.rsp},
19+ # #' Dirk Eddelbuettel for the shortened ones used here
20+ # #' @examples
21+ # #' # To register this vignette engine use
22+ # #' \dontrun{tools::vignetteEngine("asis", package = pkgname, pattern = "[.](pdf|html)[.]asis$",
23+ # #' weave = asisWeave, tangle = asisTangle)}
24+ # #' # and add \code{VignetteBuilder: Rcpp} as well as \code{Suggests: Rcpp} to \code{DESCRIPTON}
25+ # #'
26+ # #' # Use a .asis file as in the Rcpp package, for example Rcpp-FAQ.pdf.asis has these lines:
27+ # #' # %\VignetteIndexEntry{Rcpp-FAQ}
28+ # #' # %\VignetteKeywords{Rcpp, FAQ, R, Cpp}
29+ # #' # %\VignettePackage{Rcpp}
30+ # #' # %\VignetteEncoding{UTF-8}
31+ # #' # %\VignetteEngine{Rcpp::asis}
532asisWeave <- function (file , ... ) {
633 output <- tools :: file_path_sans_ext(basename(file ))
734 if (! file.exists(output )) {
@@ -14,9 +41,10 @@ asisWeave <- function (file, ...) {
1441 }
1542 }
1643 Sys.setFileTime(output , time = Sys.time())
17- output
44+ invisible ( output )
1845}
1946
47+ # #' @rdname asisWeave
2048asisTangle <- function (file , ... , pattern = " (|[.][^.]*)[.]asis$" ) {
2149 workdir <- " ."
2250 filename <- basename(file )
0 commit comments