mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-19 02:21:06 +00:00
fixed dj comment formatting and added test
This commit is contained in:
parent
41a3346c14
commit
4d5e3b184d
2 changed files with 13 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ ignored_block_closing = [r"</style" r"\*}", r"\?>", r"</script"]
|
|||
# contents of tags will not be formated and tags will not be formatted
|
||||
ignored_group_opening = [r"<!--", r"[^\{]{#", r"<pre", r"<textarea"]
|
||||
|
||||
ignored_group_closing = [r"-->", r"#}[^\}]", r"</pre", r"</textarea"]
|
||||
ignored_group_closing = [r"-->", r"#}", r"</pre", r"</textarea"]
|
||||
|
||||
|
||||
# the contents of these tag blocks will be indented, then unindented
|
||||
|
|
|
|||
|
|
@ -355,3 +355,15 @@ comment-->
|
|||
</div>
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def test_dj_comments_tag(runner, tmp_file):
|
||||
write_to_file(
|
||||
tmp_file.name,
|
||||
b"""{# comment #}\n{% if this %}<div></div>{% endif %}""",
|
||||
)
|
||||
runner.invoke(djlint, [tmp_file.name, "--reformat"])
|
||||
assert (
|
||||
open(tmp_file.name).read()
|
||||
== """{# comment #}\n{% if this %}<div></div>{% endif %}\n"""
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue