Skip to content

Commit

Permalink
Merge pull request #36 from FRAMverse/adding/templates
Browse files Browse the repository at this point in the history
Added second WDFW template, infrastructure for labeled templates
Ty-WDFW authored Nov 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents dbf042b + 6a1c92f commit e148e94
Showing 5 changed files with 34 additions and 3 deletions.
10 changes: 8 additions & 2 deletions R/initialize_project.R
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
#' @param organization Character, defaults to "WDFW". Specifies the set of quarto templates to use. Currently only supports "WDFW".
#' @param renv Boolean to initialize renv. Defaults to FALSE.
#' @param template.overwrite Boolean. Overwrite _quarto.yml and style.css files if they already exist? Defaults to TRUE
#' @param color Character string, defaults to "coffee". Specifies quarto template to use; organizations may have several.
#' @param quiet Boolean, defaults to FALSE. If TRUE, suppresses informational messages.
#' @export
#' @examples
@@ -37,6 +38,7 @@ initialize_project <-
organization = "WDFW",
renv = FALSE,
template.overwrite = TRUE,
color = "coffee",
quiet = TRUE) {
organization <- rlang::arg_match(organization, c("WDFW"))

@@ -61,6 +63,7 @@ initialize_project <-
}
fetch_quarto_templates(to.path = ".",
organization = organization,
color = color,
overwrite = template.overwrite)

}
@@ -95,18 +98,21 @@ initialize_project <-
#'
fetch_quarto_templates = function(to.path,
organization = "WDFW",
color = "coffee",
overwrite = FALSE) {
rlang::arg_match(organization, c("WDFW")) ## add more as appropriate.
rlang::arg_match(color, c("green", "coffee"))
## The associated yaml and style files should be added to the `inst` folder with a subfolder
## that matches the organization name

organization <- rlang::arg_match(organization, c("WDFW"))
yaml.path <- system.file(glue::glue("{organization}/_quarto.yml"), package = "framrsquared")
yaml.path <- system.file(glue::glue("{organization}/{color}_quarto.yml"), package = "framrsquared")
style.path <- system.file(glue::glue("{organization}/style.css"), package = "framrsquared")
invisible(file.copy (
c(yaml.path,
style.path),
to = to.path,
to = c(glue::glue("{to.path}/_quarto.yml"),
glue::glue("{to.path}/style.css")),
overwrite = overwrite
))
}
15 changes: 15 additions & 0 deletions inst/WDFW/coffee_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
date: last-modified
execute:
warning: false
message: false
format:
html:
code-fold: true
embed-resources: true
toc: true
title-block-banner: "#ede9da"
title-block-banner-color: "#967259"
css: style.css
project:
title: ""
output-dir: results/quarto_output/
File renamed without changes.
9 changes: 8 additions & 1 deletion man/fetch_quarto_templates.Rd

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

3 changes: 3 additions & 0 deletions man/initialize_project.Rd

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

0 comments on commit e148e94

Please sign in to comment.