Page MenuHomePhabricator

Add explicit reflist numbers to the Cite Parsoid parser
Open, Needs TriagePublic

Description

This ticket is done when Parsoid includes explicit footnote numbers in reflist HTML. The approach can be incremental and rough for now.

Note that the status quo is already broken for both parsers, for example in the "Notes" section on this page: https://en.wikipedia.org/wiki/2024_United_States_presidential_election#Notes the list numbering is only alpha due to a custom class "reflist-lower-alpha" added in wikitext:

<templatestyles src="Reflist/styles.css" /><div class="reflist reflist-lower-alpha"><references group="lower-alpha" /></div>

Without that code, the footnote markers "[a]" would not match the reflist numbers "1."

Acceptance criteria

  • Show the localized reflist number somehow in the reflist item.

Suggested implementation:

  • ~~Parsoid outputs a CSS custom property --footnote-number like we've already done in visual editor:

<li style="--footnote-number: &quot;1.&quot;;">, with the correct footnote marker for custom groups. Punctuation can be ignored for the moment.~~

  • Parsoid outputs a data-mw-footnote-number attribute with the rendered marker symbol.
  • Parsoid renders these symbols in the li::marker, at a lower precedence than on-wiki customizations if possible.
  • Number punctuation must match the content language, before we make this the default rendering.

Event Timeline

awight subscribed.

bringing into the current sprint, this is required by open work.

Change #1164400 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [POC] Explicit numbering for Parsoid reflists

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

Moving this ticket back to stalled because it is a stub and needs more description. :)

Change #1186469 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] Test subref marker labeling

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

Change #1186470 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] Option to return the footnote mark without a group name

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

Change #1186471 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [WIP] Emit reflist item data-mw-footnote-number in Parsoid output

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

Pausing work on this task: we only need the data attribute for mobile apps.

Change #1186469 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Test subref marker labeling

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

Change #1186470 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Option to return the footnote mark without a group name

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

Change #1186471 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Emit reflist item data-mw-footnote-number in Parsoid output

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

This is "done" from the perspective of our current sprint, but there are additional steps to take in the future so I'm leaving it in the "watching" column to avoid accidentally closing the task.

Change #1189172 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] [POC] Do not output the default data-mw-footnote-number="1"

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

Change #1189172 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/extensions/Cite@master] [POC] Do not output the default data-mw-footnote-number="1"

Reason:

I realized there is one relevant issue with this approach: How can a consumer tell if **all** numbers are missing, or only the number "1"? The worst case would be an article that shows "1" everywhere. We certainly don't want that.

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

Change #1191402 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [WIP] Render custom markers in reflist

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