mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-29 14:03:59 +00:00

This commit introduces a shorthand for defining and calling macros when using them as a reusable substitute for variables assigned complex values (e.g. string literals with or without newline escapes). The use-case is formatting - from my experience it's easier to visually parse a `macro` `endmacro` block than a multiline variable assignment. Signed-off-by: mataha <mataha@users.noreply.github.com>
22 lines
167 B
HTML
22 lines
167 B
HTML
1
|
|
|
|
{%- macro empty -%}
|
|
the best thing
|
|
{%- endmacro -%}
|
|
|
|
1
|
|
|
|
{%- call empty() -%}
|
|
|
|
1
|
|
|
|
{%- macro whole() -%}
|
|
we've ever done
|
|
{%- endmacro -%}
|
|
|
|
11
|
|
|
|
{%- call whole -%}
|
|
|
|
11
|