Massive overhaul of Mustache.php's whitespace handling.
Move regex preparation into methods, use named subpatterns so the regex makes more sense. Fix the logic around eating newlines adjacent to tags. Update tests to reflect the changes.
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
<h1>{{header}}</h1>
|
||||
{{#notEmpty}}
|
||||
<ul>
|
||||
{{#item}}
|
||||
{{#current}}
|
||||
<li><strong>{{name}}</strong></li>
|
||||
{{/current}}
|
||||
{{^current}}
|
||||
<li><a href="{{url}}">{{name}}</a></li>
|
||||
{{/current}}
|
||||
{{/item}}
|
||||
</ul>
|
||||
<ul>
|
||||
{{#item}}
|
||||
{{#current}}
|
||||
<li><strong>{{name}}</strong></li>
|
||||
{{/current}}
|
||||
{{^current}}
|
||||
<li><a href="{{url}}">{{name}}</a></li>
|
||||
{{/current}}
|
||||
{{/item}}
|
||||
</ul>
|
||||
{{/notEmpty}}
|
||||
{{#isEmpty}}
|
||||
<p>The list is empty.</p>
|
||||
<p>The list is empty.</p>
|
||||
{{/isEmpty}}
|
||||
Reference in New Issue
Block a user