mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-17 05:50:24 +00:00
fix(formatter): fixed runaway regex on templates with many template attriutes inside html tags
closes #340
This commit is contained in:
parent
90cf5764ac
commit
79cd013f8d
2 changed files with 5 additions and 5 deletions
|
|
@ -61,13 +61,13 @@ def expand_html(html: str, config: Config) -> str:
|
|||
|
||||
if inside_ignored_block(config, html, match):
|
||||
return match.group(1)
|
||||
|
||||
if not re.findall(
|
||||
r"\<(?:"
|
||||
+ str(config.indent_html_tags)
|
||||
+ r")\b(?:[^>]|{%[^(?:%}]*?%}|{{[^(?:}}]*?}})*?"
|
||||
+ re.escape(match.group(1))
|
||||
+ "$",
|
||||
+ r")\b(?:\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|{\#[^\#]*\#}|[^>{}])*?"
|
||||
# original
|
||||
# + r")\b(?:[^>]|{%[^(?:%}]*?%}|{{[^(?:}}]*?}})*?"
|
||||
+ re.escape(match.group(1)) + "$",
|
||||
html[: match.end()],
|
||||
re.MULTILINE | re.VERBOSE,
|
||||
):
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@
|
|||
message: Tag seems to be an orphan.
|
||||
flags: re.I|re.DOTALL
|
||||
patterns:
|
||||
- <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|{#[^%]*#}|[^'\">{}])*)(?<!/)>
|
||||
- <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|{#[^#]*#}|[^'\">{}])*)(?<!/)>
|
||||
- rule:
|
||||
name: H026
|
||||
message: Empty id and class tags can be removed.
|
||||
|
|
|
|||
Loading…
Reference in a new issue