!! version 2 !! test Book Referencing attribute rejected by default !! config wgCiteBookReferencing=false !! wikitext [foo] [bar] !! html/php

[1] Cite error: Invalid parameter in <ref> tag

  1. [foo]
!! end !! test Book Referencing attribute allowed with feature flag set !! config wgCiteBookReferencing=true !! wikitext [foo] [bar] !! html/php

[1] [1.1]

  1. [foo]
    1. [bar]
!! end !! test T236256 - Extending the same base multiple times is fine !! options language=de !! config wgCiteBookReferencing=true !! wikitext book page 2 page 3 !! html/php

[1] [1.1] [1.2]

  1. book
    1. page 2
    2. page 3
!! end !! test Extended references can be reused !! options language=de !! config wgCiteBookReferencing=true !! wikitext book page 2 !! html

[1] [1.1] [1.1]

  1. book
    1. 1.1,0 1.1,1 page 2
!! end !! test T240424 - Subreference reused as normal ref before its full definition !! config wgCiteBookReferencing=true !! wikitext page 2 book !! html

[1] Cite error: Invalid <ref> tag; name "b" defined multiple times with different content [2]

  1. Cite error: Invalid <ref> tag; no text was provided for refs named b
  2. book
!! end !! test T240424 - Extended reference reused before defined in the section !! config wgCiteBookReferencing=true !! wikitext page 2 book !! html

[1] [2]

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

Cite error: Invalid <ref> tag; name "b" defined multiple times with different content

!! 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 page 20 page 20 book !! html

[1] Cite error: Invalid <ref> tag; name "p20" defined multiple times with different content

  1. page 20

Cite error: <ref> tag with name "book" defined in <references> is not used in prior text.

!! end !! test T367749 - Turning a top-level ref into a subref is forbidden, especially when the content conflicts !! config wgCiteBookReferencing=true !! wikitext page 20 different content book !! html

[1] Cite error: Invalid <ref> tag; name "p20" defined multiple times with different content

  1. page 20

Cite error: <ref> tag with name "book" defined in <references> is not used in prior text.

!! 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 page 20 book !! html

[1] Cite error: Invalid <ref> tag; name "p20" defined multiple times with different content

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

Cite error: <ref> tag with name "book" defined in <references> is not used in prior text.

!! end !! test T236256 - Naming book references is fine !! config wgCiteBookReferencing=true !! wikitext book page 2 page 3 !! html/php

[1] [1.1] [1.2] [1.1] [1.2]

  1. book
    1. 1.1.0 1.1.1 page 2
    2. 1.2.0 1.2.1 page 3
!! end !! test T236256 - Extending a reference that doesn't exist #1 !! config wgCiteBookReferencing=true !! wikitext page 1 !! html/php

[1.1]

  1. Cite error: Invalid <ref> tag; no text was provided for refs named a
    1. page 1
!! end !! test T236256 - Extending a reference that doesn't exist #2 !! config wgCiteBookReferencing=true !! wikitext book page 1 !! html/php

[1] [2.1]

  1. book
  2. Cite error: Invalid <ref> tag; no text was provided for refs named a
    1. page 1
!! end !! test T236256 - Reference with the same name defined twice !! config wgCiteBookReferencing=true !! wikitext book magazine page 1 !! html/php

[1] [1] [1.1]

  1. 1.0 1.1 book Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
    1. page 1
!! end !! test T236256 - Can't reuse a name for two book references !! config wgCiteBookReferencing=true !! wikitext book page 2 page 3 !! html/php

[1] [1.1] [1.1]

  1. book
    1. 1.1.0 1.1.1 page 2 Cite error: Invalid <ref> tag; name "b" defined multiple times with different content
!! end !! test T236256 - Can't extend a book reference (no nesting) !! config wgCiteBookReferencing=true !! wikitext book page 2 section 3 !! html/php

[1] [1.1] Cite error: Extending <ref> tags more than one level deep is not allowed

  1. book
    1. page 2
!! end !! test T236256 - Can't extend a book reference (no nesting), specified in reverse order !! config wgCiteBookReferencing=true !! wikitext section 3 page 2 book !! html/php

[1.1] Cite error: Invalid <ref> tag; name "b" defined multiple times with different content [2]

  1. Cite error: Invalid <ref> tag; no text was provided for refs named b
    1. section 3
  2. book
!! end !! test T236256 - Named reference without text !! config wgCiteBookReferencing=true !! wikitext page 1 !! html/php

[1] [1.1]

  1. Cite error: Invalid <ref> tag; no text was provided for refs named a
    1. page 1
!! end !! test T236256 - No text for a book reference !! config wgCiteBookReferencing=true !! wikitext book !! html/php

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

  1. book
!! end !! test T236256 - Empty text for a book reference !! config wgCiteBookReferencing=true !! wikitext book !! html/php

[1] Cite error: Invalid <ref> tag; refs with no name must have content

  1. book
!! end !! test T236256 - De-facto empty text for a book reference !! config wgCiteBookReferencing=true !! wikitext book !! html/php

[1] Cite error: Invalid <ref> tag; refs with no name must have content

  1. book
!! end !! test T236256 - Everything in the same group !! config wgCiteBookReferencing=true !! wikitext book page !! html/php

[g1 1] [g1 1.1] [g1 1.1]

  1. book
    1. 1.1.0 1.1.1 page
!! end !! test T236256 - Base and book reference in different groups don't collide !! config wgCiteBookReferencing=true !! wikitext book page !! html/php

[g1 1] [g2 1.1]

  1. book
  1. Cite error: Invalid <ref> tag; no text was provided for refs named a
    1. page
!! end !! test T236256 - Extending in the unnamed default group doesn't collide with refs from other groups !! config wgCiteBookReferencing=true !! wikitext book page !! html/php

[g1 1] [1.1]

  1. book
  1. Cite error: Invalid <ref> tag; no text was provided for refs named a
    1. page
!! end !! test T236256 - Extends in named group doesn't conflict with default group !! config wgCiteBookReferencing=true !! wikitext book page !! html/php

[1] [g1 1.1]

  1. Cite error: Invalid <ref> tag; no text was provided for refs named a
    1. page
  1. book
!! end !! test T236256 - Extending a multi-part ref should be fine !! config wgCiteBookReferencing=true !! wikitext part 1 part 2 ok !! html/php

[1]

[1.1]

  1. part 1 part 2
    1. 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 book page 2 and page 3 the same time? !! html/php

[1] [1.1]

  1. book
    1. 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 book 1 huh? !! html/php

[1] Cite error: A <ref follow="…"> tag that is the continuation of a previous one can neither be named individually nor extended

  1. 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 book 1 book 2 huh? !! html/php

[1] [2] Cite error: A <ref follow="…"> tag that is the continuation of a previous one can neither be named individually nor extended

  1. book 1
  2. book 2
!! end !! test Extending a that doesn't appear in the text, but in !! config wgCiteBookReferencing=true !! wikitext Page 2 Book !! html

[1.1]

  1. Book
    1. Page 2
!! end !! test T239810: Extending a that doesn't appear in the text, but in {{#tag:references}} !! config wgCiteBookReferencing=true !! wikitext Page 2 {{#tag:references| Book }} !! html

[1.1]

  1. Book
    1. Page 2
!! end !! test Extends defined in called with #tag !! config wgCiteBookReferencing=true !! wikitext BAR {{#tag:references| p. 10 }} !! html

[1] [2]

  1. BAR
  2. Cite error: Invalid <ref> tag; no text was provided for refs named footwo
!! end !! test Extends parent defined in called with #tag !! config wgCiteBookReferencing=true !! wikitext BAR page 7 {{#tag:references| book name }} !! html

[1] [2.1] [2]

  1. BAR
  2. book name
    1. page 7
!! end !! test Interleaved extends groups !! config wgCiteBookReferencing=true !! wikitext text-a text-c page b page d !! html

[1] [2]

[1.1] [2.1]

  1. text-a
    1. page b
  2. text-c
    1. page d
!! end !! test Multiple groups with extends !! config wgCiteBookReferencing=true !! wikitext text-a page b text-c page d !! html

[1] [1.1]

  1. text-a
    1. page b

[1] [1.1]

  1. text-c
    1. page d
!! end !! test Multiple groups with extends, duplicated names across groups !! config wgCiteBookReferencing=true !! wikitext text-a page b text-c page d !! html

[1] [1.1]

  1. text-a
    1. page b

[1] [1.1]

  1. text-c
    1. page d
!! end !! test Intervening ref before extends !! config wgCiteBookReferencing=true !! wikitext book another page 2 !! html/php

[1] [2] [1.1]

  1. book
    1. page 2
  2. another
!! end !! test Normal refs after extends !! config wgCiteBookReferencing=true !! wikitext text-a page b text-c !! html

[1] [1.1]

[2]

  1. text-a
    1. page b
  2. text-c
!! end !! test T242110: Copy-pasted, named sub-references should be merged and not mess with the numbering !! config wgCiteBookReferencing=true !! wikitext a1 a1 a !! html

[1.1] [1.1]

  1. a
    1. 1.1.0 1.1.1 a1
!! end !! test T242110: Reused sub-references should be merged and not mess with the numbering !! config wgCiteBookReferencing=true !! wikitext a1 a !! html

[1.1] [1.1]

  1. a
    1. 1.1.0 1.1.1 a1
!! end !! test Reused sub-references can be rolled back without messing up numbering !! config wgCiteBookReferencing=true !! wikitext {{#tag:references| a in group a1 in group |group=g}} a1 a !! html

[1.1] [g 1.1]

  1. a in group
    1. a1 in group

[1.1]

  1. a in group Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
    1. 1.1.0 1.1.1 a1
!! end !! test T242110: Bad extends attributes on reused sub-references should report an error !! config wgCiteBookReferencing=true !! wikitext a1 a !! html

[1.1] [1.1]

  1. a
    1. 1.1.0 1.1.1 a1 Cite error: Invalid <ref> tag; name "a1" defined multiple times with different content
!! end !! test T242110: Copy-pasted, named sub-references should appear in proper order !! config wgCiteBookReferencing=true !! wikitext a1 a1 b1 c1 a a a !! html

[1.1] [1.1] [2.1] [2.1] [3.1] [3.1]

  1. a
    1. 1.1.0 1.1.1 a1
  2. a
    1. 2.1.0 2.1.1 b1
  3. a
    1. 3.1.0 3.1.1 c1
!! end