Template
liquid.BoundTemplate
A liquid template that has been parsed and is bound to a liquid.Environment
.
You probably don't want to instantiate BoundTemplate
directly. Use
liquid.Environment.from_string()
or liquid.Environment.get_template()
instead.
PARAMETER | DESCRIPTION |
---|---|
env
|
The environment this template is bound to.
TYPE:
|
nodes
|
The parse tree representing this template.
TYPE:
|
name
|
Optional name of the template. Defaults to an empty string.
TYPE:
|
path
|
Optional origin path or identifier for the template.
TYPE:
|
globals
|
An optional mapping of context variables made available every
time the resulting template is rendered. Defaults to
TYPE:
|
matter
|
Optional mapping containing variables associated with the template. Could be "front matter" or other meta data.
TYPE:
|
uptodate
|
Optional callable that will return
TYPE:
|
analyze
Statically analyze this template and any included/rendered templates.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
analyze_async
async
An async version of analyze
.
filter_names
Return a list of filter names used in this template.
filter_names_async
async
Return a list of filter names used in this template.
global_variable_paths
Return a list of variables used in this template including all path segments.
Excludes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
A list of distinct paths for variables in this template. |
global_variable_paths_async
async
Return a list of variables used in this template including all path segments.
Excludes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
A list of distinct paths for variables in this template. |
global_variable_segments
Return a list of variables used in this template, each as a list of segments.
Excludes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[Segments]
|
A list of distinct paths for variables in this template. |
global_variable_segments_async
async
Return a list of variables used in this template, each as a list of segments.
Excludes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[Segments]
|
A list of distinct paths for variables in this template. |
global_variables
Return a list of variables used in this template without path segments.
Excludes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
A list of distinct root segments for variables in this template. |
global_variables_async
async
Return a list of variables used in this template without path segments.
Excludes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
A list of distinct root segments for variables in this template. |
is_up_to_date_async
async
An async version of the is_up_to_date
property.
If template.uptodate
is a coroutine, it wil be awaited. Otherwise it will be
called just like is_up_to_date
make_globals
Return a mapping including render arguments and template globals.
make_partial_namespace
Return a namespace dictionary.
This is used by render_with_context
to extend an existing context.
render
Render the template with args
and kwargs
included in the render context.
Accepts the same arguments as the dict
constructor.
render_async
async
An async version of liquid.template.BoundTemplate.render
.
render_with_context
render_with_context(
context: RenderContext,
buffer: TextIO,
*args: Any,
partial: bool = False,
block_scope: bool = False,
**kwargs: Any
) -> None
Render the template using an existing context and output buffer.
PARAMETER | DESCRIPTION |
---|---|
context
|
A render context.
TYPE:
|
buffer
|
File-like object to which rendered text is written.
TYPE:
|
partial
|
If
TYPE:
|
block_scope
|
If
TYPE:
|
args
|
Passed to the
TYPE:
|
kwargs
|
Passed to the
TYPE:
|
render_with_context_async
async
render_with_context_async(
context: RenderContext,
buffer: TextIO,
*args: Any,
partial: bool = False,
block_scope: bool = False,
**kwargs: Any
) -> None
An async version of render_with_context
.
tag_names
Return a list of tag names used in this template.
tag_names_async
async
Return a list of tag names used in this template.
variable_paths
Return a list of variables used in this template including all path segments.
Includes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
See also global_variable_paths.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
A list of distinct paths for variables in this template. |
variable_paths_async
async
Return a list of variables used in this template including all path segments.
Includes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
See also global_variable_paths.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
A list of distinct paths for variables in this template. |
variable_segments
Return a list of variables used in this template, each as a list of segments.
Includes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[Segments]
|
A list of distinct paths for variables in this template. |
variable_segments_async
async
Return a list of variables used in this template, each as a list of segments.
Includes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[Segments]
|
A list of distinct paths for variables in this template. |
variables
Return a list of variables used in this template without path segments.
Includes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
See also global_variables.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
A list of distinct root segments for variables in this template. |
variables_async
async
Return a list of variables used in this template without path segments.
Includes variables that are local to the template, like those crated with
{% assign %}
and {% capture %}
.
See also global_variables.
PARAMETER | DESCRIPTION |
---|---|
include_partials
|
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[str]
|
A list of distinct root segments for variables in this template. |
liquid.static_analysis.TemplateAnalysis
dataclass
The result of analyzing a template using Template.analyze()
.
PARAMETER | DESCRIPTION |
---|---|
variables
|
All referenced variables, whether they are in scope or not.
Including references to names such as
TYPE:
|
locals
|
Template variables that are added to the template local scope, whether they are subsequently used or not.
TYPE:
|
globals
|
Template variables that, on the given line number and "file", are out of scope or are assumed to be "global". That is, expected to be included by the application developer rather than a template author.
TYPE:
|
filters
|
All filters found during static analysis.
TYPE:
|
tags
|
All tags found during static analysis.
TYPE:
|
liquid.static_analysis.Variable
dataclass
A variable as sequence of segments that make up its path and its location.
Variables with the same segments compare equal, regardless of span.
liquid.static_analysis.Span
dataclass
The location of a variable, tag or filter in a template.