Page MenuHomePhabricator

Spike: Look into wiring back sub-refs when saving in VE
Closed, ResolvedPublicSpike

Description

Try an exploratory wiring of the internal VE representation of sub-refs back to the expected output that then can be saved. This task is done when the work has been defined, no implementation needs to be finalized here.

Requirements:

  • Never save the main ref as list defined ref ( unless it was one )
  • If the main ref content is inlined with the sub, make sure it's inlined in the output
  • If the main ref content was separate from the sub, make sure it's separate in the output
  • Write round-trip tests for VE data model<->Parsoid DOM in ve.dm.citeExample.domToDataCases
  • Write round-trip tests for wikitext<->Parsoid DOM in Cite subReferencing.txt

Investigation notes:

  • Reintegration should be symmetrical with where we split main from details, in other words it should happen in Parsoid and not VE. VE is responsible for rebuilding a Parsoid-like DOM in which the main + subref look almost like normal refs other than some additional linking attributes. This also means that Parsoid is where the details attribute is sanitized and escaped.
  • But by careful ordering, it might be possible to reuse existing contentsUsed logic almost unchanged. The trick would be to deduplicate *either* the contents of a normal ref, or the main body content which has become a synthetic, list-defined reference.
  • VE includes some logic for how to handle reused subreferences—this should be removed for now.
  • To play with round-tripping, edit the following header line in subReferences.txt: parsoid-compatible=wt2html,html2wt
  • Parsoid html2wt is contained in the files RefTagHandler.php and ReferenceListTagHandler.php .

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptMar 5 2025, 9:37 AM
awight moved this task from Sprint Backlog to Doing on the WMDE-TechWish-Sprint-2025-03-05 board.
awight updated the task description. (Show Details)

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

[mediawiki/extensions/Cite@master] Round-trip subref from VE to Parsoid HTML

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

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

[mediawiki/extensions/Cite@master] Boolean attributes must be stringified for serialization

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

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

[mediawiki/extensions/Cite@master] [WIP] Move ephemeral data out of mwAttrs

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

awight subscribed.

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

[mediawiki/extensions/Cite@master] [WIP] move main* attributes out of attrs

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

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

[mediawiki/extensions/Cite@master] [WIP] Basic support for subref dom->wikitext

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

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

[mediawiki/extensions/Cite@master] Remove "extends" subref VE -> DOM transformation

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

Change #1129206 abandoned by Awight:

[mediawiki/extensions/Cite@master] [WIP] move main* attributes out of attrs

Reason:

squashed

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

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

[mediawiki/extensions/Cite@master] Fix wikitext source for details attribute

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

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

[mediawiki/extensions/Cite@master] [DNM] Demonstrate html2wt failures for details subrefs

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

Change #1128899 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Boolean attributes must be stringified for serialization

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

Change #1128911 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Move ephemeral data out of mwAttrs

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

Change #1129236 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Remove "extends" subref VE -> DOM transformation

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

Change #1128887 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Rough test for round-trip subref from VE to Parsoid HTML

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

Change #1129272 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix wikitext source for details attribute

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

Change #1129207 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Initial support for subref dom->wikitext

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

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

[mediawiki/extensions/Cite@master] Fix data-mw body.id for synthetic list-defined main refs

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

Change #1130961 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix data-mw body.id for synthetic list-defined main refs

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