Page MenuHomePhabricator

Check different formating of references on wikis
Open, Needs TriagePublic

Description

The output of <ref> tags and the <references> section is customizable using MediaWiki messages. So it might make sense to keep an eye open on what's done in the wild to these outputs. And ideally we have a good reflection of what's going on in production on the beta cluster.

See Help:Cite#Customization

Also see T353695 for an analysis of the cite_error and cite_warning messages.

Event Timeline

I had a closer look at the remaining messages.

cite_references_link_many_format_backlink_labels
Makes it possible to customize the backlink labels "a b c …". So far this is a legitimate use of the i18n system, in my opinion. It might be possible to replace it with CSS counters in the future, but I'm not sure if this is even worth it.

cite_references_link_many_sep
cite_references_link_many_and
Used as separators between said backlink labels. Both are nothing but a single space character by default. The possibility to customize them is barely used anywhere, neither via translatewiki nor locally in the wikis. We can possibly removed this altogether after consultation with the (very few) communities.

cite_reference_link
The central message that makes the little [1] in the text.

  • 4 wikis (ar.wikisource, es.wiktionary, it.wikisource, vec.wikisource) remove the square brackets.
  • 1 wiki (es.wikipedia) adds a zero width space (U+200B) at the end. It's unclear why and if this even does anything.
  • 12 wikis replace the &#91; entities with plain square brackets wrapped in <nowiki>. This is most certainly meaningless. The original message in the code was changed away from <nowiki> in 2016 via https://gerrit.wikimedia.org/r/277893. The local overrides are all older and most certainly use <nowiki> only because they have never been updated. We should feel free to fix this inconsistency.
  • 9 wikis wrap the square brackets in extra <span> to be able to style them individually, different from the number.

At least 2 overrides (es.wikiquote, pl.wikipedia) can be removed right now because they don't contain any meaningful change.

cite_references_link_one
cite_references_link_many
The central messages that make the list items. Investigated separately, see below.

cite_references_link_many_format
As of now 92 wikis use the message for a series of different customizations:

  • 85 wikis replace the parameter $2 with $3. 25 wikis don't do anything but that. This possibility to use an "alternate backlink label" is an intentional feature that exists since 2005, see commit 800e7821. We would need to provide an alternative to that, or possibly make it the default behavior.
  • 70 wikis flip the order of the <sup> and <a> elements. The explanation is that this order was actually changed in the original code in 2007, but these messages never updated. The code change is explained in T8906. Since most users don't have the "Link underlining" preference enabled this has almost no consequence. It's more a technical bugfix. We should be free to apply it everywhere.
  • A lot of wikis change the styling, e.g. add a padding (1 wiki), make the text smaller (1 wiki), bold (3 wikis), italics (4 wikis), or bold and italics the same time (51 wikis). This can very easily be replaced with CSS, but needs coordination with the communities. The selector .mw-cite-backlink that makes this possible exists since 2012, see T34626.
  • 3 wikis remove the <sup> HTML, namely fr.wikipedia, fr.wiktionary, and sv.wikipedia. I suspect this is done for styling purposes and can probably as well be done with CSS.

3 wikis can delete their local copy right now because it is identical with the default (except for the flipped order of the <sup>, see above): ka.wikipedia, eo.wikipedia, bs.wiktionary.

cite_references_link_one
53 local overrides currently exist.

  • 38 remove the parameter $4. This doesn't make much sense. The parameter is mostly for a dir="…" attribute, see T15673. It was added in 2012. The overrides that miss the parameter are probably older and just never updated.
  • 32 remove the <span class="mw-cite-backlink">. As above, this doesn't make much sense and is most certainly only because these overrides have never been updated. The feature was added in 2012 via T34626.
  • 2 wikis (frwiki, frpwiki) add a class="noprint". This is most certainly pointless. The mw-cite-backlink class mentioned above is supposed to do that. Again, the overrides are just outdated (both from 2007) and never updated.
  • frpwiki adds a hard-coded id="rèferences_vers_lo_tèxte" to every <li>. This is just wrong and not how HTML works. It's not even possible to reliably use this anchor to jump to the first list element because pages can contain more than one reference list. frwiki once did the same but was fixed in 2019. frpwiki needs to be updated the same way.
  • 35 wikis add ''' or <strong> or <b> to make parts bold. This should be done with CSS. The class mw-cite-backlink mentioned above was added exactly for that.
  • 41 change the symbol to ^.
  • 3 change the symbol to . All 3 are vi wikis. 2 more vi wikis exist but don't use the same symbol for an unknown reason.
  • enwiktionary adds spaces that are most certainly meaningless or should be replaced with CSS.
  • ruwikivoyage removes the backlink entirely (example). This really doesn't make any sense, interferes with what readers need to be able to do with references, and should just be impossible to do.

Pieces that are never changed and should just be hard-coded in the code instead are:

  • The outer <li id="$1"> is never touched.
  • The inner [[#$2|^]], followed by a space and $3, is always the same. The only exception here is the symbol ^, as well as the outlier ruwikivoyage mentioned above.

At least 3 overrides (eowiki, euwiki, kawiki) can probably be deleted right now because they don't do anything.

cite_references_link_many
51 local overrides currently exist. At first glance it looks extremely similar to the analysis above – as it should.

  • The most extreme outlier here is svwiki which uses <nowiki>[</nowiki> to add square brackets to the numbers in the reference list (example). This is never done anywhere else.
  • ruwikivoyage still removes the but keeps the backlinks in case a reference is reused multiple times.

cite_reference_link
9 wikis wrap the square brackets in extra <span> to be able to style them individually, different from the number.

This is used to make the square brackets invisible by default but potentially still show up when copy-pasting content and if CSS is used to revert the invisibility. This square bracket suppression happens on eswiki, frwiki, and possibly others.