mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-18 10:01:06 +00:00
added script and style tags to single line tags. fixed #68 and added test
This commit is contained in:
parent
f4f6c32a04
commit
863efbf116
3 changed files with 22 additions and 2 deletions
|
|
@ -102,5 +102,5 @@ def compress_html(html: str, config: Config) -> str:
|
|||
r"\1\3\4",
|
||||
html,
|
||||
)
|
||||
|
||||
print(html)
|
||||
return html
|
||||
|
|
|
|||
|
|
@ -564,6 +564,8 @@ class Config:
|
|||
| label
|
||||
| div
|
||||
| li
|
||||
| script
|
||||
| style
|
||||
"""
|
||||
|
||||
self.always_single_line_html_tags: str = r"""
|
||||
|
|
|
|||
|
|
@ -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_long_attributes --cov=src/djlint --cov-branch \
|
||||
pytest tests/test_html.py::test_style_tag --cov=src/djlint --cov-branch \
|
||||
--cov-report xml:coverage.xml --cov-report term-missing
|
||||
|
||||
|
||||
|
|
@ -53,6 +53,15 @@ console.log();
|
|||
"""
|
||||
)
|
||||
|
||||
# check script includes
|
||||
output = reformat(
|
||||
tmp_file,
|
||||
runner,
|
||||
b"""<script src="{% static 'common/js/foo.min.js' %}"></script>""",
|
||||
)
|
||||
|
||||
assert output["exit_code"] == 0
|
||||
|
||||
|
||||
def test_html_comments_tag(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(
|
||||
|
|
@ -343,3 +352,12 @@ def test_style_tag(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
)
|
||||
|
||||
assert output["exit_code"] == 0
|
||||
|
||||
# check style includes
|
||||
output = reformat(
|
||||
tmp_file,
|
||||
runner,
|
||||
b"""<link href="{% static 'common/js/foo.min.js' %}" />""",
|
||||
)
|
||||
|
||||
assert output["exit_code"] == 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue