Reduce whitespace in jinja2 templates

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).
This commit is contained in:
Nicki Křížek 2026-04-07 14:40:33 +02:00
parent dddb067351
commit 4f8e3774bb
2 changed files with 3 additions and 1 deletions

View 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 %}

View 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 %}
{% endfor %}