[antlr-interest] Help with {{Mustache}} expressions

Edgar Espina espina.edgar at gmail.com
Mon Jun 4 13:20:25 PDT 2012

Hi Guys,

 I'm trying to implement a Mustache
engine using ANTLR. I've almost everything done, except for one thing that
I couldn't find a way to do it.

 Basically, I've to remove lines from the final output if a section/comment
have blanks (spaces or new lines) at the beginning or end.

 Sections looks like: {{#section}}{{/name}}
 Comments looks like: {{!Ignore me}}

 Given: "Hello {{#person}}{{name}}{{/person}}!" will be: "Hello World!"
(This one is working), but

 Given: "Hello*\n*{{#person}}*\n*{{name}}*\n*{{/person}}*\n*" it should be:
"Hello\nWorld!\n" 2nd and 3th lines were removed

 Given: "Hello*\n\t*{{!Ignore me}}*\n*World!" it should be "Hello\nWorld!"

 I appreciated any kind of help.





More information about the antlr-interest mailing list