function Template.handlebars
Renders a Handlebars template with the provided data.
Parameters
template: The Handlebars template string.data: A dictionary of data to render the template with.
function Template.jinja2
Renders a Jinja2 template with the provided data.
Parameters
template: The Jinja2 template string.data: A dictionary of data to render the template with.
function Template.liquid
Renders a Liquid template with the provided data.
Parameters
template: The Liquid template string.data: A dictionary of data to render the template with.
function Template.try_handlebars
Renders a Handlebars template like
handlebars, but never fails the evaluation — see try_jinja2 for the (ok, text) contract and when to prefer this over the raising variant.
function Template.try_jinja2
Renders a Jinja2 template like
jinja2, but never fails the evaluation: a render error is returned to the caller as a value instead of propagating and aborting the whole invocation.
Returns a 2-tuple (ok, text):
(True, rendered)on success.(False, error_message)on any parse/render error.
jinja2 for internal templates whose failure is a
programming error that should surface loudly.
Example
function Template.try_liquid
Renders a Liquid template like
liquid, but never fails the evaluation — see try_jinja2 for the (ok, text) contract and when to prefer this over the raising variant.
