mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-18 01:51:06 +00:00
fixed #146, added test, updated version
This commit is contained in:
parent
ec60646b36
commit
a053175663
7 changed files with 20 additions and 7 deletions
|
|
@ -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 ---------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
next release
|
||||
------------
|
||||
0.6.3
|
||||
-----
|
||||
- Added support for django `blocktrans` tag
|
||||
- Bug fixes
|
||||
|
||||
0.6.2
|
||||
-----
|
||||
|
|
|
|||
|
|
@ -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 <cpickering@rhc.net>"]
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
6
tests/config_blank_lines_after_tag/html_seven.html
Normal file
6
tests/config_blank_lines_after_tag/html_seven.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{% blocktrans %}my words{% endblocktrans %}
|
||||
{% block body %}
|
||||
<div></div>
|
||||
{% endblock body %}
|
||||
|
||||
{% block js %}{% endblock %}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
[tool]
|
||||
[tool.djlint]
|
||||
blank_line_after_tag = "load, extends, include "
|
||||
blank_line_after_tag = "load, extends, include ,endblock "
|
||||
|
|
|
|||
|
|
@ -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"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue