chromium/chromium-99.0.4844.84-markdownsafe-soft_str.patch
2022-03-28 11:28:42 -04:00

139 lines
4.6 KiB
Diff

diff -up chromium-99.0.4844.84/third_party/jinja2/filters.py.soft_str chromium-99.0.4844.84/third_party/jinja2/filters.py
--- chromium-99.0.4844.84/third_party/jinja2/filters.py.soft_str 2022-03-28 10:33:14.979405438 -0400
+++ chromium-99.0.4844.84/third_party/jinja2/filters.py 2022-03-28 10:33:45.934597164 -0400
@@ -10,7 +10,7 @@ from itertools import groupby
from markupsafe import escape
from markupsafe import Markup
-from markupsafe import soft_unicode
+from markupsafe import soft_str
from ._compat import abc
from ._compat import imap
@@ -191,18 +191,18 @@ def do_replace(eval_ctx, s, old, new, co
):
s = escape(s)
else:
- s = soft_unicode(s)
- return s.replace(soft_unicode(old), soft_unicode(new), count)
+ s = soft_str(s)
+ return s.replace(soft_str(old), soft_str(new), count)
def do_upper(s):
"""Convert a value to uppercase."""
- return soft_unicode(s).upper()
+ return soft_str(s).upper()
def do_lower(s):
"""Convert a value to lowercase."""
- return soft_unicode(s).lower()
+ return soft_str(s).lower()
@evalcontextfilter
@@ -245,7 +245,7 @@ def do_capitalize(s):
"""Capitalize a value. The first character will be uppercase, all others
lowercase.
"""
- return soft_unicode(s).capitalize()
+ return soft_str(s).capitalize()
def do_title(s):
@@ -255,7 +255,7 @@ def do_title(s):
return "".join(
[
item[0].upper() + item[1:].lower()
- for item in _word_beginning_split_re.split(soft_unicode(s))
+ for item in _word_beginning_split_re.split(soft_str(s))
if item
]
)
@@ -495,7 +495,7 @@ def do_join(eval_ctx, value, d=u"", attr
return d.join(value)
# no html involved, to normal joining
- return soft_unicode(d).join(imap(soft_unicode, value))
+ return soft_str(d).join(imap(soft_str, value))
def do_center(value, width=80):
@@ -761,7 +761,7 @@ def do_wordwrap(
def do_wordcount(s):
"""Count the words in that string."""
- return len(_word_re.findall(soft_unicode(s)))
+ return len(_word_re.findall(soft_str(s)))
def do_int(value, default=0, base=10):
@@ -820,12 +820,12 @@ def do_format(value, *args, **kwargs):
raise FilterArgumentError(
"can't handle positional and keyword arguments at the same time"
)
- return soft_unicode(value) % (kwargs or args)
+ return soft_str(value) % (kwargs or args)
def do_trim(value, chars=None):
"""Strip leading and trailing characters, by default whitespace."""
- return soft_unicode(value).strip(chars)
+ return soft_str(value).strip(chars)
def do_striptags(value):
@@ -1365,7 +1365,7 @@ FILTERS = {
"selectattr": do_selectattr,
"slice": do_slice,
"sort": do_sort,
- "string": soft_unicode,
+ "string": soft_str,
"striptags": do_striptags,
"sum": do_sum,
"title": do_title,
diff -up chromium-99.0.4844.84/third_party/jinja2/runtime.py.soft_str chromium-99.0.4844.84/third_party/jinja2/runtime.py
--- chromium-99.0.4844.84/third_party/jinja2/runtime.py.soft_str 2022-03-28 10:36:17.301534689 -0400
+++ chromium-99.0.4844.84/third_party/jinja2/runtime.py 2022-03-28 10:36:33.053632253 -0400
@@ -6,7 +6,7 @@ from types import MethodType
from markupsafe import escape # noqa: F401
from markupsafe import Markup
-from markupsafe import soft_unicode
+from markupsafe import soft_str
from ._compat import abc
from ._compat import imap
@@ -62,7 +62,7 @@ def identity(x):
def markup_join(seq):
"""Concatenation that escapes if necessary and converts to unicode."""
buf = []
- iterator = imap(soft_unicode, seq)
+ iterator = imap(soft_str, seq)
for arg in iterator:
buf.append(arg)
if hasattr(arg, "__html__"):
diff -up chromium-99.0.4844.84/third_party/jinja2/utils.py.soft_str chromium-99.0.4844.84/third_party/jinja2/utils.py
--- chromium-99.0.4844.84/third_party/jinja2/utils.py.soft_str 2022-03-28 10:34:29.063864294 -0400
+++ chromium-99.0.4844.84/third_party/jinja2/utils.py 2022-03-28 10:35:31.555251349 -0400
@@ -725,13 +725,13 @@ except SyntaxError:
have_async_gen = False
-def soft_unicode(s):
- from markupsafe import soft_unicode
+def soft_str(s):
+ from markupsafe import soft_str
warnings.warn(
- "'jinja2.utils.soft_unicode' will be removed in version 3.0."
- " Use 'markupsafe.soft_unicode' instead.",
+ "'jinja2.utils.soft_str' will be removed in version 3.0."
+ " Use 'markupsafe.soft_str' instead.",
DeprecationWarning,
stacklevel=2,
)
- return soft_unicode(s)
+ return soft_str(s)