]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Reduce whitespace in jinja2 templates
authorNicki Křížek <nicki@isc.org>
Tue, 7 Apr 2026 12:40:33 +0000 (14:40 +0200)
committerNicki Křížek <nicki@isc.org>
Wed, 27 May 2026 14:19:31 +0000 (14:19 +0000)
Omit extra newlines when combining and including templates.

Adjust the xfer/ns8/small.db.j2 so it doesn't trim the endline twice
(as that would join the two subsequent records on the same line).

bin/tests/system/isctest/template.py
bin/tests/system/xfer/ns8/small.db.j2

index 8065f4acbbd8a862ac39dd32e26805b8a6fb2494..21cc811dfb6ea5d3c7d58c2d1377c51900ef065c 100644 (file)
@@ -44,6 +44,8 @@ class TemplateEngine:
             undefined=jinja2.StrictUndefined,
             variable_start_string="@",
             variable_end_string="@",
+            trim_blocks=True,
+            keep_trailing_newline=True,
         )
         # allow instantiating the template dataclasses in jinja2 templates when
         # using {% set %}
index c2c098fca938e467bf2d4b3b761cdec1281b5a4d..90db2db2ad6c4f7893dd5caef86f715e37024c7f 100644 (file)
@@ -1,4 +1,4 @@
 {% for i in range(4096) %}
 name@i@ 259200 A 1.2.3.4
 name@i@ 259200 TXT "Hello World @i@"
-{%- endfor %}
\ No newline at end of file
+{% endfor %}