Trim newlines from section tags with leading+trailing whitespace.

Other implementations apparently do it, and we have to keep up with the
Joneses.

Closes #59.
This commit is contained in:
Michael Bayne
2014-12-15 16:32:13 -08:00
parent 4cb0d876ed
commit ef4184404d
2 changed files with 140 additions and 35 deletions
@@ -453,6 +453,25 @@ public class MustacheTest
test("list:" + sep +
"no items" + sep +
"endlist", tmpl, context("items", Collections.emptyList()));
// this tests newline trimming even if the group tags have leading/trailing whitespace
String htmlTmpl =
"<ul>" + sep +
" {{#items}} " + sep +
" <li>{{this}}</li>" + sep +
" {{/items}} " + sep +
" {{^items}}" + sep +
" <li>no items</li>" + sep +
" {{/items}}" + sep +
"</ul>";
test("<ul>" + sep +
" <li>one</li>" + sep +
" <li>two</li>" + sep +
" <li>three</li>" + sep +
"</ul>", htmlTmpl, context("items", Arrays.asList("one", "two", "three")));
test("<ul>" + sep +
" <li>no items</li>" + sep +
"</ul>", htmlTmpl, context("items", Collections.emptyList()));
}
@Test public void testNewlineNonSkipping () {