除了修剪空格之外,连字符还有什么用?
What is the hyphen for, apart from trimming whitespace?
我明白使用
{{- remove leading spaces -}}
用于修剪空格,但在下面的示例中,我已经看到了负载,有什么意义?
{%- if true -%}
或
{%- endfor %}
它在控制语句中的作用是什么?我在文档中找不到任何关于此的具体内容,但如果有任何内容,请指出正确的方向!
适用于整块,
{% for i in 1..10 %}
{{ i }}
{% endfor %}
{%- for i in 1..10 -%}
{{ i }}
{%- endfor -%}
输出
1
2
3
4
5
6
7
8
9
10
12345678910
我明白使用
{{- remove leading spaces -}}
用于修剪空格,但在下面的示例中,我已经看到了负载,有什么意义?
{%- if true -%}
或
{%- endfor %}
它在控制语句中的作用是什么?我在文档中找不到任何关于此的具体内容,但如果有任何内容,请指出正确的方向!
适用于整块,
{% for i in 1..10 %}
{{ i }}
{% endfor %}
{%- for i in 1..10 -%}
{{ i }}
{%- endfor -%}
输出
1
2
3
4
5
6
7
8
9
10
12345678910