fixed #112, added tests

This commit is contained in:
Christopher Pickering 2021-10-14 13:31:45 +03:00
parent ca87bb7d22
commit e0fed97e70
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
2 changed files with 8 additions and 8 deletions

View file

@ -88,7 +88,7 @@
flags: re.DOTALL|re.I|re.M|re.X
patterns:
- |
<(?:(?!meta)\w+)\s+?[^>]*?(?:class|id|src|width|height|alt|style|lang|title|href|action|method|checked|required|srcset)=[a-zA-Z_-]+
<(?:(?!meta)\w+)\b(\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}])*(?:class|id|src|width|height|alt|style|lang|title|href|action|method|checked|required|srcset)=[a-zA-Z_-]+
- <(?:meta)\s+?[^>]*?(?:class|id|src|alt|style|lang|title|href|action|method|name)=[a-zA-Z_-]+
- rule:
name: H012

View file

@ -133,13 +133,13 @@ def test_H011(runner: CliRunner, tmp_file: TextIO) -> None:
result = runner.invoke(djlint, [tmp_file.name])
assert "H011 1:" not in result.output
# # check keywords inside template syntax
# write_to_file(
# tmp_file.name,
# b'<a href="{{ url_for(\'connection_bp.one_connection\', connection_id=connection.id) }}">{{ connection }}</a>',
# )
# result = runner.invoke(djlint, [tmp_file.name])
# assert "H011 1:" not in result.output
# check keywords inside template syntax
write_to_file(
tmp_file.name,
b"<a href=\"{{ url_for('connection_bp.one_connection', connection_id=connection.id) }}\">{{ connection }}</a>",
)
result = runner.invoke(djlint, [tmp_file.name])
assert "H011 1:" not in result.output
def test_H012(runner: CliRunner, tmp_file: TextIO) -> None: