Template
liquid2.Template
A parsed template ready to be rendered.
Don't try to instantiate Template
directly. Use parse()
,
Environment.from_string()
or
Environment.get_template()
instead.
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
Return False if the template has been modified, True otherwise.
is_up_to_date_async
async
An async version of is_up_to_date().
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.
render
Render this template with args and kwargs added to the render context.
args and kwargs are passed to dict()
.
render_async
async
Render this template with args and kwargs added to the render context.
args and kwargs are passed to dict()
.
render_with_context
render_with_context(
context: RenderContext,
buf: TextIO,
*args: Any,
partial: bool = False,
block_scope: bool = False,
**kwargs: Any
) -> int
Render this template using an existing render context and output buffer.
render_with_context_async
async
render_with_context_async(
context: RenderContext,
buf: TextIO,
*args: Any,
partial: bool = False,
block_scope: bool = False,
**kwargs: Any
) -> int
Render this template using an existing render context and output buffer.
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 %}
.
See also global_variable_segments.
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 %}
.
See also global_variable_segments.
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. |
liquid2.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:
|
liquid2.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.