Generate and Write Document to File
build_typst_file.RdGenerates document content from sections and data, then writes it to a file. This function combines document generation with file output handling and error management.
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
- data
List of data to be used in template rendering
- output_file
Character string specifying the path to the output file
- template_dir
Character string specifying the directory containing templates. Defaults to "template-files".