Yaffs site version 1.1
[yaffs-website] / vendor / twig / twig / test / Twig / Tests / Fixtures / tags / trim_block.test
1 --TEST--
2 Whitespace trimming on tags.
3 --TEMPLATE--
4 {{ 5 * '{#-'|length }}
5 {{ '{{-'|length * 5 + '{%-'|length }}
6
7 Trim on control tag:
8 {% for i in range(1, 9) -%}
9         {{ i }}
10 {%- endfor %}
11
12
13 Trim on output tag:
14 {% for i in range(1, 9) %}
15         {{- i -}}
16 {% endfor %}
17
18
19 Trim comments:
20       
21 {#- Invisible -#}
22        
23 After the comment.
24
25 Trim leading space:
26 {% if leading %}
27
28                 {{- leading }}
29 {% endif %}
30
31 {%- if leading %}
32         {{- leading }}
33
34 {%- endif %}
35
36
37 Trim trailing space:
38 {% if trailing -%}          
39         {{ trailing -}}
40
41 {% endif -%}
42
43 Combined:
44
45 {%- if both -%}
46 <ul>
47         <li>    {{- both -}}   </li>
48 </ul>
49
50 {%- endif -%}
51
52 end
53 --DATA--
54 return array('leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both')
55 --EXPECT--
56 15
57 18
58
59 Trim on control tag:
60 123456789
61
62 Trim on output tag:
63 123456789
64
65 Trim comments:After the comment.
66
67 Trim leading space:
68 leading space
69 leading space
70
71 Trim trailing space:
72 trailing spaceCombined:<ul>
73         <li>both</li>
74 </ul>end