Skip to content

AST

liquid.Node

Bases: ABC

Base class for all nodes in a parse tree.

blank instance-attribute

blank = True

If True, indicates that the node, when rendered, produces no output text or only whitespace.

The output node ({{ something }}) and echo tag are exception. Even if they evaluate to an empty or blank string, they are not considered "blank".

block_scope

block_scope() -> Iterable[Identifier]

Return variables this node adds to the node's block scope.

children

children(
    static_context: RenderContext,
    *,
    include_partials: bool = True
) -> Iterable[Node]

Return this node's children.

children_async async

children_async(
    static_context: RenderContext,
    *,
    include_partials: bool = True
) -> Iterable[Node]

An async version of children().

expressions

expressions() -> Iterable[Expression]

Return this node's expressions.

partial_scope

partial_scope() -> Partial | None

Return information about a partial template loaded by this node.

raise_for_disabled

raise_for_disabled(disabled_tags: Collection[str]) -> None

Raise a DisabledTagError if this node's type is in the given list.

render

render(context: RenderContext, buffer: TextIO) -> int

Check disabled tags before delegating to render_to_output.

render_async async

render_async(context: RenderContext, buffer: TextIO) -> int

An async version of liquid.ast.Node.render.

render_to_output abstractmethod

render_to_output(
    context: RenderContext, buffer: TextIO
) -> int

Render this node to the output buffer.

render_to_output_async async

render_to_output_async(
    context: RenderContext, buffer: TextIO
) -> int

An async version of liquid.ast.Node.render_to_output.

template_scope

template_scope() -> Iterable[Identifier]

Return variables this node adds to the template local scope.

liquid.BlockNode

Bases: Node

A parse tree node representing a sequence of statements.

children

children(
    static_context: RenderContext,
    *,
    include_partials: bool = True
) -> Iterable[Node]

Return this node's children.

render_to_output

render_to_output(
    context: RenderContext, buffer: TextIO
) -> int

Render the node to the output buffer.

render_to_output_async async

render_to_output_async(
    context: RenderContext, buffer: TextIO
) -> int

Render the node to the output buffer.

liquid.ConditionalBlockNode

Bases: Node

A node containing a sequence of statements and a conditional expression.

children

children(
    static_context: RenderContext,
    *,
    include_partials: bool = True
) -> Iterable[Node]

Return this node's children.

expressions

expressions() -> Iterable[Expression]

Return this node's expressions.

render_to_output

render_to_output(
    context: RenderContext, buffer: TextIO
) -> int

Render the node to the output buffer.

render_to_output_async async

render_to_output_async(
    context: RenderContext, buffer: TextIO
) -> int

Render the node to the output buffer.

liquid.ast.Partial

Partial template meta data.

PARAMETER DESCRIPTION
name

An expression resolving to the name associated with the partial template.

TYPE: Expression

scope

The kind of scope the partial template should have when loaded.

TYPE: PartialScope

in_scope

Names that will be added to the partial template scope.

TYPE: Iterable[Identifier]

liquid.ast.PartialScope

Bases: Enum

The kind of scope a partial template should have when loaded.