Skip to contents

Processes multiple document sections and combines them into a complete document. Each section can be either template-rendered or included directly.

Usage

create_typst_content(sections, data, template_dir = "template-files")

Arguments

sections

List of section configurations. Each section should be a list containing:

  • name: Character string, name of the section

  • use_template: Logical, whether to use template rendering

  • content: Optional character vector of raw content

  • include: Optional logical indicating whether to include the section (defaults to TRUE)

data

List of data to be used in template rendering

template_dir

Character string specifying the directory containing templates. Defaults to "template-files".

Value

Character vector containing the complete document content

Examples

if (FALSE) { # \dontrun{
sections <- list(
  list(name = "header", use_template = TRUE),
  list(name = "body", use_template = TRUE, include = TRUE),
  list(name = "footer", use_template = FALSE, content = "Page {{page}}")
)
data <- list(title = "Report", page = 1)
content <- create_typst_content(sections, data)
} # }