thibaudcolas / curlylint

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

Parser fails on comment containing HTML tag #148

Open gasman opened 1 year ago

gasman commented 1 year ago

Describe the bug

An unmatched HTML tag inside a {% comment %} block raises the error

Parse error: expected one of 'autoescape', 'block', 'blocktrans', 'comment', 'filter', 'for', 'if', 'ifchanged', 'ifequal', 'ifnotequal', 'not an intermediate Jinja tag name', 'spaceless', 'verbatim', 'with'.

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

comment, parse error

74 is similar but not identical.

Environment

curlylint 0.13.1, python 3.11.1, MacOS 11.7.3

Steps to reproduce

Create a new folder containing a file test.html:

{% comment %}
    there is an <interesting> tag here
{% endcomment %}

Run curlylint --parse-only .

Expected behavior

Linting should pass with no errors

Actual behavior

Error reported:

test.html
2: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 2:3  parse_error

Oh no! 💥 💔 💥
1 error reported