fix(t001): fixed false positive on multiline template tags

closes #350
This commit is contained in:
Christopher Pickering 2022-08-24 08:30:30 -05:00
parent 79cd013f8d
commit ea766722a5
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
2 changed files with 14 additions and 2 deletions

View file

@ -18,8 +18,8 @@
# close
- '[^(\s|^|\-)]+[}|%|#]}'
- '[^(\s|^)]+\-[}|%|#]}'
- \s{2,}[}|%|#]}
- '{[{|%|#]-?\s{2,}'
- '[^\s][ ]{2,}[}|%|#]}'
- '{[{|%|#]-?[ ]{2,}'
- rule:
name: T002
message: Double quotes should be used in tags.

View file

@ -50,6 +50,18 @@ def test_T001(runner: CliRunner, tmp_file: TextIO) -> None:
result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"])
assert result.exit_code == 0
# test line break around tag
write_to_file(
tmp_file.name,
b"""<div>
{%
("SashaNose", "1"),
%}
</div>""",
)
result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"])
assert "T001" not in result.output
def test_T002(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(tmp_file.name, b"{% extends 'this' %}")