diff --git a/docs/src/docs/changelog.md b/docs/src/docs/changelog.md index a622bc5..bad6168 100644 --- a/docs/src/docs/changelog.md +++ b/docs/src/docs/changelog.md @@ -8,9 +8,14 @@ keywords: template linter, template formatter, djLint, HTML, templates, formatte # Changelog +## Next Release +::: content +- Bug fixes [#167](https://github.com/Riverside-Healthcare/djLint/issues/167), [#166](https://github.com/Riverside-Healthcare/djLint/issues/166) +::: + ## 0.7.1 ::: content -- Bug fixes +- Bug fixes [#166](https://github.com/Riverside-Healthcare/djLint/issues/166) ::: ## 0.7.0 diff --git a/docs/src/index.njk b/docs/src/index.njk index 2246d8b..cabcb43 100644 --- a/docs/src/index.njk +++ b/docs/src/index.njk @@ -13,7 +13,7 @@ date: Last Modified
Once upon a time all the other programming languages had a formatter and linter. Css, javascript, python, the c suite, typescript, ruby, php, go, swift, and you know the others. The cool kids on the block.
HTML templates were left out there on their own, in the cold, unformatted and unlinted :( The dirty corner in your repository. Something had to change.
-Welcome djLint, the free cleaning service for html templates!
|
- | \#}
+ # | \#}
|
| <(script|style).*?(?=(\(?:\3)>))
# html comment
- | .*?
+ | .*?(?=)
# 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*%\}
+ | {\#\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*%\})
# handlebars
- | {{!--\s*djlint\:off\s*--}}.*?{{!--\s*djlint\:on\s*--}}
+ | {{!--\s*djlint\:off\s*--}}.*?(?={{!--\s*djlint\:on\s*--}})
# golang
- | {{-?\s*/\*\s*djlint\:off\s*\*/\s*-?}}.*?{{-?\s*/\*\s*djlint\:on\s*\*/\s*-?}}
+ | {{-?\s*/\*\s*djlint\:off\s*\*/\s*-?}}.*?(?={{-?\s*/\*\s*djlint\:on\s*\*/\s*-?}})
|
| <\?php.*?\?>
- | {%[ ]*?blocktranslate\b((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
- | {%[ ]*?blocktrans\b((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktrans[ ]*?%}
- | {%[ ]*?comment\b[^(?:%})]*?%}.*?{%[ ]*?endcomment[ ]*?%}
+ | {%[ ]*?blocktranslate\b[^(?:%})]*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
+ | {%[ ]*?blocktrans\b[^(?:%})]*?%}.*?{%[ ]*?endblocktrans[ ]*?%}
+ | {%[ ]*?comment\b[^(?:%})]*?%}.*?(?={%[ ]*?endcomment[ ]*?%})
"""
self.ignored_inline_blocks: str = r"""
| {\*.*?\*}
- | {\#.*?\#}
+ | {\#(?!.*djlint:[ ]*?(?:off|on)\b).*\#}
| <\?php.*?\?>
| {%[ ]*?comment\b[^(?:%})]*?%}.*?{%[ ]*?endcomment[ ]*?%}
- | {%[ ]*?blocktranslate\b((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
- | {%[ ]*?blocktrans\b((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktrans[ ]*?%}
+ | {%[ ]*?blocktranslate\b[^(?:%})]*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
+ | {%[ ]*?blocktrans\b[^(?:%})]*?%}.*?{%[ ]*?endblocktrans[ ]*?%}
"""
self.optional_single_line_html_tags: str = r"""
diff --git a/tests/test_django.py b/tests/test_django.py
index b2f4a10..b372f93 100644
--- a/tests/test_django.py
+++ b/tests/test_django.py
@@ -80,6 +80,52 @@ def test_comment(runner: CliRunner, tmp_file: TextIO) -> None:
"""
)
+ output = reformat(
+ tmp_file,
+ runner,
+ b"""+ Lorem ipsum dolor + sit + amet +
+
+ + Lorem ipsum dolor sit amet +
+ {# djlint:on #} +
+