Page MenuHomePhabricator

VE tries to copy content to a sub-ref if the main ref is defined within a template – but delivers broken wikitext if the main ref uses a template
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue
  • In wikitext, create a page with:
    • An infobox (or any other template) which includes a (main) reference
    • Make sure the reference uses a template, e.g. a standard citation template like {{cite book}}
    • Add a sub-reference to the article text
  • Example:
{{Infobox album
| Artist = Artist name<ref name="Test">{{cite book |last1=Playfair |first1=I. S. O. |author-link1=Ian Stanley Ord Playfair |last2=Stitt |first2=G. M. S. |date=2004 |orig-date=1st pub. [[HMSO]]:1954 |editor-last=Butler |editor-first=J. R. M. |editor-link=James Ramsay Montagu Butler |title=Mediterranean and Middle East Volume I |isbn=1-845740-65-3}}</ref>
}}

Article text.<ref name="Test" details="page 2" />

== References ==
<references />

Screenshot from 2026-03-04 17-48-36.png (1,206×226 px, 32 KB)

  • Edit the page in VisualEditor and make any minor edit in the article text
What happens?
{{Infobox album
| Artist = Artist name<ref name="Test">{{cite book |last1=Playfair |first1=I. S. O. |author-link1=Ian Stanley Ord Playfair |last2=Stitt |first2=G. M. S. |date=2004 |orig-date=1st pub. [[HMSO]]:1954 |editor-last=Butler |editor-first=J. R. M. |editor-link=James Ramsay Montagu Butler |title=Mediterranean and Middle East Volume I |isbn=1-845740-65-3}}</ref>
}}

Article text.<ref name="Test" details="page 2"><templatestyles src="Module:Citation/CS1/styles.css"></templatestyles><cite id="CITEREFPlayfairStitt2004" class="citation book cs1">[[Ian Stanley Ord Playfair|Playfair, I. S. O.]]; Stitt, G. M. S. (2004) [1st pub. [[HMSO]]:1954]. [[James Ramsay Montagu Butler|Butler, J. R. M.]] (ed.). ''Mediterranean and Middle East Volume I''. [[ISBN (identifier)|ISBN]]&nbsp;[[Special:BookSources/1-845740-65-3|<bdi>1-845740-65-3</bdi>]].</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Mediterranean+and+Middle+East+Volume+I&rft.date=2004&rft.isbn=1-845740-65-3&rft.aulast=Playfair&rft.aufirst=I.+S.+O.&rft.au=Stitt%2C+G.+M.+S.&rfr_id=info%3Asid%2Ftest.wikipedia.org%3AUser%3AJohannes+Richter+%28WMDE%29%2Ftest8" class="Z3988"></span></ref>

Minor test edit without touching any ref. 

== References ==
<references>
</references>
What should have happened instead?
  • <ref name="Test" details="page 2" /> should have stayed the way it was. If copying content can't be avoided, at least the template shouldn't break...
Other information
  • Saving the page leads to an reference error in reader's view because the copied content is obviously different from the first reference:

Screenshot from 2026-03-04 17-57-17.png (1,208×363 px, 63 KB)

  • Initially observed in this dewiki article and reported on my talk page
  • The issue wouldn't appear if the main ref was part of the article content and the infobox would just re-use the main ref. But reference content is usually defined when it's first used in an article – in quite a large number of articles that's the infobox...
  • Created a sub-ticket of T412007 because this variation of the bug leads to more severe consequences
Outcome

image.png (971×328 px, 22 KB)

https://de.wikipedia.beta.wmcloud.org/wiki/VESubRefContent

Event Timeline

Change #1248795 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] Converter tests for template-produced main+details

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

Change #1248795 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Converter tests for template-produced main+details

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

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

[mediawiki/extensions/Cite@master] Converter tests: Adding missing html2wt tests and document issues

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

Change #1249366 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Converter tests: Adding missing html2wt tests and document issues

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

Fist assessment:

Tobi_WMDE_SW claimed this task.