samskivert/jmustache — pull request #29 by bruckner (2013-03-06 20:56:08+00:00)
Title: Fixes issue 28, comments containing '}' parsed as text

Quick fix to Mustache.Parser.parseChar.

When in the TAG state, the parseChar checks for a start delimiter in the middle of the tag text. If it finds one, it decides the tag text it'd been accumulating is actually plain text, and moves to MATCHING_START.

Fix is to check if the tag is a comment tag before taking any action, by adding:

text.charAt(0) != '!'

to the condition (comments open with '!').

Also added a test case that fails on previous commit, but passes with the fix.