From 4dc2140c41b4beac7da969783b0714620a05e06e Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Tue, 21 Jun 2022 07:13:44 -0500 Subject: [PATCH] fix(curly hash comment): fix formatting on curly hash comment blocks closes #265 --- README.md | 9 ++++++--- src/djlint/formatter/indent.py | 1 + src/djlint/settings.py | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 33e0acd..1c1947f 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,12 @@

The missing formatter and linter for HTML templates.

+ tweet + + Discord Chat + +

+

Codecov Status @@ -20,9 +26,6 @@ Downloads - - Discord Chat - Pypi Download diff --git a/src/djlint/formatter/indent.py b/src/djlint/formatter/indent.py index 3d27f1d..3c08d23 100644 --- a/src/djlint/formatter/indent.py +++ b/src/djlint/formatter/indent.py @@ -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 diff --git a/src/djlint/settings.py b/src/djlint/settings.py index 9438946..91470fa 100644 --- a/src/djlint/settings.py +++ b/src/djlint/settings.py @@ -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