Page MenuHomePhabricator

Suppress built-in Cite CSS numbering for Parsoid
Closed, ResolvedPublic

Description

Now that Parsoid emits "fallback" (explicit text) footnote markers which match the Cite legacy parser, we can slowly dismantle the CSS counter styling. We think a good next step is to remove the styling built into Cite, which should leave only the on-wiki overrides remaining.

However, there are risks:

  • Never want to show two markers or "[0]". This is easy to accidentally cause, by tampering with the "display: none" rule on the fallback text or by attempting to CSS number a tag which has no counter-reset attribute. Especially need to test the default group, custom groups, custom groups without legacy i18n sequence, and both Parsoid read and VE edit modes, including within a template transclusion.
  • Some languages might have an associated default numbering style in most browsers, which Cite is overriding with its default "decimal" style. These languages will need to be reconfigured as we discover them.
  • Coordination around on-wiki stylesheet edits may be challenging, and for debugging purposes it would be best if we could ask a global admin to make the changes while we're available to help test.

What to review:
These use cases should ideally be unchanged. Next-best option is that they are slightly improved if currently incorrect.

  • Parsoid read mode for content language en
  • Parsoid read mode for content language ar and $wgTranslateNumerals=false
    • Currently shows Indic numerals, which is incorrect.
  • Parsoid read mode for content language fa
  • VE for content language en
  • VE for content language en, from template
  • VE for content language ar and $wgTranslateNumerals=false
  • VE for content language ar and $wgTranslateNumerals=false, from template
    • Currently shows Indic numerals, which is incorrect.
  • VE for content language fa
  • VE for content language fa, from template
  • use cases involving on-wiki style overrides

We can't completely remove the mechanism yet, because they're still used for backlink numbering. Complete removal will come in a follow-up task.

Event Timeline

Change #1104974 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [WIP] Stop styling languages that have no counter style

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

Global search for "mw-Ref" CSS rules that might apply to Parsoid footnote markers: https://global-search.toolforge.org/?q=%22mw-Ref%22&namespaces=8&title=.*css (111 results)

There are no matches for "mw-reflink-text" which means that all CSS relies on Cite styling to hide the fallback text.

Unfortunately, this probably means that we would cause many duplicated footnote markers without a more sophisticated migration than the current WIP patch.

Grabbing a typical example of these rules, eswiki has:

.mw-ref > a[data-mw-group=lower-alpha]::after {
    content: counter( mw-Ref, lower-alpha );
}

and copying the custom sequence message https://es.wikipedia.org/w/index.php?title=MediaWiki:Cite_link_label_group-lower-alpha

The result is indeed a doubled footnote marker: [a]a (Spanish Wikipedia suppresses square brackets so they aren't included in the CSS rule.)

Looking at actual eswiki and how we might safely change the rule, the following separate rules are applying to lower-alpha footnote markers in parsoid read mode, listed here in decreasing order of precedence:

  • "[lower-alpha 4]" from .mw-ref > a[style~="mw-Ref"][data-mw-group]::after { content: '[' attr(data-mw-group) ' ' counter(mw-Ref,var(--cite-counter-style)) ']'; }
  • "d" from .mw-ref > a[data-mw-group="lower-alpha"]::after { content: counter(mw-Ref,lower-alpha); }
  • "lower-alpha 4" from .mw-ref > a[data-mw-group]::after { content: attr(data-mw-group) ' ' counter(mw-Ref,decimal); }
  • "[4]" from .mw-ref > a[style~="mw-Ref"]::after { content: '[' counter(mw-Ref,var(--cite-counter-style)) ']'; }

Finally, the fallback text is already more correct than what is actually rendered, "[d]".

In this case, the ideal would be to immediately prevent any CSS rules on mw-Ref, or add an additional rule which takes higher precedence and hides the ::after while showing the fallback?

In this case, the ideal would be to immediately prevent any CSS rules on mw-Ref, or add an additional rule which takes higher precedence and hides the ::after while showing the fallback?

I like that idea 😁.

.mw-ref > a::after {
	content: none !important;
}

We learned from @ssastry that it's possible to preview the effect of our CSS changes by applying them as a file in the visual diffs tool, see for example https://gerrit.wikimedia.org/r/plugins/gitiles/integration/visualdiff/+/refs/heads/master/configs/parsoid_vs_core/parsoid.custom_styles.yaml

The specific rules we'll add are:

.mw-ref > a[style~='mw-Ref']::after { content: none !important; }
.mw-ref > a[style~='mw-Ref'] span.mw-reflink-text { display: revert; }

Change #1109034 had a related patch set uploaded (by Awight; author: Awight):

[integration/visualdiff@master] [DNM] Switch to explicit numbering of footnote markers

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

Change #1111215 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@wmf/1.44.0-wmf.12] Switch to explicit numbering for Parsoid footnote markers

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

Waiting for a scheduled backport deployment on 20 January so we can better monitor.

Change #1104974 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Switch to explicit numbering for Parsoid footnote markers

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

Change #1111215 merged by jenkins-bot:

[mediawiki/extensions/Cite@wmf/1.44.0-wmf.12] Switch to explicit numbering for Parsoid footnote markers

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

Mentioned in SAL (#wikimedia-operations) [2025-01-20T08:31:32Z] <awight@deploy2002> Started scap sync-world: Backport for [[gerrit:1111215|Switch to explicit numbering for Parsoid footnote markers (T382310)]]

Mentioned in SAL (#wikimedia-operations) [2025-01-20T08:44:31Z] <awight@deploy2002> awight: Backport for [[gerrit:1111215|Switch to explicit numbering for Parsoid footnote markers (T382310)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-01-20T08:55:11Z] <awight@deploy2002> Finished scap sync-world: Backport for [[gerrit:1111215|Switch to explicit numbering for Parsoid footnote markers (T382310)]] (duration: 23m 38s)

awight renamed this task from Remove built-in Cite CSS numbering for Parsoid, if possible to Suppress built-in Cite CSS numbering for Parsoid.Feb 12 2025, 11:27 AM
awight closed this task as Resolved.
awight updated the task description. (Show Details)