mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-30 12:10:25 +00:00
fixed #144, added test
This commit is contained in:
parent
c295354ec5
commit
ec60646b36
3 changed files with 36 additions and 4 deletions
|
|
@ -1,6 +1,10 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
next release
|
||||
------------
|
||||
- Added support for django `blocktrans` tag
|
||||
|
||||
0.6.2
|
||||
-----
|
||||
- Bug fixes
|
||||
|
|
|
|||
|
|
@ -636,8 +636,9 @@ class Config:
|
|||
| {{-?\s*/\*\s*djlint\:off\s*\*/\s*-?}}.*?{{-?\s*/\*\s*djlint\:on\s*\*/\s*-?}}
|
||||
| <!--.*?-->
|
||||
| <\?php.*?\?>
|
||||
| {%[ ]*?blocktranslate[ ]+?((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
|
||||
| {%[ ]*?comment[ ]+?[^(?:%})]*?%}.*?{%[ ]*?endcomment[ ]*?%}
|
||||
| {%[ ]*?blocktranslate\b((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
|
||||
| {%[ ]*?blocktrans\b((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktrans[ ]*?%}
|
||||
| {%[ ]*?comment\b[^(?:%})]*?%}.*?{%[ ]*?endcomment[ ]*?%}
|
||||
"""
|
||||
|
||||
self.ignored_inline_blocks: str = r"""
|
||||
|
|
@ -645,8 +646,9 @@ class Config:
|
|||
| {\*.*?\*}
|
||||
| {\#.*?\#}
|
||||
| <\?php.*?\?>
|
||||
| {%[ ]*?comment[ ]+?[^(?:%})]*?%}.*?{%[ ]*?endcomment[ ]*?%}
|
||||
| {%[ ]*?blocktranslate[ ]+?((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
|
||||
| {%[ ]*?comment\b[^(?:%})]*?%}.*?{%[ ]*?endcomment[ ]*?%}
|
||||
| {%[ ]*?blocktranslate\b((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktranslate[ ]*?%}
|
||||
| {%[ ]*?blocktrans\b((?!%}|trimmed).)*?%}.*?{%[ ]*?endblocktrans[ ]*?%}
|
||||
"""
|
||||
|
||||
self.optional_single_line_html_tags: str = r"""
|
||||
|
|
|
|||
|
|
@ -254,6 +254,32 @@ def test_blocktranslate(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
"""
|
||||
)
|
||||
|
||||
output = reformat(
|
||||
tmp_file,
|
||||
runner,
|
||||
b"""{% blocktrans %}The width is: {{ width }}{% endblocktrans %}""",
|
||||
)
|
||||
assert output["exit_code"] == 0
|
||||
assert (
|
||||
output["text"]
|
||||
== r"""{% blocktrans %}The width is: {{ width }}{% endblocktrans %}
|
||||
"""
|
||||
)
|
||||
|
||||
output = reformat(
|
||||
tmp_file,
|
||||
runner,
|
||||
b"""{% blocktrans trimmed %}The width is: {{ width }}{% endblocktrans %}""",
|
||||
)
|
||||
assert output["exit_code"] == 1
|
||||
assert (
|
||||
output["text"]
|
||||
== r"""{% blocktrans trimmed %}
|
||||
The width is: {{ width }}
|
||||
{% endblocktrans %}
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def test_trans(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
output = reformat(
|
||||
|
|
|
|||
Loading…
Reference in a new issue