mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-17 05:50:24 +00:00
feat(h021): allow inline styles that contain template syntax
closes #351
This commit is contained in:
parent
ea766722a5
commit
f1a39ed289
2 changed files with 6 additions and 1 deletions
|
|
@ -161,7 +161,7 @@
|
|||
message: Inline styles should be avoided.
|
||||
flags: re.I
|
||||
patterns:
|
||||
- <\w+\s(?:[^>]*\s)?style=(?=[^>]*>)
|
||||
- <\w+\s(?:[^>]*\s)?style=(?=((?!>|{{|{%).)*>)
|
||||
- rule:
|
||||
name: H022
|
||||
message: Use HTTPS for external links.
|
||||
|
|
|
|||
|
|
@ -405,6 +405,11 @@ def test_H021(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
assert result.exit_code == 0
|
||||
assert "H021" not in result.output
|
||||
|
||||
# allow template syntax inside styles
|
||||
write_to_file(tmp_file.name, b'<div style="test {%"><div style="test {{">')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert "H021" not in result.output
|
||||
|
||||
|
||||
def test_H022(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(tmp_file.name, b'<a href="http://">')
|
||||
|
|
|
|||
Loading…
Reference in a new issue