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
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);
}- Make sure other CSS does not mess up that override
- Make sure that it also works with custom group footnotes e.g. https://bn.wikipedia.org/wiki/MediaWiki:Cite_link_label_group-lower-greek - can be tested by copying over the page and using "lower-greek" as a group name in a reference
- Check if there's anything extra in T378062: Parsoid references list rendering needs to support custom group markers to consider
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
- copy http://dev.wiki.local.wmftest.net:8080/wiki/MediaWiki:Cite_link_label_group-lower-greek over into your local wiki
- use the custom marker in wikitext: <ref group="lower-greek">Lower Greek</ref><references group="lower-greek" />
- read the page to see the custom group markers
