thibaudcolas / curlylint

Experimental HTML templates linting for Jinja, Nunjucks, Django templates, Twig, Liquid
https://www.curlylint.org/
MIT License
237 stars 25 forks source link

invalid parse error #74

Open tisdall opened 3 years ago

tisdall commented 3 years ago

Describe the bug

I get a parse error when I don't believe one should happen. I don't really know what it's having an issue with though so unfortunately I can't be more descriptive.

Which terms did you search for in the documentation and issue tracker?

Tried searching for "comment", but switching the comment to an if gave the same issue so I'm unsure the problem.

Environment

curlylint==0.12.2 parsy==1.1.0 pathspec==0.8.1 attrs==19.3.0 click==7.0 toml==0.10.0

Python 3.8.3 on Mac OS 10.13.6

Steps to reproduce

I reduced my template to the smallest example that still exhibited the issue:

{% if page_type %}
    {% comment %} some comment {% endcomment %}
    <div>
{% endif %}

{% if page_type %}
    </div>
{% endif %}

If I remove the {% comment %} line than it passes as valid. If I change the comment to an if block I still see the issue. Single line {# #} also has the issue.

Expected behavior

Should clear as valid

Actual behavior

3:3 Parse error: expected one of 'autoescape', 'block', 'blocktrans', 'comment', 'filter', 'for', 'if', 'ifchanged', 'ifequal', 'ifnotequal', 'not an intermediate Jinja tag name', 'spaceless', 'verbatim', 'with' at 3:3  parse_error
thatmatthewxu commented 1 year ago

I had the same issue in v0.13.1