diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml
index e240884..884d8d7 100644
--- a/src/djlint/rules.yaml
+++ b/src/djlint/rules.yaml
@@ -7,19 +7,20 @@
- golang
patterns:
# open
- - '{{[^\s#/@^]+'
- - '{%-[^\s]+'
- - '{%[^\s|\-]+'
+ - '{{[^\s#/@^\-\+]+'
+ - '{%[\-\+][^\s]+'
+ - '{%[^\s|\-|\+]+'
# handlebars
- '[^{]{#[^\s-]+|^{#[^\s-]+'
- '[^{]{#-[^\s]+|^{#-[^\s]+'
- '[^{]{\/[^\s]+|^{\/[^\s]+'
- '[^{]{\@[^\s]+|^{\@[^\s]+'
# close
- - '[^(\s|^|\-)]+[}|%|#]}'
+ - '[^(\s|^|\-|\+)]+[}|%|#]}'
- '[^(\s|^)]+\-[}|%|#]}'
- - '[^\s][ ]{2,}[}|%|#]}'
- - '{[{|%|#]-?[ ]{2,}'
+ - '[^(\s|^)]+\+[}|%|#]}'
+ - '[^\s\-\+][ ]{2,}[}|%|#]}'
+ - '{[{|%|#]\-?\+?[ ]{2,}'
- rule:
name: T002
message: Double quotes should be used in tags.
diff --git a/tests/test_linter/test_linter.py b/tests/test_linter/test_linter.py
index 9e53cb3..c2872a9 100644
--- a/tests/test_linter/test_linter.py
+++ b/tests/test_linter/test_linter.py
@@ -55,13 +55,18 @@ def test_T001(runner: CliRunner, tmp_file: TextIO) -> None:
tmp_file.name,
b"""
{%
- ("SashaNose", "1"),
+ ("something", "1"),
%}
""",
)
result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"])
assert "T001" not in result.output
+ # allow jinja spaceless tags
+ write_to_file(tmp_file.name, b"{{- foo }}{{+ bar }}{{ biz -}}{{ baz +}}")
+ result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"])
+ assert "T001" not in result.output
+
def test_T002(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(tmp_file.name, b"{% extends 'this' %}")
@@ -114,7 +119,7 @@ def test_H006(runner: CliRunner, tmp_file: TextIO) -> None:
b"""{# [INFO][JINJA] I use syntax "{% if
+
""",
)
result = runner.invoke(djlint, [tmp_file.name])
@@ -136,7 +141,7 @@ def test_H008(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(
tmp_file.name,
- b"""""",
+ b"""""",
)
result = runner.invoke(djlint, [tmp_file.name])
assert result.exit_code == 1
@@ -144,7 +149,7 @@ def test_H008(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(
tmp_file.name,
- b"""""",
+ b"""""",
)
result = runner.invoke(djlint, [tmp_file.name])
assert "H008 1:" not in result.output
@@ -777,15 +782,15 @@ def test_T032(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(
tmp_file.name,
b"""{# [INFO] Simple example #}
- {% set kira = [
- 'Goddess', 'Genius'
+ {% set stuff = [
+ 'value', 'value'
] %}
{# [INFO] Real example #}
- {% set kira_online_scaners = [
- ('https://quttera.com/sitescan/', 'SashaButtonLightSkyBlue', 'Quttera'),
- ('https://sitecheck.sucuri.net/results/', 'SashaButtonLimeGreen', 'Sucuri'),
- ('https://www.isithacked.com/check/', 'SashaButtonPlum', 'Is It Hacked?'),
+ {% set online_scaners = [
+ ('https://example.com', 'blue', 'One'),
+ ('https://example.com', 'green', 'Two'),
+ ('https://example.com', 'plum', 'Three'),
] %}
""",
)
@@ -905,7 +910,7 @@ def test_ignoring_rules(runner: CliRunner, tmp_file: TextIO) -> None:
\t\t{# djlint:off H006 #}
-\t\t
+\t\t
\t\t{# djlint:on #}