fix(h025): fixes rule H025 where tags have curly hash

Closes #270
This commit is contained in:
Christopher Pickering 2022-06-28 12:38:28 -05:00
parent 66a294bddb
commit e4fe62f52e
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
2 changed files with 6 additions and 1 deletions

View file

@ -184,7 +184,7 @@
message: Tag seems to be an orphan.
flags: re.I|re.DOTALL
patterns:
- <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|[^'\">{}])*)(?<!/)>
- <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|{#[^%]*#}|[^'\">{}])*)(?<!/)>
- rule:
name: H026
message: Empty id and class tags can be removed.

View file

@ -522,6 +522,11 @@ def test_H025(runner: CliRunner, tmp_file: TextIO) -> None:
result = runner.invoke(djlint, [tmp_file.name])
assert "H025" not in result.output
# test {# #} inside tag
write_to_file(tmp_file.name, b'<div id="example" {# for #}></div>')
result = runner.invoke(djlint, [tmp_file.name])
assert "H025" not in result.output
def test_H026(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(tmp_file.name, b'<asdf id="" >')