Page MenuHomePhabricator

[Epic] Implement a new mechanism that connects MWReferenceNodes with InternalItemNodes
Open, Needs TriagePublic

Description

Context

The introduction of Cite (Sub-referencing) surfaced a new need to connect reference content (InternalItemNodes) to reference nodes (MWReferenceNodes). Sub-refs need to connect to two types of content. The content of the main reference and the content of the details attribute. Originally we tried to solve that by introducing "synthetic" LDR, but that approach has several flaws a needs to be replaced ( see parent epic T397501 ).

At the time synthetic LDRs were a good workaround to meet the requirements of VE's internal data structure that a MWReferenceNode connects to one InternalItemNode and removing the ref node also disconnects the content. But the whole structure on how these nodes relate to each other seems weirdly complicated.

Current situation

Currently at least three attributes are used to connect MWReferenceNodes with InternalItemNodes: listGroup, listKeyand listIndex. The later has a special meaning and reflects the position of the InternalItemNodes in the InternalListNode.

In many cases all three attributes need to be maintained on the InternalList or MWReferenceNodes when the later are added, deleted or changed.

We could probably deprecate a lot of code that’s currently needed to maintain these mappings by introducing something simpler. Furthermore it would make the way how content is connected to MWReferenceNodes more clear and easier to use. Not only for the sub-ref use cases.

Solutions

Ideally MWReferenceNodes don't need to be mapped to their InternalItemNode by using a key or index. Instead we would like to make that connection more direct per reference. This is already the case for other objects in VE like the Document a node belongs to.

Referencing the InternalItemNode directly will help getting rid of some other means to maintain that connection making properties and methods around these properties simpler or obsolete.

Implementation

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

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

[mediawiki/extensions/Cite@master] [DNM][POC] Use the listIndex to link ReferenceNodes and InternalItems

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