askama/testing/templates/macro-no-args.html
mataha cba1fb8e50 Allow macros to be defined and called without arguments
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>
2023-06-12 10:35:40 +02:00

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