Tokenizing `{{}}` results in an IndexError
jeking3 opened this issue · 0 comments
jeking3 commented
The tag parser is looking for content on an empty string.
>>> from chevron.tokenizer import tokenize
>>> print(list(tokenize(r"{{ foo }}")))
[('variable', 'foo')]
>>> print(list(tokenize(r"{{foo}}")))
[('variable', 'foo')]
>>> print(list(tokenize(r"{{ }}")))
[('variable', '')]
>>> print(list(tokenize(r"{{}}")))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/.../.tox/run/lib/python3.9/site-packages/chevron/tokenizer.py", line 190, in tokenize
tag, template = parse_tag(template, l_del, r_del)
File "/home/.../.tox/run/lib/python3.9/site-packages/chevron/tokenizer.py", line 89, in parse_tag
tag_type = tag_types.get(tag[0], 'variable')
IndexError: string index out of range