inyokaproject / inyoka

All-in-one portal software
http://inyokaproject.org
Other
14 stars 4 forks source link

PygmentParser (#!code) ignores first line of code block if first character is '=' #582

Open mrkramps opened 8 years ago

mrkramps commented 8 years ago

Check issue at https://wiki.ubuntuusers.de/Wiki/Sandkasten

{{{#!code LEXER
=
}}}

Renders empty code block.

{{{#!code LEXER
=
=
}}}

Renders code block with one line and second = only.

If no LEXER is set parser recognises = as first character in first line. Simple code block ({{{=}}}) is also working properly. Issue cross-checked in wiki, forum and Ikhaya comments.

MarkusH commented 6 years ago

Report upstream?

sebix commented 6 years ago

Pygments 2.2.0 does it correctly:

>>> from pygments import highlight
>>> from pygments.lexers import PythonLexer
>>> from pygments.formatters import HtmlFormatter
>>> code = '='
>>> highlight(code, PythonLexer(), HtmlFormatter())
'<div class="highlight"><pre><span></span><span class="o">=</span>\n</pre></div>\n'
sebix commented 6 years ago

parse_pre_block in inyoka/markup/__init__.py already gets the wrong data (without =) so the bug could be in the Lexer?