support array in chalkboard reveal_options (#88)
fixes #62
Co-authored-by: christophe dervieux <christophe.dervieux@gmail.com>
diff --git a/.Rbuildignore b/.Rbuildignore
index b97bfda..21b0514 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -9,4 +9,5 @@
^_pkgdown\.yml$
^reference$
^pkgdown$
-vignettes/
\ No newline at end of file
+vignettes/
+^tests/manual$
diff --git a/DESCRIPTION b/DESCRIPTION
index 967e4eb..29b0dfb 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Type: Package
Package: revealjs
Title: R Markdown Format for 'reveal.js' Presentations
-Version: 0.9.1.9001
+Version: 0.9.1.9002
Date: 2017-03-13
Authors@R:
c(person(given = "Hakim",
diff --git a/NEWS.md b/NEWS.md
index 05ee455..29b1160 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,7 @@
# revealjs (development version)
+- Fix an issue with some configurations keys for chalkboard plugin - multiple value are now correctly passed to Pandoc's template (thanks, @grayknight2, @atusy, #62, #88).
+
- Fix issue with quoting of options when passed as variables to Pandoc. This was caused by a change in Pandoc 2.14.0.3 which now sets some default value for reveal.js options (thanks, @iain-palmer, #72).
- Add `md_extensions` argument in `revealjs_presentation()` (thanks, @atusy, #75).
diff --git a/R/revealjs_presentation.R b/R/revealjs_presentation.R
index 84df1dc..1e6f897 100644
--- a/R/revealjs_presentation.R
+++ b/R/revealjs_presentation.R
@@ -148,9 +148,14 @@
if (is.list(reveal_options)) {
add_reveal_option <- function(option, value) {
- if (is.logical(value))
+ if (is.logical(value)) {
value <- jsbool(value)
- else if (is.character(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 = ", "))
+ }
# Add quotes around some config that can be several type
# e.g slideNumber = true or slideNumber = 'c/t'
if (option %in% c("slideNumber")) {
diff --git a/tests/manual/.gitignore b/tests/manual/.gitignore
new file mode 100644
index 0000000..3c10755
--- /dev/null
+++ b/tests/manual/.gitignore
@@ -0,0 +1,2 @@
+*_files
+*.html
diff --git a/tests/manual/test-plugin-chalkboard.Rmd b/tests/manual/test-plugin-chalkboard.Rmd
new file mode 100644
index 0000000..1f6c00b
--- /dev/null
+++ b/tests/manual/test-plugin-chalkboard.Rmd
@@ -0,0 +1,18 @@
+---
+title: "chalkboard plugin"
+output:
+ revealjs::revealjs_presentation:
+ self_contained: false
+ reveal_plugins: ["chalkboard"]
+ reveal_options:
+ chalkboard:
+ theme: whiteboard
+ color: ['rgba(255, 0, 0, 0.3)', 'rgba(255, 0, 0, 0.3)']
+---
+
+# Configurations
+
+We are testing that color can be correctly change.
+Pen is now red in both mode: Click on the left icons and write in Red.
+
+Default is blue.