2019-11-08 09:02:38 +00:00
!! test
2019-11-12 10:03:44 +00:00
Book Referencing attribute rejected by default
2019-11-08 09:02:38 +00:00
!! config
wgCiteBookReferencing=false
!! wikitext
<ref name="parent">[foo]</ref>
2019-11-12 10:03:44 +00:00
<ref extends="parent">[bar]</ref>
2019-11-08 09:02:38 +00:00
!! html/php
<p><sup id="cite_ref-parent_1-0" class="reference"><a href="#cite_note-parent-1">[1]</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
</p>
invalid names, e.g. too many</span><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>
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
Book Referencing attribute allowed with feature flag set
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="parent">[foo]</ref>
2019-11-12 10:03:44 +00:00
<ref extends="parent">[bar]</ref>
2019-11-11 11:50:51 +00:00
!! html/php
<p><sup id="cite_ref-parent_1-0" class="reference"><a href="#cite_note-parent-1">[1]</a></sup>
</p>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup><div class="mw-references-wrap"><ol class="references">
2019-11-11 11:50:51 +00:00
<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>
2019-11-18 14:49:51 +00:00
<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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - Extending the same base multiple times is fine
2019-12-04 08:10:03 +00:00
!! options
language=de
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a">page 2</ref>
<ref extends="a">page 3</ref>
2019-11-11 11:50:51 +00:00
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup>
<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[1.2]</a></sup>
2019-11-11 11:50:51 +00:00
</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>
2019-11-18 14:49:51 +00:00
<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>
2019-11-11 11:50:51 +00:00
</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>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
2019-12-09 15:01:13 +00:00
!! test
Extended references can be reused
!! options
language=de
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
<ref extends="a" name="b">page 2</ref>
<ref name="b" />
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup>
</p>
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup><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">↑ <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>
</ol></li>
</ol></div>
!! end
2019-12-11 15:30:17 +00:00
# TODO: The number for the first <ref> must be "1.1", not just "1"
!! test
T240424 - Extended reference reused before defined in the text
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="b" />
<ref name="b" extends="a">page 2</ref>
<ref name="a">book</ref>
!! html
<p><sup id="cite_ref-b_1-0" class="reference"><a href="#cite_note-b-1">[1]</a></sup>
<sup id="cite_ref-b_1-1" class="reference"><a href="#cite_note-b-1">[1.1]</a></sup>
</p>
<sup id="cite_ref-a_2-0" class="reference"><a href="#cite_note-a-2">[1]</a></sup><div class="mw-references-wrap"><ol class="references">
<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>
<ol class="mw-extended-references"><li id="cite_note-b-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-b_1-0">1.1.0</a></sup> <sup><a href="#cite_ref-b_1-1">1.1.1</a></sup></span> <span class="reference-text">page 2</span>
</li>
</ol></li>
</ol></div>
!! end
# TODO: This currently renders as if the extends="…" is not there
# TODO: Render a helpful error message to make this issue visible
# TODO: Find a way to render this properly
!! test
T240424 - Extended reference reused before defined in the <references> section
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a" />
<ref name="b" />
<references>
<ref name="b" extends="a">page 2</ref>
<ref name="a">book</ref>
</references>
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[2]</a></sup>
</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 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>
</ol></div>
!! end
2019-12-11 14:58:34 +00:00
# TODO: The two identical tags should be merged into one
!! test
T240459 - References should be merged when they have the exact same content
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
<ref extends="a">page 2</ref>
<ref extends="a">page 2</ref>
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup>
</p>
<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[1.2]</a></sup><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-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">page 2</span>
</li>
<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>
</ol></li>
</ol></div>
!! end
2019-11-11 11:50:51 +00:00
!! test
2019-11-12 10:03:44 +00:00
T236256 - Naming book references is fine
2019-11-08 09:02:38 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a" name="b">page 2</ref>
<ref extends="a" name="c">page 3</ref>
2019-11-11 11:50:51 +00:00
<ref name="b" />
<ref name="c" />
2019-11-08 09:02:38 +00:00
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup>
<sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">[1.2]</a></sup>
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup>
<sup id="cite_ref-c_3-1" class="reference"><a href="#cite_note-c-3">[1.2]</a></sup>
2019-11-08 09:02:38 +00:00
</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>
2019-11-18 14:49:51 +00:00
<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>
2019-11-08 09:02:38 +00:00
</li>
2019-11-18 14:49:51 +00:00
<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>
2019-11-08 09:02:38 +00:00
</li>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-08 09:02:38 +00:00
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - Extending a reference that doesn't exist #1
2019-11-08 09:02:38 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
2019-11-12 10:03:44 +00:00
<ref extends="a">page 1</ref>
2019-11-08 09:02:38 +00:00
!! html/php
2019-11-29 11:50:07 +00:00
<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1.1]</a></sup><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><ref></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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-29 11:50:07 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - Extending a reference that doesn't exist #2
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref>book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a">page 1</ref>
2019-11-11 11:50:51 +00:00
!! html/php
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2019-11-08 09:02:38 +00:00
</p>
2019-11-29 11:50:07 +00:00
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[2.1]</a></sup><div class="mw-references-wrap"><ol class="references">
2019-11-11 11:50:51 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">book</span>
</li>
2019-11-29 11:50:07 +00:00
<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><ref></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>
2019-11-08 09:02:38 +00:00
</li>
2019-11-29 11:50:07 +00:00
</ol></li>
2019-11-08 09:02:38 +00:00
</ol></div>
!! end
!! test
T236256 - Reference with the same name defined twice
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
<ref name="a">magazine</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a">page 1</ref>
2019-11-08 09:02:38 +00:00
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
</p>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup><div class="mw-references-wrap"><ol class="references">
2019-11-08 09:02:38 +00:00
<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><ref></code> tag; name "a" defined multiple times with different content</span></span>
2019-11-18 14:49:51 +00:00
<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>
2019-11-08 09:02:38 +00:00
</li>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-08 09:02:38 +00:00
</ol></div>
!! end
2019-11-11 11:50:51 +00:00
!! test
2019-11-12 10:03:44 +00:00
T236256 - Can't reuse a name for two book references
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a" name="b">page 2</ref>
<ref extends="a" name="b">page 3</ref>
2019-11-11 11:50:51 +00:00
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup>
2020-01-07 14:52:59 +00:00
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup>
2019-11-11 11:50:51 +00:00
</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>
2020-01-07 14:52:59 +00:00
<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><ref></code> tag; name "b" defined multiple times with different content</span></span>
2019-11-11 11:50:51 +00:00
</li>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
!! test
2019-12-09 08:37:38 +00:00
T236256 - Can't extend a book reference (no nesting)
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a" name="b">page 2</ref>
<ref extends="b">section 3</ref>
2019-11-11 11:50:51 +00:00
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup>
2019-12-09 08:37:38 +00:00
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
invalid names, e.g. too many</span>
2019-11-11 11:50:51 +00:00
</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>
2019-11-18 14:49:51 +00:00
<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>
2019-11-11 11:50:51 +00:00
</li>
2019-12-04 12:54:34 +00:00
</ol></li>
2019-12-09 08:37:38 +00:00
</ol></div>
!! end
!! test
T236256 - Can't extend a book reference (no nesting), specified in reverse order
!! config
wgCiteBookReferencing=true
!! wikitext
<ref extends="b">section 3</ref>
<ref extends="a" name="b">page 2</ref>
<ref name="a">book</ref>
<references />
!! html/php
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1.1]</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup>
<sup id="cite_ref-a_3-0" class="reference"><a href="#cite_note-a-3">[1]</a></sup>
</p>
<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">book</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 class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
2019-12-04 10:59:56 +00:00
invalid names, e.g. too many</span></span>
2019-11-11 11:50:51 +00:00
</li>
2019-12-09 08:37:38 +00:00
<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>
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
!! test
T236256 - Named reference without text
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a" />
2019-11-12 10:03:44 +00:00
<ref extends="a">page 1</ref>
2019-11-11 11:50:51 +00:00
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
</p>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup><div class="mw-references-wrap"><ol class="references">
2019-11-11 11:50:51 +00:00
<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><ref></code> tag;
2019-11-18 14:49:51 +00:00
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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
2019-11-08 09:02:38 +00:00
!! test
2019-11-12 10:03:44 +00:00
T236256 - No text for a book reference
2019-11-08 09:02:38 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="foo">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="foo" />
2019-11-08 09:02:38 +00:00
!! html/php
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
</p>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: The opening <code><ref></code> tag is malformed or has a bad name</span><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>
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - Empty text for a book reference
2019-11-08 09:02:38 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="foo">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="foo"></ref>
2019-11-08 09:02:38 +00:00
!! html/php
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
</p>
refs with no name must have content</span><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>
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - De-facto empty text for a book reference
2019-11-08 09:02:38 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="foo">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="foo"> </ref>
2019-11-08 09:02:38 +00:00
!! html/php
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
2019-11-20 14:44:12 +00:00
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
2019-11-08 09:02:38 +00:00
</p>
2019-11-20 14:44:12 +00:00
refs with no name must have content</span><div class="mw-references-wrap"><ol class="references">
2019-11-08 09:02:38 +00:00
<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>
</ol></div>
!! end
2019-11-11 11:50:51 +00:00
!! test
T236256 - Everything in the same group
!! config
wgCiteBookReferencing=true
!! wikitext
<ref group="g1" name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref group="g1" extends="a" name="b">page</ref>
2019-11-11 11:50:51 +00:00
<ref group="g1" name="b" />
<references group="g1"/>
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[g1 1]</a></sup>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[g1 1.1]</a></sup>
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2">[g1 1.1]</a></sup>
2019-11-11 11:50:51 +00:00
</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>
2019-11-18 14:49:51 +00:00
<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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - Base and book reference in different groups
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref group="g1" name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref group="g2" extends="a">page</ref>
2019-11-11 11:50:51 +00:00
<references group="g1"/>
<references group="g2"/>
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[g1 1]</a></sup>
2019-11-29 11:50:07 +00:00
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[g2 1.1]</a></sup>
2019-11-11 11:50:51 +00:00
</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>
</ol></div>
<div class="mw-references-wrap"><ol class="references">
2019-11-29 11:50:07 +00:00
<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><ref></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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-29 11:50:07 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - Extending in the unnamed default group
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref group="g1" name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a">page</ref>
2019-11-11 11:50:51 +00:00
<references group="g1"/>
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[g1 1]</a></sup>
2019-11-29 11:50:07 +00:00
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup>
2019-11-11 11:50:51 +00:00
</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>
</ol></div><div class="mw-references-wrap"><ol class="references">
2019-11-29 11:50:07 +00:00
<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><ref></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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-29 11:50:07 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
!! test
T236256 - Base in the unnamed default group
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref group="g1" extends="a">page</ref>
2019-11-11 11:50:51 +00:00
<references group="g1"/>
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2019-11-29 11:50:07 +00:00
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[g1 1.1]</a></sup>
2019-11-11 11:50:51 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
2019-11-29 11:50:07 +00:00
<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><ref></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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-29 11:50:07 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></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">book</span>
</li>
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - Extending a multi-part ref should be fine
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">part 1</ref>
<ref follow="a">part 2</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a">ok</ref>
2019-11-11 11:50:51 +00:00
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2019-11-18 14:49:51 +00:00
</p><p><sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup>
2019-11-11 11:50:51 +00:00
</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">part 1 part 2</span>
2019-11-18 14:49:51 +00:00
<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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
# TODO:
# * Should render an error at the third reference.
!! test
2019-11-12 10:03:44 +00:00
T236256 - Dont allow splitting a book reference for now
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
2019-11-12 10:03:44 +00:00
<ref extends="a" name="b">page 2</ref>
2019-11-11 11:50:51 +00:00
<ref follow="b">and page 3 the same time?</ref>
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2019-11-18 14:49:51 +00:00
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[1.1]</a></sup>
2019-11-11 11:50:51 +00:00
</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>
2019-11-18 14:49:51 +00:00
<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>
2019-11-11 11:50:51 +00:00
</li>
2019-11-18 14:49:51 +00:00
</ol></li>
2019-11-11 11:50:51 +00:00
</ol></div>
!! end
!! test
2019-11-26 11:05:51 +00:00
T236256 - Can't be a follow up and a book reference the same time
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book 1</ref>
2019-11-12 10:03:44 +00:00
<ref follow="a" extends="a">huh?</ref>
2019-11-11 11:50:51 +00:00
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2019-11-05 15:02:12 +00:00
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
invalid names, e.g. too many</span>
2019-11-11 11:50:51 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
2019-11-05 15:02:12 +00:00
<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>
2019-11-11 11:50:51 +00:00
</li>
</ol></div>
!! end
!! test
2019-11-12 10:03:44 +00:00
T236256 - Can't be a follow up and a book reference the same time, even when referencing 2 different bases
2019-11-11 11:50:51 +00:00
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book 1</ref>
<ref name="b">book 2</ref>
2019-11-12 10:03:44 +00:00
<ref follow="a" extends="b">huh?</ref>
2019-11-11 11:50:51 +00:00
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[2]</a></sup>
2019-11-05 15:02:12 +00:00
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
invalid names, e.g. too many</span>
2019-11-11 11:50:51 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
2019-11-05 15:02:12 +00:00
<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>
2019-11-11 11:50:51 +00:00
</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>
</ol></div>
!! end
2019-11-18 14:49:51 +00:00
2019-11-29 11:50:07 +00:00
# TODO
# * This should be invalid, there's no way to know that `footwo` should be subnumbered in a one-pass parse.
2019-11-18 14:49:51 +00:00
!! test
Extends <ref> defined in <references> called with #tag
2019-12-09 15:01:13 +00:00
!! config
wgCiteBookReferencing=true
2019-11-18 14:49:51 +00:00
!! wikitext
<ref name="foo">BAR</ref>
<ref name="footwo" />
{{#tag:references|
<ref name="footwo" extends="foo">p. 10</ref>
}}
!! html
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
<sup id="cite_ref-footwo_2-0" class="reference"><a href="#cite_note-footwo-2">[2]</a></sup>
</p>
<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>
2019-11-29 23:10:11 +00:00
<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">p. 10</span>
2019-11-18 14:49:51 +00:00
</li>
2019-11-29 23:10:11 +00:00
</ol></li>
2019-11-18 14:49:51 +00:00
</ol></div>
!! end
2019-11-29 11:50:07 +00:00
!! test
Extends parent <ref> defined in <references> called with #tag
2019-12-09 15:01:13 +00:00
!! config
wgCiteBookReferencing=true
2019-11-29 11:50:07 +00:00
!! wikitext
<ref>BAR</ref>
<ref name="footwo" extends="foo">page 7</ref>
<ref name="foo" />
{{#tag:references|
<ref name="foo">book name</ref>
}}
!! html
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
<sup id="cite_ref-footwo_2-0" class="reference"><a href="#cite_note-footwo-2">[2.1]</a></sup>
<sup id="cite_ref-foo_3-0" class="reference"><a href="#cite_note-foo-3">[2]</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">BAR</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>
</ol></li>
</ol></div>
!! end
!! test
Interleaved extends groups
2019-12-09 15:01:13 +00:00
!! config
wgCiteBookReferencing=true
2019-11-29 11:50:07 +00:00
!! wikitext
<ref name="a">text-a</ref>
<ref name="c">text-c</ref>
<ref extends="a">page b</ref>
<ref extends="c">page d</ref>
<references />
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-c_2-0" class="reference"><a href="#cite_note-c-2">[2]</a></sup>
</p><p><sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[1.1]</a></sup>
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4">[2.1]</a></sup>
</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">text-a</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>
</ol></li>
<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>
<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>
</ol></li>
</ol></div>
!! end
2019-11-18 14:49:51 +00:00
!! test
Multiple groups with extends
2019-12-09 15:01:13 +00:00
!! config
wgCiteBookReferencing=true
2019-11-18 14:49:51 +00:00
!! wikitext
<ref name="a">text-a</ref>
<ref extends="a">page b</ref>
<references />
<ref name="c">text-c</ref>
<ref extends="c">page d</ref>
<references />
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup>
</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">text-a</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>
</ol></li>
</ol></div>
<p><sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">[1]</a></sup>
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4">[1.1]</a></sup>
</p>
<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>
<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>
</ol></li>
</ol></div>
!! end
2019-11-29 22:24:51 +00:00
!! test
Multiple groups with extends, duplicated names across groups
2019-12-09 15:01:13 +00:00
!! config
wgCiteBookReferencing=true
2019-11-29 22:24:51 +00:00
!! wikitext
<ref name="a">text-a</ref>
<ref extends="a">page b</ref>
<references />
<ref name="a">text-c</ref>
<ref extends="a">page d</ref>
<references />
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup>
</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">text-a</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>
</ol></li>
</ol></div>
<p><sup id="cite_ref-a_3-0" class="reference"><a href="#cite_note-a-3">[1]</a></sup>
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4">[1.1]</a></sup>
</p>
<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>
<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>
</ol></li>
</ol></div>
!! end
2019-11-18 14:49:51 +00:00
!! test
Intervening ref before extends
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a">book</ref>
<ref>another</ref>
<ref extends="a">page 2</ref>
2019-11-29 11:50:07 +00:00
2019-11-18 14:49:51 +00:00
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[2]</a></sup>
2019-11-29 23:10:11 +00:00
<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[1.1]</a></sup>
2019-11-18 14:49:51 +00:00
</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-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">page 2</span>
</li>
</ol></li>
2019-11-29 11:50:07 +00:00
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">another</span>
</li>
2019-11-18 14:49:51 +00:00
</ol></div>
!! end
2019-12-09 08:52:33 +00:00
!! test
Normal refs after extends
2019-12-09 15:01:13 +00:00
!! config
wgCiteBookReferencing=true
2019-12-09 08:52:33 +00:00
!! wikitext
<ref name="a">text-a</ref>
<ref extends="a">page b</ref>
<ref name="c">text-c</ref>
<references />
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1.1]</a></sup>
2019-12-09 09:19:55 +00:00
</p><p><sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">[2]</a></sup>
2019-12-09 08:52:33 +00:00
</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">text-a</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>
</ol></li>
<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>
</ol></div>
!! end
2020-01-07 14:52:59 +00:00
!! test
T242110: Copy-pasted, named sub-references should be merged and not mess with the numbering
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a1" extends="a">a1</ref>
<ref name="a1" extends="a">a1</ref>
<references>
<ref name="a">a</ref>
</references>
!! html
<p><sup id="cite_ref-a1_1-0" class="reference"><a href="#cite_note-a1-1">[1.1]</a></sup>
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1">[1.1]</a></sup>
</p>
<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>
<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>
</ol></div>
!! end
!! test
T242110: Reused sub-references should be merged and not mess with the numbering
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a1" extends="a">a1</ref>
<ref name="a1" extends="a" />
<references>
<ref name="a">a</ref>
</references>
!! html
<p><sup id="cite_ref-a1_1-0" class="reference"><a href="#cite_note-a1-1">[1.1]</a></sup>
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1">[1.1]</a></sup>
</p>
<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>
<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>
</ol></div>
!! end
# TODO: Currently, the extends attribute is ignored in this situation.
!! test
T242110: Bad extends attributes on reused sub-references should report an error
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a1" extends="a">a1</ref>
<ref name="a1" extends="unknown" />
<references>
<ref name="a">a</ref>
</references>
!! html
<p><sup id="cite_ref-a1_1-0" class="reference"><a href="#cite_note-a1-1">[1.1]</a></sup>
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1">[1.1]</a></sup>
</p>
<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>
<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>
</ol></div>
!! end
!! test
T242110: Copy-pasted, named sub-references should appear in proper order
!! config
wgCiteBookReferencing=true
!! wikitext
<ref name="a1" extends="a">a1</ref>
<ref name="a1" extends="a">a1</ref>
<ref name="b1" extends="b">b1</ref>
<ref name="b1" extends="b" />
<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">[1.1]</a></sup>
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1">[1.1]</a></sup>
<sup id="cite_ref-b1_2-0" class="reference"><a href="#cite_note-b1-2">[2.1]</a></sup>
<sup id="cite_ref-b1_2-1" class="reference"><a href="#cite_note-b1-2">[2.1]</a></sup>
<sup id="cite_ref-c1_3-0" class="reference"><a href="#cite_note-c1-3">[3.1]</a></sup>
<sup id="cite_ref-c1_3-1" class="reference"><a href="#cite_note-c1-3">[3.1]</a></sup>
</p>
<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>
<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>
</ol></li>
</ol></div>
!! end