Page MenuHomePhabricator

Support for a counter-style parameter in the references tag
Open, MediumPublic

Description

Based on recommendation made in T196828#4272355 it is desirable to allow the <references> tag to have an optional counter-style attribute which would apply that to the <OL> object as a list-style-type value in the styles.

So <references counter-style="persian"> would output as <OL style="list-style-type: persian">...

Event Timeline

Change 439784 had a related patch set uploaded (by Huji; owner: Huji):
[mediawiki/extensions/Cite@master] Support for a counter-style parameter in the references tag

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

Additions like this have been discussed in the past. I believe @Jdforrester-WMF was involved in most of these discussions. To my knowledge the outcome often was that it does not make much sense to allow changing styling details per <references> tag. What is the use-case for this? Why would a wiki need one page to show a special reference numbering scheme, and all others to be different? If the use-case is that a Persian wiki wants all references to be numbered in Persian style, this needs to be a per wiki setting.

All references tags generated by a particular template would need to have this particular counter style applied to them (see further explanation in T196828#4270679).

So no, it is not a per-wiki setting, because not all references tags are affected (only certain ones are). And it is not a per-page thing either because this applies to every page that has references coming from the {{notelist}} template.

It is a per-template setting. And it is something that we believe is not unique to Persian Wikipedia, and would be desirable for other Persian wikis too.

If you decline this request, what I would do is to wrap the current output of {{notelist}} on fawiki in a div with the desired class name, and then every other Persian wiki would also have to copy the definition of {{notelist}} form fawiki. You might argue it is a better solution, but practically, it just shifts the work from MW to the wikis, and adds the burden of maintenance to all other wikis. Like everything in the world, there are cons and pros :) So, let me let you call the shots.

[…] it just shifts the work from MW to the wikis, and adds the burden of maintenance to all other wikis.

I'm very much confused by this comment, because this describes exactly the issue I see with the current patch. It shifts the work to the wikis. But why? Why should the community need to update all their templates? Why not make this a per-wiki setting?

Can you explain how you mean it when you say "per-wiki"?

Essentially what https://phabricator.wikimedia.org/diffusion/ECIT/browse/master/modules/ext.cite.style.fa.css already does. This CSS is active for wikis in a specific language only. The same can be done for other languages.

That CSS is only active for wikis in Parsoid mode (e.g. using Visual Editor). In the View mode (which is arguably the most commonly used mode) it is NOT used.

But regardless, the bigger issue is that that CSS would apply to all <references> tags, not to some.

Let me repeat and re-clarify: the counter style for all <references> tags is not the same. Most of them are the default (which in fawiki is "list-style-type: persian"). Some of them (and they are all the output of the {{notelist}} template) should be something else (namely, "list-style-type: persian-alphabetic").

Your proposed solution (i.e. a modification of CSS that would apply to a certain language only) is one half the job. The other half (of determining which <references> are or are not the target of the CSS, so we can apply the CSS only to those) can only be done if either T196828 or this task are accepted. Without either of those, it is not possible (or at least I cannot think of how, and what you suggested did not help either).

Yeah, switching to proper CSS-based styling is stalled waiting on converting wikis' read mode to Parsoid HTML. That's T55784: [EPIC] Use Parsoid HTML for all page views.

Got it. Well, that has been opened in 2013, so I wouldn't hold my breath here. I would still like this task to be implemented.

Most of them are the default (which in fawiki is "list-style-type: persian"). Some of them […] should be something else (namely, "list-style-type: persian-alphabetic").

Again, why? What does make this difference necessary?

The way the use-case is described now does not sound like it is necessary to give users full control over the list-style-type CSS property, but rather distinguish between … yea, what again? According to https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type the "persian" style is experimental and not supported by any major browser yet, and "persian-alphabetic" does not even exist according to this page.

Most of them are the default (which in fawiki is "list-style-type: persian"). Some of them […] should be something else (namely, "list-style-type: persian-alphabetic").

Again, why? What does make this difference necessary?

