[issue2551097] fenced-code-blocks must be a dict

Cédric Krier <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
New submission from Cédric Krier:

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.

----------
components: Web interface
files: roundup-fenced-code-blocks.patch
keywords: patch
messages: 7013
nosy: ced
severity: normal
status: new
title: fenced-code-blocks must be a dict
type: crash
versions: 2.0.0

_________________________________________________
Roundup tracker <[email protected]>
<https://issues.roundup-tracker.org/issue2551097>
_________________________________________________


_______________________________________________
Roundup-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.