art-template
art-template copied to clipboard
希望支持类jinja空字符{% foo -%}
Jinja 支持空字符忽略: 比如下面这段话是从jinja的文档里拿来的:
You can also strip whitespace in templates by hand. If you add a minus sign (-) to the start or end of a block (e.g. a For tag), a comment, or a variable expression, the whitespaces before or after that block will be removed:
{% for item in seq -%}
{{ item }}
{%- endfor %}
This will yield all elements without whitespace between them. If seq was a list of numbers from 1 to 9, the output would be 123456789.
就是说如果加了这个减号, 比如<%-
-%>
或者 {{-
-}}
, 那么中间的空白字符都会被忽略, 这样中间可以写比较复杂的内容而不用担心空格和换行.
上述例子如果 seq 是从1到9, 那么输出就是连着的 123456789
.
现在art-template的其他功能已经占用了这个减号, 所以可能需要换一个其他的字符来代表这个.