diff --git a/docs/.eleventy.js b/docs/.eleventy.js index f6aa1d1..3bc5f54 100644 --- a/docs/.eleventy.js +++ b/docs/.eleventy.js @@ -15,7 +15,7 @@ const slugifyCustom = (s) => async function imageShortcode(src, alt, sizes, type='asdf', loading="lazy", decoding="async") { let metadata = await Image(src, { widths: [24, 300, 400, 500, 600, 800, 1200], - formats: ["webp"], + formats: ["webp", "png"], sharpWebpOptions: { options: { quality:70 diff --git a/src/djlint/lint.py b/src/djlint/lint.py index 320363d..eba53ae 100644 --- a/src/djlint/lint.py +++ b/src/djlint/lint.py @@ -80,10 +80,7 @@ def lint_file(config: Config, this_file: Path) -> Dict: open_tags.insert(0, match) else: for i, tag in enumerate(copy.deepcopy(open_tags)): - if ( - re.split(r"\s+", tag.group(1))[0] - == match.group(2)[1:] - ): + if tag.group(3) == match.group(2)[1:]: open_tags.pop(i) break else: diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index ad56a80..a219d4d 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -184,7 +184,7 @@ message: Tag seems to be an orphan. flags: re.I|re.DOTALL patterns: - - <((/?\w+)\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|[^'\">{}])*)(? + - <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|[^'\">{}])*)(? - rule: name: H026 message: Emtpy id and class tags can be removed. diff --git a/tests/test_linter.py b/tests/test_linter.py index ab3701b..30b8032 100644 --- a/tests/test_linter.py +++ b/tests/test_linter.py @@ -7,7 +7,7 @@ run:: # for a single test - pytest tests/test_linter.py::test_output_for_no_linebreaks --cov=src/djlint --cov-branch \ + pytest tests/test_linter.py::test_H025 --cov=src/djlint --cov-branch \ --cov-report xml:coverage.xml --cov-report term-missing """ @@ -484,6 +484,16 @@ def test_H025(runner: CliRunner, tmp_file: TextIO) -> None: result = runner.invoke(djlint, [tmp_file.name]) assert "H025" not in result.output + # fix issue #169 + write_to_file( + tmp_file.name, + b"""