Parser reorganization, parsing lenience++.
Reorganized the parser as a proper class so that I could easily reenter it to
deal with things like optional second open and close tag characters. In the
process, made the parser simply pass through certain kinds of malformed input
as text.
I hope to go further in this regard, avoiding parse exceptions in favor of
simply showing the user the malformed output unsubstituted. It's just as easy
to see "{{broken blah blah" in ones result template as it is to read exception
messages, and apps that wish to use JMustache for things like end-user
templates will find this much more agreeable.
This commit is contained in:
@@ -205,9 +205,16 @@ public class MustacheTest
|
||||
execute(context("a", "<b>")));
|
||||
}
|
||||
|
||||
@Test(expected=MustacheParseException.class)
|
||||
public void testDanglingTag () {
|
||||
Mustache.compiler().escapeHTML(true).compile("{{a").execute(context("a", "<b>"));
|
||||
@Test public void testDanglingTag () {
|
||||
test("foo{", "foo{", context("a", "<b>"));
|
||||
test("foo{{", "foo{{", context("a", "<b>"));
|
||||
test("foo{{a", "foo{{a", context("a", "<b>"));
|
||||
test("foo{{a}", "foo{{a}", context("a", "<b>"));
|
||||
}
|
||||
|
||||
@Test public void testRepeatedOpenTag () {
|
||||
test("{{ funny [b] business", "{{ funny {{a}} business", context("a", "[b]"));
|
||||
test("{{ funny <b> business", "{{ funny {{{a}}} business", context("a", "<b>"));
|
||||
}
|
||||
|
||||
@Test(expected=MustacheParseException.class)
|
||||
|
||||
Reference in New Issue
Block a user