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


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:

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

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

<references />

In read mode, everything looks right:

Hello world.[1]

An image[2]


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

In VisualEditor, you get this:

Hello world.[1]

An image[1]

  1. ^ A footnote for the image


  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.


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="//" width="120" height="79" srcset="// 1.5x, // 2x" data-file-width="300" data-file-height="197"/></a></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>
</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?