例如:
{% if xxx %} # 空行 1
something...
{% endif %} # 空行 2
# 空行 3
{% if xxx %} # 空行 4
something...
{% endif %} # 空行 5
# 空行 6
{% if xxx %} # 空行 7
something...
{% endif %} # 空行 8
解决方法:
在block中加入"-"符号。
例如:
------
{%- if test -%}
{%- endif -%}