Skip to contents

Create an object to configure the templating engine behavior (e.g. customize the syntax). The default values have been chosen to match the Jinja defaults.

Usage

jinjar_config(
  loader = NULL,
  block_open = "{%",
  block_close = "%}",
  variable_open = "{{",
  variable_close = "}}",
  comment_open = "{#",
  comment_close = "#}",
  line_statement = NULL,
  trim_blocks = FALSE,
  lstrip_blocks = FALSE,
  ignore_missing_files = FALSE
)

default_config()

Arguments

loader

How the engine discovers templates. Choices:

  • NULL (default), disables search for templates.

  • Path to template directory.

  • A loader object.

block_open, block_close

The opening and closing delimiters for control blocks. Default: "{%" and "%}".

variable_open, variable_close

The opening and closing delimiters for print statements. Default: "{{" and "}}".

comment_open, comment_close

The opening and closing delimiters for comments. Default: "{#" and "#}".

line_statement

The prefix for an inline statement. If NULL (the default), inline statements are disabled.

trim_blocks

Remove first newline after a block. Default: FALSE.

lstrip_blocks

Remove inline whitespace before a block. Default: FALSE.

ignore_missing_files

Ignore include or extends statements when the auxiliary template cannot be found. If FALSE (default), then an error is raised.

Value

A "jinjar_config" object.

Note

The equivalent Jinja class is Environment, but this term has special significance in R (see environment()).

Examples

jinjar_config()
#> 
#> ── Template configuration ──────────────────────────────────────────────────────
#> Loader: disabled
#> Syntax: {% block %} {{ variable }} {# comment #}