Reference Test: Difference between revisions

From Invader Historical Foundation
Jump to navigation Jump to search
(Created page with "!! version 2 !! test Book Referencing attribute rejected by default !! config wgCiteBookReferencing=false !! wikitext <ref name="parent">[foo]</ref> <ref extends="parent">[bar...")
 
No edit summary
Line 1: Line 1:
!! version 2
# Force the test runner to ensure the extension is loaded
!! hooks
ref
references
!! endhooks
 
!! article
Template:echo
!! text
{{{1}}}
!! endarticle
 
!! article
Template:refinref
!! text
<ref>ho</ref>
!! endarticle
 
!! test
!! test
Book Referencing attribute rejected by default
Simple <ref>, no <references/>
!! config
!! wikitext
wgCiteBookReferencing=false
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
!! html
Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
</ol></div>
!! end
 
!! test
Simple <ref>, with <references/>
!! wikitext
!! wikitext
<ref name="parent">[foo]</ref>
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
<ref extends="parent">[bar]</ref>
 
!! html/php
<references />
<p><sup id="cite_ref-parent_1-0" class="reference"><a href="#cite_note-parent-1">&#91;1&#93;</a></sup>
!! html
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; invalid names, e.g. too many</span>
<p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-parent-1"><span class="mw-cite-backlink"><a href="#cite_ref-parent_1-0">↑</a></span> <span class="reference-text">[foo]</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
</li>
</ol></div>
</ol></div>
!! end
!! end
!! article
Template:Simple template
!! text
A ''simple'' template.
!! endarticle


!! test
!! test
Book Referencing attribute allowed with feature flag set
<ref> with a simple template
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="parent">[foo]</ref>
Templating<ref>{{simple template}}</ref>
<ref extends="parent">[bar]</ref>
 
!! html/php
<references/>
<p><sup id="cite_ref-parent_1-0" class="reference"><a href="#cite_note-parent-1">&#91;1&#93;</a></sup>
!! html
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
<p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-parent-1"><span class="mw-cite-backlink"><a href="#cite_ref-parent_1-0">↑</a></span> <span class="reference-text">[foo]</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">A <i>simple</i> template.</span>
<ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2"></a></span> <span class="reference-text">[bar]</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Extending the same base multiple times is fine
<ref> with a <nowiki>
!! options
language=de
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book</ref>
Templating<ref><nowiki>{{simple template}}</nowiki></ref>
<ref extends="a">page 2</ref>
 
<ref extends="a">page 3</ref>
<references />
<references />
!! html/php
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">&#91;1.2&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">{{simple template}}</span>
<ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page 2</span>
</li>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">page 3</span>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
Extended references can be reused
<ref> in a <nowiki>
!! options
!! wikitext
language=de
Templating<nowiki><ref>{{simple template}}</ref></nowiki>
!! config
 
wgCiteBookReferencing=true
<references />
!! html
<p>Templating&lt;ref&gt;{{simple template}}&lt;/ref&gt;
</p><p><br />
</p>
!! end
 
!! test
<ref> in a <!--comment-->
!! wikitext
Templating<!--<ref>{{simple template}}</ref>-->
 
<references />
!! html
<p>Templating
</p><p><br />
</p>
!! end
 
!! test
<!--comment--> in a <ref> (bug 5384)
!! wikitext
!! wikitext
<ref name="a">book</ref>
Templating<ref>Text<!--comment--></ref>
<ref extends="a" name="b">page 2</ref>
 
<ref name="b" />
<references />
!! html
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2">&#91;1.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Text</span>
<ol class="mw-extended-references"><li id="cite_note-b-2"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-b_2-0">1.1,0</a></sup> <sup><a href="#cite_ref-b_2-1">1.1,1</a></sup></span> <span class="reference-text">page 2</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T240424 - Subreference reused as normal ref before its full definition
<references> after <gallery> (bug 6164)
!! config
!! options
wgCiteBookReferencing=true
parsoid=wt2html,html2html
!! wikitext
!! wikitext
<ref name="b" />
<ref>one</ref>
<ref name="b" extends="a">page 2</ref>
 
<ref name="a">book</ref>
<gallery>Image:Foobar.jpg</gallery>
!! html
 
<p><sup id="cite_ref-b_1-0" class="reference"><a href="#cite_note-b-1">&#91;1&#93;</a></sup>
<references />
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "b" defined multiple times with different content</span>
!! html/php
<sup id="cite_ref-a_2-0" class="reference"><a href="#cite_note-a-2">&#91;2&#93;</a></sup>
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p>
</p>
<ul class="gallery mw-gallery-traditional">
<li class="gallerybox" style="width: 155px"><div style="width: 155px">
<div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
<div class="gallerytext">
</div>
</div></li>
</ul>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-b-1"><span class="mw-cite-backlink"><a href="#cite_ref-b_1-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>b</code></span></li>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">one</span>
<li id="cite_note-a-2"><span class="mw-cite-backlink"><a href="#cite_ref-a_2-0">↑</a></span> <span class="reference-text">book</span>
</li>
</li>
</ol></div>
</ol></div>
!! html/parsoid
<p><sup about="#mwt4" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt9" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
<li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
</ul>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><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">one</span></li></ol>
!! end
!! end


!! test
!! test
T240424 - Extended reference reused before defined in the <references> section
{{REVISIONID}} on page with <ref> (bug 6299)
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a" />
{{REVISIONID}}<ref>elite</ref>
<ref name="b" />
<references>
<ref name="b" extends="a">page 2</ref>
<ref name="a">book</ref>
</references>
!! html
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
1337<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup><div class="mw-references-wrap"><ol class="references">
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;2&#93;</a></sup>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">elite</span>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
</li>
</li>
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>b</code></span></li>
</ol></div>
</ol></div>
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "b" defined multiple times with different content</span>
!! end
 
!! test
{{REVISIONID}} on page without <ref> (bug 6299 sanity check)
!! wikitext
{{REVISIONID}}
!! html
<p>1337
</p>
</p>
!! end
!! end


!! test
!! test
T236256 - Naming book references is fine
Ref with content followed by blank ref
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book</ref>
<ref name="blank">content</ref>
<ref extends="a" name="b">page 2</ref>
 
<ref extends="a" name="c">page 3</ref>
<ref name="blank" />
<ref name="b" />
 
<ref name="c" />
<references />
<references />
!! html/php
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;1.1&#93;</a></sup>
</p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">&#91;1.2&#93;</a></sup>
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-c_3-1" class="reference"><a href="#cite_note-c-3">&#91;1.2&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">content</span>
<ol class="mw-extended-references"><li id="cite_note-b-2"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-b_2-0">1.1.0</a></sup> <sup><a href="#cite_ref-b_2-1">1.1.1</a></sup></span> <span class="reference-text">page 2</span>
</li>
</li>
<li id="cite_note-c-3"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-c_3-0">1.2.0</a></sup> <sup><a href="#cite_ref-c_3-1">1.2.1</a></sup></span> <span class="reference-text">page 3</span>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Extending a reference that doesn't exist #1
Blank ref followed by ref with content
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref extends="a">page 1</ref>
<ref name="blank" />
!! html/php
 
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1.1&#93;</a></sup>
<ref name="blank">content</ref>
 
<references />
!! html
<p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">&#91;1&#93;</a></sup>
</p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>a</code></span><ol class="mw-extended-references"><li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1"></a></span> <span class="reference-text">page 1</span>
<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">content</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Extending a reference that doesn't exist #2
Regression: non-blank ref "0" followed by ref with content
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref>book</ref>
<ref name="blank">0</ref>
<ref extends="a">page 1</ref>
 
!! html/php
<ref name="blank">content</ref>
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
 
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;2.1&#93;</a></sup>
<references />
!! html
<p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">&#91;1&#93;</a></sup>
</p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1"></a></span> <span class="reference-text">book</span>
<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">0 <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "blank" defined multiple times with different content</span></span>
</li>
</li>
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>a</code></span><ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page 1</span>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Reference with the same name defined twice
Regression sanity check: non-blank ref "1" followed by ref with content
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book</ref>
<ref name="blank">1</ref>
<ref name="a">magazine</ref>
 
<ref extends="a">page 1</ref>
<ref name="blank">content</ref>
!! html/php
 
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<references />
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
!! html
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
<p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">&#91;1&#93;</a></sup>
</p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">book <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "a" defined multiple times with different content</span></span>
<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">1 <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "blank" defined multiple times with different content</span></span>
<ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page 1</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Can't reuse a name for two book references
Ref names containing a number
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book</ref>
<ref name="test123test">One</ref>
<ref extends="a" name="b">page 2</ref>
<ref name="123test">Two</ref>
<ref extends="a" name="b">page 3</ref>
<ref name="test123">Three</ref>
 
<references />
<references />
!! html/php
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-test123test_1-0" class="reference"><a href="#cite_note-test123test-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-123test_2-0" class="reference"><a href="#cite_note-123test-2">&#91;2&#93;</a></sup>
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-test123_3-0" class="reference"><a href="#cite_note-test123-3">&#91;3&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-test123test-1"><span class="mw-cite-backlink"><a href="#cite_ref-test123test_1-0">↑</a></span> <span class="reference-text">One</span>
<ol class="mw-extended-references"><li id="cite_note-b-2"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-b_2-0">1.1.0</a></sup> <sup><a href="#cite_ref-b_2-1">1.1.1</a></sup></span> <span class="reference-text">page 2 <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "b" defined multiple times with different content</span></span>
</li>
<li id="cite_note-123test-2"><span class="mw-cite-backlink"><a href="#cite_ref-123test_2-0"></a></span> <span class="reference-text">Two</span>
</li>
<li id="cite_note-test123-3"><span class="mw-cite-backlink"><a href="#cite_ref-test123_3-0"></a></span> <span class="reference-text">Three</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Can't extend a book reference (no nesting)
T184912: Consistent normalization of consecutive underscores
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book</ref>
<ref name="x__x">example</ref>
<ref extends="a" name="b">page 2</ref>
<ref extends="b">section 3</ref>
<references />
<references />
!! html/php
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-x_x_1-0" class="reference"><a href="#cite_note-x_x-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;1.1&#93;</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Extending <code>&lt;ref&gt;</code> tags more than one level deep is not allowed</span>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-x_x-1"><span class="mw-cite-backlink"><a href="#cite_ref-x_x_1-0">↑</a></span> <span class="reference-text">example</span>
<ol class="mw-extended-references"><li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">page 2</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Can't extend a book reference (no nesting), specified in reverse order
Erroneous refs
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref extends="b">section 3</ref>
<ref name="0">Zero</ref>
<ref extends="a" name="b">page 2</ref>
 
<ref name="a">book</ref>
<ref>Also zero, but differently! (Normal ref)</ref>
 
<ref />
 
<ref name="foo" name="bar" />
 
<ref name="blankwithnoreference" />
 
<references name="quasit" />
 
<references />
<references />
!! html/php
!! html
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1.1&#93;</a></sup>
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "b" defined multiple times with different content</span>
name cannot be a simple integer. Use a descriptive title</span>
<sup id="cite_ref-a_2-0" class="reference"><a href="#cite_note-a-2">&#91;2&#93;</a></sup>
</p><p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p><p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: The opening <code>&lt;ref&gt;</code> tag is malformed or has a bad name</span>
</p><p><sup id="cite_ref-bar_2-0" class="reference"><a href="#cite_note-bar-2">&#91;2&#93;</a></sup>
</p><p><sup id="cite_ref-blankwithnoreference_3-0" class="reference"><a href="#cite_note-blankwithnoreference-3">&#91;3&#93;</a></sup>
</p><p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid parameter in <code>&lt;references&gt;</code> tag</span>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-b-"><span class="mw-cite-backlink">↑ </span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>b</code></span><ol class="mw-extended-references"><li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">section 3</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Also zero, but differently! (Normal ref)</span>
</li>
</ol></li>
<li id="cite_note-a-2"><span class="mw-cite-backlink"><a href="#cite_ref-a_2-0">↑</a></span> <span class="reference-text">book</span>
</li>
</li>
<li id="cite_note-bar-2"><span class="mw-cite-backlink"><a href="#cite_ref-bar_2-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
no text was provided for refs named <code>bar</code></span></li>
<li id="cite_note-blankwithnoreference-3"><span class="mw-cite-backlink"><a href="#cite_ref-blankwithnoreference_3-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
no text was provided for refs named <code>blankwithnoreference</code></span></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Named reference without text
Can't have name="…" and follow="…" the same time
!! config
!! wikitext
wgCiteBookReferencing=true
<ref name="theName" follow="theFollows">theValue</ref>
<references />
!! html
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
invalid names, e.g. too many</span>
</p>
!! end
 
!! test
Conflicting name="…" and follow="…" still invalid when a third parameter is present
!! wikitext
<ref name="theName" follow="theFollows" dummy="dummy">theValue</ref>
<references />
!! html
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
invalid names, e.g. too many</span>
</p>
!! end
 
!! test
Valid parameters become invalid when a third is present
!! wikitext
<ref name="theName" group="theGroup" dummy="dummy">theValue</ref>
<references group="theGroup" />
!! html
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
invalid names, e.g. too many</span>
</p>
!! end
 
!! test
Simple <ref>, with <references/> in group
!! wikitext
!! wikitext
<ref name="a" />
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
<ref extends="a">page 1</ref>
Wikipedia rocks!<ref group="note">Proceeds of Rockology, vol. XXI</ref>
!! html/php
 
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<references />
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
<references group="note" />
!! html
<p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
Wikipedia rocks!<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;note 1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>a</code></span><ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page 1</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
</ol></div>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - No text for a book reference
Simple <ref>, with <references/> in group, with groupname in Chinese
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="foo">book</ref>
AAA<ref group="">ref a</ref>BBB<ref group="注">note b</ref>CCC<ref group="参">ref c</ref>
<ref extends="foo" />
 
!! html/php
;refs
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">&#91;1&#93;</a></sup>
<references group="参" />
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: The opening <code>&lt;ref&gt;</code> tag is malformed or has a bad name</span>
 
;notes
<references group="" />
!! html
<p>AAA<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>BBB<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;注 1&#93;</a></sup>CCC<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">&#91;参 2&#93;</a></sup>
</p>
</p>
<dl><dt>refs</dt></dl>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">ref a</span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">ref c</span>
</li>
</ol></div>
<dl><dt>notes</dt></dl>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">note b</span>
</li>
</li>
</ol></div>
</ol></div>
Line 317: Line 401:


!! test
!! test
T236256 - Empty text for a book reference
<ref> defined in <references>
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="foo">book</ref>
<ref name="foo" />
<ref extends="foo"></ref>
 
!! html/php
<references>
<ref name="foo">BAR</ref>
</references>
!! html
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">&#91;1&#93;</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; refs with no name must have content</span>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">BAR</span>
</li>
</li>
</ol></div>
</ol></div>
Line 334: Line 418:


!! test
!! test
T236256 - De-facto empty text for a book reference
<ref> defined in <references> called with #tag
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="foo">book</ref>
<ref name="foo" />
<ref extends="foo"> </ref>
 
!! html/php
{{#tag:references|
<ref name="foo">BAR</ref>
}}
!! html
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">&#91;1&#93;</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; refs with no name must have content</span>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">BAR</span>
</li>
</li>
</ol></div>
</ol></div>
Line 351: Line 435:


!! test
!! test
T236256 - Everything in the same group
<ref> defined in <references> error conditions
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref group="g1" name="a">book</ref>
<ref name="foo" group="2" />
<ref group="g1" extends="a" name="b">page</ref>
 
<ref group="g1" name="b" />
<references group="2">
<references group="g1"/>
<ref name="foo" />
!! html/php
<ref name="unused">BAR</ref>
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;g1 1&#93;</a></sup>
<ref name="foo" group="1">bad group</ref>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;g1 1.1&#93;</a></sup>
<ref>BAR BAR</ref>
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2">&#91;g1 1.1&#93;</a></sup>
</references>
!! html
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">&#91;2 1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
<ol class="mw-extended-references"><li id="cite_note-b-2"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-b_2-0">1.1.0</a></sup> <sup><a href="#cite_ref-b_2-1">1.1.1</a></sup></span> <span class="reference-text">page</span>
no text was provided for refs named <code>foo</code></span></li>
</li>
</ol></li>
</ol></div>
</ol></div>
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code>&lt;ref&gt;</code> tag with name "unused" defined in <code>&lt;references&gt;</code> is not used in prior text.</span><br />
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code>&lt;ref&gt;</code> tag in <code>&lt;references&gt;</code> has conflicting group attribute "1".</span><br />
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code>&lt;ref&gt;</code> tag defined in <code>&lt;references&gt;</code> has no name attribute.</span>
</p>
!! end
!! end
!! article
MediaWiki:cite_link_label_group-klingon
!! text
wa'  cha' wej loS vagh jav Soch chorgh Hut wa'maH
!! endarticle


!! test
!! test
T236256 - Base and book reference in different groups
<ref> with custom group link with number names in Klingon
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref group="g1" name="a">book</ref>
Wikipedia rocks!<ref group="klingon">Proceeds of Rockology, vol. XXI</ref>
<ref group="g2" extends="a">page</ref>
 
