-
-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Looking for double quotes inside Jinja tags #585
Comments
I'm going to pin on a few other items related to jinja2 templates - maybe they are related. If not, I can open separate issues. Tag Pair & Spec Char EscapeHaving an Having a You can see that when I remove the if statement there are no errors on the line. HTML: <!DOCTYPE HTML>
<option value="w" {% if p.type == "w" %}selected{% endif %}>week(s)</option>
<option value="w" selected>week(s)</option> |
Attr No Duplication & Attr Must Have A ValueThis error is thrown whenever a <option value="{{ t.id }}" {% if t.id == s.id %} selected {% endif %}> Expected: Attr No Unnecessary WhitespaceThis seems too be through when there is whitespace around the connects of an if statement - |
I'm not experienced in TS, but I created pull request #586 that seems to correct all these issues by stripping the tags from the attributes. Any thoughts or ways this could potentially go wrong? Thanks! |
I think my fix causes issues w/ items like this: <link href="{{ my_href_var }}" rel="shortcut icon" /> will now trigger the I'll tweak the pr to only trip tags that have a leading white space and see how that helps. |
Maybe you can give a tip - most of the tests seem to be passing now, when I have valid template tags, except this one is still triggering the <option value="w" {% if p.type == "w" %} selected="selected" {% endif %}>week(s)</option> output: test.html: line 2, col 81, error - Tag must be paired, no start tag: [ </option> ] (tag-pair)
test.html: line 2, col 1, error - Special characters must be escaped : [ < ]. (spec-char-escape)
test.html: line 2, col 73, error - Special characters must be escaped : [ > ]. (spec-char-escape) |
Great tool, and ditto on a request for this feature. I'm using nunjucks templates, which is basically the same syntax as jinja. Although I'm wondering if it might be better to add to the rc file definition some sort of way to express file-extension-specific overrides, for example something like:
anyway, just my two cents. I figure that might make it easier to support all sorts of html template syntaxes. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale... can any of the devs chip in? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@christopherpickering I "unstale" it, it should not go to stale anymore 😉 |
Thanks 😁 Is this something you can consider investigating? |
Hi, thanks for the excellent tool! When running on Jinja2 templates it generally works pretty well. However, when there is an if statement inside a tag this error comes up -
The html is:
and run htmlhint:
Is there a way that at htmlhint can ignore what is inside a
{% ... %}
and{{ ... }}
?The text was updated successfully, but these errors were encountered: