Skip to content

jinja

Source

Hook for jinja templates. If given an output, the rendered contents are output to a file, otherwise the rendered contents are output as a string.

Inputs

Name Type Default Required Description
template str True Path to the template to render relative to file_system_loader.
output str None False Path to the output the template.
extra_context dict None False Extra context update the global context to render with.
render_context dict None False A render context that invalidates the default context.
additional_context dict None False A map to use as additional context when rendering.
file_system_loader Union[str, list] . True List of paths or string path to directory with templates to load from. Docs.

Arguments

Position Argument Type
1 template str
2 output str

Returns

str

Examples

Basic

The most minimal implementation.

stuff: things
jinja_example->: jinja path/to/template/file.tpl output/path.py

With specific context

jinja with specific context:
  _>: jinja
  templates: path/to/template/file.tpl
  output: output/path.py
  render_context:
    stuff: things

With extra context

stuff: things
jinja with specific context:
  _>: jinja
  templates: path/to/template/file.tpl
  output: output/path.py
  extra_context:
    foo: bar