Context
This is meant as an umbrella ticket to manage WMDE-TechWish 's refactoring work in Cite and VE to fix know issues with the {{reflist}} template or missing references lists and main+details[1] sub-references. The main reason for these issues is the current implementation of how a reference including main and details content is handled in VE. Currently this is done by adding a "synthetic list defined" MWReferenceNode for storing the main content to the references list. When the reference list is not present on fresh articles, when it gets deleted or due to the use of a {{reflist}} template this leads to some problems.
[1]
<ref name="book" details="page 1">Miller</ref>
Solution
We identified the need to store references more independently of a synthetic MWReferenceNode. The reference nodes are very close to <ref> tags in Wikitext and will only appear once in the document when a ref or a main+details occurs. InternalItemNodes are the objects that store the content of references. So to solve the described problems we're working on changes that allow us to access two different InternalItemNodes from sub-references without the need that the main content is also associated with a distinct MWReferenceNode. It still can be for cases where the main ref is ( manually ) list defined or elsewhere reused in the article, but it does not has to.
Goals
- Eliminate the "synthetic list-defined main ref" in VE T406866: [Epic] Stop creating new synthetic refs in VisualEditor
- Eliminate the "synthetic list-defined main ref" in the wire format between Parsoid and VE to safely load and store content T406866: [Epic] Stop creating new synthetic refs in VisualEditor
Known use cases with issues
When using main+details with the {{reflist}} template or with a missing reference list a VE user can...
- ... see correct main content in the ContextMenuItem T415523: [Refactor] Add helper method to retrieve InternalItems for content and use it in the ContextItem
- ... see correct numbers and main content in the ReferenceList T415525: [Refactor] Show main content in the ReferencesList of a sub-ref node without relying on a main node
- ... see correct numbers and main content in the reuse SearchResults T415524: [Refactor] Show main content in the ReferenceSearchWidget of a sub-ref node without relying on a main node
- ... edit simple main content from the ContextMenuItem T406022: [Refactor] Allow editing main content in the ReferenceDialog of a sub-ref node without relying on a main node
- ... edit simple main content from the ReferenceList T406022: [Refactor] Allow editing main content in the ReferenceDialog of a sub-ref node without relying on a main node
- ... edit citation template main content from the ContextMenuItem T420971: [Refactor] Allow editing main content in the CitationDialog of a sub-ref node without relying on a main node
- ... edit citation template main content from the ReferenceList T420971: [Refactor] Allow editing main content in the CitationDialog of a sub-ref node without relying on a main node
- ... delete the sub-ref and there's no dangling main content in the ReferenceList or SearchResults T423276: [Refactor] Make sure there's no dangling main content when deleting a sub-ref
- ... delete the main ref and there's no orphaned sub-ref content in the ReferenceList or SearchResults T423277: [Refactor] Make sure there's no orphaned sub-ref when deleting a main
Publishing step:
- ... change and save the main content correctly back to Wikitext T422932: [Refactor] Changed main content should be saved back to Wikitext sub-ref node without relying on a main node
Optional
VisualDiff:
- ... see correct numbers and content in the VisualDiff T404587: [Epic] Fix VisualDiff for incompatibilities with sub-references
Related Bugs
{{Reflist}}
T395083: VE: Cannot render main content from inline main+details when {{reflist}} is used
Deleted/Missing References List
T402900: Avoid orphaning subrefs when a reference list is deleted
T404297: Adding main+details references to an empty article leads to content loss
Other
T403573: Synthetic list defined refs can be orphaned