Loading doc/news.rst +3 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,9 @@ News / Changelog - Fixes the rendering of patches in markdown rendering mode. (Fixes #393) - Replace use of ``pytz`` with ``zoneinfo``. (See !462) - An attachment with content ``None`` is properly handled. (Closes #496) - Fix a bug which caused error in plaintext renderer when the email was quoted more than default no of. max_nested_levels in mistune. (Fixes #494) .. _news-1.3.8: Loading hyperkitty/lib/renderer.py +2 −2 Original line number Diff line number Diff line Loading @@ -185,8 +185,8 @@ def plugin_disable_markdown(md): markdown rendering. """ md.block.rules = ['block_quote'] md.block.block_quote_rules = ['block_quote'] md.block.list_rules = ['block_quote'] md.block.block_quote_rules = ['block_quote', 'blank_line'] md.block.list_rules = [] md.inline.rules = ['inline_html', 'auto_link'] Loading hyperkitty/templatetags/decorate.py +11 −3 Original line number Diff line number Diff line from contextlib import suppress from django import template from django.utils.safestring import mark_safe Loading Loading @@ -25,12 +27,18 @@ def render(email, mlist): """ try: content = email.content display_fixed = email.display_fixed except AttributeError: content = email.get('content', '') display_fixed = email.get('display_fixed', False) if ( mlist.archive_rendering_mode == ArchiveRenderingMode.markdown.name and not email.display_fixed not display_fixed ): with suppress(TypeError): return mark_safe(markdown_renderer(content)) try: return mark_safe(text_renderer(content)) except (KeyError, ValueError): return mark_safe('<pre>' + content + '</pre>') hyperkitty/tests/test_templatetags.py +12 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,13 @@ class TestDecoratePlain(TestCase): result = text_renderer(contents) self.assertEqual(result.strip(), EXPECTED_TEST_EMAIL_PATCH_QUOTED) def test_plaintext_patch_gl_494(self): self.maxDiff = None contents = TEST_EMAIL_ISSUE_GL_494 result = text_renderer(contents) self.assertEqual( result.strip(), TEST_EMAIL_TEXT_RENDER_RESULT.strip()) class SettingsValuesTest(TestCase): Loading Loading @@ -387,3 +394,8 @@ ion_req; function to return void?</p> <div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><p>}</p> </blockquote><p>Best</p>""" # noqa: E501 TEST_EMAIL_ISSUE_GL_494 = """>> >>> >In the example""" TEST_EMAIL_TEXT_RENDER_RESULT = """<div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><p>In the example</p> </blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>""" # noqa: E501 Loading
doc/news.rst +3 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,9 @@ News / Changelog - Fixes the rendering of patches in markdown rendering mode. (Fixes #393) - Replace use of ``pytz`` with ``zoneinfo``. (See !462) - An attachment with content ``None`` is properly handled. (Closes #496) - Fix a bug which caused error in plaintext renderer when the email was quoted more than default no of. max_nested_levels in mistune. (Fixes #494) .. _news-1.3.8: Loading
hyperkitty/lib/renderer.py +2 −2 Original line number Diff line number Diff line Loading @@ -185,8 +185,8 @@ def plugin_disable_markdown(md): markdown rendering. """ md.block.rules = ['block_quote'] md.block.block_quote_rules = ['block_quote'] md.block.list_rules = ['block_quote'] md.block.block_quote_rules = ['block_quote', 'blank_line'] md.block.list_rules = [] md.inline.rules = ['inline_html', 'auto_link'] Loading
hyperkitty/templatetags/decorate.py +11 −3 Original line number Diff line number Diff line from contextlib import suppress from django import template from django.utils.safestring import mark_safe Loading Loading @@ -25,12 +27,18 @@ def render(email, mlist): """ try: content = email.content display_fixed = email.display_fixed except AttributeError: content = email.get('content', '') display_fixed = email.get('display_fixed', False) if ( mlist.archive_rendering_mode == ArchiveRenderingMode.markdown.name and not email.display_fixed not display_fixed ): with suppress(TypeError): return mark_safe(markdown_renderer(content)) try: return mark_safe(text_renderer(content)) except (KeyError, ValueError): return mark_safe('<pre>' + content + '</pre>')
hyperkitty/tests/test_templatetags.py +12 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,13 @@ class TestDecoratePlain(TestCase): result = text_renderer(contents) self.assertEqual(result.strip(), EXPECTED_TEST_EMAIL_PATCH_QUOTED) def test_plaintext_patch_gl_494(self): self.maxDiff = None contents = TEST_EMAIL_ISSUE_GL_494 result = text_renderer(contents) self.assertEqual( result.strip(), TEST_EMAIL_TEXT_RENDER_RESULT.strip()) class SettingsValuesTest(TestCase): Loading Loading @@ -387,3 +394,8 @@ ion_req; function to return void?</p> <div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><p>}</p> </blockquote><p>Best</p>""" # noqa: E501 TEST_EMAIL_ISSUE_GL_494 = """>> >>> >In the example""" TEST_EMAIL_TEXT_RENDER_RESULT = """<div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><div class="quoted-switch"><a href="#">...</a></div><blockquote class="blockquote quoted-text"><p>In the example</p> </blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>""" # noqa: E501