Page MenuHomePhabricator

VE: Cannot render main content from inline main+details when {{reflist}} is used
Open, Needs TriagePublicBUG REPORT

Description

Context
  • create wikitext:
<ref name="refname" details="page 4 {{Cite book|title=detail}}">This is a reference {{Cite book|title=main}}</ref>
==References==
{{Reflist}}
  • switch to Visual Editor

What happens?:
Visual Editor cannot display the reference and displays a warning instead

Screenshot From 2025-05-22 21-38-51.png (87×1 px, 40 KB)

Implementation
Notes:

The underlying issue also affects the previews in the context menu and when editing details.

The tricky case we want to support is an inline main+details in the article, which is then rendered inside a {{reflist}}. Sample wikitext above has been tweaked to reflect this. Our questions are:

  • Will data-mw be present in Parsoid's reflist <li>, such that the wikitext of the main ref and details can be round-tripped?
    • Yes, the reflist <li> contains full content needed to round trip.
  • Is it possible to find the main footnote body in the DOM?

A major edge case to consider is that the main ref might be defined within a template, which means that VE should *not* be able to find its contents to reconstruct main content. We might not be able to detect this easily when pulling main content from the references list item. See T412007: VE unexpectedly copies reference content from one sub-ref to another if the main ref is defined within a template for an explanation of the issue.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Works for me:

image.png (417×1 px, 38 KB)

Maybe we fixed this somehow by other code changes we did. :)

Could you add the Wikitext of the template used to the task description. I think that would be helpful :-). Or a link to beta / test wikipedia where this can be verified?

WMDE-Fisch renamed this task from VE: cannot display inline main+details in reference list or previews when {{Reflist}} is used to VE: Cannot render main content previews from inline main+details when {{Reflist}} is used.Jun 24 2025, 2:19 PM

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

[mediawiki/extensions/Cite@master] [WIP] Make sure synthetic refs are know with {{reflist}}

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

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

[mediawiki/extensions/Cite@master] Add parser test for main+details and the references tag

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

Change #1165468 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Add parser test for main+details and the references tag

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

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

[mediawiki/extensions/Cite@master] Parsoid: Add bodyHtml of synthetic refs from `details` to mwData

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

Change #1168834 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Parsoid: Add bodyHtml of synthetic refs from `details` to mwData

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

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

[mediawiki/extensions/Cite@master] VE: Emit fresh reflist when saving a reflist template

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

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

[mediawiki/extensions/Cite@master] [Parsoid] Add more checks to detect template wrapped references

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

The current patch shows some issues when Parsoid round tripps the filtered reflist items. We need to solve these to move forward.

Change #1170529 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Parsoid: Add more checks to detect template wrapped references

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

WMDE-Fisch renamed this task from VE: Cannot render main content previews from inline main+details when {{Reflist}} is used to VE: Cannot render main content from inline main+details when {{reflist}} is used.Feb 17 2026, 8:00 AM

Change #1165000 abandoned by WMDE-Fisch:

[mediawiki/extensions/Cite@master] VE: Allow converting mwData refs from transcluded references tags

Reason:

We're going a different approach now for getting that content for synth refs.

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

awight subscribed.

I'm going to pick this up with a focus on the risk that even our newly-refactored solution could still be incompatible with the {{reflist}} template. The current assumption is that if we can solve this task using our new wiring, then the approach will work out overall since the lack of main content is exactly the hole provisionally filled by the synthetic ref.

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

[mediawiki/extensions/Cite@master] [WIP] Converter tests for {{reflist}} and main+details

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

We found that any new solution to finding a subref's main ref needs to *not* know about main refs (or main part of a main+details) that were produced by a transclusion and do not appear at the top-level document, to avoid perpetuating the issue from T412007: VE unexpectedly copies reference content from one sub-ref to another if the main ref is defined within a template. The main ref's InternalList item if produced by a transclusion should render as missing, "This reference is defined in a template"—until T355858: References from template transclusions should be included (read-only) in the internalList is solved.

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

[mediawiki/extensions/Cite@master] [DNM] Parsoid stops emitting synthetic refs

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

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

[mediawiki/core@master] [DNM] Transitional: turn off Cite "synthetic refs"

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

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 #1248836 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [WIP] Ignore synthetic refs when loading from Parsoid

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

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

[mediawiki/extensions/Cite@master] [WIP] Reference list renders without assuming ref node

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

So far, it seems that mainBody (Parsoid-added refListItemId of the main ref, as an attribute on a main+details footnote marker) already carries the information we need. I'm still experimenting with transclusion edge cases.

awight moved this task from Doing to Tech Review on the WMDE-TechWish-Sprint-2026-03-03-Spinach board.

Change #1245347 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Converter tests for {{reflist}} and main+details

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

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

Change #1248787 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Parsoid stops emitting synthetic refs (behind feature flag)

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

Change #1248836 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Don't rely on synthetic refs when loading from Parsoid

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

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

[mediawiki/extensions/Cite@master] [WIP] Reference list renders without assuming ref node

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

Change #1248837 had a related patch set uploaded (by Awight; author: Mareike Heuer):

[mediawiki/extensions/Cite@master] [WIP] Reference list renders without assuming ref node

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