Reverted the Jinja2 related changes as per the discussion.

This commit is contained in:
(GalaxyMaster) 2023-07-11 10:54:38 +10:00
commit 7caf3528c5
2 changed files with 0 additions and 9 deletions

View file

@ -255,12 +255,6 @@ class TestUtils(LoggedTestCase):
'<span>marker</span>'),
'<!-- comment -->' + 'word ' * 20 + '<span>marker</span>')
# Words with HTML tags and a Jinja2 generated end marker (Markup)
self.assertEqual(
utils.truncate_html_words('<p>' + 'word ' * 100 + '</p>', 20,
Markup('<span>marker</span>')),
'<p>' + 'word ' * 20 + '<span>marker</span></p>')
# Words with hypens and apostrophes.
self.assertEqual(
utils.truncate_html_words("a-b " * 100, 20),

View file

@ -580,9 +580,6 @@ def truncate_html_words(s, num, end_text='…'):
return s
out = s[:truncator.truncate_at]
if end_text:
# check if the passed terminator was Jinja2 generated (i.e. Markup)
if isinstance(end_text, Markup):
end_text = end_text.unescape()
out += ' ' + end_text
# Close any tags still open
for tag in truncator.open_tags: