This commit is contained in:
Christopher Pickering 2021-10-01 11:51:53 +02:00
parent 324582c581
commit 92872bc53c
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
6 changed files with 25 additions and 5 deletions

View file

@ -12,7 +12,7 @@
project = "djlint"
copyright = "2021, Riverside Healthcare"
author = "Christopher Pickering"
release = "0.4.8"
release = "0.4.9"
version = release
# -- General configuration ---------------------------------------------------

View file

@ -1,6 +1,10 @@
Changelog
=========
0.4.9
-----
- Fixed bug `#35 <https://github.com/Riverside-Healthcare/djLint/issues/35>`_
0.4.8
-----
- Fixed bug `#34 <https://github.com/Riverside-Healthcare/djLint/issues/34>`_

View file

@ -7,7 +7,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name="djlint"
version="0.4.8"
version="0.4.9"
description="HTML Template Linter and Formatter"
license="GPL-3.0-or-later"
authors=["Christopher Pickering <cpickering@rhc.net>"]

View file

@ -174,10 +174,12 @@ def indent_html(rawcode: str, config: Config) -> str:
if config.blank_line_after_tag:
for tag in [x.strip() for x in config.blank_line_after_tag.split(",")]:
beautified_code = re.sub(
fr"((?:{{%\s*?{tag}[^}}]+?%}}\n?)+)",
re.compile(
fr"((?:^{{%\s*?{tag}[^}}]+?%}}\n?)+)",
re.IGNORECASE | re.MULTILINE | re.DOTALL,
),
r"\1\n",
beautified_code,
re.IGNORECASE,
)
return beautified_code.strip() + "\n"

View file

@ -0,0 +1,5 @@
<div class="tab-cnt">
<div class="tab-dta active" id="details">
<div class="em-grid">{% include "pages/task/details_source.html.j2" %}</div>
</div>
</div>

View file

@ -7,7 +7,7 @@ run::
for a single test, run::
pytest tests/test_config.py::test_profile --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
"""
@ -91,6 +91,7 @@ def test_blank_lines_after_tag(runner: CliRunner) -> None:
result = runner.invoke(
djlint, ["tests/config_blank_lines_after_tag/html.html", "--check"]
)
assert (
"""+{% extends "nothing.html" %}
+
@ -117,6 +118,14 @@ def test_blank_lines_after_tag(runner: CliRunner) -> None:
assert """1 file would be updated.""" in result.output
assert result.exit_code == 1
# check blocks that do not start on a newline - they should be left as is.
result = runner.invoke(
djlint, ["tests/config_blank_lines_after_tag/html_three.html", "--check"]
)
assert """0 files would be updated.""" in result.output
assert result.exit_code == 0
def test_profile(runner: CliRunner) -> None:
result = runner.invoke(djlint, ["tests/config_profile/html.html"])