Skip to content

Commit

Permalink
Close yihui#230: add the params argument to infinite_moon_reader() (y…
Browse files Browse the repository at this point in the history
  • Loading branch information
paulklemm authored and yihui committed Dec 24, 2019
1 parent 377d9d8 commit 0f0c343
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 15 deletions.
15 changes: 9 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,29 @@ Title: Presentation Ninja
Version: 0.13.2
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
# contributors ordered alphabetically below
person("Alessandro", "Gasparini", role = "ctb", comment = c(ORCID = "0000-0002-8319-7624")),
person("Benjie", "Gillam", role = "ctb"),
person("Claus Thorn", "Ekstrøm", role = "ctb"),
person("Daniel", "Anderson", role = "ctb"),
person("Dawei", "Lang", role = "ctb"),
person("Emi", "Tanaka", role = "ctb"),
person("Garrick", "Aden-Buie", role = "ctb"),
person("Iñaki", "Ucar", role = "ctb", comment = c(ORCID = "0000-0001-6403-5550")),
person("John", "Little", role = "ctb"),
person("Joseph", "Casillas", role = "ctb"),
person("Lucy", "D'Agostino McGowan", role = "ctb", comment = c(ORCID = "0000-0001-7297-9359")),
person("Malcolm", "Barrett", role = "ctb", comment = c(ORCID = "0000-0003-0299-5825")),
person("Michael Wayne", "Kearney", role = "ctb"),
person("Nan-Hung", "Hsieh", role = "ctb"),
person("Ole Petter", "Bang", role = "ctb", comment = "CSS in rmarkdown/templates/xaringan/resources/default.css"),
person("Patrick", "Schratz", role = "ctb"),
person("Paul", "Klemm", role = "ctb", comment = c(ORCID = "0000-0002-5985-1737")),
person("Paul", "Lemmens", role = "ctb"),
person("Sean", "Lopp", role = "ctb"),
person("Lucy", "D'Agostino McGowan", role = "ctb", comment = c(ORCID = "0000-0001-7297-9359")),
person("Emi", "Tanaka", role = "ctb"),
person("Yongfu", "Liao", role = "ctb"),
person("Malcolm", "Barrett", role = "ctb", comment = c(ORCID = "0000-0003-0299-5825")),
person("Alessandro", "Gasparini", role = "ctb", comment = c(ORCID = "0000-0002-8319-7624")),
person("Yue", "Jiang", role = "ctb", comment = c(ORCID = "0000-0002-9798-5517")),
person("Iñaki", "Ucar", role = "ctb", comment = c(ORCID = "0000-0001-6403-5550"))
person()
)
Description: Create HTML5 slides with R Markdown and the JavaScript library
'remark.js' (<https://remarkjs.com>).
Expand All @@ -39,4 +42,4 @@ URL: https://github.com/yihui/xaringan
BugReports: https://github.com/yihui/xaringan/issues
VignetteBuilder: knitr
Encoding: UTF-8
RoxygenNote: 6.1.1
RoxygenNote: 7.0.2
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Added a theme following the Karolinska Institutet design guidelines (@ellessenne, #238).

- Added the argument `params` to `infinite_moon_reader()` (@paulklemm, #240).

## BUG FIXES

- Removed the `xmlns` attribute in the `<html>` tag in the default HTML template (thanks, @pat-s, #197).
Expand Down
5 changes: 3 additions & 2 deletions R/render.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,15 @@ tsukuyomi = function(...) moon_reader(...)
#' @param moon The input Rmd file path (if missing and in RStudio, the current
#' active document is used).
#' @param cast_from The root directory of the server.
#' @param params Passed to \code{rmarkdown::\link[rmarkdown]{render}()}.
#' @references \url{http://naruto.wikia.com/wiki/Infinite_Tsukuyomi}
#' @note This function is not really tied to the output format
#' \code{\link{moon_reader}()}. You can use it to serve any single-HTML-file R
#' Markdown output.
#' @seealso \code{servr::\link{httw}}
#' @export
#' @rdname inf_mr
infinite_moon_reader = function(moon, cast_from = '.') {
infinite_moon_reader = function(moon, cast_from = '.', params = NULL) {
# when this function is called via the RStudio addin, use the dir of the
# current active document
if (missing(moon) && requireNamespace('rstudioapi', quietly = TRUE)) {
Expand All @@ -231,7 +232,7 @@ infinite_moon_reader = function(moon, cast_from = '.') {
}
moon = normalize_path(moon)
rebuild = function() {
rmarkdown::render(moon, envir = globalenv(), encoding = 'UTF-8')
rmarkdown::render(moon, envir = parent.frame(2), params = params)
}
html = NULL
# rebuild if moon or any dependencies (CSS/JS/images) have been updated
Expand Down
9 changes: 7 additions & 2 deletions man/decktape.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/inf_mr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions man/moon_reader.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0f0c343

Please sign in to comment.