Reference Test
- Force the test runner to ensure the extension is loaded
!! hooks ref references !! endhooks
!! article Template:echo !! text {{{1}}} !! endarticle
!! article Template:refinref !! text [1] !! endarticle
!! test
Simple Cite error: Closing </ref>
missing for <ref>
tag
!! html
Wikipedia rocks!<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> Proceeds of Rockology, vol. XXI
!! end
!! test
Simple Cite error: Closing </ref>
missing for <ref>
tag
- ↑ ho
!! html
Wikipedia rocks!<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> Proceeds of Rockology, vol. XXI
!! end
!! article Template:Simple template !! text A simple template. !! endarticle
!! test
Cite error: Closing </ref>
missing for <ref>
tag
!! html
Templating<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> A simple template.
!! end
!! test [1]
- ↑ with a !! wikitext Templating<ref><nowiki>{{simple template}}
!! html
Templating<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> Template:Simple template
!! end
!! test
Cite error: Closing </ref>
missing for <ref>
tag</nowiki>
!! html
Templating<ref>Template:Simple template</ref>
!! end
!! test
Cite error: Closing </ref>
missing for <ref>
tag-->
!! html
Templating
!! end
!! test
in a Cite error: Closing </ref>
missing for <ref>
tag
!! html
Templating<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> Text
!! end
!! test
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag with name "blank" defined in <references>
group "" has no content.
Cite error: <ref>
tag with name "blank" defined in <references>
group "" has no content.
Cite error: <ref>
tag with name "blank" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "blank" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "blank" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "blank" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "blank" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "test123test" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "123test" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "test123" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "x__x" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: Invalid <ref>
tag; name cannot be a simple integer. Use a descriptive title
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag with name "bar" defined in <references>
group "" has no content.
Cite error: <ref>
tag with name "blankwithnoreference" defined in <references>
group "" has no content.
Cite error: Invalid <ref>
tag; invalid names, e.g. too many
Cite error: Invalid <ref>
tag; invalid names, e.g. too many
Cite error: Invalid <ref>
tag; invalid names, e.g. too many
Cite error: <ref>
tag in <references>
has conflicting group attribute "theGroup".
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag in <references>
has conflicting group attribute "note".
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag in <references>
has conflicting group attribute "注".
Cite error: <ref>
tag in <references>
has conflicting group attribute "参".
Cite error: <ref>
tag defined in <references>
has no name attribute.
!! html
<a href="#cite_note-foo-1">[1]</a>
- <a href="#cite_ref-foo_1-0">↑</a> BAR
!! end
!! test
Cite error: Closing </ref>
missing for <ref>
tag
}}
!! html
<a href="#cite_note-foo-1">[1]</a>
- <a href="#cite_ref-foo_1-0">↑</a> BAR
!! end
!! test
Cite error: Closing </ref>
missing for <ref>
tag
[1 1]
[1]
</references>
!! html
<a href="#cite_note-foo-1">[2 1]</a>
- <a href="#cite_ref-foo_1-0">↑</a> Cite error: Invalid
<ref>
tag; no text was provided for refs namedfoo
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
Cite error: Closing </ref>
missing for <ref>
tag
!! html
Wikipedia rocks!<a href="#cite_note-1">[wa']</a>
- <a href="#cite_ref-1">↑</a> Proceeds of Rockology, vol. XXI
!! end
!! test Consecutive whitespace in custom link label message should not create empty [] !! wikitext [klingon 1] [klingon 2]
!! html
<a href="#cite_note-1">[wa']</a> <a href="#cite_note-2">[cha']</a>
- <a href="#cite_ref-1">↑</a> 1st
- <a href="#cite_ref-2">↑</a> 2nd
!! end
!! test Bug 31374 regression check: nested strip items !! wikitext [Note 1]
!! html
<a href="#cite_note-2">[Note 1]</a>
- <a href="#cite_ref-2">↑</a> note<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> reference
!! end
!! test
Bug 13073 regression check: wrapped
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag defined in <references>
has no name attribute.
Cite error: <ref>
tag with name "a" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "a" defined in <references>
has group attribute "" which does not appear in prior text.
Cite error: <ref>
tag with name "a" defined in <references>
group "" has no content.
Cite error: <ref>
tag with name "a" defined in <references>
has group attribute "" which does not appear in prior text.
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-a-1">[1]</a>
- <a href="#cite_ref-a_1-0">↑</a> abc Cite error: Invalid
<ref>
tag; name "a" defined multiple times with different content
!! end
!! test Multiple definition (mixed outside/inside) !! wikitext [1]
- ↑ abc Cite error: Invalid
<ref>
tag; name "a" defined multiple times with different content
!! html
<a href="#cite_note-a-1">[1]</a>
- <a href="#cite_ref-a_1-0">↑</a> abc Cite error: Invalid
<ref>
tag; name "a" defined multiple times with different content
!! end
!! test Multiple definition (inside ) !! wikitext [1]
- ↑ abc Cite error: Invalid
<ref>
tag; name "a" defined multiple times with different content
!! html
<a href="#cite_note-a-1">[1]</a>
- <a href="#cite_ref-a_1-0">↑</a> abc Cite error: Invalid
<ref>
tag; name "a" defined multiple times with different content
!! end
- Parsoid doesn't rt cleanly because name attribute is actually broken
- here (Cite error: Closing
</ref>
missing for<ref>
tag
!! html/php
<a href="#cite_note-[#foo]_{bar}_<baz-1">[1]</a>
- <a href="#cite_ref-[#foo]_{bar}_<baz_1-0">↑</a> ">[bar]
!! html/parsoid
<a href="./Parser_test#cite_note-[#foo]_{bar}_<baz-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-[#foo]_{bar}_<baz_1-0" rel="mw:referencedBy">↑ </a> ">[bar]
!! end
!! test T29694 - [] in reference names in HTML5 fragment mode (tidied) !! config wgFragmentMode=[ 'html5' ] !! wikitext [1]
- ↑ [bar]
!! html/php
<a href="#cite_note-[#foo]_{bar}_<baz>-1">[1]</a>
- <a href="#cite_ref-[#foo]_{bar}_<baz>_1-0">↑</a> [bar]
!! html/parsoid
_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"[#foo] {bar} <baz>"},"body":{"id":"mw-reference-text-cite_note-[#foo]_{bar}_<baz>-1"}}'><a href="./Parser_test#cite_note-[#foo]_{bar}_<baz>-1" style="counter-reset: mw-Ref 1;">[1]</a>
- -1" id="cite_note-[#foo]_{bar}_<baz>-1"><a href="./Parser_test#cite_ref-[#foo]_{bar}_<baz>_1-0" rel="mw:referencedBy">↑ </a> -1" class="mw-reference-text" data-parsoid="{}">[bar]
!! end
- ----------------------------------------------------------------
- Parsoid-only testing of Parsoid's impl of Cite error: Closing
</ref>
missing for<ref>
tag
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a> B <a href="./Parser_test#cite_note-x-2">[2]</a> C <a href="./Parser_test#cite_note-y-3">[3]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
- <a href="./Parser_test#cite_ref-x_2-0" rel="mw:referencedBy">↑ </a> foo
- <a href="./Parser_test#cite_ref-y_3-0" rel="mw:referencedBy">↑ </a>
!! end
!! test Ref: 2. ref-tags with identical names should all get the same index !! wikitext A [1] B [1]
!! html/parsoid
A <a href="./Parser_test#cite_note-x-1">[1]</a> B <a href="./Parser_test#cite_note-x-1">[1]</a>
- <a href="./Parser_test#cite_ref-x_1-0">1 </a><a href="./Parser_test#cite_ref-x_1-1">2 </a> foo
!! end
!! test Ref: 3. spaces in ref-names should be ignored !! wikitext A [1] B [1] C [1]
!! html/parsoid
A <a href="./Parser_test#cite_note-x-1">[1]</a> B <a href="./Parser_test#cite_note-x-1">[1]</a> C <a href="./Parser_test#cite_note-x-1">[1]</a></supn>
- <a href="./Parser_test#cite_ref-x_1-0">1 </a><a href="./Parser_test#cite_ref-x_1-1">2 </a><a href="./Parser_test#cite_ref-x_1-2">3 </a> 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 [1]
- ↑ foo
!! html/parsoid
A <a href="./Parser_test#cite_note-constructor-1">[1]</a>
- <a href="./Parser_test#cite_ref-constructor_1-0" rel="mw:referencedBy">↑ </a> foo
!! end
!! test Ref: 5. body should accept generic wikitext !! wikitext A [1]
- ↑ This is a bolded link and this is a Template:Echo
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> This is a <a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a> and this is a transclusion
!! end
!! test Ref: 6. indent-pres should not be output in ref-body !! wikitext A [1]
- ↑ foo bar baz
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo bar baz
!! end
!! test Ref: 7. No p-wrapping in ref-body !! wikitext A [1]
- ↑ foo bar baz booz
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo bar baz booz
!! end
!! test Ref: 8. transclusion wikitext has lower precedence !! wikitext A [1] B C}}
- ↑ foo {{echo|
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a> B C}}
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo Template:Echo'><a href="./Parser_test#cite_note-1">[1]</a> B C
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
!! end
!! test Ref: 10. Unclosed HTML tags should not leak out of ref-body !! wikitext A [1] B C
- ↑ foo
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a> B C
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
!! end
!! test Ref: 11. ref-tags acts like an inline element wrt P-wrapping !! wikitext A [1] B C [2] D
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a> B C <a href="./Parser_test#cite_note-2">[2]</a> D
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> bar
!! end
!! test Ref: 12. ref-tags act as trailing newline migration barrier !! wikitext a
b Cite error: The opening
<ref>
tag is malformed or has a bad name Cite error: The opening<ref>
tag is malformed or has a bad namec
!! html/parsoid
a
b <a href="./Parser_test#cite_note-1">[1]</a> <a href="./Parser_test#cite_note-2">[2]</a>
c
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a>
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a>
!! end
!! test Ref: 13. ref-tags are not SOL-transparent and block indent-pres !! wikitext [1] A [2] B
!! html/parsoid
<a href="./Parser_test#cite_note-1">[1]</a> A <a href="./Parser_test#cite_note-2">[2]</a> B
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 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 Cite error: Closing
</ref>
missing for<ref>
tag baz</ref>
!! html/parsoid<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a> baz</ref>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo <ref>bar
!! end
!! test Ref: 15. ref-tags with identical names should get identical indexes !! wikitext A1 [1] A2 [1] B1 [2] B2 [2]
!! html/parsoid
A1 <a href="./Parser_test#cite_note-a-1">[1]</a> A2 <a href="./Parser_test#cite_note-a-1">[1]</a> B1 <a href="./Parser_test#cite_note-b-2">[2]</a> B2 <a href="./Parser_test#cite_note-b-2">[2]</a>
- <a href="./Parser_test#cite_ref-a_1-0">1 </a><a href="./Parser_test#cite_ref-a_1-1">2 </a> foo
- <a href="./Parser_test#cite_ref-b_2-0">1 </a><a href="./Parser_test#cite_ref-b_2-1">2 </a> bar
!! end
- We don't bother wt2wt-ing non-standard whitespace
!! test Ref: 16. Tokenizer should accept non-standard whitespace in [1] tags !!options parsoid=wt2html !! wikitext A [2]
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
!! end
!! test Ref: 17. Generate valid HTML5 id/about attributes !! wikitext [1] [2]
!! html/parsoid
<a href="./Parser_test#cite_note-a_b-1" style="counter-reset: mw-Ref 1;">[1]</a> <a href="./Parser_test#cite_note-:0-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-a_b_1-0" rel="mw:referencedBy">↑ </a> foo
- <a href="./Parser_test#cite_ref-:0_2-0" rel="mw:referencedBy">↑ </a> ve-created name
!! end
!! test Ref: 18. T58916: Extension attributes should be parsed as plain text !! config wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext [1]
- ↑ foo
!! html/php
<a href="#cite_note-Template:Echo-1">[1]</a>
- <a href="#cite_ref-Template:Echo_1-0">↑</a> foo
!! html/parsoid
<a href="./Parser_test#cite_note-Template:Echo-1">[1]</a>
- <a href="./Parser_test#cite_ref-Template:Echo_1-0" rel="mw:referencedBy">↑ </a> 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 [1] 2 [1]
!! html/php
1 <a href="#cite_note-a_&_b-1">[1]</a> 2 <a href="#cite_note-a_&_b-1">[1]</a>
- ↑ <a href="#cite_ref-a_&_b_1-0">1.0</a> <a href="#cite_ref-a_&_b_1-1">1.1</a> foo
!! html/parsoid
1 <a href="./Parser_test#cite_note-a_&_b-1">[1]</a> 2 <a href="./Parser_test#cite_note-a_&_b-1">[1]</a>
- <a href="./Parser_test#cite_ref-a_&_b_1-0">1 </a><a href="./Parser_test#cite_ref-a_&_b_1-1">2 </a> foo
!! end
!! test Ref: 20. ref-tags with identical names but different content should keep it !! wikitext A [1] B [1] C [1]
!! html/parsoid
A <a href="./Parser_test#cite_note-foo-1">[1]</a> B <a href="./Parser_test#cite_note-foo-1">[1]</a> C <a href="./Parser_test#cite_note-foo-1">[1]</a>
- <a href="./Parser_test#cite_ref-foo_1-0">1 </a><a href="./Parser_test#cite_ref-foo_1-1">2 </a><a href="./Parser_test#cite_ref-foo_1-2">3 </a> Foo one
!! 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 [a 1] B [b 1] C [1]
- ↑ foo
- ↑ baz
- ↑ bar
!! html/parsoid
A <a href="./Parser_test#cite_note-1" data-mw-group="a">[a 1]</a> B <a href="./Parser_test#cite_note-2" data-mw-group="b">[b 1]</a> C <a href="./Parser_test#cite_note-3">[1]</a>
- <a href="./Parser_test#cite_ref-1" data-mw-group="a" rel="mw:referencedBy">↑ </a> foo
- <a href="./Parser_test#cite_ref-3" rel="mw:referencedBy">↑ </a> baz
- <a href="./Parser_test#cite_ref-2" data-mw-group="b" rel="mw:referencedBy">↑ </a> bar
!! end
!! test References: 3. ref list should be cleared after processing references !! wikitext A [1]
- ↑ foo
B [1]
- ↑ bar
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
B <a href="./Parser_test#cite_note-2">[1]</a>
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> bar
!! end
!! test References: 4. only referenced group should be cleared after processing references !! wikitext A [a 1] B [1]
- ↑ afoo
C [2]
!! html/parsoid
A <a href="./Parser_test#cite_note-1" data-mw-group="a">[a 1]</a> B <a href="./Parser_test#cite_note-2">[1]</a>
- <a href="./Parser_test#cite_ref-1" data-mw-group="a" rel="mw:referencedBy">↑ </a> afoo
C <a href="./Parser_test#cite_note-3">[2]</a>
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> bfoo
- <a href="./Parser_test#cite_ref-3" rel="mw:referencedBy">↑ </a> 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 [1] B [2]
!! html/parsoid
A <a href="./Parser_test#cite_note-a-1">[1]</a> B <a href="./Parser_test#cite_note-b-2">[2]</a>
- <a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'>
- <a href="./Parser_test#cite_ref-a_1-0" rel="mw:referencedBy">↑ </a> foo
- <a href="./Parser_test#cite_ref-b_2-0" rel="mw:referencedBy">↑ </a> bar
!! end
!! test References: 6. from a transclusion !! wikitext [1] Template:Echo !! html/php
<a href="#cite_note-1">[1]</a>- <a href="#cite_ref-1">↑</a> Foo
!! html/php+tidy
<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> Foo
!! html/parsoid
<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
- "}},"i":0}}]}'>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> Foo
!! end
!! test References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled !! wikitext A [2] B [X 1]
- ↑ foo
!! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a> B <a href="./Parser_test#cite_note-b-2" data-mw-group="X">[X 1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo bar for a
- <a href=\"./Parser_test#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]</span></a></sup>\n"}}'>
- <a href="./Parser_test#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy">↑ </a> foo
!! end
!! test References: 8. T88019: Remove <meta>s from templates inside Cite error: Closing
</ref>
missing for<ref>
tag}}!! html/parsoid
Xfoo Template:Echo and Template:Echo boo</ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-1">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo bar and baz boo
!! end
!! test References: 9. Generate missing references list at the end !! wikitext A [1] B [inexistent 1] !! html/parsoid
A <a href="./Parser_test#cite_note-1">[1]</a> B <a href="./Parser_test#cite_note-2" data-mw-group="inexistent">[inexistent 1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
- <a href="./Parser_test#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy">↑ </a> bar
!! end
!! test
References: 10.1. Newshouldn't be added for unrelated edits.- ↑ foo
!! options parsoid={
"modes": ["selser"], "changes": "#x", "remove", "selser": "noauto"
} !! wikitext Unrelated text that's going to disappear. A [1] !! wikitext/edited Unrelated text. A [2] !! 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 [1] !! wikitext/edited Unrelated text. A [2] !! 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 [3]
!! html/php
<a href="#cite_note-test_&_me_Template:Echo-1">[1]</a>
- <a href="#cite_ref-test_&_me_Template:Echo_1-0">↑</a> hi
!! html/parsoid
<a href="./Parser_test#cite_note-test_&_me_Template:Echo-1">[1]</a>
- <a href="./Parser_test#cite_ref-test_&_me_Template:Echo_1-0" rel="mw:referencedBy">↑ </a> 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 a[1]
<references> !! html/parsoid
a<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
<references>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> foo
!! end
!! test New reference serializes on its own line !! options parsoid=wt2wt,html2wt !! wikitext foo
- ↑ foo
!! html/parsoid
foo!! end
!! test Ref in ref !! wikitext test [1]
!! html/php
test <a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> hi
Cite error:
<ref>
tag defined in<references>
has no name attribute.!! html/parsoid
test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> hi
!! end
- Parsoid responsive references tests
!! test Responsive references: disabled, autogenerated !! options parsoid={
"modes": ["wt2html"], "responsiveReferences": { "enabled": false, "threshold": 2 }
} !! wikitext Test [1][2] !! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: enabled, autogenerated !! options parsoid={
"modes": ["wt2html"], "responsiveReferences": { "enabled": true, "threshold": 2 }
} !! wikitext Test [3][4] !! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: enabled, autogenerated, exceed !! options parsoid={
"modes": ["wt2html"], "responsiveReferences": { "enabled": true, "threshold": 1 }
} !! wikitext Test [5][6] !! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: disabled !! options parsoid={
"responsiveReferences": { "enabled": false, "threshold": 2 }
!! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: enabled !! options parsoid={
"responsiveReferences": { "enabled": true, "threshold": 2 }
!! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: enabled, exceed !! options parsoid={
"responsiveReferences": { "enabled": true, "threshold": 1 }
!! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: disabled, explicit !! options parsoid={
"responsiveReferences": { "enabled": false, "threshold": 2 }
!! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: disabled, explicit, exceed !! options parsoid={
"responsiveReferences": { "enabled": false, "threshold": 1 }
!! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: enabled, explicit off !! options parsoid={
"responsiveReferences": { "enabled": true, "threshold": 2 }
!! html/parsoid
Test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;">[2]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 1
- <a href="./Parser_test#cite_ref-2" rel="mw:referencedBy">↑ </a> 2
!! end
!! test Responsive references: roundtrip templates !! options parsoid={
"responsiveReferences": { "enabled": true, "threshold": 2 }
} !! wikitext test [1]
Template:Echo !! html/parsoid
test <a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
"}},"i":0}}]}'>haha
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> 123
!! end
- End Parsoid responsive references tests
!! article Template:CircularRef !! text [2] !! endarticle
!! test CircularRef !! wikitext [3]
- ↑ 123
- ↑ Hi Template:CircularRef
- ↑ Hi Template:CircularRef
!! html/php
<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> Hi
Cite error:
<ref>
tag defined in<references>
has no name attribute.!! html/parsoid
<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> Hi
!! end
!! test T15673: Cite error: Closing
</ref>
missing for<ref>
tag
!! html/php<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> TEST
!! html/parsoid
<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> TEST
!! end
!! test T15673: Cite error: Closing
</ref>
missing for<ref>
tag
!! html/php<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> TEST
!! html/parsoid
<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> TEST
!! end
!! test T15673: Cite error: Closing
</ref>
missing for<ref>
tag
!! html/php<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> TEST
!! html/parsoid
<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> TEST
!! end
!! test T15673: Cite error: Closing
</ref>
missing for<ref>
tag
!! html/php<a href="#cite_note-1">[1]</a>
- <a href="#cite_ref-1">↑</a> TESTCite error: Invalid
<ref>
tag; dir attribute "nonsense" is unknown. Must be ltr or rtl
!! html/parsoid
<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> TEST
!! end
!! test T15673: Direction is supported when specifying name and group !! wikitext [note 1]
- ↑ TEST
!! html/php
<a href="#cite_note-a-1">[note 1]</a>
- <a href="#cite_ref-a_1-0">↑</a> TEST
!! html/parsoid
<a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;" data-mw-group="note">[note 1]</a>
- <a href="./Parser_test#cite_ref-a_1-0" data-mw-group="note" rel="mw:referencedBy">↑ </a> TEST
!! end
- Just to catch regressions in Parsoid's tree-building / p-wrapping
!! test Ref with block content in formatting tag !! wikitext hi[1]
- ↑ ho
!! html/parsoid
hi<a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-1" rel="mw:referencedBy">↑ </a> ho
!! end
!! test T196827: Use the dir parameter only from the full definition of a named ref tag !! wikitext abc[1]def
ghi[1]mno
!! html/php
abc<a href="#cite_note-r1-1">[1]</a>def
ghi<a href="#cite_note-r1-1">[1]</a>mno
- ↑ <a href="#cite_ref-r1_1-0">1.0</a> <a href="#cite_ref-r1_1-1">1.1</a> jkl
!! html/parsoid
abc<a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;">[1]</a>def
ghi<a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;">[1]</a>mno
- <a href="./Parser_test#cite_ref-r1_1-0">1 </a><a href="./Parser_test#cite_ref-r1_1-1">2 </a> 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 abc[1]def
ghi[1]mno
!! html/php
abc<a href="#cite_note-r1-1">[1]</a>def
ghi<a href="#cite_note-r1-1">[1]</a>mno
- ↑ <a href="#cite_ref-r1_1-0">1.0</a> <a href="#cite_ref-r1_1-1">1.1</a> jkl
!! html/parsoid
abc<a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;">[1]</a>def
ghi<a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;">[1]</a>mno
- <a href="./Parser_test#cite_ref-r1_1-0">1 </a><a href="./Parser_test#cite_ref-r1_1-1">2 </a> jkl
!! end
!! test Similarly named refs with identical bodies !! wikitext 1 Cite error: Invalid
<ref>
tag; name cannot be a simple integer. Use a descriptive title 2 Cite error: Invalid<ref>
tag; name cannot be a simple integer. Use a descriptive title
!! html/parsoid1 <a href="./Parser_test#cite_note-1-1" style="counter-reset: mw-Ref 1;">[1]</a> 2 <a href="./Parser_test#cite_note-1-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-1_1-0">1 </a><a href="./Parser_test#cite_ref-1_1-1">2 </a> 1
!! end
!! test T220196 - Reference names with high-bit characters, html5 mode !! config wgFragmentMode=['html5'] !! wikitext [1]
- ↑ [bar]
!! html/php
<a href="#cite_note-füllen-1">[1]</a>
- <a href="#cite_ref-füllen_1-0">↑</a> [bar]
!! html/parsoid
<a href="./Parser_test#cite_note-füllen_1-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-füllen-0" rel="mw:referencedBy">↑ </a> [bar]
!! end
!! test T220196 - Reference names with high-bit characters, legacy mode !! config wgFragmentMode=['legacy'] !! wikitext [1]
- ↑ [bar]
!! html/php
<a href="#cite_note-f.C3.BCllen-1">[1]</a>
- <a href="#cite_ref-f.C3.BCllen_1-0">↑</a> [bar]
!! html/parsoid
<a href="./Parser_test#cite_note-füllen_1-1" style="counter-reset: mw-Ref 1;">[1]</a>
- <a href="./Parser_test#cite_ref-füllen-0" rel="mw:referencedBy">↑ </a> [bar]
!! end
Cite error:<ref>
tags exist for a group named "1", but no corresponding<references group="1"/>
tag was found
Cite error:<ref>
tags exist for a group named "inexistent", but no corresponding<references group="inexistent"/>
tag was found