Handle correctly % value in width and height
related to #72
diff --git a/DESCRIPTION b/DESCRIPTION
index 29b0dfb..b665124 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.9002
+Version: 0.9.1.9003
Date: 2017-03-13
Authors@R:
c(person(given = "Hakim",
diff --git a/NEWS.md b/NEWS.md
index 29b1160..8f15e08 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,7 +2,7 @@
- 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).
+- Fix issues 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 1e6f897..8e429c3 100644
--- a/R/revealjs_presentation.R
+++ b/R/revealjs_presentation.R
@@ -157,8 +157,10 @@
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")) {
+ # like number or percent unit or slideNumber = true or slideNumber = 'c/t'
+ if (
+ option %in% c("slideNumber") ||
+ (option %in% c("width", "height") && grepl("%$", value))) {
value <- paste0("'", value, "'")
}
}
diff --git a/tests/manual/test-options-size.Rmd b/tests/manual/test-options-size.Rmd
new file mode 100644
index 0000000..89862d8
--- /dev/null
+++ b/tests/manual/test-options-size.Rmd
@@ -0,0 +1,20 @@
+---
+output:
+ revealjs::revealjs_presentation:
+ reveal_options:
+ width: "100%"
+ height: "100%"
+ margin: 0
+ minScale: 1
+ maxScale: 1
+---
+
+# Test
+
+Content very long
+
+```{r, echo = FALSE, results='asis'}
+cat(paste(lapply(replicate(100, sample(letters, sample.int(10, 1, TRUE), replace = TRUE)), paste0, collapse = ""), collapse = " "))
+```
+
+