fixed #110, added test

This commit is contained in:
Christopher Pickering 2021-10-14 13:37:21 +03:00
parent e0fed97e70
commit 84a182595c
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
3 changed files with 6 additions and 2 deletions

View file

@ -69,7 +69,6 @@ def lint_file(config: Config, this_file: Path) -> Dict:
),
html,
):
if match.group(1) and not re.match(
re.compile(
fr"^/?{config.always_self_closing_html_tags}", re.I | re.X

View file

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

View file

@ -397,6 +397,11 @@ def test_H025(runner: CliRunner, tmp_file: TextIO) -> None:
assert "H025 1:" in result.output
assert "H025 2:" not in result.output
# test tags inside attibutes
write_to_file(tmp_file.name, b'<span title="<p>Bar</p>">Foo</span>')
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="" >')