tar_quarto_run: Render a Quarto project inside a 'tar_quarto()' target.

View source: R/tar_quarto_raw.R

tar_quarto_runR Documentation

Render a Quarto project inside a tar_quarto() target.

Description

Internal function needed for tar_quarto(). Users should not invoke it directly.

Usage

tar_quarto_run(args, deps, sources, output, input, profile)

Arguments

args

A named list of arguments to quarto::quarto_render().

deps

An unnamed list of target dependencies of the Quarto source files.

sources

Character vector of Quarto source files.

output

Character vector of Quarto output files and directories.

input

Character vector of non-source Quarto input files and directories.

profile

Quarto profile.

Value

Sorted character vector with the paths to all the important files that targets should track for changes.

Examples

if (identical(Sys.getenv("TAR_LONG_EXAMPLES"), "true")) {
targets::tar_dir({  # tar_dir() runs code from a temporary directory.
# Unparameterized Quarto document:
lines <- c(
  "---",
  "title: Quarto source file",
  "output_format: html",
  "---",
  "Assume these lines are in the Quarto source file.",
  "```{r}",
  "1 + 1",
  "```"
)
tmp <- tempfile(fileext = ".qmd")
writeLines(lines, tmp)
args <- list(input = tmp, quiet = TRUE)
files <- fs::path_ext_set(tmp, "html")
tar_quarto_run(args = args, deps = list(), files = files)
file.exists(files)
})
}

wlandau/tarchetypes documentation built on Sept. 26, 2024, 12:23 p.m.