Update to reveal.js 4.1.2 (#136)
- New tools/ script to manually keep step for updates
- Plugins are all updated
- Template update following latest Pandoc version
- updated README for documentation
- Help page updated
- See other change in NEWS file
diff --git a/R/utils.R b/R/utils.R
index 7251cff..10cd223 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -5,6 +5,17 @@
package = "revealjs")
}
+
+revealjs_lib_path <- function(...) {
+ pkg <- system.file(package = "revealjs")
+ lib_folder <- list.files(pkg, pattern = "reveal.js-")[1]
+ system.file(lib_folder, ..., package = "revealjs")
+}
+
+revealjs_version <- function() {
+ as.numeric_version(gsub(".*reveal\\.js-(.*)$", "\\1", revealjs_lib_path()))
+}
+
# Convert boolean from R to JS boolean
jsbool <- function(value) ifelse(value, "true", "false")
@@ -13,10 +24,17 @@
if (is.logical(value)) {
value <- jsbool(value)
} else if (is.character(value)) {
- # Special handling for some chalkboard plugin options
- # e.g: color: [ 'rgba(0,0,255,1)', 'rgba(255,255,255,0.5)' ]
- if (grepl("chalkboard-(background|color|draw|pen)", option)) {
- value <- sprintf("[%s]", paste(paste0("'", value, "'"), collapse = ", "))
+ # Special handling for some vector options
+ if (
+ # chalkboard plugin options
+ # e.g: color: [ 'rgba(0,0,255,1)', 'rgba(255,255,255,0.5)' ]
+ grepl("chalkboard-(background|draw)", option)
+ # e.g autoAnimateStyles: ['opacity','color']
+ || grepl("autoAnimateStyles", option)
+ ) {
+ if (length(value) > 1 || !grepl("^\\[.*\\]$", value)) {
+ value <- sprintf("[%s]", paste(paste0("'", value, "'"), collapse = ", "))
+ }
}
# Add quotes around some config that can be several type
# like number or percent unit or slideNumber = true or slideNumber = 'c/t'