diff --git a/src/djlint/settings.py b/src/djlint/settings.py index 48dc9285..51888890 100644 --- a/src/djlint/settings.py +++ b/src/djlint/settings.py @@ -759,7 +759,7 @@ def __init__( """ ) self.template_blocks: str = r""" - {%((?!%}).)+%} + {%((?!%}).)+%}|{{((?!}}).)+}} """ self.ignored_linter_blocks: str = r""" diff --git a/tests/test_django/test_html_tags_in_template_tag.py b/tests/test_django/test_html_tags_in_template_tag.py new file mode 100644 index 00000000..3ccb437f --- /dev/null +++ b/tests/test_django/test_html_tags_in_template_tag.py @@ -0,0 +1,24 @@ +"""Test html inside template tags for tag. + +poetry run pytest tests/test_django/test_html_tags_in_template_tag.py +""" +import pytest + +from src.djlint.reformat import formatter +from tests.conftest import printer + +test_data = [ + pytest.param( + ("{{ some_val | default:'some_comment1
some_comment2' }}"), + ("{{ some_val | default:'some_comment1
some_comment2' }}\n"), + id="test", + ), +] + + +@pytest.mark.parametrize(("source", "expected"), test_data) +def test_base(source, expected, django_config): + output = formatter(django_config, source) + + printer(expected, source, output) + assert expected == output