Page MenuHomePhabricator

PoC: Parsoid to split ref with "details" into a sub-ref and a main ref
Closed, ResolvedPublic

Description

There are several advantages of having separate nodes that represent the main content and the content of the additional details. Especially when it comes to the handling in VE. It also would come with the perk that existing code for sub-references could be re-used to solve issues of numbering, editing, creating and previewing these special ref types.

  • Find the place where refs can be "split" while parsing in Parsoid
  • Wire existing VE logic to at least visualize the output of the separation

TODO: display main reference again :)

Event Timeline

Change #1098598 had a related patch set uploaded (by Svantje Lilienthal; author: WMDE-Fisch):

[mediawiki/extensions/Cite@master] [DNM][POC] Parse sub-ref content using the `details` attribute in Parsoid

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

We worked on this today and found some partial answers: most importantly, it is possible for References.php to emit two reference nodes as it parses a main+details line of wikitext. Wiring the main and details content into the new refs will still take some work. One lower-risk question that was opened is, whether we can recursively parse the details wikitext into DOM nodes in this Parsoid context, but that seems likely because the parsoid API includes some methods for doing exactly this.

Next steps for this task are to fill in the remaining wiring and recursively parse details wikitext.

We're not worried about the main-only or details-only, or any other edge cases like reuse, therefore we won't include in the proof of concept.

Change #1102868 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Cite@master] [DNM][POC] Parsoid: Split sub-ref content using `details`

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

We've successfully demonstrated what we consider to be the highest-risk technical aspects: recursive wikitext parsing from the attribute text in Parsoid, and splitting the single main+details wikitext ref tag into two nodes which land as a subref and as a quasi-list-defined main ref, which concludes this investigation.

Change #1102868 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Parsoid: Split main+details into two ref nodes (rough)

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