Nothing
#' Create a UC-branded Quarto document
#'
#' Copies a UC Quarto template into the specified directory, ready to edit and render.
#'
#' @param type Character. Template type: \code{"html"}, \code{"pdf"}, or \code{"revealjs"}.
#' @param path Character. Directory to copy the template into. Default is current working directory.
#' @param overwrite Logical. Overwrite existing files? Default is FALSE.
#' @return An invisible character scalar giving the path to the created
#' \code{template.qmd} file.
#' @author Saannidhya Rawat
#' @family utilities
#' @export
#'
#' @examples
#' out_dir <- file.path(tempdir(), "uc-quarto")
#' created <- bcat_new_quarto("html", path = out_dir)
#' basename(created)
#' unlink(out_dir, recursive = TRUE)
bcat_new_quarto <- function(type = c("html", "pdf", "revealjs"),
path = getwd(),
overwrite = FALSE) {
type <- match.arg(type)
template_dir <- system.file("quarto", "templates",
paste0("bcat_", type),
package = "Rbearcat")
if (!nzchar(template_dir)) {
stop("Template '", type, "' not found in package.", call. = FALSE)
}
if (!dir.exists(path)) dir.create(path, recursive = TRUE)
files <- list.files(template_dir, recursive = TRUE, all.files = TRUE)
for (f in files) {
src <- file.path(template_dir, f)
dest <- file.path(path, f)
dest_dir <- dirname(dest)
if (!dir.exists(dest_dir)) dir.create(dest_dir, recursive = TRUE)
if (file.exists(dest) && !overwrite) {
message("Skipping existing file: ", f, " (use overwrite = TRUE to replace)")
next
}
file.copy(src, dest, overwrite = overwrite)
}
message("UC Quarto template ('", type, "') created in: ", path)
invisible(file.path(path, "template.qmd"))
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.