Fix quoting of default variable in template (#91)
* Revert "don't quote reveal options in template". This reverts commit 633c05f47dca23c48382804bd8d0cf9d55d018bb fixing #72
* Only quote specific option that can be character or else like slideNumber https://revealjs.com/slide-numbers/
diff --git a/DESCRIPTION b/DESCRIPTION
index 7f82218..30f5a45 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: revealjs
Type: Package
Title: R Markdown Format for 'reveal.js' Presentations
-Version: 0.9
+Version: 0.9.1
Date: 2017-03-13
Authors@R: c(
person("Hakim", "El Hattab", role = c("aut", "cph"),
diff --git a/R/revealjs_presentation.R b/R/revealjs_presentation.R
index 73dfdbd..3ca3a57 100644
--- a/R/revealjs_presentation.R
+++ b/R/revealjs_presentation.R
@@ -147,8 +147,13 @@
add_reveal_option <- function(option, value) {
if (is.logical(value))
value <- jsbool(value)
- else if (is.character(value))
- value <- paste0("'", value, "'")
+ else if (is.character(value)) {
+ # Add quotes around some config that can be several type
+ # e.g slideNumber = true or slideNumber = 'c/t'
+ if (option %in% c("slideNumber")) {
+ value <- paste0("'", value, "'")
+ }
+ }
args <<- c(args, pandoc_variable_arg(option, value))
}
diff --git a/inst/rmarkdown/templates/revealjs_presentation/resources/default.html b/inst/rmarkdown/templates/revealjs_presentation/resources/default.html
index d06e13b..d888684 100644
--- a/inst/rmarkdown/templates/revealjs_presentation/resources/default.html
+++ b/inst/rmarkdown/templates/revealjs_presentation/resources/default.html
@@ -531,7 +531,7 @@
<script>
// Full list of configuration options available at:
- // https://github.com/hakimel/reveal.js#configuration
+ // https://revealjs.com/config/
Reveal.initialize({
$if(controls)$
// Display controls in the bottom right corner
@@ -543,6 +543,14 @@
$endif$
$if(slideNumber)$
// Display the page number of the current slide
+ // - true: Show slide number
+ // - false: Hide slide number
+ //
+ // Can optionally be set as a string that specifies the number formatting:
+ // - "h.v": Horizontal . vertical slide number (default)
+ // - "h/v": Horizontal / vertical slide number
+ // - "c": Flattened slide number
+ // - "c/t": Flattened slide number / total slides
slideNumber: $slideNumber$,
$endif$
$if(history)$
@@ -615,7 +623,7 @@
$endif$
$if(transitionSpeed)$
// Transition speed
- transitionSpeed: $transitionSpeed$, // default/fast/slow
+ transitionSpeed: '$transitionSpeed$', // default/fast/slow
$endif$
$if(backgroundTransition)$
// Transition style for full page slide backgrounds
@@ -627,19 +635,19 @@
$endif$
$if(parallaxBackgroundImage)$
// Parallax background image
- parallaxBackgroundImage: $parallaxBackgroundImage$, // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
+ parallaxBackgroundImage: '$parallaxBackgroundImage$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
$endif$
$if(parallaxBackgroundSize)$
// Parallax background size
- parallaxBackgroundSize: $parallaxBackgroundSize$, // CSS syntax, e.g. "2100px 900px"
+ parallaxBackgroundSize: '$parallaxBackgroundSize$', // CSS syntax, e.g. "2100px 900px"
$endif$
$if(parallaxBackgroundHorizontal)$
// Amount to move parallax background (horizontal and vertical) on slide change
// Number, e.g. 100
- parallaxBackgroundHorizontal: $parallaxBackgroundHorizontal$,
+ parallaxBackgroundHorizontal: '$parallaxBackgroundHorizontal$',
$endif$
$if(parallaxBackgroundVertical)$
- parallaxBackgroundVertical: $parallaxBackgroundVertical$,
+ parallaxBackgroundVertical: '$parallaxBackgroundVertical$',
$endif$
$if(width)$
// The "normal" size of the presentation, aspect ratio will be preserved