diff --git a/src/djlint/formatter/indent.py b/src/djlint/formatter/indent.py
index de813d8..df2eaee 100644
--- a/src/djlint/formatter/indent.py
+++ b/src/djlint/formatter/indent.py
@@ -62,34 +62,24 @@ def indent_html(rawcode: str, config: Config) -> str:
# if a one-line, inline tag, just process it, only if line starts w/ it
elif (
- re.findall(
- rf"(^<({slt_html})>)(.*?)((\2)>[^<]*?$)",
- item,
- re.IGNORECASE | re.VERBOSE | re.MULTILINE,
- )
- or re.findall(
- re.compile(
- rf"(<({slt_html})\b.+?>)(.*?)((\2)>[^<]*?$)",
+ (
+ re.findall(
+ rf"""^ # start of a line
+ (?:
+ (?:<({slt_html})>)(?:.*?)(?:(?:\1)>[ \t]*?) # stuff >>>> match 1
+ |(?:<({slt_html})\b[^>]+?>)(?:.*?)(?:(?:\2)>[ \t]*?) # stuff >>> match 2
+ |(?:<(?:{always_self_closing_html})\b[^>]*?/?>[ \t]*?) #
+ |(?:<(?:{slt_html})\b[^>]*?/>[ \t]*?) #
+ |(?:{{%[ ]*?({slt_template})[ ]+?.*?%}})(?:.*?)(?:{{%[ ]+?end(\3)[ ]+?.*?%}}[ \t]*?) # >>> match 3
+ )
+ +?[^<]*?$ # with no other tags following until end of line
+ """,
+ item,
re.IGNORECASE | re.VERBOSE | re.MULTILINE,
- ),
- item,
+ )
)
- or re.findall(
- rf"^({{%[ ]*?({slt_template})[ ]+?.*?%}})(.*?)({{%[ ]+?end(\2)[ ]+?.*?%}})",
- item,
- re.IGNORECASE | re.MULTILINE | re.VERBOSE,
- )
- or re.findall(
- rf"(<({slt_html})\b.*?/>)", item, flags=re.IGNORECASE | re.VERBOSE
- )
- or re.findall(
- re.compile(
- rf"(<({always_self_closing_html})\b.*?/?>)",
- re.IGNORECASE | re.VERBOSE,
- ),
- item,
- )
- ) and is_block_raw is False:
+ and is_block_raw is False
+ ):
tmp = (indent * indent_level) + item + "\n"
# if unindent, move left
@@ -108,7 +98,7 @@ def indent_html(rawcode: str, config: Config) -> str:
re.IGNORECASE | re.VERBOSE | re.MULTILINE,
)
and not re.findall(
- rf"(<({slt_html})\\b.+?>)(.*?)((\2)>[^<]*?$)",
+ rf"(<({slt_html})\\b[^>]+?>)(.*?)((\2)>[^<]*?$)",
item,
re.IGNORECASE | re.VERBOSE | re.MULTILINE,
)
@@ -123,7 +113,7 @@ def indent_html(rawcode: str, config: Config) -> str:
)
or re.findall(
re.compile(
- rf"(^<({slt_html})\b.+?>)(.*?)((\2)>)",
+ rf"(^<({slt_html})\b[^>]+?>)(.*?)((\2)>)",
re.IGNORECASE | re.VERBOSE | re.MULTILINE,
),
item,
@@ -157,6 +147,17 @@ def indent_html(rawcode: str, config: Config) -> str:
),
item,
)
+ # # and not ending in a slt like .
+ # and not re.findall(
+ # rf"(<({slt_html})>)(.*?)((\2)>[^<]*?$)",
+ # item,
+ # re.IGNORECASE | re.VERBOSE | re.MULTILINE,
+ # )
+ # and not re.findall(
+ # rf"(<({slt_html})\\b.+?>)(.*?)((\2)>[^<]*?$)",
+ # item,
+ # re.IGNORECASE | re.VERBOSE | re.MULTILINE,
+ # )
and is_block_raw is False
):
tmp = (indent * indent_level) + item + "\n"
diff --git a/tests/test_config/test_preserve_blank_lines/test_config.py b/tests/test_config/test_preserve_blank_lines/test_config.py
index 4f50c0d..4906ade 100644
--- a/tests/test_config/test_preserve_blank_lines/test_config.py
+++ b/tests/test_config/test_preserve_blank_lines/test_config.py
@@ -25,7 +25,7 @@ def test_config(runner: CliRunner) -> None:
"--preserve-blank-lines",
],
)
-
+ print(result.output)
assert result.exit_code == 0
diff --git a/tests/test_html/test_tag_span.py b/tests/test_html/test_tag_span.py
index fd98117..3fef8fb 100644
--- a/tests/test_html/test_tag_span.py
+++ b/tests/test_html/test_tag_span.py
@@ -63,5 +63,26 @@ def test_nested_string(runner: CliRunner, tmp_file: TextIO) -> None: