Classes
Node
2
▼
Base class for all AST nodes.
All nodes track their source location for error reporting.
Nodes are…
Node
2
▼
Base class for all AST nodes.
All nodes track their source location for error reporting. Nodes are immutable for thread-safety.
Attributes
| Name | Type | Description |
|---|---|---|
lineno |
int
|
— |
col_offset |
int
|
— |
Template
3
▼
Root node representing a complete template.
Template
3
▼
Root node representing a complete template.
Attributes
| Name | Type | Description |
|---|---|---|
body |
Sequence[Node]
|
Sequence of top-level nodes |
extends |
Extends | None
|
Optional parent template path |
context_type |
TemplateContext | None
|
Optional type declaration from {% template %} |
TemplateContext
1
▼
Type declaration: {% template page: Page, site: Site %}
Kida-native feature for type-aware validat…
TemplateContext
1
▼
Type declaration: {% template page: Page, site: Site %}
Kida-native feature for type-aware validation.
Attributes
| Name | Type | Description |
|---|---|---|
declarations |
Sequence[tuple[str, str]]
|
— |
Extends
1
▼
Template inheritance: {% extends "base.html" %}
Extends
1
▼
Template inheritance: {% extends "base.html" %}
Attributes
| Name | Type | Description |
|---|---|---|
template |
Expr
|
— |
Block
4
▼
Named block for inheritance: {% block name %}...{% end %}
Kida uses unified {% end %} for all bloc…
Block
4
▼
Named block for inheritance: {% block name %}...{% end %}
Kida uses unified {% end %} for all block closings.
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
Block identifier |
body |
Sequence[Node]
|
Block content |
scoped |
bool
|
If True, block has its own variable scope |
required |
bool
|
If True, child templates must override this block |
Include
3
▼
Include another template: {% include "partial.html" %}
Include
3
▼
Include another template: {% include "partial.html" %}
Attributes
| Name | Type | Description |
|---|---|---|
template |
Expr
|
Template path expression |
with_context |
bool
|
If True, pass current context to included template |
ignore_missing |
bool
|
If True, silently skip if template doesn't exist |
Import
3
▼
Import functions from template: {% import "funcs.html" as f %}
Import
3
▼
Import functions from template: {% import "funcs.html" as f %}
Attributes
| Name | Type | Description |
|---|---|---|
template |
Expr
|
— |
target |
str
|
— |
with_context |
bool
|
— |
FromImport
3
▼
Import specific functions: {% from "funcs.html" import button, card %}
FromImport
3
▼
Import specific functions: {% from "funcs.html" import button, card %}
Attributes
| Name | Type | Description |
|---|---|---|
template |
Expr
|
— |
names |
Sequence[tuple[str, str | None]]
|
— |
with_context |
bool
|
— |
Output
2
▼
Output expression: {{ expr }}
Output
2
▼
Output expression: {{ expr }}
Attributes
| Name | Type | Description |
|---|---|---|
expr |
Expr
|
Expression to output |
escape |
bool
|
If True, HTML-escape the result |
Data
1
▼
Raw text data between template constructs.
Data
1
▼
Raw text data between template constructs.
Attributes
| Name | Type | Description |
|---|---|---|
value |
str
|
— |
If
4
▼
Conditional: {% if cond %}...{% elif cond %}...{% else %}...{% end %}
Kida uses unified {% end %} …
If
4
▼
Conditional: {% if cond %}...{% elif cond %}...{% else %}...{% end %}
Kida uses unified {% end %} instead of {% endif %}.
Attributes
| Name | Type | Description |
|---|---|---|
test |
Expr
|
Condition expression |
body |
Sequence[Node]
|
Nodes to render if condition is true |
elif_ |
Sequence[tuple[Expr, Sequence[Node]]]
|
Sequence of (condition, body) pairs |
else_ |
Sequence[Node]
|
Nodes to render if all conditions are false |
For
6
▼
For loop: {% for x in items %}...{% empty %}...{% end %}
Kida uses {% empty %} (not {% else %}) an…
For
6
▼
For loop: {% for x in items %}...{% empty %}...{% end %}
Kida uses {% empty %} (not {% else %}) and {% end %} (not {% endfor %}).
Attributes
| Name | Type | Description |
|---|---|---|
target |
Expr
|
Loop variable(s) - can be tuple for unpacking |
iter |
Expr
|
Iterable expression |
body |
Sequence[Node]
|
Loop body |
empty |
Sequence[Node]
|
Rendered if iterable is empty (Kida uses 'empty' not 'else') |
recursive |
bool
|
Enable recursive loop calls |
test |
Expr | None
|
Optional filter condition (like Python's if in comprehensions) |
AsyncFor
4
▼
Async for loop: {% async for x in async_items %}...{% end %}
Native async iteration without wrappe…
AsyncFor
4
▼
Async for loop: {% async for x in async_items %}...{% end %}
Native async iteration without wrapper adapters.
Attributes
| Name | Type | Description |
|---|---|---|
target |
Expr
|
— |
iter |
Expr
|
— |
body |
Sequence[Node]
|
— |
empty |
Sequence[Node]
|
— |
While
2
▼
While loop: {% while cond %}...{% end %}
Kida-native feature.
While
2
▼
While loop: {% while cond %}...{% end %}
Kida-native feature.
Attributes
| Name | Type | Description |
|---|---|---|
test |
Expr
|
— |
body |
Sequence[Node]
|
— |
Match
2
▼
Pattern matching: {% match expr %}{% case pattern [if guard] %}...{% end %}
Kida-native feature fo…
Match
2
▼
Pattern matching: {% match expr %}{% case pattern [if guard] %}...{% end %}
Kida-native feature for cleaner branching than if/elif chains. Supports optional guard clauses for conditional matching.
With guards: {% match api_type %} {% case _ if 'python' in api_type %}Python API {% case _ if 'rest' in api_type %}REST API {% case _ %}Other {% end %}
Attributes
| Name | Type | Description |
|---|---|---|
subject |
Expr
|
— |
cases |
Sequence[tuple[Expr, Expr | None, Sequence[Node]]]
|
— |
Let
2
▼
Template-scoped variable: {% let x = expr %} or {% let a, b = 1, 2 %}
Variables declared with 'let…
Let
2
▼
Template-scoped variable: {% let x = expr %} or {% let a, b = 1, 2 %}
Variables declared with 'let' persist across the template and can be modified within inner scopes. Supports tuple unpacking on the left-hand side.
Kida-native replacement for Jinja's confusing namespace() workaround.
Attributes
| Name | Type | Description |
|---|---|---|
name |
Expr
|
— |
value |
Expr
|
— |
Set
2
▼
Block-scoped variable: {% set x = expr %} or {% set a, b = 1, 2 %}
Variable is scoped to current b…
Set
2
▼
Block-scoped variable: {% set x = expr %} or {% set a, b = 1, 2 %}
Variable is scoped to current block. Use 'let' for template-wide scope. Supports tuple unpacking on the left-hand side.
Attributes
| Name | Type | Description |
|---|---|---|
target |
Expr
|
Assignment target - can be a Name or Tuple of Names |
value |
Expr
|
Value expression to assign |
Export
2
▼
Export variable from inner scope: {% export x = expr %} or {% export a, b = 1, 2 %}
Explicitly exp…
Export
2
▼
Export variable from inner scope: {% export x = expr %} or {% export a, b = 1, 2 %}
Explicitly exports a variable from an inner scope (like a for loop) to the enclosing scope. Makes scope behavior explicit and predictable. Supports tuple unpacking on the left-hand side.
Attributes
| Name | Type | Description |
|---|---|---|
name |
Expr
|
— |
value |
Expr
|
— |
Capture
3
▼
Capture block content: {% capture x %}...{% end %}
Kida-native name (clearer than Jinja's {% set x…
Capture
3
▼
Capture block content: {% capture x %}...{% end %}
Kida-native name (clearer than Jinja's {% set x %}...{% endset %}).
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
body |
Sequence[Node]
|
— |
filter |
Filter | None
|
— |
Def
4
▼
Function definition: {% def name(args) %}...{% end %}
Kida uses functions with true lexical scopin…
Def
4
▼
Function definition: {% def name(args) %}...{% end %}
Kida uses functions with true lexical scoping instead of macros. Functions can access variables from their enclosing scope.
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
Function name |
args |
Sequence[str]
|
Argument names |
body |
Sequence[Node]
|
Function body |
defaults |
Sequence[Expr]
|
Default argument values |
Slot
1
▼
Slot for component content: {% slot %}
Used inside {% def %} to mark where caller content goes.
Slot
1
▼
Slot for component content: {% slot %}
Used inside {% def %} to mark where caller content goes.
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
CallBlock
3
▼
Call function with body content: {% call name(args) %}body{% end %}
The body content fills the {% …
CallBlock
3
▼
Call function with body content: {% call name(args) %}body{% end %}
The body content fills the {% slot %} in the function.
Attributes
| Name | Type | Description |
|---|---|---|
call |
Expr
|
— |
body |
Sequence[Node]
|
— |
args |
Sequence[Expr]
|
— |
Cache
4
▼
Fragment caching: {% cache key %}...{% end %}
Kida-native built-in caching. No external dependenci…
Cache
4
▼
Fragment caching: {% cache key %}...{% end %}
Kida-native built-in caching. No external dependencies required.
Attributes
| Name | Type | Description |
|---|---|---|
key |
Expr
|
Cache key expression |
body |
Sequence[Node]
|
Content to cache |
ttl |
Expr | None
|
Optional time-to-live expression |
depends |
Sequence[Expr]
|
Optional dependency expressions for invalidation |
With
2
▼
Jinja2-style context manager: {% with x = expr %}...{% end %}
Always renders body with variable bi…
With
2
▼
Jinja2-style context manager: {% with x = expr %}...{% end %}
Always renders body with variable bindings.
Attributes
| Name | Type | Description |
|---|---|---|
targets |
Sequence[tuple[str, Expr]]
|
— |
body |
Sequence[Node]
|
— |
WithConditional
4
▼
Conditional with block: {% with expr as name %}...{% end %}
Renders body only if expr is truthy. B…
WithConditional
4
▼
Conditional with block: {% with expr as name %}...{% end %}
Renders body only if expr is truthy. Binds the evaluated expression to the specified variable name(s).
This provides nil-resilience: the block is silently skipped when the expression evaluates to None, empty collections, or other falsy values.
Syntax:
{% with page.author as author %}
<span>{{ author.name }}</span>
{% end %}
{% with page.author %}
<span>{{ it.name }}</span>
{% end %}
{% with a, b as x, y %}
{{ x }}, {{ y }}
{% end %}
Behavior:
- Evaluates expr once
- If truthy: binds result to target, renders body
- If falsy: renders empty block (if provided), or skips entirely
- Restores previous variable binding after block
Contrast with standard With node:
- With: Always renders body with variable bindings
- WithConditional: Only renders if expression is truthy
Attributes
| Name | Type | Description |
|---|---|---|
expr |
Expr
|
— |
target |
Expr
|
— |
body |
Sequence[Node]
|
— |
empty |
Sequence[Node]
|
— |
FilterBlock
2
▼
Apply filter to block: {% filter upper %}...{% end %}
FilterBlock
2
▼
Apply filter to block: {% filter upper %}...{% end %}
Attributes
| Name | Type | Description |
|---|---|---|
filter |
Filter
|
— |
body |
Sequence[Node]
|
— |
Autoescape
2
▼
Control autoescaping: {% autoescape true %}...{% end %}
Autoescape
2
▼
Control autoescaping: {% autoescape true %}...{% end %}
Attributes
| Name | Type | Description |
|---|---|---|
enabled |
bool
|
— |
body |
Sequence[Node]
|
— |
Raw
1
▼
Raw block (no template processing): {% raw %}...{% end %}
Raw
1
▼
Raw block (no template processing): {% raw %}...{% end %}
Attributes
| Name | Type | Description |
|---|---|---|
value |
str
|
— |
Trim
1
▼
Whitespace control block: {% trim %}...{% end %}
Kida-native replacement for Jinja's {%- -%} modif…
Trim
1
▼
Whitespace control block: {% trim %}...{% end %}
Kida-native replacement for Jinja's {%- -%} modifiers. Content inside is trimmed of leading/trailing whitespace.
Attributes
| Name | Type | Description |
|---|---|---|
body |
Sequence[Node]
|
— |
Break
0
▼
Break out of loop: {% break %}
Exits the innermost for/while loop.
Part of RFC: kida-modern-syntax…
Break
0
▼
Break out of loop: {% break %}
Exits the innermost for/while loop. Part of RFC: kida-modern-syntax-features.
Continue
0
▼
Skip to next iteration: {% continue %}
Skips to the next iteration of the innermost for/while loop…
Continue
0
▼
Skip to next iteration: {% continue %}
Skips to the next iteration of the innermost for/while loop. Part of RFC: kida-modern-syntax-features.
Spaceless
1
▼
Remove whitespace between HTML tags: {% spaceless %}...{% end %}
Removes whitespace between > and …
Spaceless
1
▼
Remove whitespace between HTML tags: {% spaceless %}...{% end %}
Removes whitespace between > and <, preserving content whitespace. Part of RFC: kida-modern-syntax-features.
Attributes
| Name | Type | Description |
|---|---|---|
body |
Sequence[Node]
|
— |
Embed
3
▼
Embed template with block overrides: {% embed 'card.html' %}...{% end %}
Like include, but allows …
Embed
3
▼
Embed template with block overrides: {% embed 'card.html' %}...{% end %}
Like include, but allows overriding blocks in the embedded template. Part of RFC: kida-modern-syntax-features.
Attributes
| Name | Type | Description |
|---|---|---|
template |
Expr
|
Template path expression |
blocks |
dict[str, Block]
|
Block overrides defined in embed body |
with_context |
bool
|
Pass current context to embedded template |
Expr
0
▼
Base class for expressions.
Expr
0
▼
Base class for expressions.
Const
1
▼
Constant value: string, number, boolean, None.
Const
1
▼
Constant value: string, number, boolean, None.
Attributes
| Name | Type | Description |
|---|---|---|
value |
str | int | float | bool | None
|
— |
Name
2
▼
Variable reference: {{ user }}
Name
2
▼
Variable reference: {{ user }}
Attributes
| Name | Type | Description |
|---|---|---|
name |
str
|
— |
ctx |
Literal['load', 'store', 'del']
|
— |
Tuple
2
▼
Tuple expression: (a, b, c)
Tuple
2
▼
Tuple expression: (a, b, c)
Attributes
| Name | Type | Description |
|---|---|---|
items |
Sequence[Expr]
|
— |
ctx |
Literal['load', 'store']
|
— |
List
1
▼
List expression: [a, b, c]
List
1
▼
List expression: [a, b, c]
Attributes
| Name | Type | Description |
|---|---|---|
items |
Sequence[Expr]
|
— |
Dict
2
▼
Dict expression: {a: b, c: d}
Dict
2
▼
Dict expression: {a: b, c: d}
Attributes
| Name | Type | Description |
|---|---|---|
keys |
Sequence[Expr]
|
— |
values |
Sequence[Expr]
|
— |
Getattr
2
▼
Attribute access: obj.attr
Getattr
2
▼
Attribute access: obj.attr
Attributes
| Name | Type | Description |
|---|---|---|
obj |
Expr
|
— |
attr |
str
|
— |
OptionalGetattr
2
▼
Optional attribute access: obj?.attr
Returns None if obj is None/undefined, otherwise obj.attr.
Pa…
OptionalGetattr
2
▼
Optional attribute access: obj?.attr
Returns None if obj is None/undefined, otherwise obj.attr. Part of RFC: kida-modern-syntax-features.
Attributes
| Name | Type | Description |
|---|---|---|
obj |
Expr
|
— |
attr |
str
|
— |
Getitem
2
▼
Subscript access: obj[key]
Getitem
2
▼
Subscript access: obj[key]
Attributes
| Name | Type | Description |
|---|---|---|
obj |
Expr
|
— |
key |
Expr
|
— |
OptionalGetitem
2
▼
Optional subscript access: obj?[key]
Returns None if obj is None/undefined, otherwise obj[key].
Pa…
OptionalGetitem
2
▼
Optional subscript access: obj?[key]
Returns None if obj is None/undefined, otherwise obj[key]. Part of RFC: kida-modern-syntax-features.
Attributes
| Name | Type | Description |
|---|---|---|
obj |
Expr
|
— |
key |
Expr
|
— |
Slice
3
▼
Slice expression: [start:stop:step]
Slice
3
▼
Slice expression: [start:stop:step]
Attributes
| Name | Type | Description |
|---|---|---|
start |
Expr | None
|
— |
stop |
Expr | None
|
— |
step |
Expr | None
|
— |
FuncCall
5
▼
Function call: func(args, **kwargs)
FuncCall
5
▼
Function call: func(args, **kwargs)
Attributes
| Name | Type | Description |
|---|---|---|
func |
Expr
|
— |
args |
Sequence[Expr]
|
— |
kwargs |
dict[str, Expr]
|
— |
dyn_args |
Expr | None
|
— |
dyn_kwargs |
Expr | None
|
— |
Filter
4
▼
Filter application: expr | filter(args)
Filter
4
▼
Filter application: expr | filter(args)
Attributes
| Name | Type | Description |
|---|---|---|
value |
Expr
|
— |
name |
str
|
— |
args |
Sequence[Expr]
|
— |
kwargs |
dict[str, Expr]
|
— |
Pipeline
2
▼
Pipeline operator: expr |> filter1 |> filter2
Kida-native syntax for readable filter chains.
More …
Pipeline
2
▼
Pipeline operator: expr |> filter1 |> filter2
Kida-native syntax for readable filter chains. More readable than deeply nested Jinja filters.
Attributes
| Name | Type | Description |
|---|---|---|
value |
Expr
|
— |
steps |
Sequence[tuple[str, Sequence[Expr], dict[str, Expr]]]
|
— |
Test
5
▼
Test application: expr is test(args) or expr is not test(args)
Test
5
▼
Test application: expr is test(args) or expr is not test(args)
Attributes
| Name | Type | Description |
|---|---|---|
value |
Expr
|
— |
name |
str
|
— |
args |
Sequence[Expr]
|
— |
kwargs |
dict[str, Expr]
|
— |
negated |
bool
|
— |
BinOp
3
▼
Binary operation: left op right
BinOp
3
▼
Binary operation: left op right
Attributes
| Name | Type | Description |
|---|---|---|
op |
str
|
— |
left |
Expr
|
— |
right |
Expr
|
— |
UnaryOp
2
▼
Unary operation: op operand
UnaryOp
2
▼
Unary operation: op operand
Attributes
| Name | Type | Description |
|---|---|---|
op |
str
|
— |
operand |
Expr
|
— |
Compare
3
▼
Comparison: left op1 right1 op2 right2 ...
Supports chained comparisons like: 1 < x < 10
Compare
3
▼
Comparison: left op1 right1 op2 right2 ...
Supports chained comparisons like: 1 < x < 10
Attributes
| Name | Type | Description |
|---|---|---|
left |
Expr
|
— |
ops |
Sequence[str]
|
— |
comparators |
Sequence[Expr]
|
— |
BoolOp
2
▼
Boolean operation: expr1 and/or expr2
BoolOp
2
▼
Boolean operation: expr1 and/or expr2
Attributes
| Name | Type | Description |
|---|---|---|
op |
Literal['and', 'or']
|
— |
values |
Sequence[Expr]
|
— |
CondExpr
3
▼
Conditional expression: a if cond else b
CondExpr
3
▼
Conditional expression: a if cond else b
Attributes
| Name | Type | Description |
|---|---|---|
test |
Expr
|
— |
if_true |
Expr
|
— |
if_false |
Expr
|
— |
NullCoalesce
2
▼
Null coalescing: a ?? b
Returns b if a is None/undefined, otherwise a.
Unlike 'or', doesn't treat …
NullCoalesce
2
▼
Null coalescing: a ?? b
Returns b if a is None/undefined, otherwise a. Unlike 'or', doesn't treat falsy values (0, '', False, []) as missing. Part of RFC: kida-modern-syntax-features.
Attributes
| Name | Type | Description |
|---|---|---|
left |
Expr
|
— |
right |
Expr
|
— |
Range
4
▼
Range literal: start..end or start...end
Part of RFC: kida-modern-syntax-features.
Range
4
▼
Range literal: start..end or start...end
Part of RFC: kida-modern-syntax-features.
Attributes
| Name | Type | Description |
|---|---|---|
start |
Expr
|
Start value (inclusive) |
end |
Expr
|
End value (inclusive if inclusive=True) |
inclusive |
bool
|
True for .., False for ... |
step |
Expr | None
|
Optional step value (from 'by' keyword) |
Await
1
▼
Await expression: await expr
Native async support without auto_await() wrappers.
Await
1
▼
Await expression: await expr
Native async support without auto_await() wrappers.
Attributes
| Name | Type | Description |
|---|---|---|
value |
Expr
|
— |
Concat
1
▼
String concatenation: a ~ b ~ c
Multiple ~ operators are collapsed into a single Concat node
for e…
Concat
1
▼
String concatenation: a ~ b ~ c
Multiple ~ operators are collapsed into a single Concat node for efficient string building.
Attributes
| Name | Type | Description |
|---|---|---|
nodes |
Sequence[Expr]
|
— |
MarkSafe
1
▼
Mark expression as safe (no escaping): {{ expr | safe }}
MarkSafe
1
▼
Mark expression as safe (no escaping): {{ expr | safe }}
Attributes
| Name | Type | Description |
|---|---|---|
value |
Expr
|
— |
LoopVar
1
▼
Loop variable access: {{ loop.index }}
Provides access to loop iteration state.
LoopVar
1
▼
Loop variable access: {{ loop.index }}
Provides access to loop iteration state.
Attributes
| Name | Type | Description |
|---|---|---|
attr |
str
|
— |
InlinedFilter
3
▼
Inlined filter as direct method call (optimization).
Generated by FilterInliner for common pure fi…
InlinedFilter
3
▼
Inlined filter as direct method call (optimization).
Generated by FilterInliner for common pure filters like upper, lower, strip.
The compiler generatesstr(value).method()instead of filter dispatch.
Attributes
| Name | Type | Description |
|---|---|---|
value |
Expr
|
— |
method |
str
|
— |
args |
Sequence[Expr]
|
— |