]> 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>
Thu, 28 May 2026 09:36:55 +0000 (11:36 +0200)
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).

(cherry picked from commit 4f8e3774bba0f63d98e651ef044d6703792921a2)

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 2c90a2577a192afae412666dace39d23f569a44b..b51aff5692bd7d48414e151dd1d7650c68ac0a72 100644 (file)
@@ -12,4 +12,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 %}