Fixed dropped character on partial delimiter match.
This commit is contained in:
@@ -113,6 +113,7 @@ public class Mustache
|
|||||||
} else {
|
} else {
|
||||||
text.append(start1);
|
text.append(start1);
|
||||||
if (c != start1) {
|
if (c != start1) {
|
||||||
|
text.append(c);
|
||||||
state = TEXT;
|
state = TEXT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,6 +147,7 @@ public class Mustache
|
|||||||
} else {
|
} else {
|
||||||
text.append(end1);
|
text.append(end1);
|
||||||
if (c != end1) {
|
if (c != end1) {
|
||||||
|
text.append(c);
|
||||||
state = TAG;
|
state = TAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,6 +120,12 @@ public class MustacheTest
|
|||||||
execute(context("a", "<b>")));
|
execute(context("a", "<b>")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test public void testPartialDelimiterMatch () {
|
||||||
|
assertEquals("{bob}", Mustache.compiler().compile("{bob}").execute(context()));
|
||||||
|
assertEquals("bar", Mustache.compiler().compile("{{bob}bob}}").execute(
|
||||||
|
context("bob}bob", "bar")));
|
||||||
|
}
|
||||||
|
|
||||||
protected void test (String expected, String template, Object ctx)
|
protected void test (String expected, String template, Object ctx)
|
||||||
{
|
{
|
||||||
assertEquals(expected, Mustache.compiler().compile(template).execute(ctx));
|
assertEquals(expected, Mustache.compiler().compile(template).execute(ctx));
|
||||||
|
|||||||
Reference in New Issue
Block a user