Updated docs for whitespace+newline trimming.
This commit is contained in:
@@ -359,31 +359,36 @@ contexts will not be searched when resolving subcomponents.
|
|||||||
Newline trimming
|
Newline trimming
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
If the opening or closing section tag are the only thing on a line, any newline following the tag
|
If the opening or closing section tag are the only thing on a line, any surrounding whitespace and
|
||||||
is trimmed. This allows for civilized templates, like:
|
the line terminator following the tag are trimmed. This allows for civilized templates, like:
|
||||||
|
|
||||||
Favorite foods:
|
Favorite foods:
|
||||||
{{#people}}
|
<ul>
|
||||||
- {{first_name}} {{last_name}} likes {{favorite_food}}.
|
{{#people}}
|
||||||
{{/people}}
|
<li>{{first_name}} {{last_name}} likes {{favorite_food}}.</li>
|
||||||
|
{{/people}}
|
||||||
|
</ul>
|
||||||
|
|
||||||
which produces output like:
|
which produces output like:
|
||||||
|
|
||||||
Favorite foods:
|
Favorite foods:
|
||||||
- Elvis Presley likes peanut butter.
|
<ul>
|
||||||
- Mahatma Gandhi likes aloo dum.
|
<li>Elvis Presley likes peanut butter.</li>
|
||||||
|
<li>Mahatma Gandhi likes aloo dum.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
rather than:
|
rather than:
|
||||||
|
|
||||||
Favorite foods:
|
Favorite foods:
|
||||||
|
<ul/>
|
||||||
- Elvis Presley likes peanut butter.
|
|
||||||
|
<li>Elvis Presley likes peanut butter.</li>
|
||||||
- Mahatma Gandhi likes aloo dum.
|
|
||||||
|
<li>Mahatma Gandhi likes aloo dum.</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
which would be produced without the newline trimming. Note: the current implementation does not
|
which would be produced without the newline trimming.
|
||||||
handle Windows-style CRLF data. If you're a Windows user, how about sending me a patch?
|
|
||||||
|
|
||||||
Nested Contexts
|
Nested Contexts
|
||||||
---------------
|
---------------
|
||||||
|
|||||||
Reference in New Issue
Block a user