diff --git a/docs/conf.py b/docs/conf.py index 93a763e..596993c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,7 +12,7 @@ project = "djlint" copyright = "2021, Riverside Healthcare" author = "Christopher Pickering" -release = "0.6.2" +release = "0.6.3" version = release # -- General configuration --------------------------------------------------- diff --git a/docs/djlint/changelog.rst b/docs/djlint/changelog.rst index a39a55c..d85e8a0 100644 --- a/docs/djlint/changelog.rst +++ b/docs/djlint/changelog.rst @@ -1,9 +1,10 @@ Changelog ========= -next release ------------- +0.6.3 +----- - Added support for django `blocktrans` tag +- Bug fixes 0.6.2 ----- diff --git a/pyproject.toml b/pyproject.toml index 1206c99..3191419 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name="djlint" -version="0.6.2" +version="0.6.3" description="HTML Template Linter and Formatter" license="GPL-3.0-or-later" authors=["Christopher Pickering "] diff --git a/src/djlint/formatter/condense.py b/src/djlint/formatter/condense.py index 0e5860a..dc45318 100644 --- a/src/djlint/formatter/condense.py +++ b/src/djlint/formatter/condense.py @@ -66,7 +66,7 @@ def condense_html(html: str, config: Config) -> str: for tag in [x.strip() for x in config.blank_line_after_tag.split(",")]: html = re.sub( re.compile( - fr"((?:{{%\s*?{tag}[^}}]+?%}}\n?)+)", + fr"((?:{{%\s*?{tag}\b[^}}]+?%}}\n?)+)", re.IGNORECASE | re.MULTILINE | re.DOTALL, ), func, diff --git a/tests/config_blank_lines_after_tag/html_seven.html b/tests/config_blank_lines_after_tag/html_seven.html new file mode 100644 index 0000000..685d0ae --- /dev/null +++ b/tests/config_blank_lines_after_tag/html_seven.html @@ -0,0 +1,6 @@ +{% blocktrans %}my words{% endblocktrans %} +{% block body %} +
+{% endblock body %} + +{% block js %}{% endblock %} diff --git a/tests/config_blank_lines_after_tag/pyproject.toml b/tests/config_blank_lines_after_tag/pyproject.toml index d5e354b..0796ce1 100644 --- a/tests/config_blank_lines_after_tag/pyproject.toml +++ b/tests/config_blank_lines_after_tag/pyproject.toml @@ -1,3 +1,3 @@ [tool] [tool.djlint] -blank_line_after_tag = "load, extends, include " +blank_line_after_tag = "load, extends, include ,endblock " diff --git a/tests/test_config.py b/tests/test_config.py index 7167681..885c57f 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -7,7 +7,7 @@ run:: for a single test, run:: - pytest tests/test_config.py::test_exclude --cov=src/djlint \ + pytest tests/test_config.py::test_blank_lines_after_tag --cov=src/djlint \ --cov-branch --cov-report xml:coverage.xml --cov-report term-missing """ @@ -153,6 +153,12 @@ def test_blank_lines_after_tag(runner: CliRunner) -> None: ) assert result.exit_code == 0 + # make sure endblock doesn't pick up endblocktrans :) + result = runner.invoke( + djlint, ["tests/config_blank_lines_after_tag/html_seven.html", "--check"] + ) + assert result.exit_code == 0 + def test_profile(runner: CliRunner) -> None: result = runner.invoke(djlint, ["tests/config_profile/html.html"])