Skip to content

Commit

Permalink
Take 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaneplusplus committed Apr 26, 2021
1 parent cd7df17 commit 3f312b0
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 11 deletions.
21 changes: 21 additions & 0 deletions R/build-site.r
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@
#' @param header a `list` with the header information for the document.
#' @param ld a `listdown` object describing how to present the computational
#' components.
#' @examples
#' library(ggplot2)
#' cc <- list(
#' iris = iris,
#' Sepal.Length = list(
#' Sepal.Width = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
#' geom_point(),
#' Petal.Length = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
#' geom_point(),
#' Colored = list(
#' Sepal.Width = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width,
#' color = Species)) + geom_point(),
#' Petal.Length = ggplot(iris, aes(x = Sepal.Length, y = Petal.Length,
#' color = Species)) + geom_point())))
#'
#' header <- ld_rmarkdown_header("Test header", author = "Some Dude",
#' date = "2020")
#'
#' ld <- listdown(package = "ggplot2")
#'
#' ld_bundle_doc(cc, header, ld)
#' @export
ld_bundle_doc <- function(cc, header, ld) {
mc <- match.call()
Expand Down
21 changes: 21 additions & 0 deletions R/chunk-writer.r
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,27 @@
#' @param ... default options sent to the chunks of the outputted document.
#' @param chunk_opts a named list of options sent to the chunks of outputted
#' documents. Note: takes priority over argument provided to ...
#' @examples
#' library(ggplot2)
#' cc <- list(
#' iris = iris,
#' Sepal.Length = list(
#' Sepal.Width = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
#' geom_point(),
#' Petal.Length = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
#' geom_point(),
#' Colored = list(
#' Sepal.Width = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width,
#' color = Species)) + geom_point(),
#' Petal.Length = ggplot(iris, aes(x = Sepal.Length, y = Petal.Length,
#' color = Species)) + geom_point())))
#'
#' header <- ld_rmarkdown_header("Test header", author = "Some Dude",
#' date = "2020")
#'
#' ld <- listdown(package = "ggplot2")
#'
#' ld_bundle_doc(cc, header, ld)
#' @export
listdown <- function(package = NULL,
decorator = list(),
Expand Down
22 changes: 22 additions & 0 deletions man/ld_bundle_doc.Rd

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

22 changes: 22 additions & 0 deletions man/listdown.Rd

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

22 changes: 11 additions & 11 deletions tests/testthat/test-create-html-site.r
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ anscombe_page <- ld_bundle_doc(anscombe_cc, header, ld)

pages <- list(Anscombe = anscombe_page, Iris = iris_page)

site_yaml <-
ld_site_yaml(
"Test Site",
tab_name = names(pages),
rmd_name = c("index.rmd", "iris.rmd"))
test_that("Site can be built.", {
site_yaml <-
ld_site_yaml(
"Test Site",
tab_name = names(pages),
rmd_name = c("index.rmd", "iris.rmd"))

site_path <- ld_build_html_site(
pages,
site_yaml,
view = TRUE,
quiet = TRUE)
site_path <- ld_build_html_site(
pages,
site_yaml,
view = TRUE,
quiet = TRUE)

test_that("Site can be built.", {
expect_equal(basename(site_path), "index.html")
})

0 comments on commit 3f312b0

Please sign in to comment.