mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-21 05:43:22 -07:00
Bump mako from 1.2.4 to 1.3.2 (#2256)
* Bump mako from 1.2.4 to 1.3.2 Bumps [mako](https://github.com/sqlalchemy/mako) from 1.2.4 to 1.3.2. - [Release notes](https://github.com/sqlalchemy/mako/releases) - [Changelog](https://github.com/sqlalchemy/mako/blob/main/CHANGES) - [Commits](https://github.com/sqlalchemy/mako/commits) --- updated-dependencies: - dependency-name: mako dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update mako==1.3.2 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
52819f7da6
commit
4468c3e4af
29 changed files with 83 additions and 54 deletions
|
@ -1,5 +1,4 @@
|
|||
import functools
|
||||
import re
|
||||
import string
|
||||
import sys
|
||||
import typing as t
|
||||
|
@ -14,10 +13,7 @@ if t.TYPE_CHECKING:
|
|||
_P = te.ParamSpec("_P")
|
||||
|
||||
|
||||
__version__ = "2.1.3"
|
||||
|
||||
_strip_comments_re = re.compile(r"<!--.*?-->", re.DOTALL)
|
||||
_strip_tags_re = re.compile(r"<.*?>", re.DOTALL)
|
||||
__version__ = "2.1.5"
|
||||
|
||||
|
||||
def _simple_escaping_wrapper(func: "t.Callable[_P, str]") -> "t.Callable[_P, Markup]":
|
||||
|
@ -162,9 +158,41 @@ class Markup(str):
|
|||
>>> Markup("Main »\t<em>About</em>").striptags()
|
||||
'Main » About'
|
||||
"""
|
||||
# Use two regexes to avoid ambiguous matches.
|
||||
value = _strip_comments_re.sub("", self)
|
||||
value = _strip_tags_re.sub("", value)
|
||||
value = str(self)
|
||||
|
||||
# Look for comments then tags separately. Otherwise, a comment that
|
||||
# contains a tag would end early, leaving some of the comment behind.
|
||||
|
||||
while True:
|
||||
# keep finding comment start marks
|
||||
start = value.find("<!--")
|
||||
|
||||
if start == -1:
|
||||
break
|
||||
|
||||
# find a comment end mark beyond the start, otherwise stop
|
||||
end = value.find("-->", start)
|
||||
|
||||
if end == -1:
|
||||
break
|
||||
|
||||
value = f"{value[:start]}{value[end + 3:]}"
|
||||
|
||||
# remove tags using the same method
|
||||
while True:
|
||||
start = value.find("<")
|
||||
|
||||
if start == -1:
|
||||
break
|
||||
|
||||
end = value.find(">", start)
|
||||
|
||||
if end == -1:
|
||||
break
|
||||
|
||||
value = f"{value[:start]}{value[end + 1:]}"
|
||||
|
||||
# collapse spaces
|
||||
value = " ".join(value.split())
|
||||
return self.__class__(value).unescape()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue