mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
Improve test coverage for incomplete follow=… rendering
There is currently no test coverage for recursively parsing the contents of a <ref>…</ref> together with an incomplete follow="…". This is critical because that's an entirely separate, special code path (the one that creates a <p> instead of an <li>). Without this test we could return unparsed wikitext and never notice. I discovered this while playing with I0b0e358. Bug: T245549 Change-Id: Ie65c6bf6bf75db26e0fff733c93cfa28ee7bd228
This commit is contained in:
parent
52df9bd54f
commit
7a9a48b1e0
|
@ -571,22 +571,22 @@ It's not possible to follow="…" a <ref> defined in the <references> section
|
|||
!! test
|
||||
A follow="…" before its parent is not merged
|
||||
!! wikitext
|
||||
<ref follow="theName">theFollows</ref>
|
||||
<ref name="theName">theValue</ref>
|
||||
<ref follow="theName">''theFollows''</ref>
|
||||
<ref name="theName">''theValue''</ref>
|
||||
<references />
|
||||
!! html/php
|
||||
<p><sup id="cite_ref-theName_2-0" class="reference"><a href="#cite_note-theName-2">[1]</a></sup>
|
||||
</p>
|
||||
<div class="mw-references-wrap"><ol class="references">
|
||||
<p id="cite_note-theName"><span class="reference-text">theFollows</span>
|
||||
<p id="cite_note-theName"><span class="reference-text"><i>theFollows</i></span>
|
||||
</p>
|
||||
<li id="cite_note-theName-2"><span class="mw-cite-backlink"><a href="#cite_ref-theName_2-0">↑</a></span> <span class="reference-text">theValue</span>
|
||||
<li id="cite_note-theName-2"><span class="mw-cite-backlink"><a href="#cite_ref-theName_2-0">↑</a></span> <span class="reference-text"><i>theValue</i></span>
|
||||
</li>
|
||||
</ol></div>
|
||||
!! html/parsoid
|
||||
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"follow":"theName"},"body":{"id":"mw-reference-text-cite_note-1"},"errors":[{"key":"cite_error_references_missing_key","params":["theName"]}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
|
||||
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-theName_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-2"}}'><a href="./Parser_test#cite_note-theName-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
|
||||
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt2"> theFollows</span></span></li><li about="#cite_note-theName-2" id="cite_note-theName-2"><a href="./Parser_test#cite_ref-theName_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-2" class="mw-reference-text">theValue</span></li></ol></div>
|
||||
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt2"> <i>theFollows</i></span></span></li><li about="#cite_note-theName-2" id="cite_note-theName-2"><a href="./Parser_test#cite_ref-theName_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-2" class="mw-reference-text"><i>theValue</i></span></li></ol></div>
|
||||
!! end
|
||||
|
||||
## This is a nasty edge case which was dropping the ref entirely from the
|
||||
|
|
Loading…
Reference in a new issue