2
2
# # by Henrik Bengtsson licensend under LPGL (>= 2.1) and somewhat simplified / shortened
3
3
# # feature-reduced here. Please the R.rsp for a full-featured version and documentation
4
4
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}
5
32
asisWeave <- function (file , ... ) {
6
33
output <- tools :: file_path_sans_ext(basename(file ))
7
34
if (! file.exists(output )) {
@@ -14,9 +41,10 @@ asisWeave <- function (file, ...) {
14
41
}
15
42
}
16
43
Sys.setFileTime(output , time = Sys.time())
17
- output
44
+ invisible ( output )
18
45
}
19
46
47
+ # #' @rdname asisWeave
20
48
asisTangle <- function (file , ... , pattern = " (|[.][^.]*)[.]asis$" ) {
21
49
workdir <- " ."
22
50
filename <- basename(file )
0 commit comments