Issue 2551097
Created on 2020-10-29 14:46 by ced, last changed 2020-10-29 21:13 by rouilj.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | Remove |
roundup-fenced-code-blocks.patch | ced, 2020-10-29 14:46 |
Messages | |||
---|---|---|---|
msg7013 | Author: [hidden] (ced) | Date: 2020-10-29 14:46 | |
When rendering a markdown with code highlighted using markdown2, it crashes because the fenced-code-blocks option must be a dictionary instead of boolean: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/roundup/cgi/client.py", line 1876, in renderContext result = pt.render(self, None, None, **args) File "/usr/lib/python3.7/site-packages/roundup/cgi/engine_jinja2.py", line 93, in render s = self._tpl.render(c) File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render self.environment.handle_exception() File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/usr/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "/home/roundup/html/issue.item.html", line 2, in top-level template code {% set bots = ['reviewbot', 'roundup-bot'] %} File "/home/roundup/html/layout/page.html", line 21, in top-level template code {% block page_content %} File "/home/roundup/html/layout/page.html", line 61, in block "page_content" {% block content %} {% endblock %} File "/home/roundup/html/issue.item.html", line 117, in block "content" <div class="msg">{{ utils.codereview_replace(utils.mercurial_replace(msg.content.markdown()))|u|safe }}</div> File "/usr/lib/python3.7/site-packages/roundup/cgi/templating.py", line 1733, in markdown return u2s(markdown(s2u(s))) File "/usr/lib/python3.7/site-packages/roundup/cgi/templating.py", line 72, in <lambda> markdown = lambda s: Markdown(safe_mode='escape', extras={ 'fenced-code-blocks' : True, 'break-on-newline': True +}).convert(s) File "/usr/lib/python3.7/site-packages/markdown2.py", line 366, in convert text = self._do_fenced_code_blocks(text) File "/usr/lib/python3.7/site-packages/markdown2.py", line 1883, in _do_fenced_code_blocks return self._fenced_code_block_re.sub(self._fenced_code_block_sub, text) File "/usr/lib/python3.7/site-packages/markdown2.py", line 1879, in _fenced_code_block_sub return self._code_block_sub(match, is_fenced_code_block=True) File "/usr/lib/python3.7/site-packages/markdown2.py", line 1824, in _code_block_sub **formatter_opts) TypeError: _color_with_pygments() argument after ** must be a mapping, not bool Here is a patch that fix it. |
|||
msg7014 | Author: [hidden] (rouilj) | Date: 2020-10-29 21:13 | |
Oh, so the crash bug fixed in issue2551093 is actually a bug not a markdown2 misfeature we needed to trap. Fixed the issue2551093 test since was failing after the patch. Geesh that is horrible looking html compared to the other renderers. Generated new markdown test case to make sure we properly handle the case where markdown formatting raises an exception. rev 6279:9ec3a9bc4ea5 Thanks for the fix, it's been pushed to CI now. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-10-29 21:13:13 | rouilj | set | status: new -> fixed nosy: + rouilj messages: + msg7014 priority: normal assignee: rouilj resolution: fixed |
2020-10-29 14:46:39 | ced | create |