Skip to contents

Render a template

Usage

lq_get(path, name, vars = NULL, raw = FALSE, rev = NULL, source = NULL)

Arguments

path

Path to the store.

name

Template name, as passed to lq_add().

vars

Named character vector of template variables, e.g. c(name = "Ada").

raw

If TRUE, return the unrendered body instead of substituting vars.

rev

Read the template as it existed at this revision instead of the working tree — a tag name (see lq_tag()), or any revspec lengua understands (e.g. "HEAD~1", a commit sha).

source

Read from this source specifically, bypassing merge precedence across sources — the only way to reach a copy shadowed by another source. Defaults to the merged view across every source.

Value

A length-1 character vector: the rendered (or raw) body.

Examples

store <- withr::local_tempdir()
lq_init(store)
lq_add(store, "hello.md", "Hi {{ name }}!")
lq_get(store, "hello.md", vars = c(name = "Ada"))
#> [1] "Hi Ada!"