Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix bug that disallowed single "{"s to appear in data

  • Loading branch information...
commit 518aa478f373ef8d05d50e56355121c0a10849ea 1 parent 0e58221
@mariusae authored
View
7 src/main/antlr/Mustache.g
@@ -30,6 +30,10 @@ document :
| mustache
)*;
+/**
+ * TODO: figure out how to get ``Data+'' to work here -- this way we
+ * don't do a character-at-a-time.
+ */
body : Data { root.addChild(nodeFactory.newDataNode($Data.text)); };
mustache
@@ -102,4 +106,5 @@ Gt : { inTag }?=> '>' ;
Ws : { inTag }?=> ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+
{ $channel = HIDDEN; };
-Data : { !inTag }?=> (~'{')+ ;
+Data : { !inTag }?=> . ;
+
View
6 src/test/scala/org/monkey/mustache/MustacheSpec.scala
@@ -8,6 +8,12 @@ object MustacheSpec extends Specification {
def eval(mustache: String, dictionary: Dictionary): String =
(new Mustache(Source.fromString(mustache)))(dictionary)
+ "data" should {
+ "not interpret single '{'s" in {
+ (new Mustache("{"))(Dictionary()) must be_==("{")
+ }
+ }
+
"basic interpolation" should {
val mustache = "hello {{world}}!"
"substitute as expected" in {
Please sign in to comment.
Something went wrong with that request. Please try again.