<references group="g1"/>
<references group="klingon" />
<references group="g2"/>
!! html
!! html/php
<p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;wa&#39;&#93;</a></sup>
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;g1 1&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;g2 1.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
</ol></div>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>a</code></span><ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Extending in the unnamed default group
Consecutive whitespace in custom link label message should not create empty []
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref group="g1" name="a">book</ref>
<ref group="klingon">1st</ref>
<ref extends="a">page</ref>
<ref group="klingon">2nd</ref>
<references group="g1"/>
<references group="klingon" />
!! html/php
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;g1 1&#93;</a></sup>
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;wa&#39;&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;cha&#39;&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">1st</span>
</li>
</li>
</ol></div>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">2nd</span>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>a</code></span><ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Base in the unnamed default group
Bug 31374 regression check: nested strip items
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book</ref>
{{#tag:ref|note<ref>reference</ref>|group=Note}}
<ref group="g1" extends="a">page</ref>
<references group="Note" />
<references group="g1"/>
<references />
!! html/php
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;Note 1&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;g1 1.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink"></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>a</code></span><ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2"></a></span> <span class="reference-text">page</span>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2"></a></span> <span class="reference-text">note<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup></span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">reference</span>
</li>
</li>
</ol></div>
</ol></div>
Line 443: Line 517:


!! test
!! test
T236256 - Extending a multi-part ref should be fine
Bug 13073 regression check: wrapped <references>
!! config
!! options
wgCiteBookReferencing=true
parsoid={"suppressErrors": true}
!! wikitext
!! wikitext
<ref name="a">part 1</ref>
<ref>
<ref follow="a">part 2</ref>
foo
<ref extends="a">ok</ref>
</ref>
<references />
<div><references /></div>
!! html/php
!! html/*
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p><p><sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">part 1 part 2</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">
<ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">ok</span>
foo</span>
</li>
</li>
</ol></li>
</ol></div></div>
!! end
 
!! test
<ref> with no name and no content.
!! wikitext
Bla.<ref></ref>
!! html
<p>Bla.<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
refs with no name must have content</span>
</p>
!! end
 
!! test
<ref> with an empty-string name parameter and no content.
!! wikitext
Bla.<ref name=""></ref>
!! html
<p>Bla.<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
refs with no name must have content</span>
</p>
!! end
 
!! test
<ref> with a non-empty name parameter and no content.
!! wikitext
Bla.<ref name="void"></ref>
!! html
Bla.<sup id="cite_ref-void_1-0" class="reference"><a href="#cite_note-void-1">&#91;1&#93;</a></sup><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-void-1"><span class="mw-cite-backlink"><a href="#cite_ref-void_1-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
no text was provided for refs named <code>void</code></span></li>
</ol></div>
</ol></div>
!! end
!! end


# TODO: T242227 - Should render an error at the third reference.
!! test
!! test
T236256 - Dont allow splitting a book reference for now
<ref> with both name and follow parameters - invalid
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book</ref>
Page one.<ref name="the-name" follow="the-name">This ref is invalid.</ref>
<ref extends="a" name="b">page 2</ref>
<ref follow="b">and page 3 the same time?</ref>
<references />
<references />
!! html/php
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p>Page one.<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;1.1&#93;</a></sup>
invalid names, e.g. too many</span>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<ol class="mw-extended-references"><li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">page 2 and page 3 the same time?</span>
</li>
</ol></li>
</ol></div>
!! end
!! end


!! test
!! test
T236256 - Can't be a follow up and a book reference the same time
Multiple definition (outside <references/>)
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book 1</ref>
<ref name="a">abc</ref>
<ref follow="a" extends="a">huh?</ref>
<ref name="a">def</ref>
<references />
<references />
!! html/php
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; invalid names, e.g. too many</span>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0"></a></span> <span class="reference-text">book 1</span>
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "a" defined multiple times with different content</span></span>
</li>
</li>
</ol></div>
</ol></div>
Line 504: Line 594:


!! test
!! test
T236256 - Can't be a follow up and a book reference the same time, even when referencing 2 different bases
Multiple definition (inside <references/>)
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book 1</ref>
<ref name="a" />
<ref name="b">book 2</ref>
<references>
<ref follow="a" extends="b">huh?</ref>
<ref name="a">abc</ref>
<references />
<ref name="a">def</ref>
!! html/php
</references>
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;2&#93;</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; invalid names, e.g. too many</span>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book 1</span>
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "a" defined multiple times with different content</span></span>
</li>
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0"></a></span> <span class="reference-text">book 2</span>
</li>
</li>
</ol></div>
</ol></div>
Line 526: Line 611:


!! test
!! test
Extending a <ref> that doesn't appear in the text, but in <references>
Multiple definition (mixed outside/inside)
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref extends="a">Page 2</ref>
<ref name="a">abc</ref>
<references>
<references>
<ref name="a">Book</ref>
<ref name="a">def</ref>
</references>
</references>
!! html
!! html
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1.1&#93;</a></sup>
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="reference-text">Book</span>
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "a" defined multiple times with different content</span></span>
<ol class="mw-extended-references"><li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1"></a></span> <span class="reference-text">Page 2</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


!! test
!! test
T239810: Extending a <ref> that doesn't appear in the text, but in {{#tag:references}}
Multiple definition (inside {{#tag:references}})
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref extends="a">Page 2</ref>
<ref name="a" />
{{#tag:references|
{{#tag:references|
<ref name="a">Book</ref>
<ref name="a">abc</ref>
<ref name="a">def</ref>
}}
}}
!! html
!! html
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1.1&#93;</a></sup>
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-2"><span class="mw-cite-backlink">↑ </span> <span class="reference-text">Book</span>
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "a" defined multiple times with different content</span></span>
<ol class="mw-extended-references"><li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1"></a></span> <span class="reference-text">Page 2</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! end
!! end


# Parsoid doesn't rt cleanly because name attribute is actually broken
# here (<ref> tag closes at first >); see next test for a tidied version.
!! test
!! test
Extends <ref> defined in <references> called with #tag
T29694 - [] in reference names in HTML5 fragment mode
!! config
!! config
wgCiteBookReferencing=true
wgFragmentMode=[ 'html5' ]
!! options
parsoid=wt2html
!! wikitext
!! wikitext
<ref name="foo">BAR</ref>
<ref name="[#foo] {bar} <baz>">[bar]</ref>
<ref name="footwo" />
!! html/php
{{#tag:references|
<sup id="cite_ref-&#91;#foo&#93;_&#123;bar&#125;_&lt;baz_1-0" class="reference"><a href="#cite_note-[#foo]_{bar}_&lt;baz-1">&#91;1&#93;</a></sup><div class="mw-references-wrap"><ol class="references">
<ref name="footwo" extends="foo">p. 10</ref>
<li id="cite_note-&#91;#foo&#93;_&#123;bar&#125;_&lt;baz-1"><span class="mw-cite-backlink"><a href="#cite_ref-[#foo]_{bar}_&lt;baz_1-0">↑</a></span> <span class="reference-text">"&gt;[bar]</span>
}}
</li>
!! html
</ol></div>
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">&#91;1&#93;</a></sup>
!! html/parsoid
<sup id="cite_ref-footwo_2-0" class="reference"><a href="#cite_note-footwo-2">&#91;2&#93;</a></sup>
<p><sup about="#mwt2" class="mw-ref" id="cite_ref-[#foo]_{bar}_&lt;baz_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"[#foo] {bar} &lt;baz"},"body":{"id":"mw-reference-text-cite_note-[#foo]_{bar}_&lt;baz-1"}}'><a href="./Parser_test#cite_note-[#foo]_{bar}_&lt;baz-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><li about="#cite_note-[#foo]_{bar}_&lt;baz-1" id="cite_note-[#foo]_{bar}_&lt;baz-1"><a href="./Parser_test#cite_ref-[#foo]_{bar}_&lt;baz_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-[#foo]_{bar}_&lt;baz-1" class="mw-reference-text" data-parsoid="{}">">[bar]</span></li></ol>
!! end
 
!! test
T29694 - [] in reference names in HTML5 fragment mode (tidied)
!! config
wgFragmentMode=[ 'html5' ]
!! wikitext
<ref name="[#foo] {bar} <baz&gt;">[bar]</ref>
<references />
!! html/php
<p><sup id="cite_ref-&#91;#foo&#93;_&#123;bar&#125;_&lt;baz&gt;_1-0" class="reference"><a href="#cite_note-[#foo]_{bar}_&lt;baz&gt;-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">BAR</span>
<li id="cite_note-&#91;#foo&#93;_&#123;bar&#125;_&lt;baz&gt;-1"><span class="mw-cite-backlink"><a href="#cite_ref-[#foo]_{bar}_&lt;baz&gt;_1-0">↑</a></span> <span class="reference-text">[bar]</span>
</li>
</li>
<li id="cite_note-footwo-2"><span class="mw-cite-backlink"><a href="#cite_ref-footwo_2-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; no text was provided for refs named <code>footwo</code></span></li>
</ol></div>
</ol></div>
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref" id="cite_ref-[#foo]_{bar}_&lt;baz>_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"[#foo] {bar} &lt;baz>"},"body":{"id":"mw-reference-text-cite_note-[#foo]_{bar}_&lt;baz>-1"}}'><a href="./Parser_test#cite_note-[#foo]_{bar}_&lt;baz>-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-[#foo]_{bar}_&lt;baz>-1" id="cite_note-[#foo]_{bar}_&lt;baz>-1"><a href="./Parser_test#cite_ref-[#foo]_{bar}_&lt;baz>_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-[#foo]_{bar}_&lt;baz>-1" class="mw-reference-text" data-parsoid="{}">[bar]</span></li></ol>
!! end
#### ----------------------------------------------------------------
#### Parsoid-only testing of Parsoid's impl of <ref> and <references>
#### tags. Parsoid's output for these tags differs from that of the
#### PHP parser.
#### ----------------------------------------------------------------
!! test
Ref: 1. ref-location should be replaced with an index span
!! wikitext
A <ref>foo</ref>
B <ref name="x">foo</ref>
C <ref name="y" />
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"},"body":{"id":"mw-reference-text-cite_note-x-2"}}'><a href="./Parser_test#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></sup>
C <sup about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="./Parser_test#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
<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">foo</span></li>
<li about="#cite_note-x-2" id="cite_note-x-2"><a href="./Parser_test#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
<li about="#cite_note-y-3" id="cite_note-y-3"><a href="./Parser_test#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
</ol>
!! end
!! test
Ref: 2. ref-tags with identical names should all get the same index
!! wikitext
A <ref name="x">foo</ref>
B <ref name="x" />
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"},"body":{"id":"mw-reference-text-cite_note-x-1"}}'><a href="./Parser_test#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Parser_test#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
</ol>
!! end
!! test
Ref: 3. spaces in ref-names should be ignored
!! wikitext
A <ref name="x">foo</ref>
B <ref name=" x " />
C <ref name= x  />
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"},"body":{"id":"mw-reference-text-cite_note-x-1"}}'><a href="./Parser_test#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Parser_test#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></sup>
C <sup about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Parser_test#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></supn></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Parser_test#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
</ol>
!! end
# NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
!! test
Ref: 4. 'constructor' should be accepted as a valid ref-name
!! wikitext
A <ref name="constructor">foo</ref>
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"constructor"},"body":{"id":"mw-reference-text-cite_note-constructor-1"}}'><a href="./Parser_test#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="./Parser_test#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
</ol>
!! end
!! test
Ref: 5. body should accept generic wikitext
!! wikitext
A <ref>
This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
</ref>
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
<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"> This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
</span></li>
</ol>
!! end
!! test
Ref: 6. indent-pres should not be output in ref-body
!! wikitext
A <ref>
foo
bar
baz
</ref>
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<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">
foo
bar
baz
</span></li>
</ol>
!! end
!! test
Ref: 7. No p-wrapping in ref-body
!! wikitext
A <ref>
foo
bar
baz
booz
</ref>
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<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">
foo
bar
baz
booz
</span></li>
</ol>
!! end
!! end


!! test
!! test
Extends parent <ref> defined in <references> called with #tag
Ref: 8. transclusion wikitext has lower precedence
!! wikitext
A <ref> foo {{echo|</ref> B C}}
 
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup> B C}}</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<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"> foo {{echo|</span></li>
</ol>
!! end
 
!! test
Ref: 9. unclosed comments should not leak out of ref-body
!! wikitext
A <ref> foo <!--</ref> B C
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup> B C</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<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"> foo <!----></span></li>
</ol>
!! end
 
!! test
Ref: 10. Unclosed HTML tags should not leak out of ref-body
!! wikitext
A <ref> <b> foo </ref> B C
 
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup> B C</p>
 
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<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"> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
</ol>
!! end
 
!! test
Ref: 11. ref-tags acts like an inline element wrt P-wrapping
!! wikitext
A <ref>foo</ref> B
C <ref>bar</ref> D
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup> B
C <sup about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2"><span class="mw-reflink-text">[2]</span></a></sup> D</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
<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">foo</span></li>
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
</ol>
!! end
 
!! test
Ref: 12. ref-tags act as trailing newline migration barrier
!! wikitext
<!--the newline at the end of this line moves out of the p tag-->a
 
b<!--the newline at the end of this line stays inside the p tag--> <ref />
<ref />
 
c
<references />
!! html/parsoid
<!--the newline at the end of this line moves out of the p tag--><p>a</p>
 
 
<p>b<!--the newline at the end of this line stays inside the p tag--> <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Parser_test#cite_note-2"><span class="mw-reflink-text">[2]</span></a></sup></p>
 
<p>c</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
<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></li>
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
!! end
 
!! test
Ref: 13. ref-tags are not SOL-transparent and block indent-pres
!! wikitext
<ref>foo</ref> A
<ref>bar
</ref> B
<references />
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup> A
<sup about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2"><span class="mw-reflink-text">[2]</span></a></sup> B</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
<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">foo</span></li>
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
</span></li>
</ol>
!! end
 
## Roundtripping fails because of nowiki'ing
!! test
Ref: 14. A nested ref-tag should be emitted as plain text
!! options
parsoid=wt2html
!! wikitext
<ref>foo <ref>bar</ref> baz</ref>
 
<references />
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> baz&lt;/ref></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><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" data-parsoid="{}">foo &lt;ref>bar</span></li></ol>
!! end
 
!! test
Ref: 15. ref-tags with identical names should get identical indexes
!! wikitext
A1 <ref name="a">foo</ref> A2 <ref name="a" />
B1 <ref name="b" /> B2 <ref name="b">bar</ref>
 
<references />
!! html/parsoid
<p>A1 <sup about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></sup> A2 <sup about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Parser_test#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></sup>
B1 <sup about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="./Parser_test#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></sup> B2 <sup about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"},"body":{"id":"mw-reference-text-cite_note-b-2"}}'><a href="./Parser_test#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></sup></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
</ol>
!! end
 
## We don't bother wt2wt-ing non-standard whitespace
!! test
Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
!!options
parsoid=wt2html
!! wikitext
A <ref >foo</ref >
 
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<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">foo</span></li></ol>
!! end
 
!! test
Ref: 17. Generate valid HTML5 id/about attributes
!! wikitext
<ref name="a b">foo</ref>
<ref name=":0">ve-created name</ref>
 
<references />
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a b"},"body":{"id":"mw-reference-text-cite_note-a_b-1"}}'><a href="./Parser_test#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref" id="cite_ref-:0_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":":0"},"body":{"id":"mw-reference-text-cite_note-:0-2"}}'><a href="./Parser_test#cite_note-:0-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Parser_test#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li><li about="#cite_note-:0-2" id="cite_note-:0-2"><a href="./Parser_test#cite_ref-:0_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-:0-2" class="mw-reference-text">ve-created name</span></li></ol>
 
!! end
 
!! test
Ref: 18. T58916: Extension attributes should be parsed as plain text
!! config
!! config
wgCiteBookReferencing=true
wgFragmentMode=[ 'html5', 'legacy' ]
!! wikitext
!! wikitext
<ref>BAR</ref>
<ref name="{{echo|a}}">foo</ref>
<ref name="footwo" extends="foo">page 7</ref>
 
<ref name="foo" />
<references />
{{#tag:references|
!! html/php
<ref name="foo">book name</ref>
<p><sup id="cite_ref-&#123;&#123;echo&#124;a&#125;&#125;_1-0" class="reference"><a href="#cite_note-{{echo|a}}-1">&#91;1&#93;</a></sup>
}}
!! html
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-footwo_2-0" class="reference"><a href="#cite_note-footwo-2">&#91;2.1&#93;</a></sup>
<sup id="cite_ref-foo_3-0" class="reference"><a href="#cite_note-foo-3">&#91;2&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">BAR</span>
<li id="cite_note-&#123;&#123;echo&#124;a&#125;&#125;-1"><span class="mw-cite-backlink"><a href="#cite_ref-{{echo|a}}_1-0">↑</a></span> <span class="reference-text">foo</span>
</li>
<li id="cite_note-foo-3"><span class="mw-cite-backlink"><a href="#cite_ref-foo_3-0">↑</a></span> <span class="reference-text">book name</span>
<ol class="mw-extended-references"><li id="cite_note-footwo-2"><span class="mw-cite-backlink"><a href="#cite_ref-footwo_2-0">↑</a></span> <span class="reference-text">page 7</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! html/parsoid
<p><sup class="mw-ref" id="cite_ref-{{echo|a}}_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"{{echo|a}}"},"body":{"id":"mw-reference-text-cite_note-{{echo|a}}-1"}}'><a href="./Parser_test#cite_note-{{echo|a}}-1"><span class="mw-reflink-text">[1]</span></a></sup>
</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_ref-{{echo|a}}_1-1" id="cite_note-{{echo|a}}-1"><a href="./Parser_test#cite_ref-{{echo|a}}_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-{{echo|a}}-1" class="mw-reference-text">foo</span></li>
</ol>
!! end
!! end


# Parsoid doesn't wt2wt this cleanly because we serialize both
# versions of the name the same way ("a & b")
!! test
!! test
Interleaved extends groups
Ref: 19. ref-tags with identical name encodings should get identical indexes
!! config
!! config
wgCiteBookReferencing=true
wgFragmentMode=[ 'html5', 'legacy' ]
!! options
parsoid=wt2html,html2html
!! wikitext
!! wikitext
<ref name="a">text-a</ref>
1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
<ref name="c">text-c</ref>


<ref extends="a">page b</ref>
<ref extends="c">page d</ref>
<references />
<references />
!! html
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p>1 <sup id="cite_ref-a_&amp;_b_1-0" class="reference"><a href="#cite_note-a_&amp;_b-1">&#91;1&#93;</a></sup> 2 <sup id="cite_ref-a_&amp;_b_1-1" class="reference"><a href="#cite_note-a_&amp;_b-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-c_2-0" class="reference"><a href="#cite_note-c-2">&#91;2&#93;</a></sup>
</p><p><sup id="cite_ref-3" class="reference"><a href="#cite_note-3">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4">&#91;2.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0"></a></span> <span class="reference-text">text-a</span>
<li id="cite_note-a_&amp;_b-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_&amp;_b_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_&amp;_b_1-1">1.1</a></sup></span> <span class="reference-text">foo</span>
<ol class="mw-extended-references"><li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3"></a></span> <span class="reference-text">page b</span>
</li>
</li>
</ol></li>
</ol></div>
<li id="cite_note-c-2"><span class="mw-cite-backlink"><a href="#cite_ref-c_2-0">↑</a></span> <span class="reference-text">text-c</span>
!! html/parsoid
<ol class="mw-extended-references"><li id="cite_note-4"><span class="mw-cite-backlink"><a href="#cite_ref-4">↑</a></span> <span class="reference-text">page d</span>
<p>1 <sup about="#mwt3" class="mw-ref" id="cite_ref-a_&amp;_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp; b"},"body":{"id":"mw-reference-text-cite_note-a_&amp;_b-1"}}'><a href="./Parser_test#cite_note-a_&amp;_b-1"><span class="mw-reflink-text">[1]</span></a></sup> 2 <sup about="#mwt4" class="mw-ref" id="cite_ref-a_&amp;_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp; b"}}'><a href="./Parser_test#cite_note-a_&amp;_b-1"><span class="mw-reflink-text">[1]</span></a></sup>
</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
<li about="cite_note-a_&amp;_b-1" id="cite_note-a_&amp;_b-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_&amp;_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_&amp;_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_&amp;_b-1" class="mw-reference-text">foo</span></li>
</ol>
!! end
 
!! test
Ref: 20. ref-tags with identical names but different content should keep it
!! wikitext
A <ref name="foo">Foo one</ref>
B <ref name="foo">Foo two</ref>
C <ref name="foo" />
 
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"},"body":{"id":"mw-reference-text-cite_note-foo-1"}}'><a href="./Parser_test#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"},"body":{"html":"Foo two"}}'><a href="./Parser_test#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></sup>
C <sup about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Parser_test#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Parser_test#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
</ol>
!! end
 
!! test
References: 1a. references tag without any refs should be handled properly
!! wikitext
<references />
!! html/parsoid
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
!! end
 
!! test
References: 1b. references tag without any refs should be handled properly
!! wikitext
<references></references>
!! html/parsoid
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{},"body":{"html":""}}'></ol>
!! end
 
!! test
References: 2. references tag with group only outputs references from that group
!! wikitext
A <ref group="a">foo</ref>
B <ref group="b">bar</ref>
C <ref>baz</ref>
 
<references group="a" />
<references />
<references group="b" />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"a"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"b"},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></sup>
C <sup class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<ol class="mw-references references" data-mw-group="a" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
</ol>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
</ol>
<ol class="mw-references references" data-mw-group="b" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
</ol>
!! end
 
!! test
References: 3. ref list should be cleared after processing references
!! wikitext
A <ref>foo</ref>
 
<references />
 
B <ref>bar</ref>
 
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><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">foo</span></li>
</ol>
 
<p>B <sup about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
</ol>
!! end
 
!! test
References: 4. only referenced group should be cleared after processing references
!! wikitext
A <ref group="a">afoo</ref>
B <ref>bfoo</ref>
 
<references group="a" />
 
C <ref>cfoo</ref>
 
<references />
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"a"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<ol class="mw-references references" data-mw-group="a" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
</ol>
 
<p>C <sup about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3"><span class="mw-reflink-text">[2]</span></a></sup></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
</ol>
!! end
 
## Don't expect this to rt since we're dropping content
!! test
References: 5. ref tags in references should be processed while ignoring all other content
!! options
parsoid=wt2html,html2html
!! wikitext
A <ref name="a" />
B <ref name="b">bar</ref>
 
<references>
<ref name="a">foo</ref>
This should just get lost.
</references>
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Parser_test#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"},"body":{"id":"mw-reference-text-cite_note-b-2"}}'><a href="./Parser_test#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></sup></p>
 
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;sup about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"attrs\":{\"name\":\"a\"},\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"}}&#39;>&lt;a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Parser_test#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Parser_test#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
</ol>
!! end
 
!! test
References: 6. <references /> from a transclusion
!! wikitext
<ref>Foo</ref> {{echo|<references />}}
!! html/php
<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup> <div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Foo</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! html/php+tidy
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup> </p><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Foo</span>
</li>
</ol></div>
!! html/parsoid
<p><sup about="#mwt6" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> </p><ol class="mw-references references" typeof="mw:Extension/references mw:Transclusion" about="#mwt3" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><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">Foo</span></li></ol>
!! end
!! end


!! test
!! test
Multiple groups with extends
References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
!! config
!! wikitext
wgCiteBookReferencing=true
A <ref>foo bar for a</ref>
B <ref group="X" name="b" />
 
<references />
 
<references group="X">
<ref name="b">foo</ref>
</references>
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="./Parser_test#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></sup>
</p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
<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">foo bar for a</span></li>
</ol>
 
<ol class="mw-references references" data-mw-group="X" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;sup about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"attrs\":{\"name\":\"b\"},\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"}}&#39;>&lt;a href=\"./Parser_test#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/sup>\n"}}'>
<li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Parser_test#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
</ol>
!! end
 
!! test
References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
!! wikitext
!! wikitext
<ref name="a">text-a</ref>
X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
<ref extends="a">page b</ref>
<references />
<references />
!! html/parsoid
<p>X<sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><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">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
</ol>
!! end
!! test
References: 9. Generate missing references list at the end
!! wikitext
A <ref>foo</ref>
B <ref group="inexistent">bar</ref>
!! html/parsoid
<p>A <sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup> B <sup class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"inexistent"},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
<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">foo</span></li>
</ol>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
</ol>
!! end


<ref name="c">text-c</ref>
!! test
<ref extends="c">page d</ref>
References: 10.1. New <references/> shouldn't be added for unrelated edits.
!! options
parsoid={
  "modes": ["selser"],
  "changes": [["#x", "remove"]],
  "selser": "noauto"
}
!! wikitext
Unrelated text<span id="x"> that's going to disappear</span>.
A <ref>foo</ref>
!! wikitext/edited
Unrelated text.
A <ref>foo</ref>
!! end
 
!! test
References: 10.2. New <references/> shouldn't be added for unrelated edits.
!! options
parsoid={
  "modes": ["selser"],
  "changes": [["#x", "remove"]],
  "selser": "noauto",
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
Unrelated text<span id="x"> that's going to disappear</span>.
A <ref>foo</ref>
!! wikitext/edited
Unrelated text.
A <ref>foo</ref>
!! end
 
# Doesn't wt2wt cleanly because we don't encode the &amp; in html2wt direction
!! test
Entities in ref name
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! options
parsoid=wt2html,html2html
!! wikitext
<ref name="test &amp; me {{echo|foo}}">hi</ref>
<references />
<references />
!! html
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-test_&amp;_me_&#123;&#123;echo&#124;foo&#125;&#125;_1-0" class="reference"><a href="#cite_note-test_&amp;_me_{{echo|foo}}-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">text-a</span>
<li id="cite_note-test_&amp;_me_&#123;&#123;echo&#124;foo&#125;&#125;-1"><span class="mw-cite-backlink"><a href="#cite_ref-test_&amp;_me_{{echo|foo}}_1-0">↑</a></span> <span class="reference-text">hi</span>
<ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page b</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
<p><sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">&#91;1&#93;</a></sup>
!! html/parsoid
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4">&#91;1.1&#93;</a></sup>
<p><sup about="#mwt2" class="mw-ref" id="cite_ref-test_&amp;_me_{{echo|foo}}_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"test &amp; me {{echo|foo}}"},"body":{"id":"mw-reference-text-cite_note-test_&amp;_me_{{echo|foo}}-1"}}'><a href="./Parser_test#cite_note-test_&amp;_me_{{echo|foo}}-1"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-test_&amp;_me_{{echo|foo}}-1" id="cite_note-test_&amp;_me_{{echo|foo}}-1"><a href="./Parser_test#cite_ref-test_&amp;_me_{{echo|foo}}_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_&amp;_me_{{echo|foo}}-1" class="mw-reference-text">hi</span></li>
</ol>
!! end
 
## The output here may look funny, but it's what the php parser will do.  The
## unclosed references tag becomes escaped text, and then a new references
## tag is auto-generated.  The test is wt2html only because it roundtrips with
## nowiki tags, and the auto-generated references tag is only dropped in
## rtTestMode.
!! test
Generate references for unclosed references tag
!! options
parsoid=wt2html
!! wikitext
a<ref>foo</ref>
 
<references>
!! html/parsoid
<p>a<sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<p>&lt;references></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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">foo</span></li></ol>
!! end
 
!! test
New reference serializes on its own line
!! options
parsoid=wt2wt,html2wt
!! wikitext
foo
<references />
!! html/parsoid
foo<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
!! end
 
!! test
Ref in ref
!! wikitext
test <ref>hi {{refinref}}</ref>
<references />
!! html/php
<p>test <sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-c-3"><span class="mw-cite-backlink"><a href="#cite_ref-c_3-0">↑</a></span> <span class="reference-text">text-c</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">hi </span>
<ol class="mw-extended-references"><li id="cite_note-4"><span class="mw-cite-backlink"><a href="#cite_ref-4">↑</a></span> <span class="reference-text">page d</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code>&lt;ref&gt;</code> tag defined in <code>&lt;references&gt;</code> has no name attribute.</span>
</p>
!! html/parsoid
<p>test <sup about="#mwt4" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><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">hi <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"refinref","href":"./Template:Refinref"},"params":{},"i":0}}]}'></span></span></li></ol>
!! end
## Parsoid responsive references tests
!! test
Responsive references: disabled, autogenerated
!! options
parsoid={
  "modes": ["wt2html"],
  "responsiveReferences": { "enabled": false, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol>
!! end
!! end


!! test
!! test
Multiple groups with extends, duplicated names across groups
Responsive references: enabled, autogenerated
!! config
!! options
wgCiteBookReferencing=true
parsoid={
  "modes": ["wt2html"],
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-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":{},"autoGenerated":true}'><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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
!! end
 
!! test
Responsive references: enabled, autogenerated, exceed
!! options
parsoid={
  "modes": ["wt2html"],
  "responsiveReferences": { "enabled": true, "threshold": 1 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<div class="mw-references-wrap mw-references-columns" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
!! end
 
!! test
Responsive references: disabled
!! options
parsoid={
  "responsiveReferences": { "enabled": false, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references />
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol>
!! end
 
!! test
Responsive references: enabled
!! options
parsoid={
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references />
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-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="#mwt6" 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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
!! end
 
!! test
Responsive references: enabled, exceed
!! options
parsoid={
  "responsiveReferences": { "enabled": true, "threshold": 1 }
}
!! wikitext
!! wikitext
<ref name="a">text-a</ref>
Test <ref>1</ref><ref>2</ref>
<ref extends="a">page b</ref>
<references />
<references />
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<div class="mw-references-wrap mw-references-columns" typeof="mw:Extension/references" about="#mwt6" 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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
!! end
!! test
Responsive references: disabled, explicit
!! options
parsoid={
  "responsiveReferences": { "enabled": false, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="" />
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-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="#mwt6" data-mw='{"name":"references","attrs":{"responsive":""}}'><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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
!! end
!! test
Responsive references: disabled, explicit, exceed
!! options
parsoid={
  "responsiveReferences": { "enabled": false, "threshold": 1 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="" />
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<div class="mw-references-wrap mw-references-columns" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"responsive":""}}'><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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
!! end
!! test
Responsive references: enabled, explicit off
!! options
parsoid={
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="0" />
!! html/parsoid
<p>Test <sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"responsive":"0"}}'><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">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol>
!! end


<ref name="a">text-c</ref>
!! test
<ref extends="a">page d</ref>
Responsive references: roundtrip templates
!! options
parsoid={
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
test <ref>123</ref>
 
{{echo|haha<references/>}}
!! html/parsoid
<p>test <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"haha&lt;references/>"}},"i":0}}]}'>haha</p><div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" 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">123</span></li></ol></div>
!! end
 
## End Parsoid responsive references tests
 
!! article
Template:CircularRef
!! text
<ref>Hi {{CircularRef}}</ref>
!! endarticle
 
!! test
CircularRef
!! wikitext
<ref>Hi {{CircularRef}}</ref>
<references />
<references />
!! html
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">text-a</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Hi </span>
<ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page b</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
<p><sup id="cite_ref-a_3-0" class="reference"><a href="#cite_note-a-3">&#91;1&#93;</a></sup>
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code>&lt;ref&gt;</code> tag defined in <code>&lt;references&gt;</code> has no name attribute.</span>
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4">&#91;1.1&#93;</a></sup>
</p>
!! html/parsoid
<p><sup about="#mwt4" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><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">Hi <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'></span></span></li></ol>
!! end
 
!! test
T15673: <ref> with direction "rtl"
!! wikitext
<ref dir="rtl">TEST</ref>
 
<references />
!! html/php
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-3"><span class="mw-cite-backlink"><a href="#cite_ref-a_3-0">↑</a></span> <span class="reference-text">text-c</span>
<li id="cite_note-1" class="mw-cite-dir-rtl"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">TEST</span>
<ol class="mw-extended-references"><li id="cite_note-4"><span class="mw-cite-backlink"><a href="#cite_ref-4">↑</a></span> <span class="reference-text">page d</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! html/parsoid
<p><sup about="#mwt4" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"rtl"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" class="mw-cite-dir-rtl"><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">TEST</span></li></ol>
!! end
!! end


!! test
!! test
Intervening ref before extends
T15673: <ref> with direction "ltr"
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">book</ref>
<ref dir="ltr">TEST</ref>
<ref>another</ref>
<ref extends="a">page 2</ref>


<references />
<references />
!! html/php
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;2&#93;</a></sup>
<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">&#91;1.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">book</span>
<li id="cite_note-1" class="mw-cite-dir-ltr"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">TEST</span>
<ol class="mw-extended-references"><li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">page 2</span>
</li>
</li>
</ol></li>
</ol></div>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">another</span>
!! html/parsoid
<p><sup about="#mwt4" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"ltr"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" class="mw-cite-dir-ltr"><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">TEST</span></li></ol>
!! end
 
!! test
T15673: <ref> with direction "LTR", keeps upper case
!! wikitext
<ref dir="LTR">TEST</ref>
 
<references />
!! html/php
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1" class="mw-cite-dir-ltr"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">TEST</span>
</li>
</li>
</ol></div>
</ol></div>
!! html/parsoid
<p><sup about="#mwt4" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"LTR"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" class="mw-cite-dir-ltr"><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">TEST</span></li></ol>
!! end
!! end


!! test
!! test
Normal refs after extends
T15673: <ref> with direction "nonsense", strip invalid dir attribute and shows error
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a">text-a</ref>
<ref dir="nonsense">TEST</ref>
<ref extends="a">page b</ref>


<ref name="c">text-c</ref>
<references />
<references />
!! html
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">&#91;1.1&#93;</a></sup>
</p><p><sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">&#91;2&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">text-a</span>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">TEST<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; dir attribute "nonsense" is unknown. Must be ltr or rtl</span></span>
<ol class="mw-extended-references"><li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2"></a></span> <span class="reference-text">page b</span>
</li>
</li>
</ol></li>
</ol></div>
<li id="cite_note-c-3"><span class="mw-cite-backlink"><a href="#cite_ref-c_3-0">↑</a></span> <span class="reference-text">text-c</span>
!! html/parsoid
<p><sup about="#mwt4" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"nonsense"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><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">TEST</span></li></ol>
!! end
 
!! test
T15673: Direction is supported when specifying name and group
!! wikitext
<ref dir="ltr" name="a" group="note">TEST</ref>
 
<references group="note" />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;note 1&#93;</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1" class="mw-cite-dir-ltr"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">TEST</span>
</li>
</li>
</ol></div>
</ol></div>
!! html/parsoid
<p><sup about="#mwt4" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"ltr","name":"a","group":"note"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;" data-mw-group="note"><span class="mw-reflink-text">[note 1]</span></a></sup></p>
<ol class="mw-references references" data-mw-group="note" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"note"}}'><li about="#cite_note-a-1" id="cite_note-a-1" class="mw-cite-dir-ltr"><a href="./Parser_test#cite_ref-a_1-0" data-mw-group="note" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">TEST</span></li></ol>
!! end
## Just to catch regressions in Parsoid's tree-building / p-wrapping
!! test
Ref with block content in formatting tag
!! wikitext
''hi<ref><div>ho</div></ref>''
<references />
!! html/parsoid
<p><i>hi<sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></i></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><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"><div data-parsoid='{"stx":"html"}'>ho</div></span></li></ol>
!! end
!! end


!! test
!! test
T242110: Copy-pasted, named sub-references should be merged and not mess with the numbering
T196827: Use the dir parameter only from the full definition of a named ref tag
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a1" extends="a">a1</ref>
abc<ref name="r1" />def
<ref name="a1" extends="a">a1</ref>
 
<references>
ghi<ref name="r1" dir="rtl">jkl</ref>mno
<ref name="a">a</ref>
 
</references>
<references />
!! html
!! html/php
<p><sup id="cite_ref-a1_1-0" class="reference"><a href="#cite_note-a1-1">&#91;1.1&#93;</a></sup>
<p>abc<sup id="cite_ref-r1_1-0" class="reference"><a href="#cite_note-r1-1">&#91;1&#93;</a></sup>def
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1">&#91;1.1&#93;</a></sup>
</p><p>ghi<sup id="cite_ref-r1_1-1" class="reference"><a href="#cite_note-r1-1">&#91;1&#93;</a></sup>mno
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="reference-text">a</span>
<li id="cite_note-r1-1" class="mw-cite-dir-rtl"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-r1_1-0">1.0</a></sup> <sup><a href="#cite_ref-r1_1-1">1.1</a></sup></span> <span class="reference-text">jkl</span>
<ol class="mw-extended-references"><li id="cite_note-a1-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a1_1-0">1.1.0</a></sup> <sup><a href="#cite_ref-a1_1-1">1.1.1</a></sup></span> <span class="reference-text">a1</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! html/parsoid
<p>abc<sup about="#mwt3" class="mw-ref" id="cite_ref-r1_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"r1"}}'><a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>def</p>
<p>ghi<sup about="#mwt6" class="mw-ref" id="cite_ref-r1_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"r1","dir":"rtl"},"body":{"id":"mw-reference-text-cite_note-r1-1"}}'><a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>mno</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-r1-1" id="cite_note-r1-1" class="mw-cite-dir-rtl"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-r1_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-r1_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-r1-1" class="mw-reference-text">jkl</span></li></ol>
!! end
!! end


!! test
!! test
T242110: Reused sub-references should be merged and not mess with the numbering
T196827: Ignore the dir parameter from the first use, which is not a full definition, and use the dir value from the full definition of a named ref tag
!! config
wgCiteBookReferencing=true
!! wikitext
!! wikitext
<ref name="a1" extends="a">a1</ref>
abc<ref name="r1" dir="rtl" />def
<ref name="a1" extends="a" />
 
<references>
ghi<ref name="r1">jkl</ref>mno
<ref name="a">a</ref>
 
</references>
<references />
!! html
!! html/php
<p><sup id="cite_ref-a1_1-0" class="reference"><a href="#cite_note-a1-1">&#91;1.1&#93;</a></sup>
<p>abc<sup id="cite_ref-r1_1-0" class="reference"><a href="#cite_note-r1-1">&#91;1&#93;</a></sup>def
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1">&#91;1.1&#93;</a></sup>
</p><p>ghi<sup id="cite_ref-r1_1-1" class="reference"><a href="#cite_note-r1-1">&#91;1&#93;</a></sup>mno
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="reference-text">a</span>
<li id="cite_note-r1-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-r1_1-0">1.0</a></sup> <sup><a href="#cite_ref-r1_1-1">1.1</a></sup></span> <span class="reference-text">jkl</span>
<ol class="mw-extended-references"><li id="cite_note-a1-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a1_1-0">1.1.0</a></sup> <sup><a href="#cite_ref-a1_1-1">1.1.1</a></sup></span> <span class="reference-text">a1</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! html/parsoid
<p>abc<sup about="#mwt3" class="mw-ref" id="cite_ref-r1_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"r1","dir":"rtl"}}'><a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>def</p>
<p>ghi<sup about="#mwt7" class="mw-ref" id="cite_ref-r1_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"r1"},"body":{"id":"mw-reference-text-cite_note-r1-1"}}'><a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>mno</p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-r1-1" id="cite_note-r1-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-r1_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-r1_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-r1-1" class="mw-reference-text">jkl</span></li></ol>
!! end
!! end


!! test
!! test
T242110: Bad extends attributes on reused sub-references should report an error
Similarly named refs with identical bodies
!! wikitext
1 <ref name="1">1</ref> 2 <ref name="1">1</ref>
 
<references />
!! html/parsoid
<p>1 <sup about="#mwt7" class="mw-ref" id="cite_ref-1_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"1"},"body":{"id":"mw-reference-text-cite_note-1-1"}}'><a href="./Parser_test#cite_note-1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> 2 <sup about="#mwt9" class="mw-ref" id="cite_ref-1_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"1"},"body":{"id":"mw-reference-text-cite_note-1-1"}}'><a href="./Parser_test#cite_note-1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
 
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1-1" id="cite_note-1-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-1_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-1_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-1-1" class="mw-reference-text" data-parsoid="{}">1</span></li></ol>
!! end
 
!! test
T220196 - Reference names with high-bit characters, html5 mode
!! config
!! config
wgCiteBookReferencing=true
wgFragmentMode=['html5']
!! wikitext
!! wikitext
<ref name="a1" extends="a">a1</ref>
<ref name="füllen">[bar]</ref>
<ref name="a1" extends="unknown" />
<references />
<references>
!! html/php
<ref name="a">a</ref>
<p><sup id="cite_ref-füllen_1-0" class="reference"><a href="#cite_note-füllen-1">&#91;1&#93;</a></sup>
</references>
!! html
<p><sup id="cite_ref-a1_1-0" class="reference"><a href="#cite_note-a1-1">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1">&#91;1.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="reference-text">a</span>
<li id="cite_note-füllen-1"><span class="mw-cite-backlink"><a href="#cite_ref-füllen_1-0"></a></span> <span class="reference-text">[bar]</span>
<ol class="mw-extended-references"><li id="cite_note-a1-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a1_1-0">1.1.0</a></sup> <sup><a href="#cite_ref-a1_1-1">1.1.1</a></sup></span> <span class="reference-text">a1 <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "a1" defined multiple times with different content</span></span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref" id="cite_ref-füllen_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"füllen"},"body":{"id":"mw-reference-text-cite_note-füllen-1"}}'><a href="./Parser_test#cite_note-füllen_1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-füllen-1" id="cite_note-füllen-1"><a href="./Parser_test#cite_ref-füllen-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-füllen-1" class="mw-reference-text" data-parsoid="{}">[bar]</span></li></ol>
!! end
!! end


!! test
!! test
T242110: Copy-pasted, named sub-references should appear in proper order
T220196 - Reference names with high-bit characters, legacy mode
!! config
!! config
wgCiteBookReferencing=true
wgFragmentMode=['legacy']
!! wikitext
!! wikitext
<ref name="a1" extends="a">a1</ref>
<ref name="füllen">[bar]</ref>
<ref name="a1" extends="a">a1</ref>
<references />
<ref name="b1" extends="b">b1</ref>
!! html/php
<ref name="b1" extends="b" />
<p><sup id="cite_ref-f.C3.BCllen_1-0" class="reference"><a href="#cite_note-f.C3.BCllen-1">&#91;1&#93;</a></sup>
<ref name="c1" extends="c">c1</ref>
<ref name="c1" />
<references>
<ref name="a">a</ref>
<ref name="b">a</ref>
<ref name="c">a</ref>
</references>
!! html
<p><sup id="cite_ref-a1_1-0" class="reference"><a href="#cite_note-a1-1">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1">&#91;1.1&#93;</a></sup>
<sup id="cite_ref-b1_2-0" class="reference"><a href="#cite_note-b1-2">&#91;2.1&#93;</a></sup>
<sup id="cite_ref-b1_2-1" class="reference"><a href="#cite_note-b1-2">&#91;2.1&#93;</a></sup>
<sup id="cite_ref-c1_3-0" class="reference"><a href="#cite_note-c1-3">&#91;3.1&#93;</a></sup>
<sup id="cite_ref-c1_3-1" class="reference"><a href="#cite_note-c1-3">&#91;3.1&#93;</a></sup>
</p>
</p>
<div class="mw-references-wrap"><ol class="references">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-"><span class="mw-cite-backlink">↑ </span> <span class="reference-text">a</span>
<li id="cite_note-f.C3.BCllen-1"><span class="mw-cite-backlink"><a href="#cite_ref-f.C3.BCllen_1-0">↑</a></span> <span class="reference-text">[bar]</span>
<ol class="mw-extended-references"><li id="cite_note-a1-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a1_1-0">1.1.0</a></sup> <sup><a href="#cite_ref-a1_1-1">1.1.1</a></sup></span> <span class="reference-text">a1</span>
</li>
</ol></li>
<li id="cite_note-b-"><span class="mw-cite-backlink">↑ </span> <span class="reference-text">a</span>
<ol class="mw-extended-references"><li id="cite_note-b1-2"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-b1_2-0">2.1.0</a></sup> <sup><a href="#cite_ref-b1_2-1">2.1.1</a></sup></span> <span class="reference-text">b1</span>
</li>
</ol></li>
<li id="cite_note-c-"><span class="mw-cite-backlink">↑ </span> <span class="reference-text">a</span>
<ol class="mw-extended-references"><li id="cite_note-c1-3"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-c1_3-0">3.1.0</a></sup> <sup><a href="#cite_ref-c1_3-1">3.1.1</a></sup></span> <span class="reference-text">c1</span>
</li>
</li>
</ol></li>
</ol></div>
</ol></div>
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref" id="cite_ref-füllen_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"füllen"},"body":{"id":"mw-reference-text-cite_note-füllen-1"}}'><a href="./Parser_test#cite_note-füllen_1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-füllen-1" id="cite_note-füllen-1"><a href="./Parser_test#cite_ref-füllen-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-füllen-1" class="mw-reference-text" data-parsoid="{}">[bar]</span></li></ol>
!! end
!! end

Revision as of 21:43, 27 July 2020

  1. Force the test runner to ensure the extension is loaded

!! hooks ref references !! endhooks

!! article Template:echo !! text {{{1}}} !! endarticle

!! article Template:refinref !! text [1] !! endarticle

!! test Simple Cite error: Closing </ref> missing for <ref> tag !! html

Wikipedia rocks!<a href="#cite_note-1">[1]</a>

  1. <a href="#cite_ref-1">↑</a> Proceeds of Rockology, vol. XXI

!! end

!! test Simple Cite error: Closing </ref> missing for <ref> tag

  1. ho

!! html

Wikipedia rocks!<a href="#cite_note-1">[1]</a>

  1. <a href="#cite_ref-1">↑</a> Proceeds of Rockology, vol. XXI

!! end

!! article Template:Simple template !! text A simple template. !! endarticle


!! test Cite error: Closing </ref> missing for <ref> tag


!! html

Templating<a href="#cite_note-1">[1]</a>

  1. <a href="#cite_ref-1">↑</a> A simple template.

!! end

!! test [1]

  1. with a !! wikitext Templating<ref><nowiki>{{simple template}}

!! html

Templating<a href="#cite_note-1">[1]</a>

  1. <a href="#cite_ref-1">↑</a> Template:Simple template

!! end


!! test Cite error: Closing </ref> missing for <ref> tag</nowiki>


!! html

Templating<ref>Template:Simple template</ref>


!! end

!! test Cite error: Closing </ref> missing for <ref> tag-->


!! html

Templating


!! end

!! test

in a Cite error: Closing </ref> missing for <ref> tag


!! html

Templating<a href="#cite_note-1">[1]</a>

  1. <a href="#cite_ref-1">↑</a> Text

!! end

!! test

Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag with name "blank" defined in <references> group "" has no content.
Cite error: <ref> tag with name "blank" defined in <references> group "" has no content.
Cite error: <ref> tag with name "blank" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "blank" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "blank" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "blank" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "blank" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "test123test" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "123test" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "test123" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "x__x" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: Invalid <ref> tag; name cannot be a simple integer. Use a descriptive title
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag with name "bar" defined in <references> group "" has no content.
Cite error: <ref> tag with name "blankwithnoreference" defined in <references> group "" has no content.
Cite error: Invalid <ref> tag; invalid names, e.g. too many
Cite error: Invalid <ref> tag; invalid names, e.g. too many
Cite error: Invalid <ref> tag; invalid names, e.g. too many
Cite error: <ref> tag in <references> has conflicting group attribute "theGroup".
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag in <references> has conflicting group attribute "note".
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag in <references> has conflicting group attribute "注".
Cite error: <ref> tag in <references> has conflicting group attribute "参".
Cite error: <ref> tag defined in <references> has no name attribute. !! html

<a href="#cite_note-foo-1">[1]</a>

  1. <a href="#cite_ref-foo_1-0">↑</a> BAR

!! end

!! test Cite error: Closing </ref> missing for <ref> tag }} !! html

<a href="#cite_note-foo-1">[1]</a>

  1. <a href="#cite_ref-foo_1-0">↑</a> BAR

!! end

!! test Cite error: Closing </ref> missing for <ref> tag [1 1] [1] </references> !! html

<a href="#cite_note-foo-1">[2 1]</a>

  1. <a href="#cite_ref-foo_1-0">↑</a> Cite error: Invalid <ref> tag; no text was provided for refs named foo

Cite error: <ref> tag with name "unused" defined in <references> is not used in prior text.
Cite error: <ref> tag in <references> has conflicting group attribute "1".
Cite error: <ref> tag defined in <references> has no name attribute.

!! end

!! article MediaWiki:cite_link_label_group-klingon !! text wa' cha' wej loS vagh jav Soch chorgh Hut wa'maH !! endarticle

!! test Cite error: Closing </ref> missing for <ref> tag


!! html

Wikipedia rocks!<a href="#cite_note-1">[wa']</a>

  1. <a href="#cite_ref-1">↑</a> Proceeds of Rockology, vol. XXI

!! end

!! test Consecutive whitespace in custom link label message should not create empty [] !! wikitext [klingon 1] [klingon 2]

  1. 1st
  2. 2nd

!! html

<a href="#cite_note-1">[wa']</a> <a href="#cite_note-2">[cha']</a>

  1. <a href="#cite_ref-1">↑</a> 1st
  2. <a href="#cite_ref-2">↑</a> 2nd

!! end

!! test Bug 31374 regression check: nested strip items !! wikitext [Note 1]

  1. note[2]
  1. BAR BAR
  2. reference

!! html

<a href="#cite_note-2">[Note 1]</a>

  1. <a href="#cite_ref-2">↑</a> note<a href="#cite_note-1">[1]</a>
  1. <a href="#cite_ref-1">↑</a> reference

!! end

!! test Bug 13073 regression check: wrapped Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag defined in <references> has no name attribute.
Cite error: <ref> tag with name "a" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "a" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "a" defined in <references> group "" has no content.
Cite error: <ref> tag with name "a" defined in <references> has group attribute "" which does not appear in prior text.
Cite error: <ref> tag with name "a" defined in <references> has group attribute "" which does not appear in prior text. !! html

<a href="#cite_note-a-1">[1]</a>

  1. <a href="#cite_ref-a_1-0">↑</a> abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! end

!! test Multiple definition (mixed outside/inside) !! wikitext [1]

  1. abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! html

<a href="#cite_note-a-1">[1]</a>

  1. <a href="#cite_ref-a_1-0">↑</a> abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! end

!! test Multiple definition (inside ) !! wikitext [1]

  1. abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! html

<a href="#cite_note-a-1">[1]</a>

  1. <a href="#cite_ref-a_1-0">↑</a> abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! end

  1. Parsoid doesn't rt cleanly because name attribute is actually broken
  2. here (Cite error: Closing </ref> missing for <ref> tag

!! html/php

<a href="#cite_note-[#foo]_{bar}_<baz-1">[1]</a>

  1. <a href="#cite_ref-[#foo]_{bar}_<baz_1-0">↑</a> ">[bar]

!! html/parsoid

<a href="./Parser_test#cite_note-[#foo]_{bar}_<baz-1" style="counter-reset: mw-Ref 1;">[1]</a>

  1. <a href="./Parser_test#cite_ref-[#foo]_{bar}_<baz_1-0" rel="mw:referencedBy"></a> ">[bar]

!! end

!! test T29694 - [] in reference names in HTML5 fragment mode (tidied) !! config wgFragmentMode=[ 'html5' ] !! wikitext [1]

  1. [bar]

!! html/php

<a href="#cite_note-[#foo]_{bar}_<baz>-1">[1]</a>

  1. <a href="#cite_ref-[#foo]_{bar}_<baz>_1-0">↑</a> [bar]

!! html/parsoid

_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"[#foo] {bar} <baz>"},"body":{"id":"mw-reference-text-cite_note-[#foo]_{bar}_<baz>-1"}}'><a href="./Parser_test#cite_note-[#foo]_{bar}_<baz>-1" style="counter-reset: mw-Ref 1;">[1]</a>

  1. -1" id="cite_note-[#foo]_{bar}_<baz>-1"><a href="./Parser_test#cite_ref-[#foo]_{bar}_<baz>_1-0" rel="mw:referencedBy"></a> -1" class="mw-reference-text" data-parsoid="{}">[bar]

!! end


        1. ----------------------------------------------------------------
        2. Parsoid-only testing of Parsoid's impl of Cite error: Closing </ref> missing for <ref> tag

B [1] C [2]

  1. foo
  2. Cite error: Invalid <ref> tag; no text was provided for refs named y

!! html/parsoid

A <a href="./Parser_test#cite_note-1">[1]</a> B <a href="./Parser_test#cite_note-x-2">[2]</a> C <a href="./Parser_test#cite_note-y-3">[3]</a>

  1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo
  2. <a href="./Parser_test#cite_ref-x_2-0" rel="mw:referencedBy"></a> foo
  3. <a href="./Parser_test#cite_ref-y_3-0" rel="mw:referencedBy"></a>

!! end

!! test Ref: 2. ref-tags with identical names should all get the same index !! wikitext A [1] B [1]

  1. 1.0 1.1 foo

!! html/parsoid

A <a href="./Parser_test#cite_note-x-1">[1]</a> B <a href="./Parser_test#cite_note-x-1">[1]</a>

  1. <a href="./Parser_test#cite_ref-x_1-0">1 </a><a href="./Parser_test#cite_ref-x_1-1">2 </a> foo

!! end

!! test Ref: 3. spaces in ref-names should be ignored !! wikitext A [1] B [1] C [1]

  1. 1.0 1.1 1.2 foo

!! html/parsoid

A <a href="./Parser_test#cite_note-x-1">[1]</a> B <a href="./Parser_test#cite_note-x-1">[1]</a> C <a href="./Parser_test#cite_note-x-1">[1]</a></supn>

  1. <a href="./Parser_test#cite_ref-x_1-0">1 </a><a href="./Parser_test#cite_ref-x_1-1">2 </a><a href="./Parser_test#cite_ref-x_1-2">3 </a> foo

!! end

  1. NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)

!! test Ref: 4. 'constructor' should be accepted as a valid ref-name !! wikitext A [1]

  1. foo

!! html/parsoid

A <a href="./Parser_test#cite_note-constructor-1">[1]</a>

  1. <a href="./Parser_test#cite_ref-constructor_1-0" rel="mw:referencedBy"></a> foo

!! end

!! test Ref: 5. body should accept generic wikitext !! wikitext A [1]

  1. This is a bolded link and this is a Template:Echo

!! html/parsoid

A <a href="./Parser_test#cite_note-1">[1]</a>

  1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> This is a <a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a> and this is a transclusion

!! end

!! test Ref: 6. indent-pres should not be output in ref-body !! wikitext A [1]

  1. foo bar baz

!! html/parsoid

A <a href="./Parser_test#cite_note-1">[1]</a>

  1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo bar baz

!! end

!! test Ref: 7. No p-wrapping in ref-body !! wikitext A [1]

  1. foo bar baz booz

!! html/parsoid

A <a href="./Parser_test#cite_note-1">[1]</a>

  1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo bar baz booz

!! end

!! test Ref: 8. transclusion wikitext has lower precedence !! wikitext A [1] B C}}

  1. foo {{echo|

!! html/parsoid

A <a href="./Parser_test#cite_note-1">[1]</a> B C}}

  1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo Template:Echo'><a href="./Parser_test#cite_note-1">[1]</a> B C

    1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo

    !! end

    !! test Ref: 10. Unclosed HTML tags should not leak out of ref-body !! wikitext A [1] B C

    1. foo

    !! html/parsoid

    A <a href="./Parser_test#cite_note-1">[1]</a> B C


    1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo

    !! end

    !! test Ref: 11. ref-tags acts like an inline element wrt P-wrapping !! wikitext A [1] B C [2] D

    1. foo
    2. bar

    !! html/parsoid

    A <a href="./Parser_test#cite_note-1">[1]</a> B C <a href="./Parser_test#cite_note-2">[2]</a> D

    1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo
    2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> bar

    !! end

    !! test Ref: 12. ref-tags act as trailing newline migration barrier !! wikitext a

    b Cite error: The opening <ref> tag is malformed or has a bad name Cite error: The opening <ref> tag is malformed or has a bad name

    c

    !! html/parsoid

    a


    b <a href="./Parser_test#cite_note-1">[1]</a> <a href="./Parser_test#cite_note-2">[2]</a>

    c

    1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a>
    2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a>

    !! end

    !! test Ref: 13. ref-tags are not SOL-transparent and block indent-pres !! wikitext [1] A [2] B

    1. foo
    2. bar

    !! html/parsoid

    <a href="./Parser_test#cite_note-1">[1]</a> A <a href="./Parser_test#cite_note-2">[2]</a> B

    1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo
    2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> bar

    !! end

      1. Roundtripping fails because of nowiki'ing

    !! test Ref: 14. A nested ref-tag should be emitted as plain text !! options parsoid=wt2html !! wikitext Cite error: Closing </ref> missing for <ref> tag baz</ref>


    !! html/parsoid

    <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a> baz</ref>

    1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo <ref>bar

    !! end

    !! test Ref: 15. ref-tags with identical names should get identical indexes !! wikitext A1 [1] A2 [1] B1 [2] B2 [2]

    1. 1.0 1.1 foo
    2. 2.0 2.1 bar

    !! html/parsoid

    A1 <a href="./Parser_test#cite_note-a-1">[1]</a> A2 <a href="./Parser_test#cite_note-a-1">[1]</a> B1 <a href="./Parser_test#cite_note-b-2">[2]</a> B2 <a href="./Parser_test#cite_note-b-2">[2]</a>

    1. <a href="./Parser_test#cite_ref-a_1-0">1 </a><a href="./Parser_test#cite_ref-a_1-1">2 </a> foo
    2. <a href="./Parser_test#cite_ref-b_2-0">1 </a><a href="./Parser_test#cite_ref-b_2-1">2 </a> bar

    !! end

      1. We don't bother wt2wt-ing non-standard whitespace

    !! test Ref: 16. Tokenizer should accept non-standard whitespace in [1] tags !!options parsoid=wt2html !! wikitext A [2]

    1. and
    2. foo

    !! html/parsoid

    A <a href="./Parser_test#cite_note-1">[1]</a>

    1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo

    !! end

    !! test Ref: 17. Generate valid HTML5 id/about attributes !! wikitext [1] [2]

    1. foo
    2. ve-created name

    !! html/parsoid

    <a href="./Parser_test#cite_note-a_b-1" style="counter-reset: mw-Ref 1;">[1]</a> <a href="./Parser_test#cite_note-:0-2" style="counter-reset: mw-Ref 2;">[2]</a>

    1. <a href="./Parser_test#cite_ref-a_b_1-0" rel="mw:referencedBy"></a> foo
    2. <a href="./Parser_test#cite_ref-:0_2-0" rel="mw:referencedBy"></a> ve-created name

    !! end

    !! test Ref: 18. T58916: Extension attributes should be parsed as plain text !! config wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext [1]

    1. foo

    !! html/php

    <a href="#cite_note-Template:Echo-1">[1]</a>

    1. <a href="#cite_ref-Template:Echo_1-0">↑</a> foo

    !! html/parsoid

    <a href="./Parser_test#cite_note-Template:Echo-1">[1]</a>

    1. <a href="./Parser_test#cite_ref-Template:Echo_1-0" rel="mw:referencedBy"></a> foo

    !! end

    1. Parsoid doesn't wt2wt this cleanly because we serialize both
    2. versions of the name the same way ("a & b")

    !! test Ref: 19. ref-tags with identical name encodings should get identical indexes !! config wgFragmentMode=[ 'html5', 'legacy' ] !! options parsoid=wt2html,html2html !! wikitext 1 [1] 2 [1]

    1. 1.0 1.1 foo

    !! html/php

    1 <a href="#cite_note-a_&_b-1">[1]</a> 2 <a href="#cite_note-a_&_b-1">[1]</a>

    1. <a href="#cite_ref-a_&_b_1-0">1.0</a> <a href="#cite_ref-a_&_b_1-1">1.1</a> foo

    !! html/parsoid

    1 <a href="./Parser_test#cite_note-a_&_b-1">[1]</a> 2 <a href="./Parser_test#cite_note-a_&_b-1">[1]</a>

    1. <a href="./Parser_test#cite_ref-a_&_b_1-0">1 </a><a href="./Parser_test#cite_ref-a_&_b_1-1">2 </a> foo

    !! end

    !! test Ref: 20. ref-tags with identical names but different content should keep it !! wikitext A [1] B [1] C [1]

    1. 1.0 1.1 1.2 Foo one Cite error: Invalid <ref> tag; name "foo" defined multiple times with different content

    !! html/parsoid

    A <a href="./Parser_test#cite_note-foo-1">[1]</a> B <a href="./Parser_test#cite_note-foo-1">[1]</a> C <a href="./Parser_test#cite_note-foo-1">[1]</a>

    1. <a href="./Parser_test#cite_ref-foo_1-0">1 </a><a href="./Parser_test#cite_ref-foo_1-1">2 </a><a href="./Parser_test#cite_ref-foo_1-2">3 </a> Foo one

    !! end

    !! test References: 1a. references tag without any refs should be handled properly !! wikitext

    !! html/parsoid

      !! end

      !! test References: 1b. references tag without any refs should be handled properly !! wikitext

      !! html/parsoid

        !! end

        !! test References: 2. references tag with group only outputs references from that group !! wikitext A [a 1] B [b 1] C [1]

        1. foo
        1. baz
        1. bar

        !! html/parsoid

        A <a href="./Parser_test#cite_note-1" data-mw-group="a">[a 1]</a> B <a href="./Parser_test#cite_note-2" data-mw-group="b">[b 1]</a> C <a href="./Parser_test#cite_note-3">[1]</a>

        1. <a href="./Parser_test#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"></a> foo
        1. <a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"></a> baz
        1. <a href="./Parser_test#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"></a> bar

        !! end

        !! test References: 3. ref list should be cleared after processing references !! wikitext A [1]

        1. foo

        B [1]

        1. bar

        !! html/parsoid

        A <a href="./Parser_test#cite_note-1">[1]</a>

        1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo

        B <a href="./Parser_test#cite_note-2">[1]</a>

        1. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> bar

        !! end

        !! test References: 4. only referenced group should be cleared after processing references !! wikitext A [a 1] B [1]

        1. afoo

        C [2]

        1. bfoo
        2. cfoo

        !! html/parsoid

        A <a href="./Parser_test#cite_note-1" data-mw-group="a">[a 1]</a> B <a href="./Parser_test#cite_note-2">[1]</a>

        1. <a href="./Parser_test#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"></a> afoo

        C <a href="./Parser_test#cite_note-3">[2]</a>

        1. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> bfoo
        2. <a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"></a> cfoo

        !! end

          1. Don't expect this to rt since we're dropping content

        !! test References: 5. ref tags in references should be processed while ignoring all other content !! options parsoid=wt2html,html2html !! wikitext A [1] B [2]

        1. foo
        2. bar

        !! html/parsoid

        A <a href="./Parser_test#cite_note-a-1">[1]</a> B <a href="./Parser_test#cite_note-b-2">[2]</a>


          <a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'>
        1. <a href="./Parser_test#cite_ref-a_1-0" rel="mw:referencedBy"></a> foo
        2. <a href="./Parser_test#cite_ref-b_2-0" rel="mw:referencedBy"></a> bar

        !! end

        !! test References: 6. from a transclusion !! wikitext [1] Template:Echo !! html/php

        <a href="#cite_note-1">[1]</a>
        1. <a href="#cite_ref-1">↑</a> Foo

        !! html/php+tidy

        <a href="#cite_note-1">[1]</a>

        1. <a href="#cite_ref-1">↑</a> Foo

        !! html/parsoid

        <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          "}},"i":0}}]}'>
        1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> Foo

        !! end

        !! test References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled !! wikitext A [2] B [X 1]

        1. Foo
        2. foo bar for a
        1. foo

        !! html/parsoid

        A <a href="./Parser_test#cite_note-1">[1]</a> B <a href="./Parser_test#cite_note-b-2" data-mw-group="X">[X 1]</a>

        1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo bar for a
          <a href=\"./Parser_test#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]</span></a></sup>\n"}}'>
        1. <a href="./Parser_test#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"></a> foo

        !! end

        !! test References: 8. T88019: Remove <meta>s from templates inside Cite error: Closing </ref> missing for <ref> tag}}

        !! html/parsoid

        Xfoo Template:Echo and Template:Echo boo</ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-1">[1]</a>

        1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo bar and baz boo

        !! end

        !! test References: 9. Generate missing references list at the end !! wikitext A [1] B [inexistent 1] !! html/parsoid

        A <a href="./Parser_test#cite_note-1">[1]</a> B <a href="./Parser_test#cite_note-2" data-mw-group="inexistent">[inexistent 1]</a>

        1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo
        1. <a href="./Parser_test#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"></a> bar

        !! end

        !! test

        References: 10.1. New
        1. foo
        shouldn't be added for unrelated edits.

        !! options parsoid={

         "modes": ["selser"],
         "changes": "#x", "remove",
         "selser": "noauto"
        

        } !! wikitext Unrelated text that's going to disappear. A [1] !! wikitext/edited Unrelated text. A [2] !! end

        !! test

        References: 10.2. New
        1. foo
        2. foo
        shouldn't be added for unrelated edits.

        !! options parsoid={

         "modes": ["selser"],
         "changes": "#x", "remove",
         "selser": "noauto",
         "responsiveReferences": { "enabled": true, "threshold": 2 }
        

        } !! wikitext Unrelated text that's going to disappear. A [1] !! wikitext/edited Unrelated text. A [2] !! end

        1. Doesn't wt2wt cleanly because we don't encode the & in html2wt direction

        !! test Entities in ref name !! config wgFragmentMode=[ 'html5', 'legacy' ] !! options parsoid=wt2html,html2html !! wikitext [3]

        1. foo
        2. foo
        3. hi

        !! html/php

        <a href="#cite_note-test_&_me_Template:Echo-1">[1]</a>

        1. <a href="#cite_ref-test_&_me_Template:Echo_1-0">↑</a> hi

        !! html/parsoid

        <a href="./Parser_test#cite_note-test_&_me_Template:Echo-1">[1]</a>

        1. <a href="./Parser_test#cite_ref-test_&_me_Template:Echo_1-0" rel="mw:referencedBy"></a> hi

        !! end

          1. The output here may look funny, but it's what the php parser will do. The
          2. unclosed references tag becomes escaped text, and then a new references
          3. tag is auto-generated. The test is wt2html only because it roundtrips with
          4. nowiki tags, and the auto-generated references tag is only dropped in
          5. rtTestMode.

        !! test Generate references for unclosed references tag !! options parsoid=wt2html !! wikitext a[1]

        <references> !! html/parsoid

        a<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

        <references>

        1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> foo

        !! end

        !! test New reference serializes on its own line !! options parsoid=wt2wt,html2wt !! wikitext foo

        1. foo

        !! html/parsoid

        foo

          !! end

          !! test Ref in ref !! wikitext test [1]

          !! html/php

          test <a href="#cite_note-1">[1]</a>

          1. <a href="#cite_ref-1">↑</a> hi

          Cite error: <ref> tag defined in <references> has no name attribute.

          !! html/parsoid

          test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> hi

          !! end

            1. Parsoid responsive references tests

          !! test Responsive references: disabled, autogenerated !! options parsoid={

           "modes": ["wt2html"],
           "responsiveReferences": { "enabled": false, "threshold": 2 }
          

          } !! wikitext Test [1][2] !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: enabled, autogenerated !! options parsoid={

           "modes": ["wt2html"],
           "responsiveReferences": { "enabled": true, "threshold": 2 }
          

          } !! wikitext Test [3][4] !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: enabled, autogenerated, exceed !! options parsoid={

           "modes": ["wt2html"],
           "responsiveReferences": { "enabled": true, "threshold": 1 }
          

          } !! wikitext Test [5][6] !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: disabled !! options parsoid={

           "responsiveReferences": { "enabled": false, "threshold": 2 }
          

          } !! wikitext Test [7][8]

          1. 1
          2. 2
          3. 1
          4. 2
          5. 1
          6. 2
          7. 1
          8. 2

          !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: enabled !! options parsoid={

           "responsiveReferences": { "enabled": true, "threshold": 2 }
          

          } !! wikitext Test [1][2]

          1. 1
          2. 2

          !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: enabled, exceed !! options parsoid={

           "responsiveReferences": { "enabled": true, "threshold": 1 }
          

          } !! wikitext Test [1][2]

          1. 1
          2. 2

          !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: disabled, explicit !! options parsoid={

           "responsiveReferences": { "enabled": false, "threshold": 2 }
          

          } !! wikitext Test [1][2]

          1. 1
          2. 2

          !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: disabled, explicit, exceed !! options parsoid={

           "responsiveReferences": { "enabled": false, "threshold": 1 }
          

          } !! wikitext Test [1][2]

          1. 1
          2. 2

          !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: enabled, explicit off !! options parsoid={

           "responsiveReferences": { "enabled": true, "threshold": 2 }
          

          } !! wikitext Test [1][2]

          1. 1
          2. 2

          !! html/parsoid

          Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 1
          2. <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"></a> 2

          !! end

          !! test Responsive references: roundtrip templates !! options parsoid={

           "responsiveReferences": { "enabled": true, "threshold": 2 }
          

          } !! wikitext test [1]

          Template:Echo !! html/parsoid

          test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          "}},"i":0}}]}'>haha

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> 123

          !! end

            1. End Parsoid responsive references tests

          !! article Template:CircularRef !! text [2] !! endarticle

          !! test CircularRef !! wikitext [3]

          !! html/php

          <a href="#cite_note-1">[1]</a>

          1. <a href="#cite_ref-1">↑</a> Hi

          Cite error: <ref> tag defined in <references> has no name attribute.

          !! html/parsoid

          <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> Hi

          !! end

          !! test T15673: Cite error: Closing </ref> missing for <ref> tag


          !! html/php

          <a href="#cite_note-1">[1]</a>

          1. <a href="#cite_ref-1">↑</a> TEST

          !! html/parsoid

          <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> TEST

          !! end

          !! test T15673: Cite error: Closing </ref> missing for <ref> tag


          !! html/php

          <a href="#cite_note-1">[1]</a>

          1. <a href="#cite_ref-1">↑</a> TEST

          !! html/parsoid

          <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> TEST

          !! end

          !! test T15673: Cite error: Closing </ref> missing for <ref> tag


          !! html/php

          <a href="#cite_note-1">[1]</a>

          1. <a href="#cite_ref-1">↑</a> TEST

          !! html/parsoid

          <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> TEST

          !! end

          !! test T15673: Cite error: Closing </ref> missing for <ref> tag


          !! html/php

          <a href="#cite_note-1">[1]</a>

          1. <a href="#cite_ref-1">↑</a> TESTCite error: Invalid <ref> tag; dir attribute "nonsense" is unknown. Must be ltr or rtl

          !! html/parsoid

          <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a> TEST

          !! end

          !! test T15673: Direction is supported when specifying name and group !! wikitext [note 1]

          1. TEST

          !! html/php

          <a href="#cite_note-a-1">[note 1]</a>

          1. <a href="#cite_ref-a_1-0">↑</a> TEST

          !! html/parsoid

          <a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;" data-mw-group="note">[note 1]</a>

          1. <a href="./Parser_test#cite_ref-a_1-0" data-mw-group="note" rel="mw:referencedBy"></a> TEST

          !! end

            1. Just to catch regressions in Parsoid's tree-building / p-wrapping

          !! test Ref with block content in formatting tag !! wikitext hi[1]

          1. ho

          !! html/parsoid

          hi<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"></a>
            ho

          !! end

          !! test T196827: Use the dir parameter only from the full definition of a named ref tag !! wikitext abc[1]def

          ghi[1]mno

          1. 1.0 1.1 jkl

          !! html/php

          abc<a href="#cite_note-r1-1">[1]</a>def

          ghi<a href="#cite_note-r1-1">[1]</a>mno

          1. <a href="#cite_ref-r1_1-0">1.0</a> <a href="#cite_ref-r1_1-1">1.1</a> jkl

          !! html/parsoid

          abc<a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;">[1]</a>def

          ghi<a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;">[1]</a>mno

          1. <a href="./Parser_test#cite_ref-r1_1-0">1 </a><a href="./Parser_test#cite_ref-r1_1-1">2 </a> jkl

          !! end

          !! test T196827: Ignore the dir parameter from the first use, which is not a full definition, and use the dir value from the full definition of a named ref tag !! wikitext abc[1]def

          ghi[1]mno

          1. 1.0 1.1 jkl

          !! html/php

          abc<a href="#cite_note-r1-1">[1]</a>def

          ghi<a href="#cite_note-r1-1">[1]</a>mno

          1. <a href="#cite_ref-r1_1-0">1.0</a> <a href="#cite_ref-r1_1-1">1.1</a> jkl

          !! html/parsoid

          abc<a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;">[1]</a>def

          ghi<a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;">[1]</a>mno

          1. <a href="./Parser_test#cite_ref-r1_1-0">1 </a><a href="./Parser_test#cite_ref-r1_1-1">2 </a> jkl

          !! end

          !! test Similarly named refs with identical bodies !! wikitext 1 Cite error: Invalid <ref> tag; name cannot be a simple integer. Use a descriptive title 2 Cite error: Invalid <ref> tag; name cannot be a simple integer. Use a descriptive title


          !! html/parsoid

          1 <a href="./Parser_test#cite_note-1-1" style="counter-reset: mw-Ref 1;">[1]</a> 2 <a href="./Parser_test#cite_note-1-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-1_1-0">1 </a><a href="./Parser_test#cite_ref-1_1-1">2 </a> 1

          !! end

          !! test T220196 - Reference names with high-bit characters, html5 mode !! config wgFragmentMode=['html5'] !! wikitext [1]

          1. [bar]

          !! html/php

          <a href="#cite_note-füllen-1">[1]</a>

          1. <a href="#cite_ref-füllen_1-0">↑</a> [bar]

          !! html/parsoid

          <a href="./Parser_test#cite_note-füllen_1-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-füllen-0" rel="mw:referencedBy"></a> [bar]

          !! end

          !! test T220196 - Reference names with high-bit characters, legacy mode !! config wgFragmentMode=['legacy'] !! wikitext [1]

          1. [bar]

          !! html/php

          <a href="#cite_note-f.C3.BCllen-1">[1]</a>

          1. <a href="#cite_ref-f.C3.BCllen_1-0">↑</a> [bar]

          !! html/parsoid

          <a href="./Parser_test#cite_note-füllen_1-1" style="counter-reset: mw-Ref 1;">[1]</a>

          1. <a href="./Parser_test#cite_ref-füllen-0" rel="mw:referencedBy"></a> [bar]

          !! end
          Cite error: <ref> tags exist for a group named "1", but no corresponding <references group="1"/> tag was found
          Cite error: <ref> tags exist for a group named "inexistent", but no corresponding <references group="inexistent"/> tag was found