Page MenuHomePhabricator

Bug in HandleParsoidSectionLinks - seems to skip some headings?
Closed, ResolvedPublic

Description

On this diffs page, there are three documented instances where a map-banner on hiwikivoyage, bnwikivoyage, trwikivoyage has different heading styles on Parsoid.

On inspecting the HTML differences, it looks like Parosid's HTML didn't get the new section link treatment.

Legacy HTML:

<div class="mw-heading mw-heading2"><h2 id="विकियात्रा_पर_आपका_स्वागत_है">...</h2></div>

Parsoid HTML:

<h2 id="विकियात्रा_पर_आपका_स्वागत_है">...</h2>

Looks like something in the HTML here tripped up the pass?

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Section links match by the ID from the TOCData, I bet parsoid's TOCData got confused. You should be able to check this by asking for the section info using the parse API.

I can't find the ticket where I investigated this at the moment, but I think the issue is because it's a compound template (or in this case recorded as a function),

<meta property="mw:PageProp/notoc" about="#mwt5" typeof="mw:Transclusion" id="mwCA" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;#if:{{{content|}}}&quot;,&quot;function&quot;:&quot;if&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;{{{content|}}}&quot;},&quot;2&quot;:{&quot;wt&quot;:&quot;{{#ifexist:{{{1|{{Documentation/docname}}}}}|{{ {{{1|{{Documentation/docname}}}}}}}}}&quot;}},&quot;i&quot;:0}}]}">

we have,

				} else {
					// Legacy parser return null here
					$metadata->fromTitle = null;

https://github.com/wikimedia/mediawiki-services-parsoid/blob/master/src/Wt2Html/DOM/Processors/WrapSectionsState.php#L125-L128

that we exit early from,
https://github.com/wikimedia/mediawiki/blob/master/includes/OutputTransform/Stages/HandleParsoidSectionLinks.php#L68-L72

There's some other discussions of Parsoid's limitations of templated section editing in T368095#9971720

Change #1113588 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/core@master] Only omit heading wrapper if it has attributes

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

ABreault-WMF triaged this task as Medium priority.

Change #1113588 merged by jenkins-bot:

[mediawiki/core@master] Only omit heading wrapper if it has attributes

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

Change #1115957 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] Keep stx info for all headings

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

Change #1115957 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Keep stx info for all headings

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

Change #1115977 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/core@master] Also omit heading wrapper if id is reused from source

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

Change #1115977 merged by jenkins-bot:

[mediawiki/core@master] Also omit heading wrapper if id is reused from source

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

Change #1116870 had a related patch set uploaded (by Jgiannelos; author: Jgiannelos):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.21.0-a14

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

Change #1116870 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.21.0-a14

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