diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index 0b75f3e..e240884 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -96,8 +96,8 @@ message: There should be no spaces around attribute =. flags: re.DOTALL patterns: - - <\w+?(?:(?!\{[%|{|#])[^\n|>])*\s+= - - <\w+?(?:(?!\{[%|{|#])[^\n|>])*=\s + - <\w+?(\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}])*\s+= + - <\w+?(\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}])*=\s - rule: name: H013 message: Img tag should have an alt attribute. diff --git a/tests/test_linter/test_linter.py b/tests/test_linter/test_linter.py index ef5f4cf..92579d5 100644 --- a/tests/test_linter/test_linter.py +++ b/tests/test_linter/test_linter.py @@ -219,6 +219,16 @@ def test_H012(runner: CliRunner, tmp_file: TextIO) -> None: assert result.exit_code == 0 assert "H012 1:" not in result.output + # space allowed inside attributes. + write_to_file( + tmp_file.name, + b"""