mirror of
https://github.com/Hopiu/djLint.git
synced 2026-04-14 10:31:01 +00:00
Merge pull request #32 from matthiask/mk/no-source-indent
Do not indent the <source> element, it does not permit content
This commit is contained in:
commit
6fc9cf45d7
2 changed files with 19 additions and 2 deletions
|
|
@ -227,7 +227,6 @@ class Config:
|
|||
| path
|
||||
| script
|
||||
| style
|
||||
| source
|
||||
| details
|
||||
| summary
|
||||
)
|
||||
|
|
@ -287,7 +286,6 @@ class Config:
|
|||
| path
|
||||
| script
|
||||
| style
|
||||
| source
|
||||
| details
|
||||
| summary
|
||||
)
|
||||
|
|
@ -445,6 +443,7 @@ class Config:
|
|||
link
|
||||
| img
|
||||
| meta
|
||||
| source
|
||||
"""
|
||||
|
||||
self.single_line_template_tags: str = r"""
|
||||
|
|
|
|||
|
|
@ -199,3 +199,21 @@ def test_ignored_attributes(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
json-data='{"menu":{"header":"SVG Viewer","items":[{"id":"Open"}]}}'></div>
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def test_picture_source_img_tags(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(
|
||||
tmp_file.name,
|
||||
b"""\
|
||||
<picture><source media="(max-width:640px)"
|
||||
srcset="image.jpg"><img src="image.jpg" alt="image"></picture>""",
|
||||
)
|
||||
runner.invoke(djlint, [tmp_file.name, "--reformat"])
|
||||
assert (
|
||||
Path(tmp_file.name).read_text()
|
||||
== """<picture>
|
||||
<source media="(max-width:640px)" srcset="image.jpg">
|
||||
<img src="image.jpg" alt="image">
|
||||
</picture>
|
||||
"""
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue