# Force the test runner to ensure the extension is loaded !! hooks ref references !! endhooks !! article Template:echo !! text {{{1}}} !! endarticle !! test Simple , no !! wikitext Wikipedia rocks!Proceeds of Rockology, vol. XXI !! html Wikipedia rocks![1]
  1. Proceeds of Rockology, vol. XXI
!! end !! test Simple , with !! wikitext Wikipedia rocks!Proceeds of Rockology, vol. XXI !! html

Wikipedia rocks![1]

  1. Proceeds of Rockology, vol. XXI
!! end !! article Template:Simple template !! text A ''simple'' template. !! endarticle !! test with a simple template !! wikitext Templating{{simple template}} !! html

Templating[1]

  1. A simple template.
!! end !! test with a !! wikitext Templating{{simple template}} !! html

Templating[1]

  1. {{simple template}}
!! end !! test in a !! wikitext Templating{{simple template}} !! html

Templating<ref>{{simple template}}</ref>


!! end !! test in a !! wikitext Templating !! html

Templating


!! end !! test in a (bug 5384) !! wikitext TemplatingText !! html

Templating[1]

  1. Text
!! end !! test after (bug 6164) !! wikitext one Image:Foobar.jpg !! html

[1]

  1. one
!! end !! test {{REVISIONID}} on page with (bug 6299) !! wikitext {{REVISIONID}}elite !! html 1337[1]
  1. elite
!! end !! test {{REVISIONID}} on page without (bug 6299 sanity check) !! wikitext {{REVISIONID}} !! html

1337

!! end !! test Ref with content followed by blank ref !! wikitext content !! html

[1]

[1]

  1. 1.0 1.1 content
!! end !! test Blank ref followed by ref with content !! wikitext content !! html

[1]

[1]

  1. 1.0 1.1 content
!! end !! test Regression: non-blank ref "0" followed by ref with content !! wikitext 0 content !! html

[1]

[1]

  1. 1.0 1.1 0 Cite error: Invalid <ref> tag; name "blank" defined multiple times with different content
!! end !! test Regression sanity check: non-blank ref "1" followed by ref with content !! wikitext 1 content !! html

[1]

[1]

  1. 1.0 1.1 1 Cite error: Invalid <ref> tag; name "blank" defined multiple times with different content
!! end !! test Ref names containing a number !! wikitext One Two Three !! html

[1] [2] [3]

  1. One
  2. Two
  3. Three
!! end !! test Erroneous refs !! wikitext Zero Also zero, but differently! (Normal ref) !! html

Cite error: Invalid <ref> tag; name cannot be a simple integer. Use a descriptive title

[1]

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

[2]

[3]

Cite error: Invalid parameter in <references> tag

  1. Also zero, but differently! (Normal ref)
  2. Cite error: Invalid <ref> tag; no text was provided for refs named bar
  3. Cite error: Invalid <ref> tag; no text was provided for refs named blankwithnoreference
!! end !! test Simple , with in group !! wikitext Wikipedia rocks!Proceeds of Rockology, vol. XXI Wikipedia rocks!Proceeds of Rockology, vol. XXI !! html

Wikipedia rocks![1] Wikipedia rocks![note 1]

  1. Proceeds of Rockology, vol. XXI
  1. Proceeds of Rockology, vol. XXI
!! end !! test Simple , with in group, with groupname in Chinese !! wikitext AAAref aBBBnote bCCCref c ;refs ;notes !! html

AAA[参 1]BBB[注 1]CCC[参 2]

refs
  1. ref a
  2. ref c
notes
  1. note b
!! end !! test defined in !! wikitext BAR !! html

[1]

  1. BAR
!! end !! test defined in called with #tag !! wikitext {{#tag:references| BAR }} !! html

[1]

  1. BAR
!! end !! test defined in error conditions !! wikitext BAR bad group BAR BAR !! html

[2 1]

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

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

!! end !! article MediaWiki:cite_link_label_group-klingon !! text wa' cha' wej loS vagh jav Soch chorgh Hut wa'maH !! endarticle !! test with custom group link with number names in Klingon !! wikitext Wikipedia rocks!Proceeds of Rockology, vol. XXI !! html

Wikipedia rocks![wa']

  1. Proceeds of Rockology, vol. XXI
!! end !! test Bug 31374 regression check: nested strip items !! wikitext {{#tag:ref|notereference|group=Note}} !! html

[Note 1]

  1. note[1]
  1. reference
!! end !! test Bug 13073 regression check: wrapped !! options parsoid={"suppressErrors": true} !! wikitext foo
!! html/*

[1]

  1. foo
!! end !! test with no name and no content. !! wikitext Bla. !! html

Bla.Cite error: Invalid <ref> tag; refs with no name must have content

!! end !! test with an empty-string name parameter and no content. !! wikitext Bla. !! html

Bla.Cite error: Invalid <ref> tag; refs with no name must have content

!! end !! test with a non-empty name parameter and no content. !! wikitext Bla. !! html Bla.[1]
  1. Cite error: Invalid <ref> tag; no text was provided for refs named void
!! end !! test s with the follow parameter !! wikitext Page one.First page footnote text. Page two.Second page footnote text. == References == !! html

Page one.[1]

Page two.

References[edit]

  1. First page footnote text. Second page footnote text.
!! end !! test with both name and follow parameters - invalid !! wikitext Page one.This ref is invalid. !! html

Page one.Cite error: Invalid <ref> tag; invalid names, e.g. too many

!! end !! test Multiple definition (outside ) !! wikitext abc def !! html

[1] [1]

  1. 1.0 1.1 abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
!! end !! test Multiple definition (inside ) !! wikitext abc def !! html

[1]

  1. abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
!! end !! test Multiple definition (mixed outside/inside) !! wikitext abc def !! html

[1]

  1. abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
!! end !! test Multiple definition (inside {{#tag:references}}) !! wikitext {{#tag:references| abc def }} !! html

[1]

  1. abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
!! end #### ---------------------------------------------------------------- #### Parsoid-only testing of Parsoid's impl of and #### tags. Parsoid's output for these tags differs from that of the #### PHP parser. #### ---------------------------------------------------------------- !! test Ref: 1. ref-location should be replaced with an index span !! wikitext A foo B foo C !! html/parsoid

A [1] B [2] C [3]

  1. foo
  2. foo
!! end !! test Ref: 2. ref-tags with identical names should all get the same index !! wikitext A foo B !! html/parsoid

A [1] B [1]

  1. 1 2 foo
!! end !! test Ref: 3. spaces in ref-names should be ignored !! wikitext A foo B C !! html/parsoid

A [1] B [1] C [1]

  1. 1 2 3 foo
!! end # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly) !! test Ref: 4. 'constructor' should be accepted as a valid ref-name !! wikitext A foo !! html/parsoid

A [1]

  1. foo
!! end !! test Ref: 5. body should accept generic wikitext !! wikitext A This is a '''[[bolded link]]''' and this is a {{echo|transclusion}} !! html/parsoid

A [1]

  1. This is a bolded link and this is a transclusion
!! end !! test Ref: 6. indent-pres should not be output in ref-body !! wikitext A foo bar baz !! html/parsoid

A [1]

  1. foo bar baz
!! end !! test Ref: 7. No p-wrapping in ref-body !! wikitext A foo bar baz booz !! html/parsoid

A [1]

  1. foo bar baz booz
!! end !! test Ref: 8. transclusion wikitext has lower precedence !! wikitext A foo {{echo| B C}} !! html/parsoid

A [1] B C}}

  1. foo {{echo|
!! end !! test Ref: 9. unclosed comments should not leak out of ref-body !! wikitext A foo !! end !! test Ref: 10. Unclosed HTML tags should not leak out of ref-body !! wikitext A foo B C !! html/parsoid

A [1] B C

  1. foo
!! end !! test Ref: 11. ref-tags acts like an inline element wrt P-wrapping !! wikitext A foo B C bar D !! html/parsoid

A [1] B C [2] D

  1. foo
  2. bar
!! end !! test Ref: 12. ref-tags act as trailing newline migration barrier !! wikitext a b c !! html/parsoid

a

b [1] [2]

c

!! end !! test Ref: 13. ref-tags are not SOL-transparent and block indent-pres !! wikitext foo A bar B !! html/parsoid

[1] A [2] B

  1. foo
  2. bar
!! end ## Roundtripping fails because of nowiki'ing !! test Ref: 14. A nested ref-tag should be emitted as plain text !! options parsoid=wt2html !! wikitext foo bar baz !! html/parsoid

[1] baz</ref>

  1. foo <ref>bar
!! end !! test Ref: 15. ref-tags with identical names should get identical indexes !! wikitext A1 foo A2 B1 B2 bar !! html/parsoid

A1 [1] A2 [1] B1 [2] B2 [2]

  1. 1 2 foo
  2. 1 2 bar
!! end ## We don't bother wt2wt-ing non-standard whitespace !! test Ref: 16. Tokenizer should accept non-standard whitespace in and tags !!options parsoid=wt2html !! wikitext A foo !! html/parsoid

A [1]

  1. foo
!! end !! test Ref: 17. Generate valid HTML5 id/about attributes !! wikitext foo ve-created name !! html/parsoid

[1] [2]

  1. foo
  2. ve-created name
!! end !! test Ref: 18. T58916: Extension attributes should be parsed as plain text !! wikitext foo !! html/parsoid

[1]

  1. foo
!! end !! test Ref: 19. ref-tags with identical name encodings should get identical indexes !! wikitext 1 foo 2 !! html/parsoid

1 [1] 2 [1]

  1. 1 2 foo
!! end !! test Ref: 20. ref-tags with identical names but different content should keep it !! wikitext A Foo one B Foo two C !! html/parsoid

A [1] B [1] C [1]

  1. 1 2 3 Foo one
!! end !! test References: 1. references tag without any refs should be handled properly !! wikitext !! html/parsoid
    !! end !! test References: 2. references tag with group only outputs references from that group !! wikitext A foo B bar C baz !! html/parsoid

    A [a 1] B [b 1] C [1]

    1. foo
    1. baz
    1. bar
    !! end !! test References: 3. ref list should be cleared after processing references !! wikitext A foo B bar !! html/parsoid

    A [1]

    1. foo

    B [1]

    1. bar
    !! end !! test References: 4. only referenced group should be cleared after processing references !! wikitext A afoo B bfoo C cfoo !! html/parsoid

    A [a 1] B [1]

    1. afoo

    C [2]

    1. bfoo
    2. cfoo
    !! end ## Don't expect this to rt since we're dropping content !! test References: 5. ref tags in references should be processed while ignoring all other content !! options parsoid=wt2html,html2html !! wikitext A B bar foo This should just get lost. !! html/parsoid

    A [1] B [2]

    1. foo
    2. bar
    !! end !! test References: 6. from a transclusion !! wikitext Foo {{echo|}} !! html/parsoid

    [1]

    1. Foo
    !! end !! test References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled !! wikitext A foo bar for a B foo !! html/parsoid

    A [1] B [X 1]

    1. foo bar for a
    1. foo
    !! end !! test References: 8. T88019: Remove s from templates inside that's itself inside a template !! wikitext X{{echo|foo {{echo|bar}} and {{echo|baz}} boo}} !! html/parsoid

    X[1]

    1. foo bar and baz boo
    !! end # This test only works in wt2html now as the are always generated # unless selser is active. Once T72722 is fixed, we should add a changes test # here to ensure that unrelated changes don't add the new # when selser is active. !! test References: 9. Generate missing references list at the end !! wikitext A foo B bar !! html/parsoid

    A [1] B [inexistent 1]

    1. foo
    1. bar
    !! end !! test References: 10. New shouldn't be added for unrelated edits. !! options parsoid={ "modes": ["selser"], "changes": [["#x", "remove"]], "selser": "noauto" } !! wikitext Unrelated text that's going to disappear. A foo !! wikitext/edited Unrelated text. A foo !! end !! test Entities in ref name !! wikitext hi !! html/parsoid

    [1]

    1. hi
    !! end ## The output here may look funny, but it's what the php parser will do. The ## unclosed references tag becomes escaped text, and then a new references ## tag is auto-generated. The test is wt2html only because it roundtrips with ## nowiki tags, and the auto-generated references tag is only dropped in ## rtTestMode. !! test Generate references for unclosed references tag !! options parsoid=wt2html !! wikitext afoo !! html/parsoid

    a[1]

    <references>

    1. foo
    !! end !! test New reference serializes on its own line !! options parsoid=wt2wt,html2wt !! wikitext foo !! html/parsoid foo
      !! end