!! version 2 # Force the test runner to ensure the extension is loaded !! hooks ref references !! endhooks !! article Template:1x !! text {{{1}}} !! endarticle !! article Template:refinref !! text {{{1}}} !! endarticle ## Parsoid only drops autoGenerated references lists in rt testing !! test Simple , no !! options parsoid=wt2html !! wikitext Wikipedia rocks!Proceeds of Rockology, vol. XXI !! html/php

Wikipedia rocks![1]

  1. Proceeds of Rockology, vol. XXI
!! html/parsoid

Wikipedia rocks![1]

  1. Proceeds of Rockology, vol. XXI
!! end !! test Simple , no , page ends in a list !! options parsoid=wt2html !! wikitext blahfoo --Matma Rex 17:35, 31 March 2020 (UTC) * bleh --Matma Rex 17:35, 31 March 2020 (UTC) !! html

blah[1] --Matma Rex 17:35, 31 March 2020 (UTC)

  • bleh --Matma Rex 17:35, 31 March 2020 (UTC)
  1. foo
!! html/parsoid

blah[1] --Matma Rex 17:35, 31 March 2020 (UTC)

  • bleh --Matma Rex 17:35, 31 March 2020 (UTC)
  1. foo
!! end !! test Simple , with !! wikitext Wikipedia rocks!Proceeds of Rockology, vol. XXI !! html/php

Wikipedia rocks![1]

  1. Proceeds of Rockology, vol. XXI
!! html/parsoid

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/php

Templating[1]

  1. A simple template.
!! html/parsoid

Templating[1]

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

Templating[1]

  1. {{simple template}}
!! html/parsoid

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 (T7384) !! wikitext TemplatingText !! html/php

Templating[1]

  1. Text
!! html/parsoid

Templating[1]

  1. Text
!! end !! test in an ignored caption (T235656) !! wikitext [[File:Foobar.jpg|frameless|ignored caption with a refboo]] !! html/php

ignored caption with a ref[1]

  1. boo
!! html/parsoid

  1. boo
!! end !! test in expanded attributes of tags (legitimate or otherwise) !! options parsoid=wt2html,wt2wt !! wikitext {| |- boo |x |} !! html/php
x
  1. boo
!! html/parsoid
x
  1. boo
!! end !! test s in language variant markup !! options language=sr variant=sr-ec !! wikitext -{lj a}-аб-{nj b}-вг-{dž}- c !! html/php

lj [1]абnj [2]вгdž ц [2]

  1. а
  2. 2,0 2,1 б
!! html/parsoid

абвг c [2]

  1. a
  2. b
!! end !! test after (bug 6164) !! options parsoid=wt2html,html2html !! wikitext one Image:Foobar.jpg !! html/php

[1]

  1. one
!! html/parsoid

