Steps to replicate the issue
- Create wikitext:
<ref details="page 1" name="book">Miller</ref>
- Switch to VE
- Add anything to the page
- Click on Save changes... to open the save dialog
- Click on Review your changes to open the VisualDiff
What happens?:
The rendered preview in the diff shows [1] for the subref in both the article and in the reference list.
What should have happened instead?:
The rendered preview in the diff should show [1.1] for the subref
Implementation
- Correct numbering of footnote markers in article diff.
- Correct numbering in reference list.
Out of scope:
- Hierarchical indentation will be done in T405345: VisualDiff: Missing indentation for subrefs in reflist.
Technical notes
There are two aspects to this.
Correct numbers
In the VE-core ve.dm.VisualDiff class, footnote numbers are completely overridden with simplistic numbering: ve.setProp( item, 'internal', 'overrideIndex', i + 1 ); . The ve.dm.MWReferenceNode gives this overrideIndex higher priority than its internally-calculated numbers. First, we should try to understand the exact problem that was being solved by this override. Then, we can decide to either continue using the override mechanism and fill it with the formatted subreference number, or we can drop the mechanism and try to simplify how this works. Numbering changes should probably not appear in the diff, but follow existing product decisions.
Findings: the overrideIndex was introduced because the diff algorithm merges the old and new InternalList together, so the native numbering of the combined list would no longer match the article numbering. Before this step, the actual numbering is frozen and saved into this field. Our initial implementation can reuse the override mechanism to pass full sub-reference numbers through to the diff renderer, but for long-term debt it would be best if this merge step could be avoided or isolated from later logic. For example, the merge could be performed on cloned lists and then results carried back into the original old and new internal lists.
Reference list rendering
In the VE library ve.ui.DiffElement there's a part that handles how the ReferenceList is rendered handleRefList . We probably need to apply changes there to make it understand subrefs.
Findings: the references list enumeration makes assumptions about sequential numbering, rather than referring back to the reference node metadata. We'll need to wire footnote number labels through. Diff logic contains several quite different code paths for insertion, removal, and changed references, and all will need to include this new wiring.
Next steps
- Get the numbering into the ReferenceNode class ( in the VE lib? )
- Get the numbers from the new VE ReferenceNode class into the VisualDiff



