mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-20 23:30:24 +00:00
parent
b2bd1ea298
commit
7e4ac76be0
7 changed files with 79 additions and 10 deletions
58
poetry.lock
generated
58
poetry.lock
generated
|
|
@ -77,6 +77,17 @@ tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.1
|
|||
[package.extras]
|
||||
toml = ["tomli"]
|
||||
|
||||
[[package]]
|
||||
name = "execnet"
|
||||
version = "1.9.0"
|
||||
description = "execnet: rapid multi-Python deployment"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.extras]
|
||||
testing = ["pre-commit"]
|
||||
|
||||
[[package]]
|
||||
name = "html-tag-names"
|
||||
version = "0.1.2"
|
||||
|
|
@ -242,6 +253,36 @@ pytest = ">=4.6"
|
|||
[package.extras]
|
||||
testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-forked"
|
||||
version = "1.4.0"
|
||||
description = "run tests in isolated forked subprocesses"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
py = "*"
|
||||
pytest = ">=3.10"
|
||||
|
||||
[[package]]
|
||||
name = "pytest-xdist"
|
||||
version = "2.5.0"
|
||||
description = "pytest xdist plugin for distributed testing and loop-on-failing modes"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
execnet = ">=1.1"
|
||||
pytest = ">=6.2.0"
|
||||
pytest-forked = "*"
|
||||
|
||||
[package.extras]
|
||||
psutil = ["psutil (>=3.0)"]
|
||||
setproctitle = ["setproctitle"]
|
||||
testing = ["filelock"]
|
||||
|
||||
[[package]]
|
||||
name = "pyyaml"
|
||||
version = "6.0"
|
||||
|
|
@ -310,13 +351,10 @@ python-versions = ">=3.7"
|
|||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||
|
||||
[extras]
|
||||
test = ["coverage", "pytest", "pytest-cov"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.7,<4.0"
|
||||
content-hash = "b775aca13fdc0d430dfed03034c4f9c5bfcedbce887f055f8101d0f3217ba32b"
|
||||
content-hash = "9e46ab4d8e14c063f669ba48e3f0bb696067b5bdfc916679597e1449f1454eb9"
|
||||
|
||||
[metadata.files]
|
||||
atomicwrites = [
|
||||
|
|
@ -403,6 +441,10 @@ coverage = [
|
|||
{file = "coverage-6.4.2-pp36.pp37.pp38-none-any.whl", hash = "sha256:e2618cb2cf5a7cc8d698306e42ebcacd02fb7ef8cfc18485c59394152c70be97"},
|
||||
{file = "coverage-6.4.2.tar.gz", hash = "sha256:6c3ccfe89c36f3e5b9837b9ee507472310164f352c9fe332120b764c9d60adbe"},
|
||||
]
|
||||
execnet = [
|
||||
{file = "execnet-1.9.0-py2.py3-none-any.whl", hash = "sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142"},
|
||||
{file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"},
|
||||
]
|
||||
html-tag-names = [
|
||||
{file = "html-tag-names-0.1.2.tar.gz", hash = "sha256:04924aca48770f36b5a41c27e4d917062507be05118acb0ba869c97389084297"},
|
||||
{file = "html_tag_names-0.1.2-py3-none-any.whl", hash = "sha256:eeb69ef21078486b615241f0393a72b41352c5219ee648e7c61f5632d26f0420"},
|
||||
|
|
@ -459,6 +501,14 @@ pytest-cov = [
|
|||
{file = "pytest-cov-3.0.0.tar.gz", hash = "sha256:e7f0f5b1617d2210a2cabc266dfe2f4c75a8d32fb89eafb7ad9d06f6d076d470"},
|
||||
{file = "pytest_cov-3.0.0-py3-none-any.whl", hash = "sha256:578d5d15ac4a25e5f961c938b85a05b09fdaae9deef3bb6de9a6e766622ca7a6"},
|
||||
]
|
||||
pytest-forked = [
|
||||
{file = "pytest-forked-1.4.0.tar.gz", hash = "sha256:8b67587c8f98cbbadfdd804539ed5455b6ed03802203485dd2f53c1422d7440e"},
|
||||
{file = "pytest_forked-1.4.0-py3-none-any.whl", hash = "sha256:bbbb6717efc886b9d64537b41fb1497cfaf3c9601276be8da2cccfea5a3c8ad8"},
|
||||
]
|
||||
pytest-xdist = [
|
||||
{file = "pytest-xdist-2.5.0.tar.gz", hash = "sha256:4580deca3ff04ddb2ac53eba39d76cb5dd5edeac050cb6fbc768b0dd712b4edf"},
|
||||
{file = "pytest_xdist-2.5.0-py3-none-any.whl", hash = "sha256:6fe5c74fec98906deb8f2d2b616b5c782022744978e7bd4695d39c8f42d0ce65"},
|
||||
]
|
||||
pyyaml = [
|
||||
{file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"},
|
||||
{file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"},
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ isort = "^5.9.3"
|
|||
coverage = "^6.4.2"
|
||||
pytest = "^7.1.2"
|
||||
pytest-cov = "^3.0.0"
|
||||
pytest-xdist = "^2.5.0"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
djlint = "djlint:main"
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ def condense_html(html: str, config: Config) -> str:
|
|||
for tag in [x.strip() for x in config.blank_line_before_tag.split(",")]:
|
||||
html = re.sub(
|
||||
re.compile(
|
||||
rf"(?<!^\n$)((?:{{%\s*?{tag}\b[^}}]+?%}}\n?)+)",
|
||||
rf"(?<!^\n)((?:{{%\s*?{tag}\b[^}}]+?%}}\n?)+)",
|
||||
re.IGNORECASE | re.MULTILINE | re.DOTALL,
|
||||
),
|
||||
func,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ def indent_html(rawcode: str, config: Config) -> str:
|
|||
ignored_level = 0
|
||||
|
||||
for item in rawcode_flat_list:
|
||||
|
||||
# if a raw tag first line
|
||||
if not is_block_raw and is_ignored_block_opening(config, item):
|
||||
is_raw_first_line = True
|
||||
|
|
@ -76,7 +75,7 @@ def indent_html(rawcode: str, config: Config) -> str:
|
|||
item,
|
||||
)
|
||||
or re.findall(
|
||||
rf"^({{%[ ]*?({slt_template})[ ]+?.+?%}})(.*?)({{%[ ]+?end(\2)[ ]+?.*?%}})",
|
||||
rf"^({{%[ ]*?({slt_template})[ ]+?.*?%}})(.*?)({{%[ ]+?end(\2)[ ]+?.*?%}})",
|
||||
item,
|
||||
re.IGNORECASE | re.MULTILINE | re.VERBOSE,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
{% block %}stuff{% endblock %}
|
||||
|
||||
{% block %}stuff{% endblock %}
|
||||
|
|
@ -105,3 +105,12 @@ def test_blank_lines_after_tag(runner: CliRunner) -> None:
|
|||
],
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
|
||||
result = runner.invoke(
|
||||
djlint,
|
||||
[
|
||||
"tests/test_config/test_blank_lines_after_tag/html_nine.html",
|
||||
"--check",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
|
|
|
|||
|
|
@ -56,8 +56,10 @@ def test_cli(runner: CliRunner) -> None:
|
|||
try:
|
||||
os.remove("tests/test_config/test_gitignore/.gitignore")
|
||||
shutil.rmtree("tests/test_config/test_gitignore/.git")
|
||||
except:
|
||||
except BaseException as e:
|
||||
print("cleanup failed")
|
||||
print(e)
|
||||
assert 2 == 1
|
||||
|
||||
|
||||
@pytest.mark.xdist_group(name="group1")
|
||||
|
|
@ -105,14 +107,17 @@ def test_pyproject(runner: CliRunner) -> None:
|
|||
"--use-gitignore",
|
||||
],
|
||||
)
|
||||
print(result.output)
|
||||
assert result.exit_code == 0
|
||||
|
||||
try:
|
||||
os.remove("tests/test_config/test_gitignore/.gitignore")
|
||||
os.remove("tests/test_config/test_gitignore/pyproject.toml")
|
||||
shutil.rmtree("tests/test_config/test_gitignore/.git")
|
||||
except:
|
||||
except BaseException as e:
|
||||
print("cleanup failed")
|
||||
print(e)
|
||||
assert 2 == 1
|
||||
|
||||
|
||||
@pytest.mark.xdist_group(name="group1")
|
||||
|
|
@ -136,5 +141,7 @@ def test_ignored_path(runner: CliRunner) -> None:
|
|||
try:
|
||||
os.remove("tests/test_config/test_gitignore/.gitignore")
|
||||
shutil.rmtree("tests/test_config/test_gitignore/.git")
|
||||
except:
|
||||
except BaseException as e:
|
||||
print("cleanup failed")
|
||||
print(e)
|
||||
assert 2 == 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue