diff options
-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() |