Page MenuHomePhabricator

Rendering diff from not wrapping bare h tags (visual diff testing)
Closed, DeclinedPublic

Description

https://parsoid-vs-core.wmflabs.org/diff/trwikivoyage/%C5%9Eablon%3APandemiDikkat

The legacy parser outputs,

<div class="mw-heading mw-heading2"><h2 id="COVID-19_pandemisi"><a href="/wiki/COVID-19_pandemisi" title="COVID-19 pandemisi">COVID-19 pandemisi</a></h2></div>

where the wikitext expands to,

	<div class="mainpage-shadowbox banner-box-2 banner-box-right" style="width:40%">
		<h2>[[COVID-19 pandemisi|COVID-19 pandemisi]]</h2>

After https://github.com/wikimedia/mediawiki/commit/b3ac045497be0ad74e2c0335783ebe12c80fa176, it would seem that we'd always be wrapping similarly but we have an early exit,

			$fromTitle = $section->fromTitle;
			if ( $fromTitle === null ) {
				// T353489: don't wrap bare <h> tags
				continue;
			}

Event Timeline

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

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

[mediawiki/core@master] [WIP] Only omit h tags with attributes

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

I think ideally we'd change the core parser behavior here. Comparing the two renderings for your example, the Parsoid one looks like what was intended. I wanted to avoid wrapping bare <hN> tags in the old parser too, but it is currently impossible due to T68637.

I think ideally we'd change the core parser behavior here. Comparing the two renderings for your example, the Parsoid one looks like what was intended. I wanted to avoid wrapping bare <hN> tags in the old parser too, but it is currently impossible due to T68637.

Ah, I see, attributes on the heading is a proxy for it being bare.

T371336 wanted the wrapping for the collapsible section feature to work,
https://en.m.wikipedia.org/wiki/User:ABreault_(WMF)/sandbox?oldid=1240347529&useparsoid=0
https://en.m.wikipedia.org/wiki/User:ABreault_(WMF)/sandbox?oldid=1240347529&useparsoid=1

but I suppose that's a bit fabricated and bare headings aren't used where they aren't necessary?

Change #1060944 abandoned by Arlolra:

[mediawiki/core@master] [WIP] Only omit h tags with attributes

Reason:

By design

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

I think it's the legacy side which is broken here.