Skip to content

Commit 2f69f10

Browse files
Reworked vignette processing via new 'asis' driver (#1394)
* Reworked vignette processing via new 'asis' driver * Document and export asisWeave and asisTangle * No need to export tangle and weave functions Also rewords commented example slightly * Add NEWS entry [ci skip] * Update R/asis.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update R/asis.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update man/asisWeave.Rd Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update R/asis.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Re-run roxygenize after copilot-corrected typos --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 24878c8 commit 2f69f10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+186
-111
lines changed

ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2025-07-18 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* DESCRIPTION (Version, Date): Roll micro version and date
4+
* inst/include/Rcpp/config.h: Idem
5+
6+
* R/asis.R (asisWeave, asisTangle): Borrowed with thanks from R.rsp
7+
and shortened / simplified to provide 'asis' vignette processor
8+
* R/zzz.R (.onLoad): Register new vignette processor
9+
* vignettes/*.asis: New files with vignette info from .Rnw files
10+
* vignettes/pdf/*.pdf: Moved to directory vignettes/
11+
* vignettes/*.Rnw: Removed
12+
* man/asisWeave.Rd: Documentation
13+
114
2025-07-01 Dirk Eddelbuettel <edd@debian.org>
215

316
* DESCRIPTION (Date, Version): Release 1.1.0

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 1.1.0
4-
Date: 2025-07-01
3+
Version: 1.1.0.1
4+
Date: 2025-07-18
55
Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org",
66
comment = c(ORCID = "0000-0001-6419-907X")),
77
person("Romain", "Francois", role = "aut",
@@ -35,3 +35,4 @@ BugReports: https://github.com/RcppCore/Rcpp/issues
3535
MailingList: rcpp-devel@lists.r-forge.r-project.org
3636
RoxygenNote: 6.1.1
3737
Encoding: UTF-8
38+
VignetteBuilder: Rcpp

NAMESPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export(Module,
3333
cpp_object_initializer,
3434
cpp_object_dummy,
3535
Rcpp.plugin.maker,
36-
getRcppVersion
37-
)
36+
getRcppVersion)
3837
S3method(print, bytes)
3938
S3method(format, Rcpp_stack_trace)
4039
S3method(str, Rcpp_stack_trace)

R/asis.R

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## These two functions are borrowed with grateful appreciation from the R.rsp package
2+
## by Henrik Bengtsson licensed under LGPL (>= 2.1) and somewhat simplified / shortened
3+
## feature-reduced here. Please see the R.rsp for a full-featured version and documentation
4+
5+
##' Simple \sQuote{asis} Vignette Processor
6+
##'
7+
##' To pass pre-made pdf 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 in another package, add
22+
##' # \code{VignetteBuilder: Rcpp} as well as \code{Suggests: Rcpp} to \code{DESCRIPTON}
23+
##' # which uses the registration this package provides via
24+
##' \dontrun{tools::vignetteEngine("asis", package = pkgname, pattern = "[.](pdf|html)[.]asis$",
25+
##' weave = asisWeave, tangle = asisTangle)}
26+
##'
27+
##' # Use a .asis file as in the Rcpp package, for example Rcpp-FAQ.pdf.asis has these lines:
28+
##' # %\VignetteIndexEntry{Rcpp-FAQ}
29+
##' # %\VignetteKeywords{Rcpp, FAQ, R, Cpp}
30+
##' # %\VignettePackage{Rcpp}
31+
##' # %\VignetteEncoding{UTF-8}
32+
##' # %\VignetteEngine{Rcpp::asis}
33+
asisWeave <- function (file, ...) {
34+
output <- tools::file_path_sans_ext(basename(file))
35+
if (!file.exists(output)) {
36+
outputS <- file.path("..", "inst", "doc", output)
37+
if (file.exists(outputS)) {
38+
file.copy(outputS, output, overwrite = TRUE)
39+
output <- outputS
40+
} else {
41+
stop("No file to process", call. = FALSE)
42+
}
43+
}
44+
Sys.setFileTime(output, time = Sys.time())
45+
invisible(output)
46+
}
47+
48+
##' @rdname asisWeave
49+
asisTangle <- function (file, ..., pattern = "(|[.][^.]*)[.]asis$") {
50+
workdir <- "."
51+
filename <- basename(file)
52+
fullname <- gsub(pattern, "", filename)
53+
filenameR <- sprintf("%s.R", fullname)
54+
cat(sprintf("### This is an R script tangled from '%s'\n", filename), file = filenameR)
55+
invisible(filenameR)
56+
}

R/zzz.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2009 - 2016 Dirk Eddelbuettel and Romain Francois
1+
# Copyright (C) 2009 - 2025 Dirk Eddelbuettel and Romain Francois
22
#
33
# This file is part of Rcpp.
44
#
@@ -20,7 +20,8 @@
2020
.classes_map <- new.env()
2121

2222
.onLoad <- function(libname, pkgname){
23-
new_dummyObject(.dummyInstancePointer) # nocov
24-
}
25-
23+
new_dummyObject(.dummyInstancePointer) # nocov start
2624

25+
tools::vignetteEngine("asis", package = pkgname, pattern = "[.](pdf|html)[.]asis$",
26+
weave = asisWeave, tangle = asisTangle) # nocov end
27+
}

inst/NEWS.Rd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
\newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}}
44
\newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}}
55

6+
\section{Changes in Rcpp release version 1.1.1 (2026-01-xx)}{
7+
\itemize{
8+
\item Changes in Rcpp Documentation:
9+
\itemize{
10+
\item Vignettes are now processed via a new "asis" processor adopted
11+
from \pkg{R.rsp} (Dirk in \ghpr{1394} fixing \ghit{1393})
12+
}
13+
}
14+
}
15+
616
\section{Changes in Rcpp release version 1.1.0 (2025-07-01)}{
717
\itemize{
818
\item Changes in Rcpp API:

inst/include/Rcpp/config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define RCPP_VERSION_STRING "1.1.0"
3232

3333
// the current source snapshot (using four components, if a fifth is used in DESCRIPTION we ignore it)
34-
#define RCPP_DEV_VERSION RcppDevVersion(1,1,0,0)
35-
#define RCPP_DEV_VERSION_STRING "1.1.0.0"
34+
#define RCPP_DEV_VERSION RcppDevVersion(1,1,0,1)
35+
#define RCPP_DEV_VERSION_STRING "1.1.0.1"
3636

3737
#endif

man/asisWeave.Rd

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/compilerCheck.Rd

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/Rcpp-FAQ.Rnw

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)