Page MenuHomePhabricator

enclose="none" clashes with the Wiki markup for lists
Closed, ResolvedPublic

Description

Author: dpld

Description:
Lines starting with #, * or : disrupt GeSHi blocks if the enclose="none" option is deployed. An illustration of the bug can be seen at

http://en.wikibooks.org/wiki/User:Duplode/Offending_GeSHi_block

There, the first two lines inside the GeSHi block are Matlab comments, which start with #. Before the second line, however, the formatting and syntax highlight are disabled, and a numbered list item is displayed at the comment line. Inspection of the page source reveals the enclosing <span class="mw-geshi matlab source-matlab"> is prematurely closed before the second line. The problem only happens when enclose="none" is used.


URL: https://en.wikibooks.org/w/index.php?title=Wikibooks:Sandbox&oldid=2684029
See Also:
T14974: The newline added to a template, magic word, variable, or parser function that returns line-start wikicode formatting (*#:; {|) causes unexpected parsing

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 10:59 PM
bzimport added a project: SyntaxHighlight.
bzimport set Reference to bz23674.
bzimport added a subscriber: Unknown Object (MLST).
He7d3r added a comment.EditedJul 23 2014, 4:35 PM

I added a simpler test case to
https://en.wikibooks.org/w/index.php?title=Wikibooks:Sandbox&oldid=2684029

In that page the

<syntaxhighlight lang="matlab" enclose="none">
# foo
# bar
# baz
</syntaxhighlight>

is parsed to

<p><span class="mw-geshi matlab source-matlab"># foo<br></span></p>
<ol>
<li><span class="mw-geshi matlab source-matlab"><span class="kw2">bar</span><br></span></li>
<li>baz</li>
</ol>

and I suspect the brokenness of the first item ("# foo") is related to T14974. Someone with a better understanding of the Parser should check if this bug is a duplicate of that one.

Krinkle updated the task description. (Show Details)Jan 5 2015, 12:24 PM
Krinkle set Security to None.
Krinkle removed a subscriber: Unknown Object (MLST).
TheDJ added a subscriber: TheDJ.Jun 25 2015, 10:45 PM

Still a problem with Pygments

Change 221740 had a related patch set uploaded (by Bartosz Dziewoński):
Use 'nowiki' strip marker for <syntaxhighlight/> output

https://gerrit.wikimedia.org/r/221740

Change 221740 abandoned by Bartosz Dziewoński:
Use 'nowiki' strip marker for <syntaxhighlight/> output

Reason:
This is a very clever idea but probably not something we want to maintain. T104067 should be fixable using a variant of this solution described by Brad on the changeset. I'll implement it and submit as a new patch.

https://gerrit.wikimedia.org/r/221740

Change 221980 had a related patch set uploaded (by Bartosz Dziewoński):
Refactor final output formatting

https://gerrit.wikimedia.org/r/221980

Change 221980 merged by jenkins-bot:
Refactor final output formatting

https://gerrit.wikimedia.org/r/221980

matmarex added a subscriber: matmarex.

Since enclose="none" now results in the output being wrapped in <code/> tags this will probably no longer look as intended originally, but the bug as filed is fixed.

matmarex claimed this task.Jul 6 2015, 4:44 PM
matmarex removed a project: Patch-For-Review.