Page MenuHomePhabricator

Parsoid handles subref coming before its main ref
Closed, ResolvedPublic

Description

User story:

As VE user I want to be able to correctly see and save sub-refs when the main content is defined after the sub-ref in Wikitext.

Acceptance criteria:
<ref name="book" details="p. 123" />
<ref name="book">The book</ref>
  • Shows two refs [1.1] and [1].
  • Both can be edited individually in VE.
  • When editing either the main or the details content in VE and saving it should update the Wikitext
Background:

Our initial implementation ignores the possibility of the main ref not yet existing. In previous phases, we've supported this use case by creating a placeholder for the main reference, connecting the subreference to it, and then replacing the placeholder when the main reference does appear.

Should also handle the case where the main ref never appears, by showing an error placeholder where the main ref should be in the reference list.

Implementation:
  • When the parser runs first it can not be sure if the main content for the sub-ref will follow, so it needs to take note that there might come main content later to fulfill that need
  • On a second run the parser could fill the gaps if main content was found in the first run, or might show an error and ignore the ref instead.
  • Booking keeping what was found in the first run to connect the lose ends in the 2nd is the problem to solve here

Event Timeline

awight changed the subtype of this task from "Spike" to "Task".Mar 4 2025, 12:11 PM

Change #1132578 had a related patch set uploaded (by Mareike Heuer; author: Mareike Heuer):

[mediawiki/extensions/Cite@master] Handle subrefs defined before main ref in Wikitext

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

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

[mediawiki/extensions/Cite@master] Some more round-trip normalizations

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

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

[mediawiki/extensions/Cite@master] Comment with specific bug numbers

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

Change #1133963 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Some more round-trip normalizations

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

Change #1133964 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Comment with specific bug numbers

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

Change #1132578 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Handle subrefs defined before main ref in Wikitext

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