Page MenuHomePhabricator

Add group name to reference link class
Open, Needs TriagePublicFeature

Description

Feature summary (what you would like to be able to do and where):
Adding group name to cite refernce llink and references section to make abilty to customizing the cite reference link and references section depending in the group.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
currently mediawiki msg 'cite_reference_link' pass three var not including the group name, the group name will be added as $4 to 'cite_reference_link'.
default 'cite_reference_link' value will be

<sup id="$1" class="reference" data-mw-group="$4">[[#$2|[$3]]]</sup>

Benefits (why should this be implemented?):

  • mak abilty to customize the apearance of reference link by its group

Event Timeline

Two separate requests, but I interpret the intent as similar also.

Change 994112 had a related patch set uploaded (by Hubaishan; author: Hubaishan):

[mediawiki/extensions/Cite@master] Add group name to reference link class

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

hubaishan changed the task status from Open to In Progress.Jan 30 2024, 9:48 AM
hubaishan claimed this task.
thiemowmde added subscribers: Jdforrester-WMF, ssastry.

One possible concern I have is that the currently proposed patch adds a fourth parameter to an already complex message that probably shouldn't exist in the first place (briefly explained here). This might make working on T321217 and related tickets a bit harder.

I also would like to understand better what the goal of the proposed change is? What do you mean when you say "customize"? Font size? Colors? How would such customized references look like in e.g. the MobileFrontend experience, or in the Android or iOS apps?

Also note that the Parsoid side of the Cite extension should be updated as well so both parsers continue to generate the same HTML.

@thiemowmde
The customization in both desktop and mobile, we need to customize the cite ref for projects like wikisource see this template in arwikisource we need to use more than one cite group each group must be styled as in the source book. because the ref hasn't a class belongs to its group we encloused the ref tag inside span tag to customize its appearance.

This feature also discussed in Wikisource Community Meeting — January 2024.

I uploaded a patch quite similar to this for T115894 on January 18, but for the <references /> tag only, see 991614. The approach I used there was to not add it as a class (because group names can basically be anything, so you'd have to escape it), but as a data attribute, which are much more lenient in what you can put in them. Would be nice to possibly merge the two patches and use the same approach (doesn't matter to me which one that is).

@hubaishan wrote:

[…] we need to use more than one cite group each group must be styled as in the source book.

Again, what does "customize" mean? What "must" be styled, how, and why?

The template you mentioned doesn't seem to have any customization. The Etherpad doesn't explain anything either, other than "every book has a different style".

You briefly mention wrapping the <ref> in a <span>. That sounds like a sensible solution. Why not go with this?

@thiemowmde

Look at this while arwikisource using default cite style [1] with Arabic European numbers, We use in this book Arabic-Indic numbers with PARENTHESIS not SQUARE BRACKET.

Also in Arabic Wikipedia the Wikipedia:Peer review policy references must be separated by language and referenced type book, web ... so we have book-en group book-ar group see this there are some letters before the ref number. No need to these letters if we have can style the ref.

Warping <ref> in <span> is difficult for beginners and not supported by Visual Editor.

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

[mediawiki/extensions/Cite@master] [POC] Call Parser::recursiveTagParse as early as possible

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

Thanks for the additional context! While I, personally, support the addition (ideally using the same data-mw-group="…" attribute as in the Parsoid implementation) it's probably blocked by the ongoing, long-term parser unification project, specifically T321217 and T156351 and the fact that the relevant <sup> and <a> are currently stuck in a message. We can't use reserved data-mw-… attributes there because they are stripped by the wikitext parser.

I believe this is for the Content-Transform-Team to decide. Would they be willing to make the situation more messy before it gets cleaned up?

There is probably nothing to do in the Parsoid code because that already adds the requested data-mw-group="…" attributes.

Change #1104689 had a related patch set uploaded (by Hubaishan; author: Hubaishan):

[mediawiki/extensions/Cite@master] [T341321] Add group to cite reference

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

Change #1104689 had a related patch set uploaded (by Hubaishan; author: Hubaishan):

[mediawiki/extensions/Cite@master] [T341321] Add group to cite reference

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

@thiemowmde done in last patch

Change #998778 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/extensions/Cite@master] [POC] Call Parser::recursiveTagParse as early as possible

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

Aklapper changed the task status from In Progress to Open.Apr 11 2025, 10:19 PM

Resetting task status from "In Progress" to "Open" as this task has been "in progress" for more than one year (see T380300). Feel free to set that status again, or rather break down into smaller subtasks.