Page MenuHomePhabricator

Parsoid: Template-generated reference lists are empty
Closed, ResolvedPublic

Description

On master:

$ echo "<ref>Foo</ref> {{echo|<references />}}" | node js/tests/parse.js

<body data-parsoid='{"dsr":[0,39,0,0]}'><span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>Foo&lt;/ref>","dsr":[0,14,5,6]}'><a href="#cite_note-1">[1]</a></span> <ol class="references" about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}' data-parsoid='{"html":"&lt;ol class=\"references\" typeof=\"mw:Extension/references\" about=\"#mwt6\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&lt;references />&amp;quot;}\">&lt;/ol>","dsr":[15,38,null,null],"pi":[[{"k":"1","spc":["","","",""]}]]}'></ol>
</body>

Note the empty <ol> tag, and the absence of the reference contents ("Foo") in the HTML (other than in the data-mw attribute of the span).


Version: unspecified
Severity: normal

Details

Reference
bz57618

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:21 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz57618.

But, this works:

[subbu@earth lib] echo "<ref>Foo</ref> {{Reflist}}" | node parse.js
<body data-parsoid='{"dsr":[0,27,0,0]}'><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>Foo&lt;/ref>","dsr":[0,14,5,6]}'><a href="#cite_note-1">[1]</a></span> <div class="reflist " style=" list-style-type: decimal;" about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Reflist","href":"./Template:Reflist"},"params":{},"i":0}}]}' data-parsoid='{"stx":"html","dsr":[15,26,null,null],"pi":[[]]}'>
<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references group=\"\">&lt;/references>"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> Foo</li></ol></div>
</body>

echo "<ref>Foo</ref> {{echo|<div><references></references></div>}}" | node parse.js works
echo "<ref>Foo</ref> {{echo|<references></references>}}" | node parse.js doesn't work

This also seems to affect the case where <references/> is in the template itself rather than a template parameter:

http://parsoid.wmflabs.org/enwiki/User%3AGWicke%2FTest?oldid=583434444

[20:42] subbu RoanKattouw, gwicke ah .. so, when <references /> is hte top-level node, our template encap/ fragment unpacker code deletes the mw:Extension/references typeof which is what is used to generate references.
[20:42] subbu it just adds the mw:Transclusion typeof to the <ol> in that case
[20:43] subbu which is why <div> or any other top-level wrapper fixes the problem.
[20:43] subbu should be simple to fix.

Change 97839 had a related patch set uploaded by Subramanya Sastry:
(BUG 57618) Bug fix in dom-fragment unpacking of transcluded extensions

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

Change 97839 merged by jenkins-bot:
(Bug 57618) Bug fix in dom-fragment unpacking of transcluded extensions

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

Change 101267 had a related patch set uploaded by GWicke:
Merge "(Bug 57618) Bug fix in dom-fragment unpacking of transcluded extensions"

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

Change 101313 had a related patch set uploaded by GWicke:
(Bug 57618) Bug fix in dom-fragment unpacking of transcluded extensions

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

Change 101267 merged by GWicke:
Merge "(Bug 57618) Bug fix in dom-fragment unpacking of transcluded extensions"

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

Change 101313 merged by GWicke:
(Bug 57618) Bug fix in dom-fragment unpacking of transcluded extensions

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