VisualEditor: References inside galleries being displayed separately, inside the gallery, instead of in the correct <references /> block at the end of the page
Closed, DuplicatePublic

Description

Open a page containing some refs, and then a gallery that contains <ref> tags but no <references /> block inside the gallery. (The references block can be elsewhere on the page.) For example:

==Section==
Hello world.<ref>First footnote</ref>

==Gallery==
<gallery>
File:Example.jpg|An image<ref>A footnote for the image</ref>
</gallery>

==References==
<references />

In read mode, everything looks right:

Section
Hello world.[1]

Gallery
An image[2]

References

  1. ^ First footnote
  2. ^ A footnote for the image

In VisualEditor, you get this:

Section
Hello world.[1]

Gallery
An image[1]

  1. ^ A footnote for the image

References

  1. ^ First footnote

VisualEditor seems to be inserting a ref block into the gallery, even though none exists at that point on the page. Also, it restarts the numbers for the gallery.

Details

Reference
bz72865
bzimport set Reference to bz72865.
Jdforrester-WMF triaged this task as "Low" priority.Jan 20 2015, 8:12 PM
Jdforrester-WMF set Security to None.
Jdforrester-WMF raised the priority of this task from "Low" to "Normal".
Jdforrester-WMF lowered the priority of this task from "Normal" to "Low".
matmarex edited the task description. (Show Details)Feb 16 2015, 3:38 PM

Reproducible in Parsoid:

$ echo -e "<gallery>\nFile:foo.jpg|A <ref group="n">ref one</ref>\n</gallery>" | node parse

<ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foo.jpg|A &lt;ref group=n>ref one&lt;/ref>\n"}}' data-parsoid='{"dsr":[0,62,2,2]}' about="#mwt3">
<li class="gallerybox" style="width: 155px">
<div style="width: 155px">
<div class="thumb" style="width: 150px;">
<div style="margin:35.5px auto;"><a href="/wiki/File:Foo.jpg" class="image"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/0/06/Foo.jpg/120px-Foo.jpg" width="120" height="79" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/0/06/Foo.jpg/180px-Foo.jpg 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/0/06/Foo.jpg/240px-Foo.jpg 2x" data-file-width="300" data-file-height="197"/></a></div>
</div>
<div class="gallerytext">
<p>A <sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span>[</span>n 1<span>]</span></a></sup></p>
</div>
</div>
</li>
</ul><span about="#mwt3">
</span><p about="#mwt3"><br/>
<strong class="error mw-ext-cite-error">Cite error: There are <code>&lt;ref group=n></code> tags on this page, but the references will not show without a <code>{{reflist|group=n}}</code> template (see the <a href="/wiki/Help:Cite_errors/Cite_error_group_refs_without_references" title="Help:Cite errors/Cite error group refs without references">help page</a>).</strong>
<link rel="mw:PageProp/Category" href="./Category:Pages_with_missing_references_list#Main%20Page"/></p>

Could this be caused by using the <gallery>'s contents as a whole page, thus confusing Cite.php?