You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some HTML input can cause content to be of type Parser not str, causing the error in the title.
I suspect there are two bugs here:
That the type of content can change seems to indicate a deeper bug than I'm able to understand at the moment. I think pulling at that thread will help with the "proper" fix
I'm not 100% sure the input file is wrong, so there might be a parser error that's causing this to be raised in the first place (see samples below).
Which terms did you search for in the documentation and issue tracker?
"concatenate"
Environment
curlylint 0.13.1
Python 3.10.7
Steps to reproduce
I have two samples:
To re-produce the actual bug
Write the below to example.html and then curlylint example.html with no other config
{% for area_url, area_name in areas %}
{% if forloop.first %}
<ul>
{% endif %}
<li><ahref="{{ area_url }}">{{ area_name }}</a></li>
{% if forloop.last %}
</ul>
{% endif %}
{% empty %}
<p>
No areas found of type {{ area_type.name }}.
</p>
{% endfor %}
Stripped down example that I don't think should be an error
{% for area_url, area_name in areas %}
{% if forloop.first %}
<ul>
{% endif %}
{% endfor %}
In this example, the <ul> is opened but not closed, however I don't think this should be a linting error...as you can see from the above example, it is closed later in the template.
(None of this is to say that the template is good, but I don't think it should raise this exception!)
Expected behavior
For sample 1, I think it shouldn't blow up. I fixed this by adding str() around content, but like I say, I think we should understand why content isn't a string already, like it's clearly expecting.
For sample 2: this might be more complex and could be punted to a different issue, but I don't think it should error.
To be clear in example 2, the error is "correct" in that I get
curlylint example.html
example.html
4: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 4:3 parse_error
Oh no! 💥 💔 💥
1 error reported
The text was updated successfully, but these errors were encountered:
Describe the bug
parse.py
contains the following on line 565 at time of writing:Some HTML input can cause
content
to be of typeParser
notstr
, causing the error in the title.I suspect there are two bugs here:
content
can change seems to indicate a deeper bug than I'm able to understand at the moment. I think pulling at that thread will help with the "proper" fixWhich terms did you search for in the documentation and issue tracker?
"concatenate"
Environment
Steps to reproduce
I have two samples:
To re-produce the actual bug
Write the below to
example.html
and thencurlylint example.html
with no other configStripped down example that I don't think should be an error
In this example, the
<ul>
is opened but not closed, however I don't think this should be a linting error...as you can see from the above example, it is closed later in the template.(None of this is to say that the template is good, but I don't think it should raise this exception!)
Expected behavior
For sample 1, I think it shouldn't blow up. I fixed this by adding
str()
aroundcontent
, but like I say, I think we should understand whycontent
isn't a string already, like it's clearly expecting.For sample 2: this might be more complex and could be punted to a different issue, but I don't think it should error.
To be clear in example 2, the error is "correct" in that I get
The text was updated successfully, but these errors were encountered: