Page MenuHomePhabricator

Support section edit links to nested templates
Open, Needs TriagePublic

Description

As noted in T387374#10587246 and T368095#9971720, Parsoid only sees the flattened wikitext output post- template expansion and so it considers all sections as belonging to the top level template.

Captured by the "Nested section numbering" test added in,
https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/1053075/6/tests/parser/headings.txt

Event Timeline

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

I'd guess this is the task for the template documentation use case (among others) e.g. at Template:Navbox and its transcluded edit section links?

From the visual diff from https://cbk-zam.wikipedia.org/wiki/Plantilla:Mapa_de_localizaci%C3%B3n_de_Espa%C3%B1a

In the legacy parser, headings from parserfunctions don't get section edit links, which Parsoid matches,
https://github.com/wikimedia/mediawiki-services-parsoid/blob/master/src/Wt2Html/DOM/Processors/WrapSectionsState.php#L131-L132

However, if the parserfunction is nested in a template, the section is treated as if coming from the outer template (the bug in this task) and so section edit links are added in Parsoid.

Isolated case from the page is putting the following in a template and including it in another page,

{{#if:1|
=== hi ===
|2}}