Classes
DefParam
2
▼
A single parameter in a {% def %} with optional type annotation.
DefParam
2
▼
A single parameter in a {% def %} with optional type annotation.
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
annotation |
str | None
|
— |
Def
7
▼
Function definition: {% def name(params) %}...{% end %}
Def
7
▼
Function definition: {% def name(params) %}...{% end %}
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
params |
Sequence[DefParam]
|
— |
body |
Sequence[Node]
|
— |
defaults |
Sequence[Expr]
|
— |
vararg |
str | None
|
— |
kwarg |
str | None
|
— |
Methods
args
0
tuple[str, ...]
▼
Backward-compat bridge: returns parameter names.
property
args
0
tuple[str, ...]
▼
def args(self) -> tuple[str, ...]
Returns
tuple[str, ...]
Region
8
▼
Parameterized renderable unit: {% region name(params) %}...{% end %}.
Compiles to BOTH a block fun…
Region
8
▼
Parameterized renderable unit: {% region name(params) %}...{% end %}.
Compiles to BOTH a block function (for render_block) AND a callable (for {{ name(args) }}). Parameters make it self-contained.
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
params |
Sequence[DefParam]
|
— |
body |
Sequence[Node]
|
— |
defaults |
Sequence[Expr]
|
— |
vararg |
str | None
|
— |
kwarg |
str | None
|
— |
condition |
Expr | None
|
— |
Methods
args
0
tuple[str, ...]
▼
Backward-compat bridge: returns parameter names.
property
args
0
tuple[str, ...]
▼
def args(self) -> tuple[str, ...]
Returns
tuple[str, ...]
Slot
3
▼
Slot placeholder inside {% def %}: {% slot %} or {% slot name %}
With scoped bindings: {% slot nam…
Slot
3
▼
Slot placeholder inside {% def %}: {% slot %} or {% slot name %}
With scoped bindings: {% slot name let:item=expr %}...default...{% end %} Bindings expose data from the def body to the caller's slot content. When a body is present, it serves as default content when no caller overrides this slot.
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
bindings |
tuple[tuple[str, Expr], ...]
|
— |
body |
Sequence[Node]
|
— |
SlotBlock
3
▼
Named slot content inside {% call %}: {% slot name %}...{% end %}
With scoped params: {% slot name…
SlotBlock
3
▼
Named slot content inside {% call %}: {% slot name %}...{% end %}
With scoped params: {% slot name let:item, let:index %}...{% end %} Params declare which scoped bindings the slot body consumes.
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
body |
Sequence[Node]
|
— |
params |
tuple[str, ...]
|
— |
CallBlock
4
▼
Call function with slot content: {% call name(args) %}...{% end %}
CallBlock
4
▼
Call function with slot content: {% call name(args) %}...{% end %}
Attributes
| Name | Type | Description |
|---|---|---|
call |
Expr
|
— |
slots |
dict[str, Sequence[Node]]
|
— |
args |
Sequence[Expr]
|
— |
Methods
body
0
Sequence[Node]
▼
Backward-compat: default slot content.
property
body
0
Sequence[Node]
▼
def body(self) -> Sequence[Node]
Returns
Sequence[Node]