Comos / tage

Tage, the PHP template engine. Developing...
GNU General Public License v3.0
4 stars 2 forks source link

Discuss how to handle tag wrap. #16

Open 13leaf opened 9 years ago

13leaf commented 9 years ago

Like this

{{foreach from=$list item='it' key='i'}}
{{$i}},{{$it}}
{{endforeach}}

After Lex,the tokens will like that:foreachTag,newLineText,print $i,print $it,newLineText,endforeachTag. So the output(with list=[1,3]) should be: newLine 0,1 newLine 1,3 newLine

That may not be expected.

bigbigant commented 9 years ago

没太明白,我感觉这个正常啊

13leaf commented 9 years ago

通常来说使用者的预期结果可能是: 0,1 newline 1,3 newline 为了写出这种效果,必须要

{{foreach from=$list item='it' key='i'}}{{$i}},{{$it}}
{{endforeach}}

Twig中可以通过设置whitespace_trim或者使用spaceless tag来解决这个问题 http://twig.sensiolabs.org/doc/templates.html

bigbigant commented 9 years ago

I see. Add the feature in next milestone?

13leaf commented 9 years ago

OK