Classes
SpecialBlockParsingMixin
14
▼
Mixin for parsing special blocks.
Host attributes and cross-mixin dependencies are declared via in…
SpecialBlockParsingMixin
14
▼
Mixin for parsing special blocks.
Host attributes and cross-mixin dependencies are declared via inline TYPE_CHECKING blocks. Inherits block stack management from BlockStackMixin.
Methods
Internal Methods 14 ▼
_parse_with
0
Node
▼
Parse {% with %} in two forms:
1. Conditional: {% with expr %} or {% with expr…
_parse_with
0
Node
▼
def _parse_with(self) -> Node
Parse {% with %} in two forms:
-
Conditional: {% with expr %} or {% with expr as name %}
- Binds expr to 'it' or 'name'
- Skips body if expr is falsy (nil-resilient)
-
Assignment: {% with name = expr, ... %}
- Creates variable bindings
- Always renders body
Detection: If first token after 'with' is a NAME followed by '=', it's assignment style. Otherwise it's conditional (expression followed by 'as' or '%' }).
Returns
Node
_is_assignment_style_with
0
bool
▼
Detect assignment-style: {% with name = expr %}.
Returns True if current token…
_is_assignment_style_with
0
bool
▼
def _is_assignment_style_with(self) -> bool
Detect assignment-style: {% with name = expr %}.
Returns True if current token is NAME and next token is ASSIGN.
Returns
bool
_parse_assignment_with
1
With
▼
Parse assignment-style: {% with x = expr, y = expr2 %}...{% end %}.
Always ren…
_parse_assignment_with
1
With
▼
def _parse_assignment_with(self, start: Token) -> With
Parse assignment-style: {% with x = expr, y = expr2 %}...{% end %}.
Always renders body with the specified variable bindings.
Parameters
| Name | Type | Description |
|---|---|---|
start |
— |
Returns
With
_parse_conditional_with
1
WithConditional
▼
Parse conditional: {% with expr %} or {% with expr as name %}...{% end %}.
Ren…
_parse_conditional_with
1
WithConditional
▼
def _parse_conditional_with(self, start: Token) -> WithConditional
Parse conditional: {% with expr %} or {% with expr as name %}...{% end %}.
Renders body only if expr is truthy. Binds expr to 'name' or 'it'. Supports multiple expressions and bindings: {% with a, b as x, y %}. Also supports {% else %} or {% empty %} for falsy cases.
Parameters
| Name | Type | Description |
|---|---|---|
start |
— |
Returns
WithConditional
_parse_flush
0
Flush
▼
Parse {% flush %} — streaming flush boundary.
Creates an explicit yield bounda…
_parse_flush
0
Flush
▼
def _parse_flush(self) -> Flush
Parse {% flush %} — streaming flush boundary.
Creates an explicit yield boundary in streaming mode. No-op in non-streaming (render) mode.
Returns
Flush
_parse_raw
0
Raw
▼
Parse {% raw %}...{% endraw %.
Raw block that prevents template processing of …
_parse_raw
0
Raw
▼
def _parse_raw(self) -> Raw
Parse {% raw %}...{% endraw %.
Raw block that prevents template processing of its content.
Returns
Raw
_parse_capture
0
Capture
▼
Parse {% capture name %}...{% end %} or {% endcapture %.
Capture rendered cont…
_parse_capture
0
Capture
▼
def _parse_capture(self) -> Capture
Parse {% capture name %}...{% end %} or {% endcapture %.
Capture rendered content into a variable.
Returns
Capture
_parse_cache
0
Cache
▼
Parse {% cache key %}...{% end %} or {% endcache %.
Fragment caching with opti…
_parse_cache
0
Cache
▼
def _parse_cache(self) -> Cache
Parse {% cache key %}...{% end %} or {% endcache %.
Fragment caching with optional TTL.
Returns
Cache
_parse_filter_block
0
FilterBlock
▼
Parse {% filter name %}...{% end %} or {% endfilter %.
Apply a filter to an en…
_parse_filter_block
0
FilterBlock
▼
def _parse_filter_block(self) -> FilterBlock
Parse {% filter name %}...{% end %} or {% endfilter %.
Apply a filter to an entire block of content.
Returns
FilterBlock
_parse_spaceless
0
Spaceless
▼
Parse {% spaceless %}...{% end %} or {% endspaceless %}.
Removes whitespace be…
_parse_spaceless
0
Spaceless
▼
def _parse_spaceless(self) -> Spaceless
Parse {% spaceless %}...{% end %} or {% endspaceless %}.
Removes whitespace between HTML tags. Part of RFC: kida-modern-syntax-features.
Returns
Spaceless
_parse_embed
0
Embed
▼
Parse {% embed 'template.html' %}...{% end %} or {% endembed %}.
Embed is like…
_parse_embed
0
Embed
▼
def _parse_embed(self) -> Embed
Parse {% embed 'template.html' %}...{% end %} or {% endembed %}.
Embed is like include but allows block overrides. Part of RFC: kida-modern-syntax-features.
Returns
Embed
_parse_push
0
Push
▼
Parse {% push "stack_name" %}...{% end %}.
Push rendered content onto a named …
_parse_push
0
Push
▼
def _parse_push(self) -> Push
Parse {% push "stack_name" %}...{% end %}.
Push rendered content onto a named stack for deferred output.
Example::
{% push "scripts" %}
<script src="widget.js"></script>
{% end %}
Returns
Push
_parse_stack
0
Stack
▼
Parse {% stack "stack_name" %}.
Emit all content previously pushed to the name…
_parse_stack
0
Stack
▼
def _parse_stack(self) -> Stack
Parse {% stack "stack_name" %}.
Emit all content previously pushed to the named stack.
Example::
{% stack "scripts" %}
Returns
Stack
_parse_provide
0
Provide
▼
Parse {% provide key = expr %}...{% endprovide %}.
Provide a value to descenda…
_parse_provide
0
Provide
▼
def _parse_provide(self) -> Provide
Parse {% provide key = expr %}...{% endprovide %}.
Provide a value to descendant consumers via render context.
Consumers read it withconsume("key").
Example::
{% provide table_align = ["left", "center", "right"] %}
{{ row("Alice", "Active", "42") }}
{% end %}
Returns
Provide