The reason is that in Persian text it is common to use two different sets of footnotes: one for references, one for non-reference footnotes (such as explanation of certain translations, etc.) Which is a side-effect of the fact that as opposed to the 1200 AD when Persian and Arabic where the language of science, for the last two centuries it is Latin-based languages (mainly English and French) which are the dominant language, so it is very commonly necessary for Persian text to translate or "transliterate" words from those languages, and provide the original word in a footnote.

Typically, the references are numbered, while the footnotes are alphabetically numbered.

According to https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type the "persian" style is experimental and not supported by any major browser yet, and "persian-alphabetic" does not even exist according to this page.

persian is supported by the latest versions of Chrome, Firefox, and Safari (haven't had a chance to check IE). persian-alphabetic is only supported by those browsers that support counter-style as well (which I think right now is only Mozilla-based browsers, e.g. Firefox).

Here is the bottom line: There is a common way for numbering references and footnotes (in text, and later on at the end of page/manuscript) in Persian material. Right now, we are using one-off hacks to make it possible in Persian Wikipedia. These patches allow us to bring that to other Persian wikis as well. It will not be a perfect and clean solution (because modern browsers still don't support CSS3 completely). But it lays the foundation, without taking away any functionality.

Using 1, 2, 3… for bibliographical references and a, b, c… for explanatory footnotes is a common convention on Polish Wikipedia as well. Currently we use a wrapper template and custom sitewide CSS to achieve this (see e.g. https://pl.wikipedia.org/wiki/Caravaggio#Uwagi). I think this would be a useful feature for many wikis.

Alternatively, if a new syntax or inline CSS is untenable (I agree it is a bit icky), perhaps specific list-style-type styles could be defined in CSS for reflists with specific values of the <ref group=…> attribute?

Using 1, 2, 3 and a, b, c as you stated is also common in English Wikipedia! The difference is when you use a, b, c, ... it is only the inline citation that turns into a, b, c, ... and the footnote itself is still numbered. Here is an example: https://en.wikipedia.org/wiki/User:Huji/citealpha

The whole point of this discussion is to make it possible for the final list to also use the same counter.

Code:

Text <ref group="lower-alpha">first ref</ref> more text.<ref group="lower-alpha">second ref</ref>

<references group="lower-alpha"/>

Current output:

Screen Shot 2018-06-14 at 6.20.05 PM.png (170×266 px, 14 KB)

Desired output:

Screen Shot 2018-06-14 at 6.20.34 PM.png (170×274 px, 14 KB)

Alternatively, if a new syntax or inline CSS is untenable (I agree it is a bit icky), perhaps specific list-style-type styles could be defined in CSS for reflists with specific values of the <ref group=…> attribute?

That is also a desirable, third way to do it! I support this idea too.

Per my comment on the originating task we shouldn't mix the semantic group name with the styling. Create a separate attribute.

In addition to the reasons provided in T196828#4272355, you may end up with multiple groups of a certain type on a page, which you might call "notes1", "notes2" etc, and now your CSS rule for group=notes no longer works.

Change 441026 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/Cite@master] Remove CSS for magic group names

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

Per my comment on the originating task we shouldn't mix the semantic group name with the styling. Create a separate attribute.

In addition to the reasons provided in T196828#4272355, you may end up with multiple groups of a certain type on a page, which you might call "notes1", "notes2" etc, and now your CSS rule for group=notes no longer works.

Okay, fine, we won't use group name for CSS purposes. That other task should stay there, in case we still want to show the group name in the OL (for other, non-CSS purposes).

But this current task doesn't mix group name and styling. It is specifically asking for a styling attribute (counter-style) to be added to the <references> tag.

Vvjjkkii renamed this task from Support for a counter-style parameter in the references tag to p8aaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii removed Huji as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Huji, Aklapper.
CommunityTechBot renamed this task from p8aaaaaaaa to Support for a counter-style parameter in the references tag.Jul 2 2018, 2:11 PM
CommunityTechBot assigned this task to Huji.
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Huji, Aklapper.

Removing task assignee due to inactivity, as this open task has been assigned to the same person for more than two years (see the emails sent to the task assignee on Oct27 and Nov23). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.
(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)

Change 441026 abandoned by Bartosz Dziewoński:

[mediawiki/extensions/Cite@master] Remove CSS for magic group names

Reason:

Superseded by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cite/+/887430

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