diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-05-05 11:42:51 -0700 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-05-05 11:42:51 -0700 |
commit | 7eef0a68507d1f01464d9ee980483ba2fca10c28 (patch) | |
tree | 2febe894161392083398220092f3cbb1897f55cf /pystache | |
parent | 28234854c152b0c7d09e7a076a8ec63b9403e7d4 (diff) | |
download | pystache-7eef0a68507d1f01464d9ee980483ba2fca10c28.tar.gz |
Avoid adding spurious empty strings to the parse tree.
Diffstat (limited to 'pystache')
-rw-r--r-- | pystache/parser.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pystache/parser.py b/pystache/parser.py index 1c6a5ee..99f8d13 100644 --- a/pystache/parser.py +++ b/pystache/parser.py @@ -113,8 +113,9 @@ class Parser(object): match_index = match.start() end_index = match.end() - # Add string contents before the tag. - parsed_template.add(template[start_index:match_index]) + # Avoid adding spurious empty strings to the parse tree. + if start_index != match_index: + parsed_template.add(template[start_index:match_index]) matches = match.groupdict() |