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() -> Optional[Partial]

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

The name of the partial or an expression resolving to the name associated with the partial template.

TYPE: Union[Expression, str]

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]

key

A hash of the partial template name and any arguments the partial template will be rendered with that might affect its scope. If a key is provided, static analysis helpers will visit a partial template once for each distinct key.

TYPE: Optional[int] DEFAULT: None

liquid.ast.PartialScope

Bases: Enum

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