|
|
|
|
|
|
|
|
#' |
|
|
#' |
|
|
#' @inheritDotParams rmarkdown::html_document_base |
|
|
#' @inheritDotParams rmarkdown::html_document_base |
|
|
#' @export |
|
|
#' @export |
|
|
bulma_document <- function(..., css = NULL, pandoc_args = NULL) { |
|
|
|
|
|
|
|
|
bulma_document <- function( |
|
|
|
|
|
..., |
|
|
|
|
|
css = NULL, |
|
|
|
|
|
fig_width = 10, |
|
|
|
|
|
fig_height = 7, |
|
|
|
|
|
fig_retina = 2, |
|
|
|
|
|
keep_md = FALSE, |
|
|
|
|
|
dev = "png", |
|
|
|
|
|
pandoc_args = NULL, |
|
|
|
|
|
extra_dependencies = NULL |
|
|
|
|
|
) { |
|
|
css_files <- c( |
|
|
css_files <- c( |
|
|
"--css", system.file("bulma", "bulma.0.7.2.min.css", package="bulma")) |
|
|
|
|
|
|
|
|
"--css", bulma_file("bulma", "bulma.0.7.2.min.css")) |
|
|
|
|
|
|
|
|
if (!is.null(css)) { |
|
|
if (!is.null(css)) { |
|
|
for (file in css) { |
|
|
|
|
|
css_files <- c(css_files, "--css", file) |
|
|
|
|
|
|
|
|
for (css_file in css) { |
|
|
|
|
|
css_files <- c(css_files, "--css", css_file) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
rmarkdown::html_document_base( |
|
|
|
|
|
pandoc_args = c( |
|
|
|
|
|
css_files, |
|
|
|
|
|
pandoc_args, |
|
|
|
|
|
"--template", |
|
|
|
|
|
system.file("bulma", "bulma.html", package="bulma") |
|
|
|
|
|
|
|
|
# rmarkdown::html_document_base( |
|
|
|
|
|
# pandoc_args = c( |
|
|
|
|
|
# css_files, |
|
|
|
|
|
# pandoc_args, |
|
|
|
|
|
# "--template", |
|
|
|
|
|
# system.file("bulma", "bulma.html", package="bulma") |
|
|
|
|
|
# ), |
|
|
|
|
|
# ... |
|
|
|
|
|
# ) |
|
|
|
|
|
deps <- htmltools::htmlDependency( |
|
|
|
|
|
name = "bulma", |
|
|
|
|
|
version = "0.7.2", |
|
|
|
|
|
src = bulma_file("bulma"), |
|
|
|
|
|
stylesheet = "bulma.0.7.2.min.css" |
|
|
|
|
|
) |
|
|
|
|
|
extra_dependencies <- append(extra_dependencies, list(deps)) |
|
|
|
|
|
|
|
|
|
|
|
# preprocessor ---- |
|
|
|
|
|
pre_processor <- function(metadata, input_file, runtime, knit_meta, files_dir, output_dir) { |
|
|
|
|
|
# browser() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rmarkdown::output_format( |
|
|
|
|
|
knitr = rmarkdown::knitr_options_html( |
|
|
|
|
|
fig_width, fig_height, fig_retina, keep_md, dev |
|
|
|
|
|
), |
|
|
|
|
|
pandoc = rmarkdown::pandoc_options( |
|
|
|
|
|
to = "html", |
|
|
|
|
|
from = "markdown+ascii_identifiers+tex_math_single_backslash", |
|
|
|
|
|
args = c( |
|
|
|
|
|
css_files, |
|
|
|
|
|
pandoc_args, |
|
|
|
|
|
"--template", |
|
|
|
|
|
bulma_file("bulma", "bulma.html") |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
... |
|
|
|
|
|
|
|
|
pre_processor = pre_processor, |
|
|
|
|
|
clean_supporting = TRUE, |
|
|
|
|
|
base_format = rmarkdown::html_document_base( |
|
|
|
|
|
self_contained = TRUE, template = NULL, |
|
|
|
|
|
pandoc_args = pandoc_args, |
|
|
|
|
|
extra_dependencies = extra_dependencies |
|
|
|
|
|
) |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bulma_file <- function(...) { |
|
|
|
|
|
system.file(..., package = "bulma") |
|
|
|
|
|
} |