Page MenuHomePhabricator

Add section attribute with page title for transcluded templates
Closed, InvalidPublic

Description

Some sections have transcluded content coming from other pages. When this happens the data-mw-section-id is -1.[1]
I think it should be possible to create a link to edit the transcluded page if Parsoid would also add another attribute to the <section> elements which were coming from transcluded pages.

Example from https://en.wikipedia.org/api/rest_v1/page/html/Wikipedia:WikiProject_Deletion_sorting%2FIndia/825839710:

<section data-mw-section-id="-1">
  <h3 typeof="mw:Transclusion" id="Kuldeep_Pai" data-mw='{"parts":[{"template":{"target":{"wt":"Wikipedia:Articles_for_deletion/Kuldeep_Pai","href":"./Wikipedia:Articles_for_deletion/Kuldeep_Pai"},"params":{},"i":0}}]}'>
    <a rel="mw:WikiLink" href="./Kuldeep_Pai" title="Kuldeep Pai">Kuldeep Pai</a>
  </h3>
  ...

The wanted information is actually in the h3.data-mw attribute. I think it would make more sense and would be easier to consume if the transclusion information (typeof="mw:Transclusion" + data-mw) was on the <section> element instead of the <h3>. Or even better if there was a data-mw-page or similar attribute with just the page title of the transcluded page.
Parsoid devs, does this sound reasonable?

[1] https://www.mediawiki.org/wiki/Parsing/Notes/Section_Wrapping#Plan_of_Record:_Implementation_proposal

Event Timeline

In the general case, adding data-mw to <section> instead of the heading is not possible since the transclusion might only produce part of the section's content.

Thanks. Looks like this is not feasible on the Parsoid level. We could try some on the PCS level but even that is a bit involved and only works in certain circumstances. (If the transcluded page content was the only content inside a particular section.)