-
-
Notifications
You must be signed in to change notification settings - Fork 219
Reworked vignette processing via new 'asis' driver #1394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Is it necessary to export these functions? Can't they simply be inlined? If we prefer to avoid changing the NAMESPACE, etc. Otherwise, it's fine. EDIT: Because, as you see in the mention above, others may start depending upon this driver, instead of just using the appropriate package designed and maintained for this. :) |
I have three or four (or five) other package where I am doing the pdfpages thing, and this approach is better. But to use it from another package I need to export them. I could put them elsewhere but these other packages also already use Rcpp so it makes some sense... And yes I could use
it pulls half a dozen packages with it. |
FWIW ... I'm in similar situation as @eddelbuettel - already using Rcpp and this seems like a very lightweight way to get the vignette. The help entry is very helpful; you could make it less so and maybe indicate that it is intended for RcppCore use only if you really don't want the public to pick it up. I would definitely not use this if you said please don't use. Anyway, thanks for showing us how to do this! KTB |
Hey @kylebaron thanks for chiming in! As you read along my musings, there really are three possible methods and this one (despite the added tiny export of two new functions -- but hey I found another one to retire so it's not all bad ...) is my current favourite. Because keeping rmarkdown (or otherwise) made pdfs 'as is' is good, and having a non-intrusive way to pass these one seems good too. And my previous approach (using latex pdfpages via Rnw) swallos pdf links so that is not as good as I thought it was... |
Mmh, but it seems it is possible to register the vignette engine without exporting the weave and tangle function, as knitr does if I'm not missing anything. |
The registration call would be (in another client package) tools::vignetteEngine("asis", package = pkgname, pattern = "[.](pdf|html)[.]asis$",
weave = Rcpp::asisWeave, tangle = Rcpp::asisTangle) # nocov end How can we do that without exporting the two tagged functions? There could well be a way I am not seeing right now, what we have in this PR follows the model of |
But the client package just needs to set I mean I certainly don't call |
Good point, I think I had overlooked that part. In which case And confirmed by adopting |
Also rewords commented example slightly
Fixes #1393
This PR adds a new vignette driver 'asis' (taken with thanks and appreciation from
R.rsp
by @HenrikBengtsson but shortened / simplified a little) which preserves hyperlinks in pdf vignettes by keeping the pre-made pdf vignettes 'as is' but merely adding the vignette metainfo via new 'asis' files (which get installed too).This PR mostly shows the minimal processing steps. It ought to be viable to keep the asis files in a subdirectory, extract the underlying .tex files from the respective .Rmd files in a processing step, prepend the asis info and process as Sweave files (processing once, running bibtex, processing twice). This would not be narrower, but reinvents the wheel a little.
Checklist
R CMD check
still passes all tests