Reference Test
!! version 2 !! test Book Referencing attribute rejected by default !! config wgCiteBookReferencing=false !! wikitext [1] [1.1] !! html/php
<a href="#cite_note-parent-1">[1]</a>
Cite error: Invalid <ref>
tag; invalid names, e.g. too many
- <a href="#cite_ref-parent_1-0">↑</a> [foo]
!! end
!! test Book Referencing attribute allowed with feature flag set !! config wgCiteBookReferencing=true !! wikitext [1] [1.2] !! html/php
<a href="#cite_note-parent-1">[1]</a> <a href="#cite_note-2">[1.1]</a>
- <a href="#cite_ref-parent_1-0">↑</a> [foo]
- <a href="#cite_ref-2">↑</a> [bar]
!! end
!! test T236256 - Extending the same base multiple times is fine !! options language=de !! config wgCiteBookReferencing=true !! wikitext [2] [2.1] [2.2]
!! html/php
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-2">[1.1]</a> <a href="#cite_note-3">[1.2]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- <a href="#cite_ref-2">↑</a> page 2
- <a href="#cite_ref-3">↑</a> page 3
!! end
!! test Extended references can be reused !! options language=de !! config wgCiteBookReferencing=true !! wikitext [1] [1.1] [1.1] !! html
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-b-2">[1.1]</a> <a href="#cite_note-b-2">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- ↑ <a href="#cite_ref-b_2-0">1.1,0</a> <a href="#cite_ref-b_2-1">1.1,1</a> page 2
!! end
!! test T240424 - Subreference reused as normal ref before its full definition !! config wgCiteBookReferencing=true !! wikitext [1.1] [1.1] [1] !! html
<a href="#cite_note-b-1">[1]</a>
Cite error: Invalid <ref>
tag; name "b" defined multiple times with different content
<a href="#cite_note-a-2">[2]</a>
- <a href="#cite_ref-b_1-0">↑</a> Cite error: Invalid
<ref>
tag; no text was provided for refs namedb
- <a href="#cite_ref-a_2-0">↑</a> book
!! end
!! test
T240424 - Extended reference reused before defined in the
Cite error: <ref>
tag with name "a" defined in <references>
group "" has no content.
Cite error: <ref>
tag with name "b" defined in <references>
group "" has no content.
!! html
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-b-2">[2]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- <a href="#cite_ref-b_2-0">↑</a> Cite error: Invalid
<ref>
tag; no text was provided for refs namedb
Cite error: Invalid <ref>
tag; name "b" defined multiple times with different content
!! end
!! test T236256 - Naming book references is fine !! config wgCiteBookReferencing=true !! wikitext [1] [1.1] [1.2] [1.1] [1.2]
!! html/php
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-b-2">[1.1]</a> <a href="#cite_note-c-3">[1.2]</a> <a href="#cite_note-b-2">[1.1]</a> <a href="#cite_note-c-3">[1.2]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- ↑ <a href="#cite_ref-b_2-0">1.1.0</a> <a href="#cite_ref-b_2-1">1.1.1</a> page 2
- ↑ <a href="#cite_ref-c_3-0">1.2.0</a> <a href="#cite_ref-c_3-1">1.2.1</a> page 3
!! end
!! test T236256 - Extending a reference that doesn't exist #1 !! config wgCiteBookReferencing=true !! wikitext [1.1] !! html/php
<a href="#cite_note-1">[1.1]</a>
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs nameda
- <a href="#cite_ref-1">↑</a> page 1
!! end
!! test T236256 - Extending a reference that doesn't exist #2 !! config wgCiteBookReferencing=true !! wikitext [2] [1.2] !! html/php
<a href="#cite_note-1">[1]</a> <a href="#cite_note-2">[2.1]</a>
- <a href="#cite_ref-1">↑</a> book
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs nameda
- <a href="#cite_ref-2">↑</a> page 1
!! end
!! test T236256 - Reference with the same name defined twice !! config wgCiteBookReferencing=true !! wikitext [1] [1] [1.3] !! html/php
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-a-1">[1]</a> <a href="#cite_note-2">[1.1]</a>
- ↑ <a href="#cite_ref-a_1-0">1.0</a> <a href="#cite_ref-a_1-1">1.1</a> book Cite error: Invalid
<ref>
tag; name "a" defined multiple times with different content- <a href="#cite_ref-2">↑</a> page 1
!! end
!! test T236256 - Can't reuse a name for two book references !! config wgCiteBookReferencing=true !! wikitext [1] [1.4] [1.4]
!! html/php
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-b-2">[1.1]</a> <a href="#cite_note-b-2">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- ↑ <a href="#cite_ref-b_2-0">1.1.0</a> <a href="#cite_ref-b_2-1">1.1.1</a> page 2 Cite error: Invalid
<ref>
tag; name "b" defined multiple times with different content
- ↑ <a href="#cite_ref-b_2-0">1.1.0</a> <a href="#cite_ref-b_2-1">1.1.1</a> page 2 Cite error: Invalid
!! end
!! test
T236256 - Can't extend a book reference (no nesting)
!! config
wgCiteBookReferencing=true
!! wikitext
[1]
[1.1]
Cite error: Extending <ref>
tags more than one level deep is not allowed
!! html/php
<a href="#cite_note-a-1">[1]</a>
<a href="#cite_note-b-2">[1.1]</a>
Cite error: Extending <ref>
tags more than one level deep is not allowed
- <a href="#cite_ref-a_1-0">↑</a> book
- <a href="#cite_ref-b_2-0">↑</a> page 2
!! end
!! test
T236256 - Can't extend a book reference (no nesting), specified in reverse order
!! config
wgCiteBookReferencing=true
!! wikitext
[1.1]
Cite error: Invalid <ref>
tag; name "b" defined multiple times with different content
[2]
!! html/php
<a href="#cite_note-1">[1.1]</a>
Cite error: Invalid <ref>
tag; name "b" defined multiple times with different content
<a href="#cite_note-a-2">[2]</a>
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedb
- <a href="#cite_ref-1">↑</a> section 3
- <a href="#cite_ref-a_2-0">↑</a> book
!! end
!! test T236256 - Named reference without text !! config wgCiteBookReferencing=true !! wikitext [1] [1.1] !! html/php
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-2">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> Cite error: Invalid
<ref>
tag; no text was provided for refs nameda
- <a href="#cite_ref-2">↑</a> page 1
!! end
!! test
T236256 - No text for a book reference
!! config
wgCiteBookReferencing=true
!! wikitext
[2]
Cite error: The opening <ref>
tag is malformed or has a bad name
!! html/php
<a href="#cite_note-foo-1">[1]</a>
Cite error: The opening <ref>
tag is malformed or has a bad name
- <a href="#cite_ref-foo_1-0">↑</a> book
!! end
!! test
T236256 - Empty text for a book reference
!! config
wgCiteBookReferencing=true
!! wikitext
[2]
Cite error: Invalid <ref>
tag; refs with no name must have content
!! html/php
<a href="#cite_note-foo-1">[1]</a>
Cite error: Invalid <ref>
tag; refs with no name must have content
- <a href="#cite_ref-foo_1-0">↑</a> book
!! end
!! test
T236256 - De-facto empty text for a book reference
!! config
wgCiteBookReferencing=true
!! wikitext
[2]
Cite error: Invalid <ref>
tag; refs with no name must have content
!! html/php
<a href="#cite_note-foo-1">[1]</a>
Cite error: Invalid <ref>
tag; refs with no name must have content
- <a href="#cite_ref-foo_1-0">↑</a> book
!! end
!! test T236256 - Everything in the same group !! config wgCiteBookReferencing=true !! wikitext [g1 1] [g1 1.1] [g1 1.1]
!! html/php
<a href="#cite_note-a-1">[g1 1]</a> <a href="#cite_note-b-2">[g1 1.1]</a> <a href="#cite_note-b-2">[g1 1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- ↑ <a href="#cite_ref-b_2-0">1.1.0</a> <a href="#cite_ref-b_2-1">1.1.1</a> page
!! end
!! test T236256 - Base and book reference in different groups !! config wgCiteBookReferencing=true !! wikitext [g1 1] [g2 1.1]
- ↑ book
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs nameda
- ↑ page
!! html/php
<a href="#cite_note-a-1">[g1 1]</a> <a href="#cite_note-2">[g2 1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs nameda
- <a href="#cite_ref-2">↑</a> page
!! end
!! test T236256 - Extending in the unnamed default group !! config wgCiteBookReferencing=true !! wikitext [g1 1] [1.2]
- ↑ book
!! html/php
<a href="#cite_note-a-1">[g1 1]</a> <a href="#cite_note-2">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs nameda
- <a href="#cite_ref-2">↑</a> page
!! end
!! test T236256 - Base in the unnamed default group !! config wgCiteBookReferencing=true !! wikitext [1] [g1 1.1]
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs nameda
- ↑ page
!! html/php
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-2">[g1 1.1]</a>
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs nameda
- <a href="#cite_ref-2">↑</a> page
- <a href="#cite_ref-a_1-0">↑</a> book
!! end
!! test T236256 - Extending a multi-part ref should be fine !! config wgCiteBookReferencing=true !! wikitext [1]
!! html/php
<a href="#cite_note-a-1">[1]</a>
<a href="#cite_note-2">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> part 1 part 2
- <a href="#cite_ref-2">↑</a> ok
!! end
- TODO: T242227 - Should render an error at the third reference.
!! test T236256 - Dont allow splitting a book reference for now !! config wgCiteBookReferencing=true !! wikitext [1] [1.1]
!! html/php
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-b-2">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- <a href="#cite_ref-b_2-0">↑</a> page 2 and page 3 the same time?
!! end
!! test
T236256 - Can't be a follow up and a book reference the same time
!! config
wgCiteBookReferencing=true
!! wikitext
[1]
Cite error: Invalid <ref>
tag; invalid names, e.g. too many
- ↑ book 1
!! html/php
<a href="#cite_note-a-1">[1]</a>
Cite error: Invalid <ref>
tag; invalid names, e.g. too many
- <a href="#cite_ref-a_1-0">↑</a> book 1
!! end
!! test
T236256 - Can't be a follow up and a book reference the same time, even when referencing 2 different bases
!! config
wgCiteBookReferencing=true
!! wikitext
[1]
[2]
Cite error: Invalid <ref>
tag; invalid names, e.g. too many
!! html/php
<a href="#cite_note-a-1">[1]</a>
<a href="#cite_note-b-2">[2]</a>
Cite error: Invalid <ref>
tag; invalid names, e.g. too many
- <a href="#cite_ref-a_1-0">↑</a> book 1
- <a href="#cite_ref-b_2-0">↑</a> book 2
!! end
!! test
Extending a Cite error: Closing </ref>
missing for <ref>
tag
Cite error: <ref>
tag with name "a" defined in <references>
has group attribute "" which does not appear in prior text.
!! html
<a href="#cite_note-1">[1.1]</a>
- ↑ Book
- <a href="#cite_ref-1">↑</a> Page 2
!! end
!! test
T239810: Extending a Cite error: Closing </ref>
missing for <ref>
tag
Cite error: <ref>
tag with name "a" defined in <references>
has group attribute "" which does not appear in prior text.
!! html
<a href="#cite_note-1">[1.1]</a>
- ↑ Book
- <a href="#cite_ref-1">↑</a> Page 2
!! end
!! test
Extends Cite error: Closing </ref>
missing for <ref>
tag
[1]
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedfootwo
!! html
<a href="#cite_note-foo-1">[1]</a> <a href="#cite_note-footwo-2">[2]</a>
- <a href="#cite_ref-foo_1-0">↑</a> BAR
- <a href="#cite_ref-footwo_2-0">↑</a> Cite error: Invalid
<ref>
tag; no text was provided for refs namedfootwo
!! end
!! test
Extends parent Cite error: Closing </ref>
missing for <ref>
tag
[1.1]
[1]
!! html
<a href="#cite_note-1">[1]</a> <a href="#cite_note-footwo-2">[2.1]</a> <a href="#cite_note-foo-3">[2]</a>
- <a href="#cite_ref-1">↑</a> BAR
- <a href="#cite_ref-foo_3-0">↑</a> book name
- <a href="#cite_ref-footwo_2-0">↑</a> page 7
!! end
!! test Interleaved extends groups !! config wgCiteBookReferencing=true !! wikitext [1] [2]
!! html
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-c-2">[2]</a>
<a href="#cite_note-3">[1.1]</a>
<a href="#cite_note-4">[2.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> text-a
- <a href="#cite_ref-3">↑</a> page b
- <a href="#cite_ref-c_2-0">↑</a> text-c
- <a href="#cite_ref-4">↑</a> page d
!! end
!! test Multiple groups with extends !! config wgCiteBookReferencing=true !! wikitext [1] [1.1]
!! html
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-2">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> text-a
- <a href="#cite_ref-2">↑</a> page b
<a href="#cite_note-c-3">[1]</a> <a href="#cite_note-4">[1.1]</a>
- <a href="#cite_ref-c_3-0">↑</a> text-c
- <a href="#cite_ref-4">↑</a> page d
!! end
!! test Multiple groups with extends, duplicated names across groups !! config wgCiteBookReferencing=true !! wikitext [1] [1.1]
!! html
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-2">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> text-a
- <a href="#cite_ref-2">↑</a> page b
<a href="#cite_note-a-3">[1]</a> <a href="#cite_note-4">[1.1]</a>
- <a href="#cite_ref-a_3-0">↑</a> text-c
- <a href="#cite_ref-4">↑</a> page d
!! end
!! test Intervening ref before extends !! config wgCiteBookReferencing=true !! wikitext [1] [2] [1.1]
!! html/php
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-2">[2]</a> <a href="#cite_note-3">[1.1]</a>
- <a href="#cite_ref-a_1-0">↑</a> book
- <a href="#cite_ref-3">↑</a> page 2
- <a href="#cite_ref-2">↑</a> another
!! end
!! test Normal refs after extends !! config wgCiteBookReferencing=true !! wikitext [1] [1.1]
!! html
<a href="#cite_note-a-1">[1]</a> <a href="#cite_note-2">[1.1]</a>
<a href="#cite_note-c-3">[2]</a>
- <a href="#cite_ref-a_1-0">↑</a> text-a
- <a href="#cite_ref-2">↑</a> page b
- <a href="#cite_ref-c_3-0">↑</a> text-c
!! end
!! test T242110: Copy-pasted, named sub-references should be merged and not mess with the numbering !! config wgCiteBookReferencing=true !! wikitext [1.1] [1.1]
!! html
<a href="#cite_note-a1-1">[1.1]</a> <a href="#cite_note-a1-1">[1.1]</a>
- ↑ a
- ↑ <a href="#cite_ref-a1_1-0">1.1.0</a> <a href="#cite_ref-a1_1-1">1.1.1</a> a1
!! end
!! test T242110: Reused sub-references should be merged and not mess with the numbering !! config wgCiteBookReferencing=true !! wikitext [1.1] [1.1]
!! html
<a href="#cite_note-a1-1">[1.1]</a> <a href="#cite_note-a1-1">[1.1]</a>
- ↑ a
- ↑ <a href="#cite_ref-a1_1-0">1.1.0</a> <a href="#cite_ref-a1_1-1">1.1.1</a> a1
!! end
!! test T242110: Bad extends attributes on reused sub-references should report an error !! config wgCiteBookReferencing=true !! wikitext [1.1] [1.1]
!! html
<a href="#cite_note-a1-1">[1.1]</a> <a href="#cite_note-a1-1">[1.1]</a>
- ↑ a
- ↑ <a href="#cite_ref-a1_1-0">1.1.0</a> <a href="#cite_ref-a1_1-1">1.1.1</a> a1 Cite error: Invalid
<ref>
tag; name "a1" defined multiple times with different content
- ↑ <a href="#cite_ref-a1_1-0">1.1.0</a> <a href="#cite_ref-a1_1-1">1.1.1</a> a1 Cite error: Invalid
!! end
!! test T242110: Copy-pasted, named sub-references should appear in proper order !! config wgCiteBookReferencing=true !! wikitext [1.1] [1.1] [2.1] [2.1] [3.1] [3.1]
!! html
<a href="#cite_note-a1-1">[1.1]</a> <a href="#cite_note-a1-1">[1.1]</a> <a href="#cite_note-b1-2">[2.1]</a> <a href="#cite_note-b1-2">[2.1]</a> <a href="#cite_note-c1-3">[3.1]</a> <a href="#cite_note-c1-3">[3.1]</a>
- ↑ a
- ↑ <a href="#cite_ref-a1_1-0">1.1.0</a> <a href="#cite_ref-a1_1-1">1.1.1</a> a1
- ↑ a
- ↑ <a href="#cite_ref-b1_2-0">2.1.0</a> <a href="#cite_ref-b1_2-1">2.1.1</a> b1
- ↑ a
- ↑ <a href="#cite_ref-c1_3-0">3.1.0</a> <a href="#cite_ref-c1_3-1">3.1.1</a> c1
!! end