diff --git a/src/djlint/settings.py b/src/djlint/settings.py index d3eb7d5cf..8b8c46215 100644 --- a/src/djlint/settings.py +++ b/src/djlint/settings.py @@ -789,6 +789,8 @@ def __init__( | {{!--\s*djlint\:off\s*--}}(?:(?!{{!--\s*djlint\:on\s*--}}).)* # golang | {{-?\s*/\*\s*djlint\:off\s*\*/\s*-?}}(?:(?!{{-?\s*/\*\s*djlint\:on\s*\*/\s*-?}}).)* + # inline golang comments + | {{-?\s*/\*(?!\s*djlint\:\s*(?:off|on)).*?\*/\s*-?}} | | <\?php.*?\?> | {%[ ]*?blocktranslate\b(?:(?!%}|\btrimmed\b).)*?%}.*?{%[ ]*?endblocktranslate[ ]*?%} @@ -810,6 +812,8 @@ def __init__( | {{!--\s*djlint\:off\s*--}}.*?(?={{!--\s*djlint\:on\s*--}}) # golang | {{-?\s*/\*\s*djlint\:off\s*\*/\s*-?}}.*?(?={{-?\s*/\*\s*djlint\:on\s*\*/\s*-?}}) + # inline golang comments + | {{-?\s*/\*(?!\s*djlint\:\s*(?:off|on)).*?\*/\s*-?}} | | <\?php.*?\?> | {%[ ]*?blocktranslate\b(?:(?!%}|\btrimmed\b).)*?%}.*?{%[ ]*?endblocktranslate[ ]*?%} diff --git a/tests/test_linter/test_django_linter.py b/tests/test_linter/test_django_linter.py index 0edbedbd7..46a80d6bf 100644 --- a/tests/test_linter/test_django_linter.py +++ b/tests/test_linter/test_django_linter.py @@ -318,9 +318,12 @@ id="T027_trans", ), pytest.param( - ( - "{% macro rendersubmit(buttons=[], class=\"\", index='', url='', that=\"\" , test='') -%}" - ), + ('{% trans "Check box if you\'re interested in this location." %}'), + ([]), + id="T027_golang comment", + ), + pytest.param( + ("{{/* can't */}}"), ([]), id="T027_mixed_quotes", ),