mirror of
https://github.com/Hopiu/djLint.git
synced 2026-04-28 17:04:45 +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):
|
if inside_ignored_block(config, html, match):
|
||||||
return match.group(1)
|
return match.group(1)
|
||||||
|
|
||||||
if not re.findall(
|
if not re.findall(
|
||||||
r"\<(?:"
|
r"\<(?:"
|
||||||
+ str(config.indent_html_tags)
|
+ str(config.indent_html_tags)
|
||||||
+ r")\b(?:[^>]|{%[^(?:%}]*?%}|{{[^(?:}}]*?}})*?"
|
+ r")\b(?:\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|{\#[^\#]*\#}|[^>{}])*?"
|
||||||
+ re.escape(match.group(1))
|
# original
|
||||||
+ "$",
|
# + r")\b(?:[^>]|{%[^(?:%}]*?%}|{{[^(?:}}]*?}})*?"
|
||||||
|
+ re.escape(match.group(1)) + "$",
|
||||||
html[: match.end()],
|
html[: match.end()],
|
||||||
re.MULTILINE | re.VERBOSE,
|
re.MULTILINE | re.VERBOSE,
|
||||||
):
|
):
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@
|
||||||
message: Tag seems to be an orphan.
|
message: Tag seems to be an orphan.
|
||||||
flags: re.I|re.DOTALL
|
flags: re.I|re.DOTALL
|
||||||
patterns:
|
patterns:
|
||||||
- <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|{#[^%]*#}|[^'\">{}])*)(?<!/)>
|
- <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|{#[^#]*#}|[^'\">{}])*)(?<!/)>
|
||||||
- rule:
|
- rule:
|
||||||
name: H026
|
name: H026
|
||||||
message: Empty id and class tags can be removed.
|
message: Empty id and class tags can be removed.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue