mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
123c6bee9d
"cite_references_link_many" message unconditionally includes an id attribute, even if empty. Follows-Up: Iec3c919ed1ea51acef9efabe979bd8d0feaf651a Depends-On: I3c547f5524530e976eb7aa960751265c8383f7b4 Change-Id: I9d3f660788fab9af7bdc8c1fa093a9a7912da2ad
967 lines
49 KiB
Plaintext
967 lines
49 KiB
Plaintext
!! version 2
|
|
|
|
!! test
|
|
Sub-referencing attribute rejected by default
|
|
!! config
|
|
wgCiteBookReferencing=false
|
|
!! wikitext
|
|
<ref name="parent">[foo]</ref>
|
|
<ref extends="parent">[bar]</ref>
|
|
!! html/php
|
|
<p><sup id="cite_ref-parent_1-0" class="reference"><a href="#cite_note-parent-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid parameter in <code><ref></code> tag</span>
|
|
</p>
|
|
<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
|
|
Sub-referencing attribute allowed with feature flag set
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="parent">[foo]</ref>
|
|
<ref extends="parent">[bar]</ref>
|
|
!! html/php
|
|
<p><sup id="cite_ref-parent_1-0" class="reference"><a href="#cite_note-parent-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<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>
|
|
<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>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Sub-referencing the same parent multiple times is fine
|
|
!! options
|
|
language=de
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book</ref>
|
|
<ref extends="a">page 2</ref>
|
|
<ref extends="a">page 3</ref>
|
|
<references />
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>1.2<span class="cite-bracket">]</span></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>
|
|
<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 3</span>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
Sub-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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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>
|
|
<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
|
|
|
|
!! test
|
|
T240424 - Subreference reused as normal ref before its full definition
|
|
!! 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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<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>
|
|
<sup id="cite_ref-a_2-0" class="reference"><a href="#cite_note-a-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<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><ref></code> tag; no text was provided for refs named <code>b</code></span></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>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T240424 - Sub-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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></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="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>b</code></span></li>
|
|
</ol></div>
|
|
<p><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>
|
|
</p>
|
|
!! end
|
|
|
|
# TODO: T367749 - We are misusing an existing error message here that is super confusing
|
|
!! test
|
|
T367749 - Turning a top-level ref into a subref is forbidden, even if the content is the same
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name=p20>page 20</ref>
|
|
<ref extends=book name=p20>page 20</ref>
|
|
<references>
|
|
<ref name=book>book</ref>
|
|
</references>
|
|
!! html
|
|
<p><sup id="cite_ref-p20_1-0" class="reference"><a href="#cite_note-p20-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "p20" defined multiple times with different content</span>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li id="cite_note-p20-1"><span class="mw-cite-backlink"><a href="#cite_ref-p20_1-0">↑</a></span> <span class="reference-text">page 20</span>
|
|
</li>
|
|
</ol></div>
|
|
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "book" defined in <code><references></code> is not used in prior text.</span>
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
T367749 - Turning a top-level ref into a subref is forbidden, especially when the content conflicts
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name=p20>page 20</ref>
|
|
<ref extends=book name=p20>different content</ref>
|
|
<references>
|
|
<ref name=book>book</ref>
|
|
</references>
|
|
!! html
|
|
<p><sup id="cite_ref-p20_1-0" class="reference"><a href="#cite_note-p20-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "p20" defined multiple times with different content</span>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li id="cite_note-p20-1"><span class="mw-cite-backlink"><a href="#cite_ref-p20_1-0">↑</a></span> <span class="reference-text">page 20</span>
|
|
</li>
|
|
</ol></div>
|
|
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "book" defined in <code><references></code> is not used in prior text.</span>
|
|
</p>
|
|
!! end
|
|
|
|
# TODO: T367749 - We want this to render successfully
|
|
!! test
|
|
T367749 - Turning a top-level ref into a subref is fine when the content is an empty string
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name=p20></ref>
|
|
<ref extends=book name=p20>page 20</ref>
|
|
<references>
|
|
<ref name=book>book</ref>
|
|
</references>
|
|
!! html
|
|
<p><sup id="cite_ref-p20_1-0" class="reference"><a href="#cite_note-p20-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "p20" defined multiple times with different content</span>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li id="cite_note-p20-1"><span class="mw-cite-backlink"><a href="#cite_ref-p20_1-0">↑</a></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>p20</code></span></li>
|
|
</ol></div>
|
|
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "book" defined in <code><references></code> is not used in prior text.</span>
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Naming sub-references is fine
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book</ref>
|
|
<ref extends="a" name="b">page 2</ref>
|
|
<ref extends="a" name="c">page 3</ref>
|
|
<ref name="b" />
|
|
<ref name="c" />
|
|
<references />
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3"><span class="cite-bracket">[</span>1.2<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-c_3-1" class="reference"><a href="#cite_note-c-3"><span class="cite-bracket">[</span>1.2<span class="cite-bracket">]</span></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>
|
|
<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 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>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Sub-referencing a reference that doesn't exist #1
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref extends="a">page 1</ref>
|
|
!! html/php
|
|
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Sub-referencing a reference that doesn't exist #2
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref>book</ref>
|
|
<ref extends="a">page 1</ref>
|
|
!! html/php
|
|
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2.1<span class="cite-bracket">]</span></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">book</span>
|
|
</li>
|
|
<li><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>
|
|
</li>
|
|
</ol></li>
|
|
</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>
|
|
<ref extends="a">page 1</ref>
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<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><ref></code> tag; name "a" 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>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Cannot reuse a name for two sub-references
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book</ref>
|
|
<ref extends="a" name="b">page 2</ref>
|
|
<ref extends="a" name="b">page 3</ref>
|
|
<references />
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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>
|
|
<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>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Cannot sub-reference a sub-reference (no nesting)
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book</ref>
|
|
<ref extends="a" name="b">page 2</ref>
|
|
<ref extends="b">section 3</ref>
|
|
<references />
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Extending <code><ref></code> tags more than one level deep is not allowed</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>
|
|
<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>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Cannot sub-reference a sub-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"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<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>
|
|
<sup id="cite_ref-a_2-0" class="reference"><a href="#cite_note-a-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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>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>
|
|
</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>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Named reference without text
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a" />
|
|
<ref extends="a">page 1</ref>
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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="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>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - No text for a sub-reference
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="foo">book</ref>
|
|
<ref extends="foo" />
|
|
!! html/php
|
|
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<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>
|
|
</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">book</span>
|
|
</li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Empty text for a sub-reference
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="foo">book</ref>
|
|
<ref extends="foo"></ref>
|
|
!! html/php
|
|
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; refs with no name must have content</span>
|
|
</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">book</span>
|
|
</li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - De-facto empty text for a sub-reference
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="foo">book</ref>
|
|
<ref extends="foo"> </ref>
|
|
!! html/php
|
|
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; refs with no name must have content</span>
|
|
</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">book</span>
|
|
</li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Everything in the same group
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref group="g1" name="a">book</ref>
|
|
<ref group="g1" extends="a" name="b">page</ref>
|
|
<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"><span class="cite-bracket">[</span>g1 1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>g1 1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-1" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>g1 1.1<span class="cite-bracket">]</span></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>
|
|
<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>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Sub-reference in named group cannot access parent from another named group
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref group="g1" name="a">book</ref>
|
|
<ref group="g2" extends="a">page</ref>
|
|
<references group="g1"/>
|
|
<references group="g2"/>
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>g1 1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>g2 1.1<span class="cite-bracket">]</span></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>
|
|
</ol></div>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Sub-reference in the unnamed default group doesn't collide with refs from other groups
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref group="g1" name="a">book</ref>
|
|
<ref extends="a">page</ref>
|
|
<references group="g1"/>
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>g1 1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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>
|
|
</ol></div>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Sub-reference in named group cannot access parent from unnamed default group
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book</ref>
|
|
<ref group="g1" extends="a">page</ref>
|
|
<references group="g1"/>
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>g1 1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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>
|
|
</li>
|
|
</ol></li>
|
|
</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
|
|
T236256 - Sub-referencing a multi-part parent should be fine
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">part 1</ref>
|
|
<ref follow="a">part 2</ref>
|
|
<ref extends="a">ok</ref>
|
|
<references />
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
</p><p><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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">part 1 part 2</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">ok</span>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
# TODO: T242227 - Should render an error at the third reference.
|
|
!! test
|
|
T236256 - Dont allow splitting a sub-reference for now
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book</ref>
|
|
<ref extends="a" name="b">page 2</ref>
|
|
<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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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>
|
|
<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
|
|
|
|
!! test
|
|
T236256 - Cannot be a follow up and a sub-reference the same time
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book 1</ref>
|
|
<ref follow="a" extends="a">huh?</ref>
|
|
<references />
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: A <code><ref follow="…"></code> tag that is the continuation of a previous one can neither be named individually nor extended</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 1</span>
|
|
</li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T236256 - Cannot be a follow up and a sub-reference the same time, even when referencing different parents
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book 1</ref>
|
|
<ref name="b">book 2</ref>
|
|
<ref follow="a" extends="b">huh?</ref>
|
|
<references />
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
|
|
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: A <code><ref follow="…"></code> tag that is the continuation of a previous one can neither be named individually nor extended</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 1</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>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
Sub-referencing a list-defined parent that doesn't appear in the text, but in <references>
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref extends="a">Page 2</ref>
|
|
<references>
|
|
<ref name="a">Book</ref>
|
|
</references>
|
|
!! html
|
|
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><span class="mw-cite-backlink">↑ </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">Page 2</span>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
T239810: Sub-referencing a list-defined parent that doesn't appear in the text, but in {{#tag:references}}
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref extends="a">Page 2</ref>
|
|
{{#tag:references|
|
|
<ref name="a">Book</ref>
|
|
}}
|
|
!! html
|
|
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><span class="mw-cite-backlink">↑ </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">Page 2</span>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
A list-defined sub-reference when the <references> tag is created using #tag
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! 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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-footwo_2-0" class="reference"><a href="#cite_note-footwo-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></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>
|
|
</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><ref></code> tag; no text was provided for refs named <code>footwo</code></span></li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
Sub-referencing a list-defined parent when the <references> tag is created using #tag
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! 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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-footwo_2-0" class="reference"><a href="#cite_note-footwo-2"><span class="cite-bracket">[</span>2.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-foo_3-0" class="reference"><a href="#cite_note-foo-3"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></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 sub-reference groups
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! 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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-c_2-0" class="reference"><a href="#cite_note-c-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
|
|
</p><p><sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>2.1<span class="cite-bracket">]</span></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
|
|
|
|
!! test
|
|
Multiple groups with sub-references
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! 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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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
|
|
|
|
!! test
|
|
Multiple groups with sub-references, duplicated names across groups
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! 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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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
|
|
|
|
!! test
|
|
Intervening ref before sub-reference
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a">book</ref>
|
|
<ref>another</ref>
|
|
<ref extends="a">page 2</ref>
|
|
|
|
<references />
|
|
!! html/php
|
|
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></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>
|
|
<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>
|
|
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">another</span>
|
|
</li>
|
|
</ol></div>
|
|
!! end
|
|
|
|
!! test
|
|
Normal ref after sub-reference
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! 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"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p><p><sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></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>
|
|
<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
|
|
|
|
!! 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"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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
|
|
Reused sub-references can be rolled back without messing up numbering
|
|
!! config
|
|
wgCiteBookReferencing=true
|
|
!! wikitext
|
|
<ref name="a1" extends="a" />
|
|
<ref group="g" name="a1" extends="a" />
|
|
{{#tag:references|
|
|
<ref name="a">a in group</ref>
|
|
<ref name="a1" extends="a">a1 in group</ref>
|
|
|group=g}}
|
|
<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"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-a1_2-0" class="reference"><a href="#cite_note-a1-2"><span class="cite-bracket">[</span>g 1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><span class="mw-cite-backlink">↑ </span> <span class="reference-text">a in group</span>
|
|
<ol class="mw-extended-references"><li id="cite_note-a1-2"><span class="mw-cite-backlink"><a href="#cite_ref-a1_2-0">↑</a></span> <span class="reference-text">a1 in group</span>
|
|
</li>
|
|
</ol></li>
|
|
</ol></div>
|
|
<p><sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><span class="mw-cite-backlink">↑ </span> <span class="reference-text">a in group <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>
|
|
<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: Bad sub-referencing 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"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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 class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "a1" defined multiple times with different content</span></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"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-a1_1-1" class="reference"><a href="#cite_note-a1-1"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b1_2-0" class="reference"><a href="#cite_note-b1-2"><span class="cite-bracket">[</span>2.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-b1_2-1" class="reference"><a href="#cite_note-b1-2"><span class="cite-bracket">[</span>2.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-c1_3-0" class="reference"><a href="#cite_note-c1-3"><span class="cite-bracket">[</span>3.1<span class="cite-bracket">]</span></a></sup>
|
|
<sup id="cite_ref-c1_3-1" class="reference"><a href="#cite_note-c1-3"><span class="cite-bracket">[</span>3.1<span class="cite-bracket">]</span></a></sup>
|
|
</p>
|
|
<div class="mw-references-wrap"><ol class="references">
|
|
<li><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><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><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
|