Steps to replicate the issue (include links if applicable):
- Assume the following Wikitext
<ref name="miller" /> Some content here <ref name="miller">Miller: main content is part of 2nd occurence in text</ref>
- Open VE
- Convert both refs into sub-refs by adding details
- Save the page
What happens?:
- The resulting Wikitext looks like this and the main content moved up
<ref details="page 1" name="miller">Miller: main content is part of 2nd occurence in text</ref> Some content here <ref details="page 2" name="miller" />
What should have happened instead?:
- The resulting Wikitext looks like this and the main content stays at the same place
<ref details="page 1" name="miller" /> Some content here <ref details="page 2" name="miller">Miller: main content is part of 2nd occurence in text</ref>
Notes:
- There is no content loss but this behavior might be considered as a dirty diff by some wikitext editors
- Unintended diff
Breadcrumbs for the fix:
- We currently just link the first sub-ref to the synthetic main content if needed this should be improved:
- The 2nd main-ref's RefNode should have a contentsUsed attribute set
- Make sure that this is also on the sub-ref's RefNode when converting to a sub-ref
- Respect the contentsUsed attribute deciding on which sub-ref gets linked to the synthetic main ref