From d31ce52b3b7952d9f7f6c8fc947c81967698fcf8 Mon Sep 17 00:00:00 2001
From: Christopher Pickering
+ |(?:<(?:{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: