Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few minor tweaks to the template docs & implementation #51

Merged
merged 4 commits into from Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -14,7 +14,7 @@ URL: https://github.com/seankross/postcards
BugReports: https://github.com/seankross/postcards/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Imports:
utils,
rmarkdown,
Expand Down
48 changes: 20 additions & 28 deletions R/postcards.R
@@ -1,49 +1,40 @@
#' Jolla website template.
#' Postcards templates
#'
#' @inheritParams rmarkdown::html_document
#' @param ... Additional arguments passed to `rmarkdown::html_document()`
#' @export
jolla <- function(css = NULL, includes = NULL) {
get_template("jolla", css, includes)
jolla <- function(css = NULL, includes = NULL, ...) {
get_template("jolla", css, includes, ...)
}

#' Jolla Blue website template.
#'
#' @inheritParams rmarkdown::html_document
#' @rdname jolla
#' @export
jolla_blue <- function(css = NULL, includes = NULL) {
get_template("jolla-blue", css, includes)
jolla_blue <- function(css = NULL, includes = NULL, ...) {
get_template("jolla-blue", css, includes, ...)
}

#' Jolla Blue website template.
#'
#' @inheritParams rmarkdown::html_document
#' @rdname jolla
#' @export
trestles <- function(css = NULL, includes = NULL) {
get_template("trestles", css, includes)
trestles <- function(css = NULL, includes = NULL, ...) {
get_template("trestles", css, includes, ...)
}

#' Onofre website template.
#'
#' @inheritParams rmarkdown::html_document
#' @rdname jolla
#' @export
onofre <- function(css = NULL, includes = NULL) {
get_template("onofre", css, includes)
onofre <- function(css = NULL, includes = NULL, ...) {
get_template("onofre", css, includes, ...)
}

#' Solana website template.
#'
#' @inheritParams rmarkdown::html_document
#' @rdname jolla
#' @export
solana <- function(css = NULL, includes = NULL) {
get_template("solana", css, includes)
solana <- function(css = NULL, includes = NULL, ...) {
get_template("solana", css, includes, ...)
}

get_template <- function(name, css, includes) {
get_template <- function(name, css, includes, ...) {

# Must we use "old" templates?
minimum_required <- "2.8"
installed <- as.character(rmarkdown::pandoc_version())
self_contained <- !(utils::compareVersion(minimum_required, installed) > 0)
self_contained <- rmarkdown::pandoc_available("2.8")

template_file <- paste0(name, ".html")

Expand All @@ -54,6 +45,7 @@ get_template <- function(name, css, includes) {
template = system.file("pandoc_templates", template_file, package = "postcards"),
css = css,
includes = includes,
md_extensions = "-autolink_bare_uris"
md_extensions = "-autolink_bare_uris",
...
)
}
20 changes: 17 additions & 3 deletions man/jolla.Rd

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

20 changes: 0 additions & 20 deletions man/jolla_blue.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/onofre.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/solana.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/trestles.Rd

This file was deleted.

1 change: 1 addition & 0 deletions postcards.Rproj
Expand Up @@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace