Debian Codegraph @

man/parse.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/parse.R
3 \name{parse}
4 \alias{parse}
5 \alias{parse_template}
6 \alias{parse_template.character}
7 \alias{parse_template.fs_path}
8 \title{Parse a template}
9 \usage{
10 parse_template(.x, .config)
11
12 \method{parse_template}{character}(.x, .config = default_config())
13
14 \method{parse_template}{fs_path}(.x, .config = default_config())
15 }
16 \arguments{
17 \item{.x}{The template. Choices:
18 \itemize{
19 \item A template string.
20 \item A path to a template file (use \code{\link[fs:path]{fs::path()}}).
21 }}
22
23 \item{.config}{The engine configuration. The default matches Jinja defaults,
24 but you can use \code{\link[=jinjar_config]{jinjar_config()}} to customize things like syntax delimiters,
25 whitespace control, and loading auxiliary templates.}
26 }
27 \value{
28 A \code{"jinjar_template"} object.
29 }
30 \description{
31 Sometimes you want to render multiple copies of a template, using different
32 sets of data variables. \code{\link[=parse_template]{parse_template()}} returns an intermediate version
33 of the template, so you can \code{\link[=render]{render()}} repeatedly without re-parsing the
34 template syntax.
35 }
36 \examples{
37 x <- parse_template("Hello {{ name }}!")
38
39 render(x, name = "world")
40 }
41 \seealso{
42 \itemize{
43 \item \code{\link[=render]{render()}} to render the final document using data variables.
44 \item \code{\link[=print.jinjar_template]{print()}} for pretty printing.
45 \item \code{vignette("template-syntax")} describes how to write templates.
46 }
47 }