closes #175, added test

This commit is contained in:
Christopher Pickering 2022-02-18 11:16:55 -06:00
parent 244f20b88c
commit b79449c386
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
4 changed files with 16 additions and 1 deletions

View file

@ -13,6 +13,7 @@ keywords: template linter, template formatter, djLint, HTML, templates, formatte
::: content
- Bug fixes [#187](https://github.com/Riverside-Healthcare/djLint/issues/187)
- Added better support for ``yaml`` front matter in template files
:::
## 0.7.4

View file

@ -13,6 +13,7 @@ keywords: облицовка шаблонов, форматер шаблонов
::: content
- Исправления ошибок [#187](https://github.com/Riverside-Healthcare/djLint/issues/187)
- Добавлена улучшенная поддержка ``yaml`` front matter в файлах шаблонов
:::
## 0.7.4

View file

@ -687,6 +687,7 @@ class Config:
| {%[ ]*?blocktranslate\b[^(?:%})]*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
| {%[ ]*?blocktrans\b[^(?:%})]*?%}.*?{%[ ]*?endblocktrans[ ]*?%}
| {%[ ]*?comment\b[^(?:%})]*?%}.*?(?={%[ ]*?endcomment[ ]*?%})
| ^---[\s\S]+?---
"""
self.ignored_inline_blocks: str = r"""

View file

@ -5,7 +5,7 @@ run::
pytest tests/test_html.py --cov=src/djlint --cov-branch \
--cov-report xml:coverage.xml --cov-report term-missing
pytest tests/test_html.py::test_pre_tag --cov=src/djlint --cov-branch \
pytest tests/test_html.py::test_front_matter --cov=src/djlint --cov-branch \
--cov-report xml:coverage.xml --cov-report term-missing
@ -21,6 +21,18 @@ from src.djlint import main as djlint
from .conftest import reformat, write_to_file
def test_front_matter(runner: CliRunner, tmp_file: TextIO) -> None:
output = reformat(
tmp_file,
runner,
b"""---
layout: <div><div></div></div>
---
<div></div>""",
)
assert output.exit_code == 0
def test_pre_tag(runner: CliRunner, tmp_file: TextIO) -> None:
# added for https://github.com/Riverside-Healthcare/djLint/issues/187
output = reformat(