fix(curly hash comment): fix formatting on curly hash comment blocks

closes #265
This commit is contained in:
Christopher Pickering 2022-06-21 07:13:44 -05:00
parent 1526e87bf9
commit 4dc2140c41
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
3 changed files with 9 additions and 3 deletions

View file

@ -8,6 +8,12 @@
<h4 align="center">The missing formatter and linter for HTML templates.</h4>
<p align="center">
<a href="https://twitter.com/intent/tweet?text=djLint%20%7C%20The%20missing%20formatter%20and%20linter%20for%20HTML%20templates.&url=https://djlint.com/&hashtags=djlint,html-templates,django,jinja,developers"><img alt="tweet" src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" /></a>
<a href="https://discord.gg/taghAqebzU">
<img src="https://badgen.net/discord/online-members/taghAqebzU?icon=discord&label" alt="Discord Chat">
</a>
</p>
<p align="center">
<a href="https://codecov.io/gh/Riverside-Healthcare/djlint">
<img src="https://codecov.io/gh/Riverside-Healthcare/djlint/branch/master/graph/badge.svg?token=eNTG721BAA" alt="Codecov Status">
</a>
@ -20,9 +26,6 @@
<a href="https://pepy.tech/project/djlint">
<img src="https://pepy.tech/badge/djlint" alt="Downloads">
</a>
<a href="https://discord.gg/taghAqebzU">
<img src="https://img.shields.io/badge/chat-discord-green" alt="Discord Chat">
</a>
<a href="https://pypi.org/project/djlint/">
<img src="https://img.shields.io/pypi/v/djlint" alt="Pypi Download">
</a>

View file

@ -37,6 +37,7 @@ def indent_html(rawcode: str, config: Config) -> str:
ignored_level = 0
for item in rawcode_flat_list:
# if a raw tag first line
if not is_block_raw and is_ignored_block_opening(config, item):
is_raw_first_line = True

View file

@ -560,6 +560,8 @@ class Config:
# django/jinja/nunjucks
| {\#\s*djlint\:\s*off\s*\#}.*?(?={\#\s*djlint\:\s*on\s*\#})
| {%\s*comment\s*%\}\s*djlint\:off\s*\{%\s*endcomment\s*%\}.*?(?={%\s*comment\s*%\}\s*djlint\:on\s*\{%\s*endcomment\s*%\})
# inline jinja comments
| {\#(?!\s*djlint\:\s*(?:off|on)).*?\#}
# handlebars
| {{!--\s*djlint\:off\s*--}}.*?(?={{!--\s*djlint\:on\s*--}})
# golang