Page MenuHomePhabricator

Add parser test for multiline <pre> or <syntaxhighlight> elements inside a dd element created by ":"
Open, MediumPublic

Description

Please, add some parser tests to ensure that Parsoid interprets the wiki markup

;A
:B<syntaxhighlight lang="CSS">
.test {
    color: red;
}
</syntaxhighlight>

as having 'an element <dd> which contains "B" and the highlighted code', instead of what the current parser does:
https://www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=1075316&action=edit&preview=yes

Here is a comparison of the wiki markup and HTML markup with the current parser:
https://www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=1075311

And here is the same kind of problem with <pre> tags instead of <syntaxhighlight>:
https://www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=1075317&action=edit&preview=yes
The current parser converts the code

;A
:B<pre>first line
second line</pre>

to

<dl>
<dt>A</dt>
<dd>B
<pre>first line
</pre></dd>
</dl>
<p>second line</p>

but it should be converted to

<dl>
<dt>A</dt>
<dd>B
<pre>first line
second line
</pre></dd>
</dl>

as Parsoid does:
http://parsoid-lb.eqiad.wikimedia.org/mediawikiwiki/Project:Sandbox?oldid=1075317

Details

Reference
bz68466

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:27 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz68466.
He7d3r created this task.Jul 23 2014, 7:24 PM

The second test can be added right away -- there are a number of dl/dd list tests in a section. Your test can be added there. Would you like to submit a patch to parserTests.txt in the parsoid repo? If not, one of us will pick it up in the coming days.

ssastry moved this task from Maintenance / Tech-Debt to Needs Triage on the Parsoid board.
ssastry moved this task from Needs Triage to Testing on the Parsoid board.Dec 20 2014, 1:06 AM
He7d3r updated the task description. (Show Details)Dec 20 2014, 10:59 AM
He7d3r set Security to None.
marcoil moved this task from Testing to Needs Triage on the Parsoid board.Feb 13 2015, 12:50 PM
ssastry moved this task from Needs Triage to Testing on the Parsoid board.Dec 18 2017, 10:09 PM
Arlolra added a subscriber: Arlolra.

This is because <syntaxhighlight> gets unstripped before doBlockLevels(),
https://github.com/wikimedia/mediawiki/blob/08510de602c239a60d0918bdbf666250d8ac5846/includes/parser/Parser.php#L1651-L1653

There was an attempt to hide the content in a nowiki stripmarker in T104067 since that gets unstripped later in the function, after those passes, but was abandoned.

We probably want to say this will be resolved when Parsoid is the default parser.

Arlolra moved this task from Testing to Known Differences on the Parsoid board.Jun 18 2020, 8:45 PM