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

Added second WDFW template, infrastructure for labeled templates #36

Merged
merged 2 commits into from
Nov 5, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions R/initialize_project.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,6 +38,7 @@ initialize_project <-
organization = "WDFW",
renv = FALSE,
template.overwrite = TRUE,
color = "coffee",
quiet = TRUE) {
organization <- rlang::arg_match(organization, c("WDFW"))

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

}
Expand Down Expand Up @@ -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.

Loading