[CHNOSZ-commits] r155 - in pkg/CHNOSZ: . inst vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 16 17:35:19 CET 2017


Author: jedick
Date: 2017-02-16 17:35:19 +0100 (Thu, 16 Feb 2017)
New Revision: 155

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/vignettes/anintro.Rmd
Log:
anintro.Rmd: workaround R CMD check warning: Unknown language engine 'marginfigure'


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-02-16 16:03:13 UTC (rev 154)
+++ pkg/CHNOSZ/DESCRIPTION	2017-02-16 16:35:19 UTC (rev 155)
@@ -1,6 +1,6 @@
 Date: 2017-02-16
 Package: CHNOSZ
-Version: 1.0.8-44
+Version: 1.0.8-45
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-02-16 16:03:13 UTC (rev 154)
+++ pkg/CHNOSZ/inst/NEWS	2017-02-16 16:35:19 UTC (rev 155)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.8-44 (2017-02-16)
+CHANGES IN CHNOSZ 1.0.8-45 (2017-02-16)
 ---------------------------------------
 
 DOCUMENTATION:

Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd	2017-02-16 16:03:13 UTC (rev 154)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd	2017-02-16 16:35:19 UTC (rev 155)
@@ -41,9 +41,14 @@
 
 ```{r setup, include=FALSE}
 library(knitr)
+
+## from "Tufte Handout" example dated 2016-12-27
 # invalidate cache when the tufte version changes
 opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
 options(htmltools.dir.version = FALSE)
+
+## adjust plot margins
+## first one from https://yihui.name/knitr/hooks/
 knit_hooks$set(small.mar = function(before, options, envir) {
     if (before) par(mar = c(4.2, 4.2, .1, .1))  # smaller margin on top and right
 })
@@ -66,7 +71,8 @@
   dpi <- 72
 }
 
-## extend knitr's hook_plot_custom to check for existence of figure file 20170216
+## pandoc error is caused by non-existent figure in rubisco_svg chunk when RSVGTipsDevice is not available,
+## so extend knitr's hook_plot_custom to check for existence of figure file 20170216
 ## first, we need to copy a couple of knitr's utility functions
 # if LHS is NULL, return the RHS
 `%n%` = function(x, y) if (is.null(x)) y else x
@@ -92,7 +98,7 @@
   ext = options$fig.ext %n% dev2ext(options$dev)
   hook = knit_hooks$get('plot')
 
-  # do not show non-existent figure (causes pandoc error)
+  # do not show non-existent figure
   if (!file.exists(fig_path(ext, options, 1))) return()
 
   n = options$fig.num
@@ -125,6 +131,28 @@
     }
 })
 timeit <- NULL
+
+## 20170216 workaround for R CMD check warning only on Windows (R-Forge, winbuilder):
+# * checking re-building of vignette outputs ... WARNING
+# Error in re-building vignettes:
+#  ...
+# Warning in get_engine(options$engine) :
+#  Unknown language engine 'marginfigure' (must be registered via knit_engines$set()).
+## 
+## from html.R in tufte package:
+knitr::knit_engines$set(marginfigure = function(options) {
+  options$type = 'marginnote'
+  if (is.null(options$html.tag)) options$html.tag = 'span'
+  options$html.before = marginnote_html()
+  eng_block = knitr::knit_engines$get('block')
+  eng_block(options)
+})
+marginnote_html = function(text = '', icon = '⊕') {
+  sprintf(paste0(
+    '<label for="tufte-mn-" class="margin-toggle">%s</label>',
+    '<input type="checkbox" id="tufte-mn-" class="margin-toggle">%s'
+  ), icon, text)
+}
 ```
 
 # First steps



More information about the CHNOSZ-commits mailing list