Page MenuHomePhabricator

2️⃣ Use explicit numbers for sub-refs in reference lists CSS and Parsoid rendering (M)
Open, Needs TriagePublic

Description

Context

References lists are currently build using <ol><li></li></ol> HTML tags. The numbering of these is usually done by the browsers. To customize the numbering there we're currently using two techniques.

  • list-style-type to allow different numbering systems like list-style-type: bengali;
  • counter-increment and counter-reset for the numbers

While this works mostly good enough for main references it's a bit problematic when using sub-references. See the screenshot

image.png (372×206 px, 10 KB)

Solution

In the article we use explicit numbers that will be added to the output. Ideally we should use the exact same numbers in the reference list. Currently that's not the case but we already prepared that transition.

The reference list's <li> already got an attribute with the right characters that should be used for the list entry. These come from the same algorithm as the footnote numbers in the artice: data-mw-footnote-number

We can use these to override the actual numbers in the HTML using CSS.

li::before {
  content: attr(data-mw-footnote-number);
}
Out of scope

Legacy renderer
There we're currently not adding the `data-mw-footnote-number attribute. We might want to fix that though to have one mechanism working with both.
VisualEditor
Potential follow up to make sure the conditions from above also work there.

How to test

Test subref numbers

  • change content language to bengali (bn) $wgLanguageCode = "bn";
  • create a page with a subref <ref name="test" details="page">Test<ref>
  • open the page in parsoid to check the new correct subref numbers
  • open page in legacy parser to make sure it works as before

Test custom group markers

Event Timeline

WMDE-Fisch renamed this task from Use explicit numbers in reference lists to Use explicit numbers in reference lists and Parsoid rendering.Aug 11 2026, 11:39 PM
WMDE-Fisch updated the task description. (Show Details)
lilients_WMDE renamed this task from Use explicit numbers in reference lists and Parsoid rendering to Use explicit numbers in reference lists and Parsoid rendering (M).Aug 21 2026, 8:37 AM

Change #1344001 had a related patch set uploaded (by Svantje Lilienthal; author: Svantje Lilienthal):

[mediawiki/extensions/Cite@master] Use explicit numbers in reference lists and Parsoid rendering

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

Change #1344001 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Use explicit numbers in reference lists and Parsoid rendering

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

Change #1347460 had a related patch set uploaded (by Svantje Lilienthal; author: Svantje Lilienthal):

[mediawiki/extensions/Cite@master] Add explicit numbers in reference lists to Parsoid rendering

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

Reopened because of T439790: References' footnote numbers no longer display on en.Wiktionary.org. There is also already a patch that should fix the original issue and not create a problem for legacy.

lilients_WMDE renamed this task from Use explicit numbers in reference lists and Parsoid rendering (M) to 2️⃣ Use explicit numbers in reference lists and Parsoid rendering (M).Tue, Oct 6, 9:03 AM

Change #1352174 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Cite@master] Respect custom group markers when rendering sub-ref numbers

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

WMDE-Fisch renamed this task from 2️⃣ Use explicit numbers in reference lists and Parsoid rendering (M) to 2️⃣ Use explicit numbers in reference lists CSS and Parsoid rendering (M).Wed, Oct 7, 7:21 AM
WMDE-Fisch removed WMDE-Fisch as the assignee of this task.
WMDE-Fisch renamed this task from 2️⃣ Use explicit numbers in reference lists CSS and Parsoid rendering (M) to 2️⃣ Use explicit numbers for sub-refs in reference lists CSS and Parsoid rendering (M).Tue, Oct 13, 9:31 AM