[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/php

[1]

[1]

  1. 1.0 1.1 content
!! html/parsoid

[1]

[1]

  1. 1 2 content
!! end !! test Blank ref followed by ref with content !! wikitext content !! html/php

[1]

[1]

  1. 1.0 1.1 content
!! html/parsoid

[1]

[1]

  1. 1 2 content
!! end !! test Regression: non-blank ref "0" followed by ref with content !! wikitext 0 content !! html/php

[1]

[1]

  1. 1.0 1.1 0 Cite error: Invalid <ref> tag; name "blank" defined multiple times with different content
!! html/parsoid

[1]

[1]

!! end !! test Regression sanity check: non-blank ref "1" followed by ref with content !! wikitext 1 content !! html/php

[1]

[1]

  1. 1.0 1.1 1 Cite error: Invalid <ref> tag; name "blank" defined multiple times with different content
!! html/parsoid

[1]

[1]

!! end !! test Ref names containing a number !! wikitext One Two Three !! html

[1] [2] [3]

  1. One
  2. Two
  3. Three
!! end ## Note that the underscores are normalized in the id only and these remain ## separate names (T184912#4758775) !! test T184912: Consistent normalization of consecutive underscores !! wikitext example example !! html/php

[1] [2]

  1. example
  2. example
!! html/parsoid

[1] [2]

  1. example
  2. example
!! end !! test Erroneous refs !! wikitext Zero Also zero, but differently! (Normal ref) !! html/php

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
!! html/parsoid

[1]

[2]

[3]

[4]

[5]

  1. Zero
  2. Also zero, but differently! (Normal ref)
    !! end !! test Can't have name="…" and follow="…" the same time !! wikitext theValue !! html/php

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

    !! html/parsoid

    [1]

    1. theValue
    !! end !! test Conflicting name="…" and follow="…" still invalid when a third parameter is present !! wikitext theValue !! html/php

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

    !! html/parsoid

    [1]

    1. theValue
    !! end !! test It's not possible to follow="…" a defined in the section !! wikitext theFollows theValue !! html/php

      theFollows

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

    !! html/parsoid

    [1]

    1. theFollows
    2. theValue
    !! end ## Note that the Cite extension of the legacy parser is putting paragraphs ## as direct descendents of ordered lists (instead of inside list items, ## or wherehaveyou) !! test A follow="…" before its parent is not merged !! wikitext theFollows theValue !! html/php

    [1]

      theFollows

    1. theValue
    !! html/parsoid

    [1] [2]

    1. theFollows
    2. theValue
    !! end ## This is a nasty edge case which was dropping the ref entirely from the ## output of the Cite extension of the legacy parser !! test "follow" after a named ref but before its parent !! wikitext First Second Third
    !! html/php

    [1]

    [2]


      Second

    1. First
    2. Third
    !! html/parsoid

    [1] [2] [3]


    1. First
    2. Second
    3. Third
    !! end !! test "follow" after an anonymous ref but before its parent !! wikitext First Second Third
    !! html/php

    [1]

    [2]


      Second

    1. First
    2. Third
    !! html/parsoid

    [1] [2] [3]


    1. First
    2. Second
    3. Third
    !! end !! test Valid follow="…" after it's parent !! wikitext theValue theFollows Should be 2 !! html/php

    [1]

    [2]

    1. theValue theFollows
    2. Should be 2
    !! html/parsoid

    [1] [1] [2]

    1. theValue theFollows
    2. Should be 2
    !! end !! test Forward-referenced ref with follow !! wikitext theFollows theValue !! html/php

    [1]

    1. theFollows Cite error: Invalid <ref> tag; name "theName" defined multiple times with different content
    !! html/parsoid

    [1] [1]

    1. theFollows
    !! end ## FIXME: Parsoid needs to strip the mw:Cite/Follow wrapper for this to pass !! test Forward-referenced ref with magical follow edge case !! wikitext theValue theValue !! html

    [1]

    1. theValue
    !! end !! test Follow following a named ref with multiple definitions !! wikitext 123 234 345 !! html/parsoid

    [1] [1] [1]

    1. 1 2 123 345
    !! end !! test Multiple follow after refs without content and trailing ref with content in references section !! wikitext ADD SUB MULtheFollowValue MODanotherFollowValue theValue !! html/php

    ADD[1] SUB[1] MUL MOD

    1. 1.0 1.1 theFollowValue anotherFollowValue Cite error: Invalid <ref> tag; name "theName" defined multiple times with different content
    !! html/parsoid

    ADD[1] SUB[1] MUL[1] MOD[1]

    1. 1 2 theFollowValue anotherFollowValue
    !!end !! test Valid parameters become invalid when a third is present !! wikitext theValue !! html

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

    !! 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 Attributes are trimmed by the parser, see Sanitizer::decodeTagAttributes() !! wikitext in group g in group " g " !! html

    [g 1] [g 2]

    1. in group g
    2. in group " g "
    !! 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 T242437 - Nested references edge case, outer tag function with LDR !! wikitext {{#tag:references| bar }} !! html

    [1] Cite error: Closing tag missing for <references>

    !! end !! test T242437 - Nested references edge case, outer tag function, inner LDR !! wikitext {{#tag:references| bar }} !! html

    [1] Cite error: Closing tag missing for <references>

    !! end !! test T242437 - Nested references edge case, inner tag function with LDR !! wikitext {{#tag:references| bar }} !! html

    [1]

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

    [2 1]

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

    Cite error: <ref> tag defined in <references> with name "foo" has no content.
    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 in <references> has conflicting group attribute "1".
    Cite error: <ref> tag defined in <references> has no name attribute.

    !! html/parsoid

    [2 1]

    1. BAR
    2. BAR BAR
    1. bad group
    !! end !! test ungrouped and grouped refs with and without content defined !! wikitext ONE TWO THREECONTENT !! html/parsoid

    ONE[1]

    TWO[NOTES 1] THREE[NOTES 2]

    1. CONTENT
    !! html/php

    ONE[1]

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

    TWO[NOTES 1] THREE[NOTES 2]

    1. Cite error: Invalid <ref> tag; no text was provided for refs named foo
    2. CONTENT
    !! end !! test Error conditions on non-visible content !! wikitext x !! html/php

    [1] [2] [3]

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

    Cite error: <ref> tag defined in <references> with name "a" has no content.
    Cite error: <ref> tag defined in <references> with name "b" has no content.
    Cite error: <ref> tag defined in <references> with name "c" has no content.

    !! html/parsoid

    [1] [2] [3]

    !! 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 Consecutive whitespace in custom link label message should not create empty [] !! wikitext 1st 2nd !! html

    [wa'] [cha']

    1. 1st
    2. 2nd
    !! 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. foo. zero{{1x|}} !! html/php

    Bla.Cite error: Invalid <ref> tag; refs with no name must have content foo.Cite error: The opening <ref> tag is malformed or has a bad name zeroCite error: The opening <ref> tag is malformed or has a bad name

    !! html/parsoid

    Bla.[1] foo.[2] zero[3]

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

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

    !! html/parsoid

    Bla.[1]

    !! end !! test with whitespace only name parameter and no content. !! options parsoid=wt2html !! wikitext Hi Ho !! html/php

    Hi Cite error: Invalid <ref> tag; refs with no name must have content Ho Cite error: The opening <ref> tag is malformed or has a bad name

    !! html/parsoid

    Hi [1] Ho [2]

    !! end !! test with a non-empty name parameter and no content. !! wikitext Bla. !! html/php

    Bla.[1]

    1. Cite error: Invalid <ref> tag; no text was provided for refs named void
    !! html/parsoid

    Bla.[1]

    !! end !! test Whitespace only doesn't set content for named ref !! wikitext Hi Hi Off to work we go! !! html/php

    Hi [1] Hi [1]

    1. 1.0 1.1 Off to work we go!
    !! html/parsoid

    Hi [1] Hi [1]

    1. 1 2 Off to work we go!
    !! end !! test Multiple definition (outside ) !! wikitext abc def !! html/php

    [1] [1]

    1. 1.0 1.1 abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
    !! html/parsoid

    [1] [1]

    1. 1 2 abc
    !! end !! test Multiple definition (inside ) !! wikitext abc def !! html/php

    [1]

    1. abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
    !! html/parsoid

    [1]

    1. abc
    !! end !! test Multiple definition (mixed outside/inside) !! wikitext abc def !! html/php

    [1]

    1. abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
    !! html/parsoid

    [1]

    1. abc
    !! end !! test Multiple definition (inside {{#tag:references}}) !! wikitext {{#tag:references| abc def }} !! html/php

    [1]

    1. abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content
    !! html/parsoid

    [1] [1] [1]

    !! end # Parsoid doesn't rt cleanly because name attribute is actually broken # here ( tag closes at first >); see next test for a tidied version. !! test T29694 - [] in reference names in HTML5 fragment mode !! config wgFragmentMode=[ 'html5' ] !! options parsoid=wt2html !! wikitext [bar] !! html/php

    [1]

    1. ">[bar]
    !! html/parsoid

    [1]

    1. ">[bar]
    !! end !! test T29694 - [] in reference names in HTML5 fragment mode (tidied) !! config wgFragmentMode=[ 'html5' ] !! wikitext [bar] !! html/php

    [1]

    1. [bar]
    !! html/parsoid

    [1]

    1. [bar]
    !! 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]

    !! 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 {{1x|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 {{1x| B C}} !! html/parsoid

    A [1] B C}}

    1. foo {{1x|
    !! 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 foo bar c !! html/parsoid

    a

    b [1] [2]

    c

    1. foo
    2. bar
    !! 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 !! config wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext foo !! html/php

    [1]

    1. foo
    !! html/parsoid

    [1]

    1. foo
    !! end # Parsoid doesn't wt2wt this cleanly because we serialize both # versions of the name the same way ("a & b") !! test Ref: 19. ref-tags with identical name encodings should get identical indexes !! config wgFragmentMode=[ 'html5', 'legacy' ] !! options parsoid=wt2html,html2html !! wikitext 1 foo 2 !! html/php

    1 [1] 2 [1]

    1. 1.0 1.1 foo
    !! 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 Verify invalid use of a numeric character in a ref name !! wikitext PRE preValue THEVALUE theValue POST postValue !! html/php

    PRE [1] THEVALUE Cite error: Invalid <ref> tag; name cannot be a simple integer. Use a descriptive title POST [2]

    1. preValue
    2. postValue
    !! html/parsoid

    PRE [1] THEVALUE [2] POST [3]

    1. preValue
    2. theValue
    3. postValue
    !! end !! test Verify invalid use of a numeric character in a ref name and follow !! wikitext theValue theFollow !! html/php

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

    !! html/parsoid

    [1] [1]

    1. theValue theFollow
    !! end !! test References: 1a. references tag without any refs should be handled properly !! wikitext !! html/parsoid
      !! end !! test References: 1b. 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

        A [1]

        1. foo

        B [1]

        1. bar
        !! html/parsoid

        A [1]

        1. foo

        B [1]

        1. bar
        !! end !! test Counters should be cleared after processing named !! wikitext A foo B bar !! html

        A [g 1]

        1. foo

        B [g 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 {{1x|}} !! html/php

        [1]

        1. Foo
        !! 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: 7b. Multiple references tags some with errors should be correctly handled !! wikitext ALPHA BETA ONE TWOfood THREECONTENT FOUR FIVE SIX NOGROUPCONTENT SEVEN EIGHT NINENINECONTENT TENTENCONTENT !! html/parsoid

        ALPHA[1] BETA[1] ONE[NOTES 1] TWO[NOTES 1]

        1. 1 2 food

        THREE[NOTES 1] FOUR[NOTES 2] FIVE[NOTES 2] SIX[1]

        1. CONTENT
        2. 1 2
        1. NOGROUPCONTENT

        SEVEN[NOTES 1] EIGHT[NOTES 2]

        NINE[NOTES 1] TEN[NOTES 2]

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

        X[1]

        1. foo bar and baz boo
        !! end !! 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.1. 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 References: 10.2. New shouldn't be added for unrelated edits. !! options parsoid={ "modes": ["selser"], "changes": [["#x", "remove"]], "selser": "noauto", "responsiveReferences": { "enabled": true, "threshold": 2 } } !! wikitext Unrelated text that's going to disappear. A foo !! wikitext/edited Unrelated text. A foo !! end !! test Grouped references with follow rendered in mixed order !! wikitext AA group_a_name_a BA group_b_name_a CA group_c_name_a BB group_b_name_b FBA group_b_follow_a FAA group_a_follow_a FBB group_b_follow_b FCA group_c_follow_a !! html/php

        AA [a 1] BA [b 1] CA [c 1] BB [b 2] FBA FAA FBB FCA

        1. group_b_name_a group_b_follow_a
        2. group_b_name_b group_b_follow_b
        1. group_c_name_a group_c_follow_a
        1. group_a_name_a group_a_follow_a
        !! html/parsoid

        AA [a 1] BA [b 1] CA [c 1] BB [b 2] FBA [b 1] FAA [a 1] FBB [b 2] FCA [c 1]

        1. group_b_name_a group_b_follow_a
        2. group_b_name_b group_b_follow_b
        1. group_c_name_a group_c_follow_a
        1. group_a_name_a group_a_follow_a
        !! end !! test Grouped references with automatic group references generating errors !! wikitext GROUP theValue GROUP3 theValue3 GROUP2 theValue2 aDifferentNameGROUP3 anotherValue3differentName aDifferentNameGROUP2 anotherValue2DifferentName anotherGROUP3 anotherValue3 aDifferentNameGROUP anotherValueDifferentName !! html/php

        GROUP [theGroup 1] GROUP3 [theGroup3 1] GROUP2 [theGroup2 1] aDifferentNameGROUP3 [theGroup3 2] aDifferentNameGROUP2 [theGroup2 2] anotherGROUP3 [theGroup3 1] aDifferentNameGROUP [theGroup 2]

        1. 1.0 1.1 theValue3 Cite error: Invalid <ref> tag; name "theName3" defined multiple times with different content
        2. anotherValue3differentName


        Cite error: <ref> tags exist for a group named "theGroup", but no corresponding <references group="theGroup"/> tag was found
        Cite error: <ref> tags exist for a group named "theGroup2", but no corresponding <references group="theGroup2"/> tag was found

        !! html/parsoid

        GROUP [theGroup 1] GROUP3 [theGroup3 1] GROUP2 [theGroup2 1] aDifferentNameGROUP3 [theGroup3 2] aDifferentNameGROUP2 [theGroup2 2] anotherGROUP3 [theGroup3 1] aDifferentNameGROUP [theGroup 2]

        1. 1 2 theValue3
        2. anotherValue3differentName
        1. theValue
        2. anotherValueDifferentName
        1. theValue2
        2. anotherValue2DifferentName
        !! end # Doesn't wt2wt cleanly because we don't encode the & in html2wt direction !! test Entities in ref name !! config wgFragmentMode=[ 'html5', 'legacy' ] !! options parsoid=wt2html,html2html !! wikitext hi !! html/php

        [1]

        1. 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. !! 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 ## Ref in ref ## The preprocessor doesn't support nested extension tags. Extensions, for ## their part, can treat portions of their content as wikitext and thus sneak ## in some nesting, the details of which are going to be extension specific. ## However, the common factor is the need to play games with transclusions ## to get around the limitations posed by the preprocessor. ## The legacy implementation only parses the ref contents when producing the ## output for reference tags, at which point, any nested refs will be ignored. ## Parsoid mimics this behaviour. !! test Ref in ref: nested in top level ref !! wikitext test hi {{refinref|ho}} !! html/php

          test [1]

          1. hi

          Cite error: <ref> tag defined in <references> has no name attribute.

          !! html/parsoid

          test [1]

          1. hi
          !! end ## Similarly, when ref contents are processed by the legacy parser, the frame ## parameters will not be around, so template arguments fail to be populated. ## Parsoid processing happens in a different order, where it has access to ## the frame. !! test Ref in ref: top level ref nested in transclusion !! wikitext test {{refinref|456123}} !! html/php

          test [1]

          1. {{{1}}}
          !! html/parsoid

          test [2]

          !! end ## This is the common way that wikis use nested references. The reference ## in the arguments will go through extension substitution before being ## passed to the parser function so, in contrast, it'll already have been ## processed by the time the parser gets to the outer ref's contents. ## ## Parsoid doesn't have support for the tag parser function in parserTests so ## the section is omitted. However, there is a curio buried here. The call to ## the legacy parser to expand this example will result in the kind of nesting ## the legacy preprocessor is bound to reject (456123). ## Parsoid, therefore, has some special handling in the grammar for nested ## extension tags when the wikitext comes from template expansion (inTemplate), ## specifically for this case. Unfortunately, it opens up some permissiveness ## not found in the legacy parser. !! test Ref in ref: top level ref nested in parser function !! wikitext test {{#tag:ref|456123}} !! html/php

          test [2]

          1. 123
          2. 456[1]
          !! end ## Bleh! Only to be used in the below. See above where the legacy parser ## wouldn't stand for this nonsense. !! article Template:nestedrefslash !! text three !! endarticle ## Just a regression test for Parsoid !! test Nested ref with forward slash !! wikitext test {{nestedrefslash}} !! html/parsoid

          test [2]

          !! end ## Parsoid responsive references tests !! test Responsive references: disabled, autogenerated !! options parsoid={ "modes": ["wt2html"], "responsiveReferences": { "enabled": false, "threshold": 2 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          1. 1
          2. 2
          !! end !! test Responsive references: enabled, autogenerated !! options parsoid={ "modes": ["wt2html"], "responsiveReferences": { "enabled": true, "threshold": 2 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          !! end !! test Responsive references: enabled, autogenerated, exceed !! options parsoid={ "modes": ["wt2html"], "responsiveReferences": { "enabled": true, "threshold": 1 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          !! end !! test Responsive references: disabled !! options parsoid={ "responsiveReferences": { "enabled": false, "threshold": 2 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          1. 1
          2. 2
          !! end !! test Responsive references: enabled !! options parsoid={ "responsiveReferences": { "enabled": true, "threshold": 2 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          !! end !! test Responsive references: enabled, exceed !! options parsoid={ "responsiveReferences": { "enabled": true, "threshold": 1 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          !! end !! test Responsive references: disabled, explicit !! options parsoid={ "responsiveReferences": { "enabled": false, "threshold": 2 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          !! end !! test Responsive references: disabled, explicit, exceed !! options parsoid={ "responsiveReferences": { "enabled": false, "threshold": 1 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          !! end !! test Responsive references: enabled, explicit off !! options parsoid={ "responsiveReferences": { "enabled": true, "threshold": 2 } } !! wikitext Test 12 !! html/parsoid

          Test [1][2]

          1. 1
          2. 2
          !! end !! test Responsive references: roundtrip templates !! options parsoid={ "responsiveReferences": { "enabled": true, "threshold": 2 } } !! wikitext test 123 {{1x|haha}} !! html/parsoid

          test [1]

          haha

          1. 123
          !! end ## End Parsoid responsive references tests !! article Template:CircularRef !! text Hi {{CircularRef}} !! endarticle !! test CircularRef !! wikitext Hi {{CircularRef}} !! html/php

          [1]

          1. Hi

          Cite error: <ref> tag defined in <references> has no name attribute.

          !! html/parsoid

          [1]

          1. Hi
          !! end !! test T15673: with direction "rtl" !! wikitext TEST !! html/php

          [1]

          1. TEST
          !! html/parsoid

          [1]

          1. TEST
          !! end !! test T15673: with direction "ltr" !! wikitext TEST !! html/php

          [1]

          1. TEST
          !! html/parsoid

          [1]

          1. TEST
          !! end !! test T15673: with direction "LTR", keeps upper case !! wikitext TEST !! html/php

          [1]

          1. TEST
          !! html/parsoid

          [1]

          1. TEST
          !! end !! test T15673: with direction "nonsense" and "" (empty), strip invalid dir attribute and shows error !! wikitext NONSENSE_DIR_TEST EMPTY_DIR_TEST !! html/php

          Cite error: Invalid dir="nonsense", must be ltr or rtl Cite error: Invalid dir="", must be ltr or rtl

          !! html/parsoid

          [1] [2]

          1. NONSENSE_DIR_TEST
          2. EMPTY_DIR_TEST
          !! end !! test T15673: Direction is supported when specifying name and group !! wikitext TEST !! html/php

          [note 1]

          1. TEST
          !! html/parsoid

          [note 1]

          1. TEST
          !! end ## Just to catch regressions in Parsoid's tree-building / p-wrapping !! test Ref with block content in formatting tag !! wikitext ''hi
          ho
          '' !! html/parsoid

          hi[1]

          !! end !! test T196827: Use the dir parameter only from the full definition of a named ref tag !! wikitext abcdef ghijklmno !! html/php

          abc[1]def

          ghi[1]mno

          1. 1.0 1.1 jkl
          !! html/parsoid

          abc[1]def

          ghi[1]mno

          1. 1 2 jkl
          !! end !! test T196827: Ignore the dir parameter from the first use, which is not a full definition, and use the dir value from the full definition of a named ref tag !! wikitext abcdef ghijklmno !! html/php

          abc[1]def

          ghi[1]mno

          1. 1.0 1.1 jkl
          !! html/parsoid

          abc[1]def

          ghi[1]mno

          1. 1 2 jkl
          !! end !! test Similarly named refs with identical bodies !! wikitext 1 1 2 1 !! html/php

          1 [1] 2 [1]

          1. 1.0 1.1 1
          !! html/parsoid

          1 [1] 2 [1]

          !! end !! test T220196 - Reference names with high-bit characters, html5 mode !! config wgFragmentMode=['html5'] !! wikitext [bar] !! html/php

          [1]

          1. [bar]
          !! html/parsoid

          [1]

          1. [bar]
          !! end !! test T220196 - Reference names with high-bit characters, legacy mode !! config wgFragmentMode=['legacy'] !! wikitext [bar] !! html/php

          [1]

          1. [bar]
          !! html/parsoid

          [1]

          1. [bar]
          !! end ## Just a regression test !! test Transclusion parameter spacing is lost without data-parsoid !! options parsoid=wt2wt !! wikitext {{1x| Hi ho }} {{1x|
          }} !! html/parsoid !! end # TODO: Return a more helpful error, this is because the reference is never used, not about the group attribute. !! test Confusing error !! wikitext foo !! html/php

          Cite error: <ref> tag defined in <references> has group attribute "" which does not appear in prior text.

          !! html/parsoid
          1. foo
          !! end !! test T242437 - Blank ref name in #tag regression !! wikitext {{#tag:references| foo }} !! html

          Cite error: <ref> tag defined in <references> has no name attribute.

          !! end !! test T48140 - Make sure rollback/redo does not consume numbers !! wikitext should be [1] {{#tag:references| a |group=g}} should be [2] !! html

          [1] [g 1]

          1. a

          [2]

          1. should be [1]
          2. should be [2]
          !! end !! test Numbers in the default group need to start with 1, independent from other groups !! wikitext {{#tag:references| a |group=g}} c !! html

          [g 1]

          1. a

          [1]

          1. c
          !! end !! test Serialize reference tags by themselves on a line !! options parsoid=html2wt !! html/parsoid

          hi [1]

          hi ho

          !! wikitext hi ho hi ho !! end ## Edge case bugs in Parsoid from T93580 !! test T93580: 1. Templated inside block images !! wikitext [[File:Foobar.jpg|thumb|Caption with templated ref: {{1x|foo}}]] !! html/parsoid
          Caption with templated ref: [1]
          1. foo
          !! end !! test T93580: 2. inside inline images !! wikitext [[File:Foobar.jpg|Undisplayed caption in inline image with ref: foo]] !! html/parsoid

          1. foo
          !! end !! test T93580: 3. Templated inside inline images !! wikitext [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{1x|{{1x|foo}}}}]] !! html/parsoid

          1. foo
          !! end !! test Report bad attributes in reference tags !! wikitext noGroupOrNameValue theNameValue theGroupValue !! html/php

          [1] Cite error: Invalid parameter in <references> tag [2] Cite error: Invalid parameter in <references> tag [theGroup 1] Cite error: Invalid parameter in <references> tag

          1. noGroupOrNameValue
          2. theNameValue


          Cite error: <ref> tags exist for a group named "theGroup", but no corresponding <references group="theGroup"/> tag was found

          !! html/parsoid

          [1]

          1. noGroupOrNameValue

          [1]

          1. theNameValue

          [theGroup 1]

          1. theGroupValue
          !! end !! test Check Cite handing of different types of whitespace in reference names !! config wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext test spacetestSpaceRef blah space test underbartestUnderbarRef blah underbar test unicode u2028 whitespacetestUnicodeWhitespaceRef blah unicode u2028 whitespace !! html/php

          test space[1] blah space[1]

          test underbar[2] blah underbar[2]

          test unicode u2028 whitespace[3] blah unicode u2028 whitespace[3]

          1. 1.0 1.1 testSpaceRef
          2. 2.0 2.1 testUnderbarRef
          3. 3.0 3.1 testUnicodeWhitespaceRef
          !! html/parsoid

          test space[1] blah space[1]

          test underbar[2] blah underbar[2]

          test unicode u2028 whitespace[3] blah unicode u2028 whitespace[3]

          1. 1 2 testSpaceRef
          2. 1 2 testUnderbarRef
          3. 1 2 testUnicodeWhitespaceRef
          !! end !! test Check Cite handing of linefeed whitespace in reference names !! wikitext test linefeedtestLinefeedRef !! html/php

          test linefeed[1]

          1. testLinefeedRef
          !! html/parsoid

          test linefeed[1]

          1. testLinefeedRef
          !! end