]> git.ipfire.org Git - thirdparty/bind9.git/commit
Add an include_indented tag for indented template includes
authorNicki Křížek <nicki@isc.org>
Mon, 3 Aug 2026 12:21:37 +0000 (12:21 +0000)
committerNicki Křížek <nicki@isc.org>
Thu, 6 Aug 2026 11:50:09 +0000 (13:50 +0200)
commitec9ba4ac823d445372a9bce0149a40b8a7a3bd02
tree57a711a2a0a84242a9f3f944cb9b02602409e5e5
parent530a2ba04f8352f8f3a47e2850f5b05da9510cb2
Add an include_indented tag for indented template includes

jinja2's {% include %} inserts the rendered file verbatim, so includes
inside view statements have to be wrapped in a three-line
{% filter indent %} block with the depth repeated by hand. Add a small
jinja2 extension providing {% include_indented "..." %}, which detects
the tag's own leading whitespace at parse time and expands to the
builtin include wrapped in the builtin indent filter, keeping stock
jinja2 runtime semantics. Detection needs the tag alone on its line in
a loader-backed template; anything else fails at parse time instead of
misrendering.

Co-Authored-By: Martin Basti <mbasti@isc.org>
Assisted-by: Claude:claude-fable-5
bin/tests/system/COOKBOOK.md
bin/tests/system/isctest/template.py
bin/tests/system/requirements.txt
bin/tests/system/selftest/tests_template.py [new file with mode: 0644]