Added figcaption, details and summary to the list of tags to indent

This commit is contained in:
Matthias Kestenholz 2021-09-21 11:55:54 +02:00
parent 678e50088c
commit f2707ba2bf
2 changed files with 42 additions and 0 deletions

View file

@ -184,6 +184,7 @@ class Config:
| aside
| footer
| figure
| figcaption
| video
| span
| p
@ -196,6 +197,8 @@ class Config:
| script
| style
| source
| details
| summary
)
)
"""
@ -241,6 +244,7 @@ class Config:
| aside
| footer
| figure
| figcaption
| video
| span
| p
@ -253,6 +257,8 @@ class Config:
| script
| style
| source
| details
| summary
)
)
"""

View file

@ -139,6 +139,42 @@ def test_dt_tag(runner: CliRunner, tmp_file: TextIO) -> None:
)
def test_details_summary_tags(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(
tmp_file.name,
b"""<details><summary>summary</summary>body</details>""",
)
runner.invoke(djlint, [tmp_file.name, "--reformat"])
assert (
Path(tmp_file.name).read_text()
== """<details>
<summary>
summary
</summary>
body
</details>
"""
)
def test_figure_figcaption_tags(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(
tmp_file.name,
b"""<figure><img src="" alt=""><figcaption>caption</figcaption></figure>""",
)
runner.invoke(djlint, [tmp_file.name, "--reformat"])
assert (
Path(tmp_file.name).read_text()
== """<figure>
<img src="" alt="">
<figcaption>
caption
</figcaption>
</figure>
"""
)
def test_ignored_attributes(runner: CliRunner, tmp_file: TextIO) -> None:
output = reformat(
tmp_file,