# MediaWiki Parser test cases # Some taken from http://meta.wikimedia.org/wiki/Parser_testing # All (C) their respective authors and released under the GPL # # The syntax should be fairly self-explanatory. # # Currently supported test options: # One of the following three: # # (default) generate HTML output # pst apply pre-save transform # msg apply message transform # # Plus any combination of these: # # cat add category links # ill add inter-language links # subpage enable subpages (disabled by default) # noxml don't check for XML well formdness # title=[[XXX]] run test using article title XXX # language=XXX set content language to XXX for this test # variant=XXX set the variant of language for this test (eg zh-tw) # disabled do not run test # parsoid parsoid-specific options (not run by PHP parser unless # the test includes an html/php section) # php php-only test (not run by the parsoid parser unless # the test includes an html/parsoid section) # showtitle make the first line the title # comment run through Linker::formatComment() instead of main parser # local format section links in edit comment text as local links # notoc disable table of contents # thumbsize=NNN set the default thumb size to NNNpx for this test # # You can also set the following parser properties via test options: # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel, # wgLinkHolderBatchSize, wgRawHtml # # For testing purposes, temporary articles can created: # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle # where '/' denotes a newline. # This is the standard article assumed to exist. !! article Main Page !! text blah blah !! endarticle !!article Foo !!text FOO !!endarticle !!article Template:Foo !!text FOO !!endarticle !! article Template:Blank !! text !! endarticle !! article Template:pipe !! text | !! endarticle !!article MediaWiki:bad image list !!text * [[File:Bad.jpg]] except [[Nasty page]] !!endarticle !! article Template:inner list !! text * item 1 !! endarticle !! article Template:tbl-start !! text {| !! endarticle !! article Template:tbl-end !! text |} !! endarticle !! article Template:echo !! text {{{1}}} !! endarticle !! article Template:echo_with_span !! text {{{1}}} !! endarticle !! article Template:echo_with_div !! text
{{{1}}}
!! endarticle !! article Template:attr_str !! text {{{1}}}="{{{2}}}" !! endarticle !! article Template:table_attribs !! text |style="color: red"| Foo !! endarticle !! article Template:table_cells !! text {{table_attribs}} || Bar || Baz !! endarticle !! article Template:image_attribs !! text [[File:foobar.jpg|right|Caption text]] !! endarticle !! article A?b !! text Weirdo titles! !! endarticle !!article Template:Bullet !!text * Bar !!endarticle !!article Template:OpenTable !!text {| !!endarticle ### ### Basic tests ### !! test Blank input !! wikitext !! html !! end !! test Simple paragraph !! wikitext This is a simple paragraph. !! html

This is a simple paragraph.

!! end !! test Paragraphs with extra newline spacing !! wikitext foo bar baz booz !! html

foo

bar


baz


booz

!! end !! test Paragraphs with newline spacing with comment lines in between !! wikitext ---- a b ---- a b ---- a b ---- a b ---- a b ---- a b ---- a b ---- !! html

a b


a b


a b


a

b


a

b


a


b


a


b


!! end !! test Paragraphs with newline spacing with non-empty white-space lines in between !! wikitext ---- a b ---- a b ---- !! html

a

b


a


b


!! end !! test Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between !! wikitext ---- a b ---- a b ---- a b ---- a b ---- !! html

a b


a b


a

b


a


b


!! end !! test Extra newlines: More paragraphs with indented comment !! wikitext a b !! html

a


b

!!end !! test Extra newlines followed by heading !! wikitext a =b= [[a]] =b= !! html

a


b[edit]

a


b[edit]

!! end !! test Extra newlines between heading and content are swallowed !! wikitext =b= [[a]] !! html

b[edit]

a

!! end !! test Parsing an URL !! wikitext http://fr.wikipedia.org/wiki/🍺 !! html

http://fr.wikipedia.org/wiki/🍺

!! end # Note that the html+tidy output removes the spaces after the
  • , # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc). # This is an issue for all tests with lists. We intentionally do # *not* add html+tidy clauses for these, as we don't want to # document/test the broken behavior. (Parsoid matches the non-tidy # output in these cases.) !! test Simple list !! wikitext * Item 1 * Item 2 !! html !! end !! test Italics and bold !! wikitext * plain * plain''italic''plain * plain''italic''plain''italic''plain * plain'''bold'''plain * plain'''bold'''plain'''bold'''plain * plain''italic''plain'''bold'''plain * plain'''bold'''plain''italic''plain * plain''italic'''bold-italic'''italic''plain * plain'''bold''bold-italic''bold'''plain * plain'''''bold-italic'''italic''plain * plain'''''bold-italic''bold'''plain * plain''italic'''bold-italic'''''plain * plain'''bold''bold-italic'''''plain * plain l'''italic''plain * plain l''''bold''' plain !! html !! end # this example taken from the [[simple:Moon]] article (bug 47326) !! test Italics and possessives (1) !! wikitext obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer !! html

    obtained by Lunar Prospector's gamma-ray spectrometer

    !! end # this example taken from [[en:Flaming Pie]] (bug 49926) !! test Italics and possessives (2) !! wikitext '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes !! html

    Flaming Pie is ... released in 1997. In Flaming Pie's liner notes

    !! end # this example taken from [[en:Dictionary]] (bug 49926) !! test Italics and possessives (3) !! wikitext The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''. !! html

    The first monolingual dictionary written in a Romance language was Sebastián Covarrubias' Tesoro de la lengua castellana o española, published in 1611 in Madrid. In 1612 the first edition of the Vocabolario dell'Accademia della Crusca, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the Dictionnaire Universel.

    !! end ### ### 2-quote opening sequence tests ### !! test Italics and bold: 2-quote opening sequence: (2,2) !! wikitext ''foo'' !! html

    foo

    !!end !! test Italics and bold: 2-quote opening sequence: (2,3) !! options parsoid=wt2html !! wikitext ''foo''' !! html/*

    foo'

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki !! wikitext ''foo''' !! html

    foo'

    !! end !! test Italics and bold: 2-quote opening sequence: (2,4) !! options parsoid=wt2html !! wikitext ''foo'''' !! html/*

    foo''

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki !! wikitext ''foo'''' !! html

    foo''

    !! end # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 2-quote opening sequence: (2,5) !! options parsoid=wt2html !! wikitext ''foo''''' !! html/php

    foo

    !! html/parsoid

    foo

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki !! wikitext ''foo'''''''' !! html/php

    foo

    !! html/parsoid

    foo

    !! end ### ### 3-quote opening sequence tests ### !! test Italics and bold: 3-quote opening sequence: (3,2) !! wikitext '''foo'' !! html

    'foo

    !!end !! test Italics and bold: 3-quote opening sequence: (3,3) !! wikitext '''foo''' !! html

    foo

    !!end !! test Italics and bold: 3-quote opening sequence: (3,4) !! options parsoid=wt2html !! wikitext '''foo'''' !! html/*

    foo'

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki !! wikitext '''foo'''' !! html

    foo'

    !! end # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 3-quote opening sequence: (3,5) !! options parsoid=wt2html !! wikitext '''foo''''' !! html/php

    foo

    !! html/parsoid

    foo

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki !! wikitext '''foo''''''' !! html/php

    foo

    !! html/parsoid

    foo

    !! end ### ### 4-quote opening sequence tests ### !! test Italics and bold: 4-quote opening sequence: (4,2) !! options parsoid=wt2html !! wikitext ''''foo'' !! html/*

    ''foo

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki !! wikitext ''''foo'' !! html

    ''foo

    !! end !! test Italics and bold: 4-quote opening sequence: (4,3) !! wikitext ''''foo''' !! html

    'foo

    !!end !! test Italics and bold: 4-quote opening sequence: (4,4) !! options parsoid=wt2html !! wikitext ''''foo'''' !! html/*

    'foo'

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki !! wikitext ''''foo'''' !! html

    'foo'

    !! end # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 4-quote opening sequence: (4,5) !! options parsoid=wt2html !! wikitext ''''foo''''' !! html/php

    'foo

    !! html/parsoid

    'foo

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki !! wikitext ''''foo''''''' !! html/php

    'foo

    !! html/parsoid

    'foo

    !! end ### ### 5-quote opening sequence tests ### !! test Italics and bold: 5-quote opening sequence: (5,2) !! options parsoid=wt2html !! wikitext '''''foo'' !! html/*

    foo

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt # skipping wt2html and html2html because it wants to put before !! test Italics and bold: 5-quote opening sequence: (5,2+3) !! options parsoid=wt2wt,html2wt !! wikitext '''''foo''''' !! html

    foo

    !! end !! test Italics and bold: 5-quote opening sequence: (5,3) !! options parsoid=wt2html !! wikitext '''''foo''' !! html/*

    foo

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 5-quote opening sequence: (5,3+2) !! wikitext '''''foo''''' !! html

    foo

    !! end !! test Italics and bold: 5-quote opening sequence: (5,4) !! options parsoid=wt2html !! wikitext '''''foo'''' !! html/*

    foo'

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki !! wikitext '''''foo'''''' !! html

    foo'

    !! end !! test Italics and bold: 5-quote opening sequence: (5,5) !! wikitext '''''foo''''' !! html

    foo

    !!end ### ### multiple quote sequences in a line ### !! test Italics and bold: multiple quote sequences: (2,4,2) !! options parsoid=wt2html !! wikitext ''foo''''bar'' !! html/*

    foo'bar

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki !! wikitext ''foo''''bar''''' !! html

    foo'bar

    !! end !! test Italics and bold: multiple quote sequences: (2,4,3) !! options parsoid=wt2html !! wikitext ''foo''''bar''' !! html/*

    foo'bar

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki !! wikitext ''foo''''bar''''' !! html

    foo'bar

    !! end !! test Italics and bold: multiple quote sequences: (2,4,4) !! options parsoid=wt2html !! wikitext ''foo''''bar'''' !! html/*

    foo'bar'

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki !! wikitext ''foo''''bar'''''' !! html

    foo'bar'

    !! end # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: multiple quote sequences: (3,4,2) !! options parsoid=wt2html !! wikitext '''foo''''bar'' !! html/php

    foo'bar

    !! html/parsoid

    foo'bar

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki !! options parsoid !! wikitext '''foo''''bar'''' !! html/php

    foo'bar

    !! html/parsoid

    foo'bar

    !! end # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: multiple quote sequences: (3,4,3) !! options parsoid=wt2html !! wikitext '''foo''''bar''' !! html/php

    foo'bar

    !! html/parsoid

    foo'bar

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki !! wikitext '''foo''''bar'''''' !! html/php

    foo'bar

    !! html/parsoid

    foo'bar

    !! end ### ### other quote tests ### !! test Italics and bold: other quote tests: (2,3,5) !! wikitext ''this is about '''foo's family''''' !! html

    this is about foo's family

    !!end !! test Italics and bold: other quote tests: (2,(3,3),2) !! wikitext ''this is about '''foo's''' family'' !! html

    this is about foo's family

    !!end !! test Italics and bold: other quote tests: (3,2,3,2) !! options parsoid=wt2html !! wikitext '''this is about ''foo'''s family'' !! html/*

    this is about foos family

    !!end # same html as previous, but wikitext adjusted to match parsoid html2wt # add 'parsoid' option to use 'parsoid' normalization of the placeholder !! test Italics and bold: other quote tests: (3,2,3+2+2,2) !! options parsoid !! wikitext '''this is about ''foo'''''''s family'' !! html/*

    this is about foos family

    !! end !! test Italics and bold: other quote tests: (3,2,3,3) !! options !! wikitext '''this is about ''foo'''s family''' !! html

    'this is about foos family

    !!end !! test Italics and bold: other quote tests: (3,(2,2),3) !! wikitext '''this is about ''foo's'' family''' !! html

    this is about foo's family

    !!end !! test Italicized possessive !! wikitext The ''[[Main Page]]'''s talk page. !! html

    The Main Page's talk page.

    !! end !! test Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line (Requires tidy for PHP parser output to be fixed up) !! options parsoid=wt2html,wt2wt !! wikitext {| !''a!!''b |''a||''b |} !! html/php+tidy
    a b a b
    !! html/parsoid
    ab ab
    !! end ### ### Non-html5 tags ### !! test Non-html5 tags should be accepted !! wikitext
    ''foo''
    ''foo'' ''foo'' ''foo'' ''foo'' !! html
    foo

    foo foo foo foo

    !! end !! test is valid wikitext (bug 52468) !! wikitext !! html

    !! end # is HTML4, is HTML4/5. !! test or for strikethrough !! wikitext strike s !! html

    strike

    s

    !! end ## a not permitted ## i,b,br omitted !! test Text-level semantic html elements in wikitext !! wikitext text text text text text text text text text text text text text text text text 明日(Ashita あした) text text text !! html

    text text text text text text text text text text text text text text text text 明日(Ashita あした) text text text

    !! end # test cases taken from # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element !! test Ruby markup (W3C-style) !! wikitext ; Mono-ruby for individual base characters : ほん ; Group ruby : 今日きょう ; Jukugo ruby : きょう ; Inline ruby : (とうきょう) ; Double-sided ruby : jiùjīnshānSan Francisco HeartCœur ShamrockTrèfle StarÉtoile !! html
    Mono-ruby for individual base characters
    ほん
    Group ruby
    今日きょう
    Jukugo ruby
    きょう
    Inline ruby
    (とうきょう)
    Double-sided ruby
    jiùjīnshānSan Francisco

    HeartCœur ShamrockTrèfle StarÉtoile

    !! end # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/ !! test Non-word characters don't terminate tag names (bug 17663, 40670, 52022) !! wikitext doesn't work! doesn't work! works fine s.foo !! html

    <b→> doesn't work! </b→>

    <bä> doesn't work! </bä>

    <boo> works fine </boo>

    <s.foo>s.foo</s.foo>

    <sub-ID#1>

    !! end !! test Isolated close tags should be treated as literal text (bug 52760) !! wikitext
    s !! html

    </b>

    <s.foo>s</s>

    !! end ### ### Special characters ### !! test Bare pipe character (bug 52363) !! wikitext | !! html

    |

    !! end !! test Bare pipe character from a template (bug 52363) !! wikitext {{pipe}} !! html

    |

    !! end ### ### test cases ### !! test unordered list !! wikitext * This is not an unordered list item. !! html

    * This is not an unordered list item.

    !! end !! test spacing !! wikitext Lorem ipsum dolor sed abit. sed nullum. :and a colon !! html

    Lorem ipsum dolor sed abit. sed nullum. :and a colon

    !! end !! test nowiki 3 !! wikitext :There is not nowiki. :There is nowiki. #There is not nowiki. #There is nowiki. *There is not nowiki. *There is nowiki. !! html
    There is not nowiki.
    There is nowiki.
    1. There is not nowiki.
    2. There is nowiki.
    • There is not nowiki.
    • There is nowiki.
    !! end !! test Entities inside !! wikitext < !! html

    <

    !! end !! test Entities inside template parameters !! options parsoid !! wikitext {{echo|–}} !! html

    !! end !! test Properly escape nowiki when combined with other wiki markup !! options parsoid=html2wt !! wikitext * </nowiki> tag !! html

    * </nowiki> tag

    !! end ### ### Comments ### !! test Comments and Indent-Pre !! wikitext asdf asdf asdf xyz asdf xyz !! html
    asdf
    
    asdf
    
    asdf
    

    xyz

    asdf
    xyz
    
    !! end !! test Comment test 2a !! wikitext asdf jkl !! html

    asdf jkl

    !! end !! test Comment test 2b !! wikitext asdf jkl !! html

    asdf

    jkl

    !! end !! test Comment test 3 !! wikitext asdf jkl !! html

    asdf jkl

    !! end !! test Comment test 4 !! wikitext asdfjkl !! html

    asdfjkl

    !! end !! test Comment spacing !! wikitext a b c !! html

    a

     b 
    

    c

    !! end !! test Comment whitespace !! wikitext !! html !! end !! test Comment semantics and delimiters !! wikitext !! html !! end !! test Comment semantics and delimiters, redux !! wikitext !! html !! end !! test Comment semantics and delimiters: directors cut !! wikitext --> !! html

    -->

    !! end !! test Comment semantics: nesting !! wikitext --> !! html

    -->

    !! end !! test Comment semantics: unclosed comment at end !! wikitext oo}} !! html

    FOO

    !! end !! test Comment on its own line post-expand !! wikitext a {{blank}} b !! html

    a

    b

    !! end !! test Comment on its own line post-expand with non-significant whitespace !! wikitext a {{blank}} b !! html

    a

    b

    !! end !! test Multiple comments should still parse as SOL-transparent !! options parsoid=wt2html,wt2wt !! wikitext *a *b !! html
    • a
    • b
    !! end ### ### paragraph wrapping tests ### !! test No block tags !! wikitext a b !! html

    a

    b

    !! end !! test Block tag on one line (
    ) !! wikitext a
    foo
    b !! html a
    foo

    b

    !! html+tidy

    a

    foo

    b

    !! end !! test Block tag on one line (
    ) !! wikitext a
    foo
    b !! html a
    foo

    b

    !! html+tidy

    a

    foo

    b

    !! end !! test Block tag on both lines (
    ) !! wikitext a
    foo
    b
    foo
    !! html a
    foo
    b
    foo
    !! html+tidy

    a

    foo

    b

    foo
    !! end !! test Block tag on both lines (
    ) !! wikitext a
    foo
    b
    foo
    !! html a
    foo
    b
    foo
    !! html+tidy

    a

    foo

    b

    foo

    !! end !! test Multiple lines without block tags !! wikitext
    foo
    a b c d e x
    foo
    z !! html
    foo
    a

    b c d e

    x
    foo
    z !! html+tidy
    foo

    a

    b c d e

    x

    foo

    z

    !! end !! test Empty lines between lines with block tags !! wikitext
    a b
    a
    b
    b
    d
    e
    !! html


    a

    b

    a
    b
    b
    d


    e
    !! html+tidy


    a

    b

    a

    b

    b

    d


    e
    !! end ## PHP parser emits output which is broken ## XXX The parsoid output doesn't match the tidy output. !! test Unclosed HTML p-tags should be handled properly !! wikitext

    foo

    a b !! html/php+tidy

    foo</div>

    a

    b
    !! html/parsoid

    foo

    a

    b

    !! end ### ### Preformatted text ### !! test Preformatted text !! wikitext This is some Preformatted text With ''italic'' And '''bold''' And a [[Main Page|link]] !! html
    This is some
    Preformatted text
    With italic
    And bold
    And a link
    
    !! end !! test Tabs don't trigger preformatted text !! wikitext This is not preformatted text. This is preformatted text. So is this. !! html

    This is not preformatted text.

    This is preformatted text.
    	So is this.
    
    !! end !! test Ident preformatting with inline content !! wikitext a ''b'' !! html
    a
    b
    
    !! end !! test
     with  inside (compatibility with 1.6 and earlier)
    !! wikitext
    
    
    
    
    
    
    !! html
    <b>
    <cite>
    <em>
    
    !! end !! test Regression with preformatted in
    !! wikitext
    Blah
    !! html
    Blah
    
    !! end !! test Bug 52763: Preformatted in
    !! wikitext
    Blah {| | indented cell (no pre-wrapping!) |}
    !! html

    Blah

    indented cell (no pre-wrapping!)

    !! end !! test Bug 51086: Double newlines in blockquotes should be turned into paragraphs !! wikitext
    Foo Bar
    !! html

    Foo

    Bar

    !! end !! test Bug 15491: / in blockquote !! wikitext
    Foo bar baz quux
    !! html

    Foo bar baz quux

    !! end # Note that the p-wrapping is newline sensitive, which could be # considered a bug: tidy will wrap only the 'Foo' in the example # below in a

    tag. (see comment 23-25 of bug #6200) !! test Bug 15491: / in blockquote (2) !! wikitext

    Foo bar baz quux
    !! html
    Foo bar baz quux
    !! html+tidy

    Foo

    bar baz quux
    !! end !! test
     with attributes (bug 3202)
    !! wikitext
    
    Bluescreen of WikiDeath
    !! html
    Bluescreen of WikiDeath
    !! end !! test
     with width attribute (bug 3202)
    !! wikitext
    
    Narrow screen goodies
    !! html
    Narrow screen goodies
    !! end !! test
     with forbidden attribute (bug 3202)
    !! wikitext
    
    Narrow screen goodies
    !! html
    Narrow screen goodies
    !! end !! test Entities inside
    !! wikitext
    
    <
    !! html
    <
    !! end !! test
     with forbidden attribute values (bug 3202)
    !! wikitext
    
    Narrow screen goodies
    !! html
    Narrow screen goodies
    !! end !! test inside
     (bug 13238)
    !! wikitext
    
    
    
    
    
    Foo
    !! html
    <nowiki>
    
    
    
    <nowiki>Foo</nowiki>
    !! end !! test and
     preference (first one wins)
    !! wikitext
    
    
    
    
    
    !! html
    <nowiki>
    

    </nowiki> </pre>

    <pre> <nowiki> </pre> </pre>

    !! end !! test
    inside nowiki !! wikitext
    !! html

    </pre>

    !! end !! test Empty pre; pre inside other HTML tags (bug 54946) !! wikitext a
    foo
    
    
    !! html
    

    a

    foo
    
    
    
    !! html+tidy
    

    a

    foo
    
    !! end !! test HTML pre followed by indent-pre !! wikitext
    foo
    bar !! html
    foo
    bar
    
    !! end !!test Block tag pre !!options parsoid !! wikitext

    foo

    !! html

    foo

    !!end !!test Templates: Indent-Pre: 1a. Templates that break a line should suppress
    !! wikitext
     {{echo|}}
    !! html
    
    !!end
    
    !!test
    Templates: Indent-Pre: 1b. Templates that break a line should suppress 
    !! wikitext
     {{echo|
    foo}}
    !! html
    

    foo

    !!end !! test Templates: Indent-Pre: 1c: Wrapping should be based on expanded content !! wikitext {{echo|a b}} !! html
    a
    

    b

    !!end !! test Templates: Indent-Pre: 1d: Wrapping should be based on expanded content !! wikitext {{echo|a b c d e }} !! html
    a
    

    b c

    d
    

    e

    !!end !!test Templates: Indent-Pre: 1e. Wrapping should be based on expanded content !! wikitext {{echo| foo}} {{echo| foo}}{{echo| bar}} {{echo| foo}} {{echo| bar}} {{echo| foo}} {{echo| foo}} {{echo|{{echo| }}bar}} !! html
    foo
    
    foo bar
    
    foo
    bar
    
    foo
    
    foo
    
    bar
    
    !!end !! test Templates: Indent-Pre: 1f: Wrapping should be based on expanded content !! wikitext {{echo| }}a {{echo| }}a {{echo| b}} {{echo|a }}b {{echo|a }} b !! html
    a
    


    a
    


    b
    

    a

    b
    

    a

    b
    
    !!end !! test Things that look like
     tags aren't treated as such
    !! wikitext
    Barack Obama  of the United States
    
    !! html
    

    Barack Obama <President> of the United States <President></President>

    !! end ## PHP parser discards the "
    x
    }}
    !! html/php
    
    x
    !! html/parsoid <pre
    x
    <pre
    !! end !! test Parsoid: handle pre with space after attribute !! options parsoid=wt2html !! wikitext
    {{echo|foo}}
    !! html
    {{echo|foo}}
    !! end # TODO / maybe: fix wt2wt for this !! test Parsoid: Don't paragraph-wrap fosterable content !! options parsoid=wt2html !! wikitext {| |} !! html
    !! end !! test Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced !! options parsoid=wt2html !! wikitext {| |} !! html
    !! end #-------------------------------------------------------------------- # Transclusion parameter whitespace stripping tests # Behavior is different for positional and named parameters #-------------------------------------------------------------------- !! test Templates: Strip leading and trailing whitespace from named-param values !! wikitext {{echo|1= a }} {{echo|1= {{echo|b}} }} {{echo| 1 = c }} {{echo| 1 = * d }} !! html

    a

    b

    c

    • d
    !! end !! test Templates: Don't strip whitespace from positional-param values !! wikitext {{echo|a }} {{echo|{{echo|b}} }} {{echo| c }} {{echo| {{echo|d}} }} {{echo| e}} {{echo| * f}} {{echo| }}g !! html

    a

    b

    c 
    


    d
    


    e
    


    • f


    g
    
    !! end !! test Templates: Handle empty comment-and-ws-only lines correctly !! wikitext {{echo|foo bar}} !! html

    foo bar

    !! end !! test Templates: Handle comments in the target !! wikitext {{echo |foo}} {{echo |foo}} {{echo|foo}} {{echo|foo}} !!html/parsoid

    foo

    foo

    foo

    foo

    !!end #-------------------------------------------------------------------- # Transclusion parameter escaping tests #-------------------------------------------------------------------- !! test Templates: Parsoid parameter escaping test 1 !! options parsoid !! wikitext {{echo|[foo]|{{echo|[bar]}}}} !! html

    [foo]

    !! end !! test Parsoid: Pipes in external links in template parameter !! options parsoid !! wikitext {{echo|[{{echo|http://example.com}} link]}} !! html

    link

    !! end !! test Parsoid: pipe in transclusion parameter !! options parsoid !! wikitext {{echo|http://foo.com/a|b}} !! html

    http://foo.com/a|b

    !! end !! test Parsoid: Pipe in external link target and content in template parameter !! options parsoid=html2wt,wt2wt !! wikitext {{echo|[http://foo.com/a|b a|b]}} !! html

    a|b

    !! end !! test Parsoid: Pipe in template with nested template in external link target in template parameter (seriously) !! options parsoid !! wikitext {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}} !! html

    [Main Page bar]

    !! end !! test Templates: Don't escape already nowiki-escaped text in template parameters !! options parsoid=html2wt,wt2wt !! wikitext {{echo|foo|bar}} {{echo|<div>}} {{echo|}} !! html

    foo|bar <div>

    !! end ## Bug 52824 !! test Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param !! options parsoid=html2wt,wt2wt !! wikitext {{echo|{{echo|1=bar}}}} !! html

    bar

    !! end ## Bug 56733 !! test Templates parameters with special tokenizing behavior dont get modified because of arg escaping !! options parsoid !! wikitext {{echo|a : b}} !! html

    a : b

    !! end ### ### Parsoid-centric tests for testing RT edge cases for pre ### !!test 1a. Indent-Pre and Comments !! wikitext a c !! html
    a
    

    c

    !!end !!test 1b. Indent-Pre and Comments !! wikitext a c !! html
    a
    

    c

    !!end !!test 1c. Indent-Pre and Comments !! wikitext a a !! html
     a
    
     a
    
    !!end !!test 1d. Indent-Pre and Comments (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order) !! wikitext a b !! html
    a
    
    b
    
    !!end !!test 2a. Indent-Pre and tables !! wikitext {| |- !h1!!h2 |foo||bar |} !! html
    h1 h2 foo bar
    !!end !!test 2b. Indent-Pre and tables !! wikitext {| |- |foo |} !! html
    foo
    !!end !!test 2c. Indent-Pre and tables (bug 42252) !! wikitext {| |+ foo ! | bar |} !! html
    foo
    bar
    !!end !!test 2d. Indent-Pre and tables !! wikitext a {| | b |} !! html/php
    a
    
    b
    !! html/parsoid
    a
    b
    !!end !!test 2e. Indent-Pre and table-line syntax !! wikitext a | b | c !! html/php
    a
    | b
    | c
    
    !!end !!test 2f. Indent-pre started by table-line syntax !! wikitext a | b | c !! html/php

    a

    | b
    | c
    
    !! html/parsoid

    a

    | b
    | c
    !!end !!test 3a. Indent-Pre and block tags (single-line html) !! wikitext a

    foo

    b
    foo
    c
    foo
    foo !! html a

    foo

    b
    foo
    c
    foo
     foo 
    
    !! html+tidy

    a

    foo

    b

    foo

    c

    foo

     foo 
    
    !! end !!test 3b. Indent-Pre and block tags (multi-line html) !! wikitext a foo b
    foo
    !! html
    a foo
    
    b
    foo
    !! html+tidy
    a foo
    

    b

    foo
    !!end !!test 3c. Indent-Pre and block tags (pre-content on separate line) !! wikitext

    foo

    foo
    foo
    foo
    foo
    
    foo
    • foo
    !! html

    foo

    foo
    
    foo
    

    foo

    foo
    
    foo
    
    • foo
    !!end !!test 4. Indent-Pre and extension tags !! wikitext a File:foobar.jpg !! html a !! html+tidy

    a

    !!end !! test Table wikitext syntax outside wiki-tables !! wikitext a ! not a table heading |- not a table row | not a table cell | class="foo bar" | baz b |} |- c !! html

    a ! not a table heading |- not a table row | not a table cell | class="foo bar" | baz b |} |- c

    !! end !!test Render paragraphs when indent-pre is suppressed in blocklevels !! wikitext
    foo bar
    !! html

    foo

    bar

    !!end !!test 4. Multiple spaces at start-of-line !! wikitext

    foo

    foo {| |foo |} !! html

    foo

       foo
    
    foo
    !!end ## NOTE: the leading white-space chars on empty line are significant !! test 5a. White-space in indent-pre !! wikitext a
    b !! html
    a
    b
    !! end ## NOTE: the leading white-space chars on empty line are significant !! test 5b. White-space in indent-pre !! wikitext a b c !! html
    a
    
    b
    
    
    c
    
    !! end !! test 5c. White-space in indent-pre !! wikitext ''a'' ''b'' ''c'' !! html
    a
     b
      c
    
    !! end !! test 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content !! wikitext a b c d !! html
    a
    
    b
    
    c
    
    

    d

    !! end !! test 7a. Indent-pre and category links !! options parsoid=wt2html,wt2wt !! wikitext [[Category:foo]] {{echo| [[Category:foo]]}} !! html !! end !! test 7b. Indent-pre and category links !! options parsoid=wt2html,wt2wt !! wikitext [[Category:foo]] a [[Category:foo]] {{echo|b}} !! html
     a
    
     b
    !! end ### ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric) ### !!test HTML-pre: 1. embedded newlines !! wikitext
    foo
    foo
    
    
    foo
    
    
    
    foo
    
    !! html
    foo
    foo
    
    
    foo
    
    
    
    foo
    
    !! html/parsoid
    foo
    foo
    
    
    foo
    
    
    
    foo
    
    !!end !! test HTML-pre: big spaces !! wikitext
    
    
    
    
    haha
    
    
    
    
    haha
    
    
    
    
    
    !! html
    
    
    
    
    haha
    
    
    
    
    haha
    
    
    
    
    
    !! html/parsoid
    
    
    
    
    haha
    
    
    
    
    haha
    
    
    
    
    
    !! end !!test HTML-pre: 2: indented text !! wikitext
     foo
    
    !! html
     foo
    
    !!end !!test HTML-pre: 3: other wikitext !! wikitext
    * foo
    # bar
    = no-h =
    '' no-italic ''
    [[ NoLink ]]
    
    !! html
    * foo
    # bar
    = no-h =
    '' no-italic ''
    [[ NoLink ]]
    
    !!end ### ### Definition lists ### !! test Simple definition !! wikitext ; name : Definition !! html
    name 
    Definition
    !! end !! test Definition list for indentation only !! wikitext : Indented text !! html
    Indented text
    !! end !! test Definition list with no space !! wikitext ;name:Definition !! html
    name
    Definition
    !!end !! test Definition list with URL link !! wikitext ; http://example.com/ : definition !! html
    http://example.com/ 
    definition
    !! end !! test Definition list with bracketed URL link !! wikitext ;[http://www.example.com/ Example]:Something about it !! html
    Example
    Something about it
    !! end !! test Definition list with wikilink containing colon !! wikitext ; [[Help:FAQ]]: The least-read page on Wikipedia !! html
    Help:FAQ
    The least-read page on Wikipedia
    !! end # At Brion's and JeLuF's insistence... :) !! test Definition list with news link containing colon !! wikitext ; news:alt.wikipedia.rox: This isn't even a real newsgroup! !! html
    news:alt.wikipedia.rox
    This isn't even a real newsgroup!
    !! end !! test Malformed definition list with colon !! wikitext ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop !! html
    news:alt.wikipedia.rox -- don't crash or enter an infinite loop
    !! end !! test Definition lists: colon in external link text !! wikitext ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up !! html
    Wikipedia : The Next Generation
    OK, I made that up
    !! end !! test Definition lists: colon in HTML attribute !! wikitext ;bold !! html
    bold
    !! end !! test Definition lists: self-closed tag !! wikitext ;one
    two : two-line fun !! html
    one
    two 
    two-line fun
    !! end !! test Bug 11748: Literal closing tags !! wikitext
    test 1
    test test test test test
    test 2
    test test test test test
    !! html
    test 1
    test test test test test
    test 2
    test test test test test
    !! end !! test Definition and unordered list using wiki syntax nested in unordered list using html tags. !! wikitext
    • ; term : description * unordered
    !! html
    • term 
      description
      • unordered
    !! end !! test Definition list with empty definition and following paragraph !! wikitext ; term: Paragraph text !! html
    term

    Paragraph text

    !! end !! test Nested definition lists using html syntax !! wikitext
    x
    a
    b
    !! end !! test Definition Lists: No nesting: Multiple dd's !! wikitext ;x :a :b !! html
    x
    a
    b
    !! end !! test Definition Lists: Indentation: Regular !! wikitext :i1 ::i2 :::i3 !! html
    i1
    i2
    i3
    !! end !! test Definition Lists: Indentation: Missing 1st level !! wikitext ::i2 :::i3 !! html
    i2
    i3
    !! end !! test Definition Lists: Indentation: Multi-level indent !! wikitext :::i3 !! html
    i3
    !! end !! test Definition Lists: Hacky use to indent tables !! wikitext ::{| |foo |bar |} this text should be left alone !! html
    foo bar

    this text should be left alone

    !! end !! test Definition Lists: Hacky use to indent tables, with comments (bug 63979) !! wikitext ::{| |foo |bar |} this text should be left alone !! html/parsoid
    foo bar

    this text should be left alone

    !! end !! test Definition Lists: Hacky use to indent tables, with comment before table !! wikitext ::{| |foo |} !! html/parsoid
    foo
    !! end # Bug 52473 !! test Definition Lists: Hacky use to indent tables (WS-insensitive) !! options parsoid !! wikitext : {| |a |} !! html
    a
    !! end ## The PHP parser treats : items (dd) without a corresponding ; item (dt) ## as an empty dt item. It also ignores all but the last ";" when followed ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple ## ";"s. ## ## Ex: ";;t2 ::d2" is transformed into: ## ##
    ##
    t2
    ##
    ##
    ##
    ##
    d2
    ##
    ##
    ##
    ## ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text ## So, the same wikitext above (;;t2 ::d2) is transformed into: ## ##
    ##
    ##
    ##
    t2
    ##
    :d2
    ##
    ##
    ##
    ## ## All Parsoid only definition list tests have this difference. ## ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html !! test Table / list interaction: indented table with lists in table contents !! wikitext :{| |- | a * b |- | c * d |} !! html
    a
    • b
    c
    • d
    !! end !!test Table / list interaction: lists nested in tables nested in indented lists !! wikitext :{| | :a :b | *c *d |} *e *f !! html
    a
    b
    • c
    • d
    • e
    • f
    !!end !! test Definition Lists: Nesting: Multi-level (Parsoid only) !! options parsoid !! wikitext ;t1 :d1 ;;t2 ::d2 ;;;t3 :::d3 !! html
    t1
    d1
    t2
    :d2
    t3
    ::d3
    !! end !! test Definition Lists: Nesting: Test 2 (Parsoid only) !! options parsoid !! wikitext ;t1 ::d2 !! html
    t1
    d2
    !! end !! test Definition Lists: Nesting: Test 3 (Parsoid only) !! options parsoid !! wikitext :;t1 ::::d2 !! html
    t1
    d2
    !! end !! test Definition Lists: Nesting: Test 4 !! wikitext ::;t3 :::d3 !! html
    t3
    d3
    !! end ## The Parsoid team believes the following three test exposes a ## bug in the PHP parser. (Parsoid team thinks the PHP parser is ## wrong to close the
    after the
    containing the
      .) ## It also exposes a "misfeature" in tidy, which doesn't like ##
      tags with a single
      child; it converts the
      into ## a
      in that case. (Parsoid leaves the
      alone!) !! test Definition Lists: Mixed Lists: Test 1 !! wikitext :;* foo ::* bar :; baz !! html/php
      • foo
      • bar
      baz
      !! html/php+tidy
      • foo
      • bar
      baz
      !! html/parsoid
      • foo
      • bar
      baz
      !! end !! test Definition Lists: Mixed Lists: Test 2 !! wikitext *: d1 *: d2 !! html
      • d1
        d2
      !! end !! test Definition Lists: Mixed Lists: Test 3 !! wikitext *::: d1 *::: d2 !! html
      • d1
        d2
      !! end !! test Definition Lists: Mixed Lists: Test 4 !! wikitext *;d1 :d2 *;d3 :d4 !! html
      • d1 
        d2
        d3 
        d4
      !! end !! test Definition Lists: Mixed Lists: Test 5 !! wikitext *:d1 *:: d2 !! html
      • d1
        d2
      !! end !! test Definition Lists: Mixed Lists: Test 6 !! wikitext #*:d1 #*::: d3 !! html
        • d1
          d3
      !! end !! test Definition Lists: Mixed Lists: Test 7 !! wikitext :* d1 :* d2 !! html
      • d1
      • d2
      !! end !! test Definition Lists: Mixed Lists: Test 8 !! wikitext :* d1 ::* d2 !! html
      • d1
      • d2
      !! end !! test Definition Lists: Mixed Lists: Test 9 !! wikitext *;foo :bar !! html
      • foo 
        bar
      !! end !! test Definition Lists: Mixed Lists: Test 10 !! wikitext *#;foo :bar !! html
        1. foo 
          bar
      !! end # The Parsoid team disagrees with the PHP parser's seemingly-random # rules regarding dd/dt on the next two tests. Parsoid is more # consistent, and recognizes the shared nesting and keeps the # still-open tags around until the nesting is complete. # (And tidy again converts
      to
      before 'bar'.) !! test Definition Lists: Mixed Lists: Test 11 !! wikitext *#*#;*;;foo :bar *#*#;boo :baz !! html/php
            1. foo 
              • bar
      boo 
      baz
  • !! html/php+tidy
          1. foo 
            • bar
            boo 
            baz
    !! html/parsoid
            • foo 
              bar
            boo 
            baz
    !! end # Another case where tidy converts a
    to a
    (but Parsoid doesn't). !! test Definition Lists: Weird Ones: Test 1 !! wikitext *#;*::;; foo : bar (who uses this?) !! html/php
      1. foo 
        • bar (who uses this?)
    !! html/php+tidy
      1. foo 
        • bar (who uses this?)
    !! html/parsoid
        • foo 
          bar (who uses this?)
    !! end ### ### External links ### !! test External links: non-bracketed !! wikitext Non-bracketed: http://example.com !! html

    Non-bracketed: http://example.com

    !! end # parsoid doesn't explicitly mark autonumbered links, see bug 53505 !! test External links: numbered !! wikitext Numbered: [http://example.com] Numbered: [http://example.net] Numbered: [http://example.com] !! html/php

    Numbered: [1] Numbered: [2] Numbered: [3]

    !! html/parsoid

    Numbered: Numbered: Numbered:

    !!end !! test External links: specified text !! wikitext Specified text: [http://example.com link] !! html

    Specified text: link

    !!end !! test External links: trail !! wikitext Linktrails should not work for external links: [http://example.com link]s !! html

    Linktrails should not work for external links: links

    !! end !! test External links: dollar sign in URL !! wikitext http://example.com/1$2345 !! html

    http://example.com/1$2345

    !! end # parsoid doesn't explicitly mark autonumbered links, see bug 53505 !! test External links: dollar sign in URL (autonumber) !! wikitext [http://example.com/1$2345] !! html/php

    [1]

    !! html/parsoid

    !!end !! test External links: open square bracket forbidden in URL (bug 4377) !! options parsoid=wt2html,wt2wt,html2html !! wikitext http://example.com/1[2345 !! html/php

    http://example.com/1[2345

    !! html/parsoid

    http://example.com/1[2345

    !! end !! test External links: open square bracket forbidden in URL (named) (bug 4377) !! options parsoid=wt2html,html2html !! wikitext [http://example.com/1[2345] !! html/php

    [2345

    !! html/parsoid

    [2345

    !!end # parsoid adds a space before the link name !! test External links: open square bracket forbidden in URL (named) (bug 4377) Parsoid variant. !! wikitext [http://example.com/1 [2345] !! html

    [2345

    !!end !! test External links: nowiki in URL link text (bug 6230) !! wikitext [http://example.com/ ''example site''] !! html

    ''example site''

    !! end !! test External links: newline forbidden in text (bug 6230 regression check) !! wikitext [http://example.com/ first second] !! html

    [http://example.com/ first second]

    !!end !! test External links: Pipe char between url and text !! wikitext [http://example.com | link] !! html

    | link

    !!end !! test External links: protocol-relative URL in brackets !! wikitext [//example.com/ Test] !! html

    Test

    !! end # parsoid doesn't explicitly mark autonumbered links, see bug 53505 !! test External links: protocol-relative URL in brackets without text !! wikitext [//example.com] !! html/php

    [1]

    !! html/parsoid

    !! end !! test External links: protocol-relative URL in free text is left alone !! wikitext //example.com/Foo !! html

    //example.com/Foo

    !!end !! test External links: protocol-relative URL in the middle of a word is left alone (bug 30269) !! wikitext foo//example.com/Foo !! html

    foo//example.com/Foo

    !! end !! test External links: with no contents !! wikitext [http://en.wikipedia.org/wiki/Foo] [[wikipedia:Foo|Bar]] [[wikipedia:Foo|Bar]] !! html/php

    [1]

    Bar

    Bar

    !! html/parsoid

    Bar

    Bar

    !! end !! test External image !! wikitext External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png !! html

    External image: Ncwikicol.png

    !! end !! test External image from https !! wikitext External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png !! html

    External image from https: Ncwikicol.png

    !! end !! test External image (when not allowed) !! options wgAllowExternalImages=0 !! wikitext External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png !! html

    External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png

    !! end !! test Link to non-http image, no img tag !! wikitext Link to non-http image, no img tag: ftp://example.com/test.jpg !! html

    Link to non-http image, no img tag: ftp://example.com/test.jpg

    !! end !! test External links: terminating separator !! wikitext Terminating separator: http://example.com/thing, !! html

    Terminating separator: http://example.com/thing,

    !! end !! test External links: intervening separator !! wikitext Intervening separator: http://example.com/1,2,3 !! html

    Intervening separator: http://example.com/1,2,3

    !! end !! test External links: old bug with URL in query !! wikitext Old bug with URL in query: [http://example.com/thing?url=http://example.com link] !! html

    Old bug with URL in query: link

    !! end !! test External links: old URL-in-URL bug, mixed protocols !! wikitext And again with mixed protocols: [ftp://example.com?url=http://example.com link] !! html

    And again with mixed protocols: link

    !!end !! test External links: URL in text !! wikitext URL in text: [http://example.com http://example.com] !! html

    URL in text: http://example.com

    !! end !! test External links: Clickable images !! wikitext ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png] !! html

    ja-style clickable images: Ncwikicol.png

    !!end !! test External links: raw ampersand !! wikitext Old & use: http://x&y !! html

    Old & use: http://x&y

    !! end !! test External links: encoded ampersand !! wikitext Old & use: http://x&y !! html/php

    Old & use: http://x&y

    !! html/parsoid

    Old & use: http://x&y

    !! end !! test External links: encoded equals (bug 6102) !! wikitext http://example.com/?foo=bar !! html/php

    http://example.com/?foo=bar

    !! html/parsoid

    http://example.com/?foo=bar

    !! end ## ## Note that parsoid doesn't explicit mark autonumbered links, nor ## does it number them. As discussed in bug 53505, we can identify ## autonumbered links via CSS. ## !! test External links: [raw ampersand] !! wikitext Old & use: [http://x&y] !! html/php

    Old & use: [1]

    !! html/parsoid

    Old & use:

    !! end # note that parsoid html is identical to [raw ampersand] case; so html2wt # mode will return the [raw ampersand] wikitext !! test External links: [encoded ampersand] !! options parsoid=wt2html,wt2wt,html2html !! wikitext Old & use: [http://x&y] !! html/php

    Old & use: [1]

    !! html/parsoid

    Old & use:

    !! end !! test External links: [raw equals] !! wikitext [http://example.com/?foo=bar] !! html/php

    [1]

    !! html/parsoid

    !! end # note that parsoid html is identical to [raw equals] case; so html2wt # mode will return the [raw equals] wikitext !! test External links: [encoded equals] (bug 6102) !! options parsoid=wt2html,wt2wt,html2html !! wikitext [http://example.com/?foo=bar] !! html/php

    [1]

    !! html/parsoid

    !! end # xxx parsoid strips the IDN character, so the round-trip tests will # obviously fail and are disabled. --cscott !! test External links: [IDN ignored character reference in hostname; strip it right off] !! options parsoid=wt2html,wt2wt,html2html !! wikitext [http://e‌xample.com/] !! html/php

    [1]

    !! html/parsoid

    !! end # FIXME: This test (the IDN characters in the text of a link) is an inconsistency. # Where an external link could easily circumvent the sanitization of the text of # a link like this (where an IDN-ignore character is in the URL somewhere), this # test demands a higher standard. That's a bit strange. # # Example: # # http://e‌xample.com -> [http://example.com|http://example.com] # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com] # # The first example is sanitized, but the second is not. Any security benefits # from this production are trivial to circumvent. Either remove this test and # let the parser(s) do their thing unaccosted, or fix the inconsistency and change # the test accordingly. # # All our love, # The Parsoid team. # xxx parsoid strips the IDN character, so the round-trip tests will # obviously fail and are disabled. --cscott !! test External links: IDN ignored character reference in hostname; strip it right off !! options parsoid=wt2html,html2html !! wikitext http://e‌xample.com/ !! html/php

    http://example.com/

    !! html/parsoid

    http://example.com/

    !! end !! test External links: www.jpeg.org (bug 554) !! wikitext http://www.jpeg.org !! html

    http://www.jpeg.org

    !! end # parsoid doesn't explicitly mark autonumbered links, see bug 53505 !! test External links: URL within URL (original bug 2) !! wikitext [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp] !! html/php

    [1]

    !! html/parsoid

    !! end !! test BUG 361: URL inside bracketed URL !! wikitext [http://www.example.com/foo http://www.example.com/bar] !! html

    http://www.example.com/bar

    !! end !! test BUG 361: URL within URL, not bracketed !! wikitext http://www.example.com/foo?=http://www.example.com/bar !! html

    http://www.example.com/foo?=http://www.example.com/bar

    !! end !! test BUG 289: ">"-token in URL-tail !! wikitext http://www.example.com/ !! html

    http://www.example.com/<hello>

    !!end !! test BUG 289: literal ">"-token in URL-tail !! wikitext http://www.example.com/html !! html

    http://www.example.com/html

    !!end !! test BUG 289: ">"-token in bracketed URL !! wikitext [http://www.example.com/ stuff] !! html

    <hello> stuff

    !!end !! test BUG 289: literal ">"-token in bracketed URL !! wikitext [http://www.example.com/html stuff] !! html

    html stuff

    !!end !! test BUG 289: literal double quote at end of URL !! wikitext http://www.example.com/"hello" !! html

    http://www.example.com/"hello"

    !!end !! test BUG 289: literal double quote in bracketed URL !! wikitext [http://www.example.com/"hello" stuff] !! html

    "hello" stuff

    !!end !! test External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081) !! wikitext [http://www.example.com test] !! html

    test

    !! end !! test External links: link text with spaces !! wikitext [http://www.example.com a b c] [http://www.example.com ''a'' ''b''] !! html

    a b c a b

    !! end !! test External links: wiki links within external link (Bug 3695) !! wikitext [http://example.com [[wikilink]] embedded in ext link] !! html/php

    wikilink embedded in ext link

    !! html/parsoid

    wikilink embedded in ext link

    !! end !! test BUG 787: Links with one slash after the url protocol are invalid !! wikitext http:/example.com [http:/example.com title] !! html

    http:/example.com

    [http:/example.com title]

    !! end !! test Bracketed external links with template-generated invalid target !! wikitext [{{echo|http:/example.com}} title] !! html

    [http:/example.com title]

    !! end !! test Bug 2702: Mismatched , and tags are invalid !! wikitext ''[http://example.com text''] [http://example.com '''text]''' ''Something [http://example.com in italic''] ''Something [http://example.com mixed''''', even bold]''' '''''Now [http://example.com both'''''] !! html

    text text Something in italic Something mixed, even bold Now both

    !! end !! test Bug 4781: %26 in URL !! wikitext http://www.example.com/?title=AT%26T !! html/php

    http://www.example.com/?title=AT%26T

    !! html/parsoid

    http://www.example.com/?title=AT%26T

    !! end # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain # % is actually legal in HTML5. Any change in output would need testing though. !! test Bug 4781, 5267: %25 in URL !! wikitext http://www.example.com/?title=100%25_Bran !! html/php

    http://www.example.com/?title=100%25_Bran

    !! html/parsoid

    http://www.example.com/?title=100%25_Bran

    !! end !! test Bug 4781, 5267: %28, %29 in URL !! wikitext http://www.example.com/?title=Ben-Hur_%281959_film%29 !! html/php

    http://www.example.com/?title=Ben-Hur_%281959_film%29

    !! html/parsoid

    http://www.example.com/?title=Ben-Hur_%281959_film%29

    !! end !! test Bug 4781: %26 in autonumber URL !! wikitext [http://www.example.com/?title=AT%26T] !! html/php

    [1]

    !! html/parsoid

    !! end !! test Bug 4781, 5267: %26 in autonumber URL !! wikitext [http://www.example.com/?title=100%25_Bran] !! html/php

    [1]

    !! html/parsoid

    !! end !! test Bug 4781, 5267: %28, %29 in autonumber URL !! wikitext [http://www.example.com/?title=Ben-Hur_%281959_film%29] !! html/php

    [1]

    !! html/parsoid

    !! end !! test Bug 4781: %26 in bracketed URL !! wikitext [http://www.example.com/?title=AT%26T link] !! html/php

    link

    !! html/parsoid

    link

    !! end !! test Bug 4781, 5267: %25 in bracketed URL !! wikitext [http://www.example.com/?title=100%25_Bran link] !! html

    link

    !! end !! test Bug 4781, 5267: %28, %29 in bracketed URL !! wikitext [http://www.example.com/?title=Ben-Hur_%281959_film%29 link] !! html/php

    link

    !! html/parsoid

    link

    !! end !! test External link containing a period in the anchor. (bug 63947) !! wikitext [//foo.org/bar#baz. bang] [//foo.org/bar. bang] !! html/php

    bang

    bang

    !! html/parsoid

    bang

    bang

    !! end !! test External link containing a single quote. (bug 63947) !! wikitext [//foo.org/bar'baz] [//foo.org/bar'baz bang] !! html/php

    [1]

    bang

    !! html/parsoid

    bang

    !! end !! test External link containing a period in the anchor. (bug 63947) !! wikitext [//foo.org/bar#baz. bang] [//foo.org/bar. bang] !! html/php

    bang

    bang

    !! html/parsoid

    bang

    bang

    !! end !! test External link containing a single quote. (bug 63947) !! wikitext [//foo.org/bar'baz] [//foo.org/bar'baz bang] !! html/php

    [1]

    bang

    !! html/parsoid

    bang

    !! end !! test External link containing double-single-quotes in text '' (bug 4598 sanity check) !! wikitext Some [http://example.com/ pretty ''italics'' and stuff]! !! html

    Some pretty italics and stuff!

    !! end !! test External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check) !! wikitext ''Some [http://example.com/ pretty ''italics'' and stuff]!'' !! html

    Some pretty italics and stuff!

    !! end !! test External link containing double-single-quotes with no space separating the url from text in italics !! wikitext [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].] !! html/php

    La muerte de Casagemas (1901) en el sitio de Museo Picasso.

    !! html/php+tidy

    La muerte de Casagemas (1901) en el sitio de Museo Picasso.

    !! html/parsoid

    La muerte de Casagemas (1901) en el sitio de Museo Picasso.

    !! end !! test External link with comments in link text !! wikitext [http://www.google.com Google ] !! html

    Google

    !! end !! test URL-encoding in URL functions (single parameter) !! wikitext {{localurl:Some page|amp=&}} !! html

    /index.php?title=Some_page&amp=&

    !! end !! test URL-encoding in URL functions (multiple parameters) !! wikitext {{localurl:Some page|q=?&=&}} !! html

    /index.php?title=Some_page&q=?&amp=&

    !! end !! test Brackets in urls !! wikitext http://example.com/index.php?foozoid%5B%5D=bar http://example.com/index.php?foozoid[]=bar !! html/php

    http://example.com/index.php?foozoid%5B%5D=bar

    http://example.com/index.php?foozoid%5B%5D=bar

    !! html/parsoid

    http://example.com/index.php?foozoid%5B%5D=bar

    http://example.com/index.php?foozoid[]=bar

    !! end !! test IPv6 urls (bug 21261) !! options disabled !! wikitext http://[2404:130:0:1000::187:2]/index.php !! html

    http://[2404:130:0:1000::187:2]/index.php

    !! end !! test Non-extlinks in brackets !! wikitext [foo] [foo bar] [foo ''bar''] [fool's] errand [fool's errand] [{{echo|foo}}] [{{echo|foo}} bar] [{{echo|foo}} ''bar''] [{{echo|foo}}l's] errand [{{echo|foo}}l's errand] [url={{echo|foo}}] [url=http://example.com] !! html

    [foo] [foo bar] [foo bar] [fool's] errand [fool's errand] [foo] [foo bar] [foo bar] [fool's] errand [fool's errand] [url=foo] [url=http://example.com]

    !! end !! test Percent encoding in external links !! wikitext [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search] !! html/php

    Search

    !! html/parsoid

    Search

    !! end !! test Use url link syntax for links where the content is equal the link target !! wikitext http://example.com !! html/php

    http://example.com

    !! html/parsoid

    http://example.com

    !! end !! test Parenthesis in external links, especially URL links !! wikitext http://example.com) http://example.com/test) http://example.com/(test) http://example.com/((test) (http://example.com/(test)) (http://example.com/(test))))) http://example.com/a)b [http://example.com) foo] !! html/php

    http://example.com)

    http://example.com/test)

    http://example.com/(test)

    http://example.com/((test)

    (http://example.com/(test))

    (http://example.com/(test)))))

    http://example.com/a)b

    foo

    !! html/parsoid

    http://example.com)

    http://example.com/test)

    http://example.com/(test)

    http://example.com/((test)

    (http://example.com/(test))

    (http://example.com/(test)))))

    http://example.com/a)b

    foo

    !! end !! test Parenthesis in external links, w/ transclusion or comment !! wikitext (http://example.com/{{echo|hi}}) (http://example.com) !! html/php

    (http://example.com/hi)

    (http://example.com)

    !! html/parsoid

    (http://example.com/hi)

    (http://example.com)

    !! end !! test Replace invalid link targets when serializing !! options parsoid=html2wt !! html Manual !! wikitext [[MediaWiki:Badtitletext|Manual]] !! end ### ### Quotes ### !! test Quotes !! wikitext Normal text. '''Bold text.''' Normal text. ''Italic text.'' Normal text. '''''Bold italic text.''''' Normal text. !! html

    Normal text. Bold text. Normal text. Italic text.

    Normal text. Bold italic text. Normal text.

    !! end # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP # parser strips. The wikitext contains just the first half of the bold # quote pair. !! test Unclosed and unmatched quotes !! wikitext '''''Bold italic text '''with bold deactivated''' in between.''''' '''''Bold italic text ''with italic deactivated'' in between.''''' '''Bold text.. ..spanning two paragraphs (should not work).''' '''Bold tag left open ''Italic tag left open Normal text. '''This year''''s election ''should'' beat '''last year''''s. ''Tom'''s car is bigger than ''Susan'''s. Plain ''italic'''s plain !! html/php

    Bold italic text with bold deactivated in between.

    Bold italic text with italic deactivated in between.

    Bold text..

    ..spanning two paragraphs (should not work).

    Bold tag left open

    Italic tag left open

    Normal text.

    This year's election should beat last year's.

    Toms car is bigger than Susans.

    Plain italic's plain

    !! html/parsoid

    Bold italic text with bold deactivated in between.

    Bold italic text with italic deactivated in between.

    Bold text..

    ..spanning two paragraphs (should not work).

    Bold tag left open

    Italic tag left open

    Normal text.

    This year's election should beat last year's.

    Toms car is bigger than Susans.

    Plain italic's plain

    !! end ### ### Tables ### ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables ### # This should not produce
    as
    # is the bare minimum required by the spec, see: # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables # Parsoid team replies: empty table tags are legal in HTML5 !! test A table with no data. !! options parsoid=wt2html !! wikitext {||} !! html/php !! html/parsoid
    !! end !! test A table with stray table end tags on start tag line (wt2html) !! options parsoid=wt2html !! wikitext {|style="color: red;"|} {|style="color: red;" |} |foo |} {|style="color: red;"|} id="foo" |foo |} {|style="color: red;" |} id="foo" |foo |} !! html
    foo
    foo
    foo
    !! end !! test A table with no data (take 2) !! wikitext {| |} !! html/parsoid
    !! end # A table with nothing but a caption is invalid XHTML, we might want to render # this as

    caption

    # Parsoid team replies: table with only a caption is legal in HTML5 !! test A table with nothing but a caption !! wikitext {| |+ caption |} !! html/php
    caption
    !! html/parsoid
    caption
    !! end !! test A table with caption with default-spaced attributes and a table row !! wikitext {| |+ style="color: red;" | caption1 |- | foo |} !! html
    caption1
    foo
    !! end !! test A table with captions with non-default spaced attributes and a table row !! wikitext {| |+style="color: red;"|caption2 |+ style="color: red;"| caption3 |- | foo |} !! html
    caption2 caption3
    foo
    !! end !! test Table td-cell syntax variations !! wikitext {| | foo bar foo | baz | foo bar foo || baz | style='color:red;' | baz | style='color:red;' || baz |} !! html
    baz foo bar foo baz baz style='color:red;' baz
    !! end !! test Simple table !! wikitext {| | 1 || 2 |- | 3 || 4 |} !! html
    1 2
    3 4
    !! end !! test Simple table but with multiple dashes for row wikitext !! wikitext {| | foo |----- | bar |} !! html
    foo
    bar
    !! end !! test Multiplication table !! wikitext {| border="1" cellpadding="2" |+Multiplication table |- ! × !! 1 !! 2 !! 3 |- ! 1 | 1 || 2 || 3 |- ! 2 | 2 || 4 || 6 |- ! 3 | 3 || 6 || 9 |- ! 4 | 4 || 8 || 12 |- ! 5 | 5 || 10 || 15 |} !! html
    Multiplication table
    × 1 2 3
    1 1 2 3
    2 2 4 6
    3 3 6 9
    4 4 8 12
    5 5 10 15
    !! end !! test Accept "||" in table headings !! wikitext {| !h1 || h2 |} !! html
    h1 h2
    !! end !! test Accept "!!" in table data !! wikitext {| | Foo!! || |} !! html
    Foo!!
    !! html/parsoid
    Foo!!
    !! end !! test Accept "||" in indented table headings !! wikitext :{| !h1 || h2 |} !! html
    h1 h2
    !! end !! test Accept empty attributes in td/th cells (td/th cells starting with leading ||) !! wikitext {| !| h1 || a |} !! html
    h1 a
    !! end !!test Accept "| !" at start of line in tables (ignore !-attribute) !! wikitext {| |- | !style="color:red" | bar |} !! html
    bar
    !!end !!test Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/- !! wikitext {| |- |style='color:red;'|+1 |style='color:blue;'|-1 |- | 1 || 2 || 3 | 1 ||+2 ||-3 |- | +1 | -1 |} !! html
    +1 -1
    1 2 3 1 +2 -3
    +1 -1
    !!end !! test Table rowspan !! wikitext {| border=1 | Cell 1, row 1 |rowspan=2| Cell 2, row 1 (and 2) | Cell 3, row 1 |- | Cell 1, row 2 | Cell 3, row 2 |} !! html
    Cell 1, row 1 Cell 2, row 1 (and 2) Cell 3, row 1
    Cell 1, row 2 Cell 3, row 2
    !! end !! test Nested table !! wikitext {| border=1 | α | {| bgcolor=#ABCDEF border=2 |nested |- |table |} |the original table again |} !! html
    α
    nested
    table
    the original table again
    !! end !! test Invalid attributes in table cell (bug 1830) !! wikitext {| |Cell:|broken |} !! html
    broken
    !! end # The "|}" to close the table is missing from the input, so parsoid's # *2wt modes will fail. !! test Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html) !! options parsoid=wt2html,html2html !! wikitext {| | |[ftp://|x||]" onmouseover="alert(document.cookie)">test !! html/php
    [ftp://%7Cx ]" onmouseover="alert(document.cookie)">test
    !! html/parsoid
    " onmouseover="alert(document.cookie)">test
    !! end !! test Indented table markup mixed with indented pre content (proposed in bug 6200) !! wikitext
    Text that should be rendered preformatted
    !! html
    Text that should be rendered preformatted
    
    !! end !! test Template-generated table cell attributes and cell content !! wikitext {| |{{table_attribs}} | {{table_attribs}} |} !! html
    Foo Foo
    !! end !! test Template-generated table cell attributes and cell content (2) !! wikitext {| |align=center {{table_attribs}} |} !! html
    Foo
    !! end !! test Template-generated table cell attributes and cell content (3) !! wikitext {| |align=center {{table_cells}} |} !! html
    Foo Bar Baz
    !! end !! test Table with row followed by newlines and table heading !! wikitext {| |- ! foo |} !! html
    foo
    !! end !! test Table with empty line following the start tag !! wikitext {| |- | foo |} !! html
    foo
    !! end # FIXME: Preserve the attribute properly (with an empty string as value) in # the PHP parser. Parsoid implements the behavior below. !! test Table attributes with empty value !! wikitext {| | style=| hello |} !! html/parsoid
    hello
    !! end !! test Wikitext table with a lot of comments !! wikitext {| | foo |- | |} !! html
    foo
    !! end !! test Wikitext table with double-line table cell !! wikitext {| |a b |} !! html
    a

    b

    !! end !! test Table cell with a single comment !! wikitext {| | | a |} !! html
    a
    !! end !! test Table-cell after a comment-only-empty-line !! wikitext {| |a | b |} !! html
    a b
    !! html/parsoid
    a b
    !! end !! test Build table with {{!}} !! wikitext {{{!}} class="wikitable" ! header ! second header {{!}}- style="color:red;" {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data {{!}}} !! html
    header second header
    data second data
    !! end # The expected HTML structure in this test is debatable. The PHP parser does # not parse this kind of table at all. The main focus for Parsoid is on # round-tripping, so this output is ok for now. TODO: revisit! !! test Wikitext table with html-syntax row !! wikitext {| |- foo |} !! html/parsoid
    foo
    !! end ## Note that Parsoid output differs from PHP and PHP+tidy here. ## The lack of tags in the PHP output is arguably a bug in the ## PHP parser, which tidy then compounds by fostering the content ## entirely out of the table. Parsoid recognizes the table context ## and generates and wrappers as needed. Hopefully nobody ## depends on PHP's treatment of broken table markup! !! test Implicit after a |- !! options parsoid=wt2html,wt2wt !! wikitext {| |- a |} !! html/php a
    !! html/php+tidy

    a

    !! html/parsoid
    a
    !! end # Again, Parsoid adds implicit s here, PHP and Tidy strip the b out. !! test
     tags should be recognized in an explicit  context, but not in an implicit  context
    !! options
    parsoid=wt2html,wt2wt
    !! wikitext
    {|
    |-
    |
     a
    |-
     b
    |}
    !! html/php
    
     b
    
    a
    
    !! html/php+tidy

    b

    a
    
    !! html/parsoid
    a
    b
    !! end # PHP + Tidy strips the list out of the table; Parsoid wraps it. !! test Lists should be recognized in an implicit context !! options parsoid=wt2html,wt2wt !! wikitext {| |- *a |} !! html/php
    • a
    !! html/php+tidy
    • a
    !! html/parsoid
    • a
    !! end !! test Parsoid: Round-trip tables directly followed by content (bug 51219) !! options parsoid=wt2html,wt2wt !! wikitext {| |foo |} bar {| |baz |}quux !! html
    foo
    bar
    baz
    quux !! end !! test Parsoid: Default to a newline after tables in new content (bug 51219) !! options parsoid=html2wt !! wikitext {| |foo |} bar {| |baz |} '''quux''' !! html
    foo
    bar
    baz
    quux !! end !! test Parsoid: newline inducing block nodes don't suppress !! options parsoid=html2wt !! wikitext a = foo = !! html a

    foo

    !! end !! test Parsoid: Row-syntax table headings followed by comment & table cells !! options parsoid=wt2html,wt2wt !! wikitext {| ! foo || bar || baz || quux |} !! html/php
    foo bar baz quux
    !! html/parsoid
    foo bar baz quux
    !! end # PHP throws away the (semi-broken) "foo" class here; Parsoid # preserves it. !!test Parsoid: Recover better from broken table attributes !!options parsoid=wt2html !!wikitext {| class="foo | class="bar" | foo |} !!html/php+tidy

    foo

    !!html/parsoid

    foo

    !!end !! test Strip unsupported table tags !! options parsoid=html2wt !! html
    Month Savings
    January $100
    February $80
    Sum $180
    !! wikitext {| !Month !Savings |January |$100 |- |February |$80 |Sum |$180 |} !! end ### ### Internal links ### !! test Plain link, capitalized !! wikitext [[Main Page]] !! html

    Main Page

    !! end !! test Plain link, uncapitalized !! wikitext [[main Page]] !! html

    main Page

    !! end !! test Piped link !! wikitext [[Main Page|The Main Page]] !! html

    The Main Page

    !! end !! test Piped link with comment in link text !! wikitext [[Main Page|The Main Page]] !! html

    The Main Page

    !! end !! test Piped link with multiple pipe characters in link text !! wikitext [[Main Page||The|Main|Page|]] !! html/php

    |The|Main|Page|

    !! html/parsoid

    |The|Main|Page|

    !! end !! test Broken link !! wikitext [[Zigzagzogzagzig]] !! html

    Zigzagzogzagzig

    !! end !! test Broken link with fragment !! wikitext [[Zigzagzogzagzig#zug]] !! html

    Zigzagzogzagzig#zug

    !! end !! test Special page link with fragment !! wikitext [[Special:Version#anchor]] !! html

    Special:Version#anchor

    !! end !! test Nonexistent special page link with fragment !! wikitext [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]] !! html

    Special:ThisNameWillHopefullyNeverBeUsed#anchor

    !! end !! test Link with prefix !! wikitext xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]] !! html

    xxxmain Page, xxxMain Page, Xxxmain Page XXXmain Page, XXXMain Page

    !! end !! test Link with suffix !! wikitext [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!! !! html

    Main Pagexxx, Main PageXXX, Main Page!!!

    !! end !! article prefixed article !! text Some text !! endarticle !! test Bug 43661: Piped links with identical prefixes !! wikitext [[prefixed article|prefixed articles with spaces]] [[prefixed article|prefixed articlesaoeu]] [[Main Page|Main Page test]] !! html

    prefixed articles with spaces

    prefixed articlesaoeu

    Main Page test

    !! end !! test Link with HTML entity in suffix / tail !! wikitext [[Main Page]]", [[Main Page]]a !! html

    Main Page", Main Pagea

    !! end !! test Link with 3 brackets !! wikitext [[[Main Page]]] !! html

    [[[Main Page]]]

    !! end !! test Link with 4 brackets !! wikitext [[[[Main Page]]]] !! html

    [[Main Page]]

    !! end !! test Piped link with 3 brackets !! wikitext [[[main page|the main page]]] !! html

    [[[main page|the main page]]]

    !! end !! test Piped link with extlink-like text !! wikitext [[Main Page|[bar]]] [[Main Page|This is a [bar]]] !! html

    [bar] This is a [bar]

    !! end !! test Link with multiple pipes !! wikitext [[Main Page|The|Main|Page]] !! html

    The|Main|Page

    !! end # Note that parsoid does not munge anchor text; all non-space # characters are valid in HTML5 ids. !! test Anchor containing a #. (bug 63430) !! wikitext [[Main Page#And#Link]] !! html/php

    Main Page#And#Link

    !! html/parsoid

    Main Page#And#Link

    !! end !! test Link to namespaces !! wikitext [[Talk:Parser testing]], [[Meta:Disclaimers]] !! html

    Talk:Parser testing, Meta:Disclaimers

    !! end !! test Link with space in namespace !! wikitext [[User talk:Foo bar]] !! html

    User talk:Foo bar

    !! end !! article MemoryAlpha:AlphaTest !! text This is an article in the MemoryAlpha namespace (which shadows the memoryalpha interwiki link). !! endarticle !! test Namespace takes precedence over interwiki link (bug 51680) !! wikitext [[MemoryAlpha:AlphaTest]] !! html

    MemoryAlpha:AlphaTest

    !! end # The previous test doesn't work correctly in html2*, due to not recognizing the # link as an internal one. This one checks for the correct behavior. !! test Link to namespace preferred over interwiki with correct rel attribute !! options parsoid=html2wt,html2html !! wikitext [[MemoryAlpha:AlphaTest]] !! html

    MemoryAlpha:AlphaTest

    !! end !! test Piped link to namespace !! wikitext [[Meta:Disclaimers|The disclaimers]] !! html

    The disclaimers

    !! end !! test Link containing } !! wikitext [[Usually caused by a typo (oops}]] !! html

    [[Usually caused by a typo (oops}]]

    !! end !! article 7% Solution !! text Just a test of an article title containing a percent. !! endarticle !! test Link containing % (not as a hex sequence) !! wikitext [[7% Solution]] !! html/php

    7% Solution

    !! html/parsoid

    7% Solution

    !! end # note that the parsoid HTML is identical to the previous test output, # so the previous test ensures that the html2wt mode will generate the # "not as a hex sequence" wikitext. !! test Link containing % as a single hex sequence interpreted to char !! options parsoid=wt2wt,wt2html,html2html !! wikitext [[7%25 Solution]] !! html/php

    7% Solution

    !! html/parsoid

    7% Solution

    !!end !! test Link containing % as a double hex sequence interpreted to hex sequence !! wikitext [[7%2525 Solution]] !! html

    [[7%2525 Solution]]

    !!end # note that parsoid does not munge anchor text; all non-space # characters are valid in HTML5 anchors. !! test Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors Example for such a section: == < == !! wikitext [[%23%3c]][[%23%3e]] !! html/php

    #<#>

    !! html/parsoid

    #<#>

    !! end !! test Link containing "<#" and ">#" as a hex sequences !! wikitext [[%3c%23]][[%3e%23]] !! html

    [[%3c%23]][[%3e%23]]

    !! end !! test Link containing an equals sign !! wikitext [[Special:BookSources/isbn=4-00-026157-6]] !! html/php

    Special:BookSources/isbn=4-00-026157-6

    !! html/parsoid

    Special:BookSources/isbn=4-00-026157-6

    !! end !! article Foo~bar !! text Just a test of an article title containing a tilde. !! endarticle # note that links containing signatures, like [[Foo~~~~]], are # massaged by the pre-save transform (PST) and so the tildes are never # seen by the parser. !! test Link containing a tilde !! wikitext [[Foo~bar]] !! html/php

    Foo~bar

    !! html/parsoid

    Foo~bar

    !! end !! test Link containing double-single-quotes '' (bug 4598) !! wikitext [[Lista d''e paise d''o munno]] !! html/php

    Lista d''e paise d''o munno

    !! html/parsoid

    Lista d''e paise d''o munno

    !! end !! test Link containing double-single-quotes '' in text (bug 4598 sanity check) !! wikitext Some [[Link|pretty ''italics'' and stuff]]! !! html/php

    Some pretty italics and stuff!

    !! html/parsoid

    Some pretty italics and stuff!

    !! end !! test Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check) !! wikitext ''Some [[Link|pretty ''italics'' and stuff]]!'' !! html

    Some pretty italics and stuff!

    !! end !! test Link with double quotes in title part (literal) and alternate part (interpreted) !! wikitext [[File:Denys Savchenko ''Pentecoste''.jpg]] [[''Pentecoste'']] [[''Pentecoste''|Pentecoste]] [[''Pentecoste''|''Pentecoste'']] !! html/php

    File:Denys Savchenko Pentecoste.jpg

    ''Pentecoste''

    Pentecoste

    Pentecoste

    !! html/parsoid

    ''Pentecoste''

    Pentecoste

    Pentecoste

    !! end !! test Broken image links with HTML captions (bug 39700) !! wikitext [[File:Nonexistent|]] [[File:Nonexistent|100px|]] [[File:Nonexistent|<]] [[File:Nonexistent|abc]] !! html

    <script></script> <script></script> < abc

    !! end !! test Plain link to URL !! wikitext [[http://www.example.com]] !! html/php

    [[1]]

    !! html/parsoid

    []

    !! end !! test Plain link to URL with link text !! wikitext [[http://www.example.com Link text]] !! html

    [Link text]

    !! end !! test Plain link to protocol-relative URL !! wikitext [[//www.example.com]] !! html/php

    [[1]]

    !! html/parsoid

    []

    !! end !! test Plain link to protocol-relative URL with link text !! wikitext [[//www.example.com Link text]] !! html

    [Link text]

    !! end !! test Plain link to page with question mark in title !! wikitext [[A?b]] [[A?b|Baz]] !! html

    A?b

    Baz

    !! end # I'm fairly sure the expected result here is wrong. # We want these to be URL links, not pseudo-pages with URLs for titles.... # However the current output is also pretty screwy. # # ---- # I'm changing it to match the current output--it arguably makes more # sense in the light of the test above. Old expected result was: #

    Piped link to URL: an example URL #

    # But I think this test is bordering on "garbage in, garbage out" anyway. # -- wtm !! test Piped link to URL !! wikitext Piped link to URL: [[http://www.example.com|an example URL]] !! html/php

    Piped link to URL: [example URL]

    !! html/parsoid

    Piped link to URL: [example URL]

    !! end !! test BUG 2: [[page|http://url/]] should link to page, not http://url/ !! wikitext [[Main Page|http://url/]] !! html/php

    http://url/

    !! html/parsoid

    http://url/

    !! end # Parsoid does not mark self-links, by design. !! test BUG 337: Escaped self-links should be bold !! options title=[[Bug462]] !! wikitext [[Bug462]] [[Bug462]] !! html/php

    Bug462 Bug462

    !! html/php+tidy

    Bug462 Bug462

    !! html/parsoid

    Bug462 Bug462

    !! end !! test Self-link to section should not be bold !! options title=[[Main Page]] !! wikitext [[Main Page#section]] !! html

    Main Page#section

    !! end !! article 00 !! text This is 00. !! endarticle !!test Self-link to numeric title !!options title=[[0]] !! wikitext [[0]] !! html

    0

    !!end !!test Link to numeric-equivalent title !!options title=[[0]] !! wikitext [[00]] !! html

    00

    !!end !! test inside a link !! wikitext [[Main Page]] [[Main Page|the main page [it's not very good]]] !! html

    [[Main Page]] the main page [it's not very good]

    !! end !! test Non-breaking spaces in title !! wikitext [[  Main   Page  ]] !! html

      Main   Page  

    !!end !! test Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue) !! options language=ca !! wikitext '''[[Main Page]]''' !! html

    Main Page

    !! end !! test Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue) !! options language=ca !! wikitext ''[[Main Page]]'' !! html

    Main Page

    !! end !! test Internal link with en linktrail: no apostrophes (bug 27473) !! options language=en !! wikitext [[Something]]'nice !! html

    Something'nice

    !! end !! test Internal link with ca linktrail with apostrophes (bug 27473) !! options language=ca !! wikitext [[Something]]'nice !! html

    Something'nice

    !! end !! test Internal link with kaa linktrail with apostrophes (bug 27473) !! options language=kaa !! wikitext [[Something]]'nice !! html

    Something'nice

    !! end !! test Link with multiple ":" in a subpage-supporting namespace (bug 63636) !! wikitext [[User:Foo/Test/63636:Bar|Test]] !! html/php

    Test

    !! html/parsoid

    Test

    !! end !! test Purely hash wikilink !! options title=[[User:test/123]] !! wikitext [[#a|b]] !! html/php

    b

    !! html/parsoid

    b

    !! end !! test 1. Interaction of linktrail and template encapsulation !! options parsoid !! wikitext {{echo|[[Foo]]}}l !! html

    Fool

    !! end !! test 2. Interaction of linktrail and template encapsulation !! options parsoid !! wikitext {{echo|Some [[Fool]]}}s !! html

    Some Fools

    !! end !! test 3. Interaction of linktrail and template encapsulation !! options parsoid !! wikitext {{echo|Some [[Fool]]s are '''bold and foolish'''}} !! html

    Some Fools are bold and foolish

    !! end !! article Söfnuður !! text Test. !! endarticle !! test Internal link with is link prefix !! options language=is !! wikitext Aðrir mótmælenda[[söfnuður|söfnuðir]] og !! html

    Aðrir mótmælendasöfnuðir og

    !! end !! article Mótmælendatrú !! text Test. !! endarticle !! test Internal link with is link trail and link prefix !! options language=is !! wikitext [[mótmælendatrú|xxx]]ar [[mótmælendatrú]]ar mótmælenda[[söfnuður]] mótmælenda[[söfnuður|söfnuðir]] mótmælenda[[söfnuður|söfnuðir]]xxx !! html

    xxxar mótmælendatrúar mótmælendasöfnuður mótmælendasöfnuðir mótmælendasöfnuðirxxx

    !! end !! test Parsoid link trail escaping !! options parsoid=html2wt,html2html !! wikitext [[apple]]s !! html

    apples

    !! end !! test Parsoid link prefix escaping !! options language=is parsoid=html2wt,html2html !! wikitext Aðrir mótmælenda[[söfnuður]] !! html

    Aðrir mótmælendasöfnuður

    !! end !! test Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved !! wikitext [[Foo| bar]] [[Foo| ''bar'']] [http://wp.org foo] [http://wp.org ''foo''] !! html

    bar

    bar

    foo

    foo

    !! end !! test Parsoid: Scoped parsing should handle mixed transclusions and plain text !! options parsoid !! wikitext [[Foo|{{echo|a}} b {{echo|c}}]] !! html

    a b c

    !! end !! test Link with angle bracket after anchor !! wikitext [[Foo#]] !! html/php

    Foo#<bar>

    !! html/parsoid

    Foo#<bar>

    !! end ### ### Interwiki links (see maintenance/interwiki.sql) ### !! test Inline interwiki link !! wikitext [[MeatBall:SoftSecurity]] !! html

    MeatBall:SoftSecurity

    !! end !! test Inline interwiki link with empty title (bug 2372) !! wikitext [[MeatBall:]] !! html

    MeatBall:

    !! end !! test Interwiki link encoding conversion (bug 1636) !! wikitext *[[Wikipedia:ro:Olteniţa]] *[[Wikipedia:ro:Olteniţa]] !! html !! html+tidy !! end !! test Interwiki link with fragment (bug 2130) !! wikitext [[MeatBall:SoftSecurity#foo]] !! html

    MeatBall:SoftSecurity#foo

    !! end # Ideally the wikipedia: prefix here should be proto-relative too !! test Different interwiki prefixes mapping to the same URL !! wikitext [[:en:Foo]] [[:en:Foo|Foo]] [[wikipedia:Foo]] [[:wikipedia:Foo|Foo]] [[wikipedia:en:Foo]] [[:wikipedia:en:Foo]] [[ wikiPEdia :Foo]] !! html/parsoid

    en:Foo

    Foo

    wikipedia:Foo

    Foo

    wikipedia:en:Foo

    wikipedia:en:Foo

    wikiPEdia :Foo

    !! end !! test Interwiki links that cannot be represented in wiki syntax !! wikitext [[meatball:ok]] [[meatball:ok#foo|ok with fragment]] [[meatball:ok_as_well?|ok ending with ? mark]] [http://de.wikipedia.org/wiki/Foo?action=history has query] [http://de.wikipedia.org/wiki/#foo is just fragment] !! html/parsoid

    meatball:ok ok with fragment ok ending with ? mark has query is just fragment

    !! end !! test Interwiki links: trail !! options parsoid !! wikitext [[wikipedia:Foo|Ba]]r !! html

    Bar

    !! end !! test Local interwiki link !! wikitext [[local:Template:Foo]] !! html

    local:Template:Foo

    !! end !! test Local interwiki link: self-link to current page !! options title=[[Main Page]] !! wikitext [[local:Main Page]] !! html

    local:Main Page

    !! end !! test Local interwiki link: prefix only (bug 64167) !! wikitext [[local:]] !! html

    local:

    !! end !! test Local interwiki link: with additional interwiki prefix (bug 61357) !! wikitext [[local:meatball:Hello]] !! html

    local:meatball:Hello

    !! end ### ### Interlanguage links ### Language links (so that searching for '### language' matches..) ### !! test Interlanguage link !! wikitext Blah blah blah [[zh:Chinese]] !! html/php

    Blah blah blah

    !! html/parsoid

    Blah blah blah

    !! end !! test Interlanguage link with spacing !! wikitext Blah blah blah [[ zh : Chinese ]] !! html/php

    Blah blah blah

    !! html/parsoid

    Blah blah blah

    !! end !! test Double interlanguage link !! wikitext Blah blah blah [[es:Spanish]] [[zh:Chinese]] !! html/php

    Blah blah blah

    !! html/parsoid

    Blah blah blah

    !! end !! test Interlanguage link variations !! wikitext Blah blah blah [[ es :Spanish]] [[ ZH :Chinese]] !! html/php

    Blah blah blah

    !! html/parsoid

    Blah blah blah !! end !! test Interlanguage link, with prefix links !! options language=ln !! wikitext Blah blah blah [[zh:Chinese]] !! html/php

    Blah blah blah

    !! html/parsoid

    Blah blah blah

    !! end !! test Double interlanguage link, with prefix links (bug 8897) !! options language=ln !! wikitext Blah blah blah [[es:Spanish]] [[zh:Chinese]] !! html/php

    Blah blah blah

    !! html/parsoid

    Blah blah blah

    !! end !! test "Extra" interlanguage links (bug 32189 / gerrit 111390) !! wikitext Blah blah blah [[mul:Article]] !! html/php

    Blah blah blah

    !! html/parsoid

    Blah blah blah

    !! end !! test Parsoid-specific test: Wikilinks with   should RT properly !! options language=ln !! wikitext [[WW II]] !! html

    WW II

    !! end !! test Parsoid bug 53221: Wikilinks should be properly entity-escaped !! options parsoid=html2wt !! wikitext He&nbsp;llo [[Foo|He&nbsp;llo]] He&nbsp;llo [[He&nbsp;llo]] !! html

    He&nbsp;llo He&nbsp;llo

    He&nbsp;llo He&nbsp;llo

    !! end !! test Parsoid: handle constructor well !! options parsoid !! wikitext [[constructor]] [[constructor:foo]] !! html

    constructor

    constructor:foo

    !! end !! test Parsoid: recognize interlanguage links without a target page !! options parsoid !! wikitext [[ko:]] !! html

    !! end !! test Parsoid: recognize interwiki links without a target page !! options parsoid !! wikitext [[:ko:]] !! html

    ko:

    !! end !! test Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links !! options parsoid !! wikitext [[en:Foo]] !! html

    Foo

    !! end !! test Interlanguage link with preceding local interwiki link (bug 68085) !! wikitext Blah blah blah [[local:es:Spanish]] !! html

    Blah blah blah local:es:Spanish

    !! end !! test Looks like an interlanguage link, but is actually a local interwiki !! wikitext Blah blah blah [[mi:Template:Foo]] !! html

    Blah blah blah mi:Template:Foo

    !! end ### ### Redirects, Parsoid-only ### !! test 1. Simple redirect to page !! options parsoid !! wikitext #REDIRECT [[Main Page]] !! html !! end # Only wt2html and html2html since "Main_Page" will serialize to "Main Page" !! test 2. Other redirect variants !! options parsoid=wt2html,wt2wt !! wikitext #REDIRECT [[Main_Page]] #REDIRECT [[[[Bar]]]] !! html !! end !! test Empty redirect !! options parsoid=wt2html,wt2wt !! wikitext #REDIRECT [[]] !! html
    1. REDIRECT [[]]
    !! end !! test Optional colon in #REDIRECT !! options # the colon is archaic syntax. we support it for wt2html, but we # don't care that it roundtrips back to the modern syntax. parsoid=wt2html,html2html !! wikitext #REDIRECT:[[Main Page]] !! html !! end !! test Whitespace in #REDIRECT with optional colon !! options # the colon and gratuitous whitespace is archaic syntax. we support # it for wt2html, but we don't care that it roundtrips back to the # modern syntax (without extra whitespace) parsoid=wt2html,html2html !! wikitext #REDIRECT : [[Main Page]] !! html !! end !! test Piped link in #REDIRECT !! options # content after piped link is ignored. we support this syntax, # but don't care that the piped link is lost when we roundtrip this. parsoid=wt2html !! wikitext #REDIRECT [[Main Page|bar]] !! html !! end !! test Redirect to category !! options parsoid=wt2html !! wikitext #REDIRECT [[Category:Foo]] !! html !! end !! test Redirect to category with URL encoding !! options parsoid=wt2html !! wikitext #REDIRECT [[Category%3AFoo]] !! html !! end !! test Redirect to category page !! options parsoid=wt2html,html2html !! wikitext #REDIRECT [[:Category:Foo]] !! html

    Category:Foo

    !! end !! test Redirect to image page (1) !! options parsoid !! wikitext #REDIRECT [[File:Wiki.png]] !! html !! end !! test Redirect to image page (2) !! options parsoid !! wikitext #REDIRECT [[Image:Wiki.png]] !! html !! end !! test Redirect to language !! options parsoid !! wikitext #REDIRECT [[en:File:Wiki.png]] !! html !! end !! test Redirect to interwiki !! options parsoid !! wikitext #REDIRECT [[meatball:File:Wiki.png]] !! html !! end !! test Non-English #REDIRECT !! options parsoid language=is !! wikitext #TILVÍSUN [[Main Page]] !! html !! end !! test New redirect !! options parsoid=html2wt !! wikitext Foo #REDIRECT [[Foo]] !! html

    Foo

    !! end ## ## XHTML tidiness ### !! test
    to
    !! wikitext 1
    2
    3 !! html

    1
    2
    3

    !! end !! test Broken br tag sanitization !! wikitext
    !! html/php

    </br>

    !! end # TODO: Fix html2html mode (bug 51055)! # This
    handling was added as part of bug 50831; but it # differs from how PHP+tidy handles this. We should investigate # this. !! test Parsoid: Broken br tag recognition !! options parsoid=wt2html !! wikitext

    !! html/php+tidy

    </br>


    !! html/parsoid



    !! end !! test Incorrecly removing closing slashes from correctly formed XHTML !! wikitext
    !! html


    !! end !! test Failing to transform badly formed HTML into correct XHTML !! wikitext


    !! html




    !!end !! test Handling html with a div self-closing tag !! wikitext
    !! html

    <div title /> <div title/>

    <div title=bar /> <div title=bar/>

    !! end !! test Handling html with a br self-closing tag !! wikitext





    !! html/php







    !! html/parsoid







    !! end !! test Horizontal ruler (should it add that extra space?) !! wikitext

    foo
    bar !! html

    foo
    bar !! end !! test Horizontal ruler -- 4+ dashes render hr !! wikitext ---- !! html
    !! end !! test Horizontal ruler -- eats additional dashes on the same line !! wikitext --------- !! html
    !! end !! test Horizontal ruler -- does not collapse dashes on consecutive lines !! wikitext ---- ---- !! html

    !! end !! test Horizontal ruler -- <4 dashes render as plain text !! wikitext --- !! html

    ---

    !! end !! test Horizontal ruler -- Supports content following dashes on same line !! wikitext ---- Foo !! html
    Foo !! html+tidy

    Foo

    !! end ### ### Block-level elements ### !! test Common list !! wikitext *Common list * item 2 *item 3 !! html
    • Common list
    • item 2
    • item 3
    !! end !! test Numbered list !! wikitext #Numbered list #item 2 # item 3 !! html
    1. Numbered list
    2. item 2
    3. item 3
    !! end !! test Mixed list !! wikitext *Mixed list *# with numbers ** and bullets *# and numbers *bullets again **bullet level 2 ***bullet level 3 ***#Number on level 4 **bullet level 2 **#Number on level 3 **#Number on level 3 *#number level 2 *Level 1 *** Level 3 #** Level 3, but ordered !! html
    • Mixed list
      1. with numbers
      • and bullets
      1. and numbers
    • bullets again
      • bullet level 2
        • bullet level 3
          1. Number on level 4
      • bullet level 2
        1. Number on level 3
        2. Number on level 3
      1. number level 2
    • Level 1
        • Level 3
        • Level 3, but ordered
    !! end !! test Nested lists 1 !! wikitext *foo **bar !! html
    • foo
      • bar
    !! end !! test Nested lists 2 !! wikitext **foo *bar !! html
      • foo
    • bar
    !! end !! test Nested lists 3 (first element empty) !! wikitext * **bar !! html
      • bar
    !! end !! test Nested lists 4 (first element empty) !! wikitext ** *bar !! html
    • bar
    !! end !! test Nested lists 5 (both elements empty) !! wikitext ** * !! html
    !! end !! test Nested lists 6 (both elements empty) !! wikitext * ** !! html
    !! end !! test Nested lists 7 (skip initial nesting levels) !! wikitext *** foo !! html
        • foo
    !! end !! test Nested lists 8 (multiple nesting transitions) !! wikitext * foo *** bar ** baz * boo !! html
    • foo
        • bar
      • baz
    • boo
    !! end !! test 1. Lists with start-of-line-transparent tokens before bullets: Comments !! wikitext *foo *bar *baz !! html
    • foo
    • bar
    • baz
    !! end !! test 2. Lists with start-of-line-transparent tokens before bullets: Template close !! wikitext *foo {{echo|bar }}*baz !! html
    • foo bar
    • baz
    !! end !! test List items are not parsed correctly following a
     block (bug 785)
    !! wikitext
    * 
    foo
    *
    bar
    * zar !! html
    • foo
    • bar
    • zar
    !! end !! test List items from template !! wikitext {{inner list}} * item 2 * item 0 {{inner list}} * item 2 * item 0 * notSOL{{inner list}} * item 2 !! html
    • item 1
    • item 2
    • item 0
    • item 1
    • item 2
    • item 0
    • notSOL
    • item 1
    • item 2
    !! end !! test List interrupted by empty line or heading !! wikitext * foo ** bar == A heading == * Another list item !! html
    • foo
      • bar

    A heading[edit]

    • Another list item
    !!end !!test Multiple list tags generated by templates !! wikitext {{echo|
  • }}a {{echo|
  • }}b {{echo|
  • }}c !! html
  • a
  • b
  • c
  • !! html+tidy
    • a
    • b
    • c
    !!end !!test Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines !! wikitext *a *b *c *d !! html
    • a
    • b
    • c
    • d
    !!end !!test Replacing whitespace with tabs still doesn't break the list (gerrit 78327) !! wikitext *a *b *c *d !! html
    • a
    • b
    • c
    • d
    !!end !!test Test the li-hack (The PHP parser relies on Tidy for the hack) !!options parsoid=wt2html,wt2wt !! wikitext * foo *
  • li-hack * {{echo|
  • templated li-hack}} *
  • unsupported li-hack with preceding comments
    • not a li-hack
    !! html+tidy
    • foo
    • li-hack
    • templated li-hack
    • unsupported li-hack with preceding comments
    • not a li-hack
    !!end !! test Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines !! options parsoid !! wikitext # foo ## bar * foo ** bar : foo :: bar !! html
    1. foo
      1. bar
    • foo
      • bar
    foo
    bar
    !! end !! test Parsoid: Test of whitespace serialization with Templated bullets !! options parsoid !! wikitext * {{bullet}} !! html
    • Bar
    !! end # ------------------------------------------------------------------------ # The next set of tests are about Parsoid's ability to handle badly nested # tags (parse, minimize scope of fixup, and roundtrip back) # ------------------------------------------------------------------------ !! test Unbalanced closing block tags break a list (php parser relies on Tidy to fix up) !! wikitext
    *a
    *b
    !! html+tidy
    • a
    • b
    !! end # Parsoid fails this test, but it might be tricky to support properly. # See bug 68395. !! test Unbalanced closing non-block tags don't break a list (php parser relies on Tidy to fix up) !! wikitext *a *b !! html/php+tidy
    • a
    • b
    !! html/parsoid
    • a
    • b
    !! end !! test Unclosed formatting tags that straddle lists are closed and reopened (php parser relies on Tidy to fix up) !! wikitext # a # b !! html/php+tidy
    1. a
    2. b
    !! html/parsoid
    1. a
    2. b
    !! end # Parsoid fails this test, but it might be tricky to support properly. # See bug 68395. !!test List embedded in a non-block tag (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy) !! wikitext * foo !! html/php+tidy
    • foo
    !! html/parsoid
    • foo
    !!end # This is a bug in the PHP parser + tidy combination. # (The tag gets parsed as text and html-escaped by PHP, # and then fostered out of the table by tidy.) # We believe the Parsoid output to be correct. !! test Table with missing opening tag !! options parsoid=wt2html,wt2wt !! wikitext
    foo
    !! html/php+tidy

    </tr>

    foo
    !! html/parsoid
    foo
    !! end ### ### Magic Words ### # Note that the current date is hard-coded as # 1970-01-01T00:02:03Z (a Thursday) # when running parser tests. The timezone is also fixed to GMT, so # local date will be identical to current date. !! test Magic Word: {{CURRENTDAY}} !! wikitext {{CURRENTDAY}} !! html

    1

    !! end !! test Magic Word: {{CURRENTDAY2}} !! wikitext {{CURRENTDAY2}} !! html

    01

    !! end !! test Magic Word: {{CURRENTDAYNAME}} !! wikitext {{CURRENTDAYNAME}} !! html

    Thursday

    !! end !! test Magic Word: {{CURRENTDOW}} !! wikitext {{CURRENTDOW}} !! html

    4

    !! end !! test Magic Word: {{CURRENTMONTH}} !! wikitext {{CURRENTMONTH}} !! html

    01

    !! end !! test Magic Word: {{CURRENTMONTH1}} !! wikitext {{CURRENTMONTH1}} !! html

    1

    !! end !! test Magic Word: {{CURRENTMONTHABBREV}} !! wikitext {{CURRENTMONTHABBREV}} !! html

    Jan

    !! end !! test Magic Word: {{CURRENTMONTHNAME}} !! wikitext {{CURRENTMONTHNAME}} !! html

    January

    !! end !! test Magic Word: {{CURRENTMONTHNAMEGEN}} !! wikitext {{CURRENTMONTHNAMEGEN}} !! html

    January

    !! end !! test Magic Word: {{CURRENTTIME}} !! wikitext {{CURRENTTIME}} !! html

    00:02

    !! end !! test Magic Word: {{CURRENTHOUR}} !! wikitext {{CURRENTHOUR}} !! html

    00

    !! end !! test Magic Word: {{CURRENTWEEK}} (@bug 4594) !! wikitext {{CURRENTWEEK}} !! html

    1

    !! end !! test Magic Word: {{CURRENTYEAR}} !! wikitext {{CURRENTYEAR}} !! html

    1970

    !! end !! test Magic Word: {{CURRENTTIMESTAMP}} !! wikitext {{CURRENTTIMESTAMP}} !! html

    19700101000203

    !! end !! test Magic Words LOCAL (UTC) !! wikitext * {{LOCALMONTH}} * {{LOCALMONTH1}} * {{LOCALMONTHNAME}} * {{LOCALMONTHNAMEGEN}} * {{LOCALMONTHABBREV}} * {{LOCALDAY}} * {{LOCALDAY2}} * {{LOCALDAYNAME}} * {{LOCALYEAR}} * {{LOCALTIME}} * {{LOCALHOUR}} * {{LOCALWEEK}} * {{LOCALDOW}} * {{LOCALTIMESTAMP}} !! html
    • 01
    • 1
    • January
    • January
    • Jan
    • 1
    • 01
    • Thursday
    • 1970
    • 00:02
    • 00
    • 1
    • 4
    • 19700101000203
    !! end !! test Magic Word: {{FULLPAGENAME}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{FULLPAGENAME}} !! html

    User:Ævar Arnfjörð Bjarmason

    !! end !! test Magic Word: {{FULLPAGENAMEE}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{FULLPAGENAMEE}} !! html

    User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test Magic Word: {{TALKSPACE}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{TALKSPACE}} !! html

    User talk

    !! end !! test Magic Word: {{TALKSPACE}}, same namespace !! options title=[[User talk:Ævar Arnfjörð Bjarmason]] !! wikitext {{TALKSPACE}} !! html

    User talk

    !! end !! test Magic Word: {{TALKSPACE}}, main namespace !! options title=[[Parser Test]] !! wikitext {{TALKSPACE}} !! html

    Talk

    !! end !! test Magic Word: {{TALKSPACEE}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{TALKSPACEE}} !! html

    User_talk

    !! end !! test Magic Word: {{SUBJECTSPACE}} !! options title=[[User talk:Ævar Arnfjörð Bjarmason]] !! wikitext {{SUBJECTSPACE}} !! html

    User

    !! end !! test Magic Word: {{SUBJECTSPACE}}, same namespace !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{SUBJECTSPACE}} !! html

    User

    !! end !! test Magic Word: {{SUBJECTSPACE}}, main namespace !! options title=[[Parser Test]] !! wikitext {{SUBJECTSPACE}} !! html !! end !! test Magic Word: {{SUBJECTSPACEE}} !! options title=[[User talk:Ævar Arnfjörð Bjarmason]] !! wikitext {{SUBJECTSPACEE}} !! html

    User

    !! end !! test Magic Word: {{NAMESPACE}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{NAMESPACE}} !! html

    User

    !! end !! test Magic Word: {{NAMESPACEE}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{NAMESPACEE}} !! html

    User

    !! end !! test Magic Word: {{NAMESPACENUMBER}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{NAMESPACENUMBER}} !! html

    2

    !! end !! test Magic Word: {{SUBPAGENAME}} !! options title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage !! wikitext {{SUBPAGENAME}} !! html

    sub ö

    !! end !! test Magic Word: {{SUBPAGENAMEE}} !! options title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage !! wikitext {{SUBPAGENAMEE}} !! html

    sub_%C3%B6

    !! end !! test Magic Word: {{ROOTPAGENAME}} !! options title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage !! wikitext {{ROOTPAGENAME}} !! html

    Ævar Arnfjörð Bjarmason

    !! end !! test Magic Word: {{ROOTPAGENAMEE}} !! options title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage !! wikitext {{ROOTPAGENAMEE}} !! html

    %C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test Magic Word: {{BASEPAGENAME}} !! options title=[[Ævar Arnfjörð Bjarmason/sub]] subpage !! wikitext {{BASEPAGENAME}} !! html

    Ævar Arnfjörð Bjarmason

    !! end !! test Magic Word: {{BASEPAGENAMEE}} !! options title=[[Ævar Arnfjörð Bjarmason/sub]] subpage !! wikitext {{BASEPAGENAMEE}} !! html

    %C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test Magic Word: {{TALKPAGENAME}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{TALKPAGENAME}} !! html

    User talk:Ævar Arnfjörð Bjarmason

    !! end !! test Magic Word: {{TALKPAGENAMEE}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{TALKPAGENAMEE}} !! html

    User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test Magic Word: {{SUBJECTPAGENAME}} !! options title=[[User talk:Ævar Arnfjörð Bjarmason]] !! wikitext {{SUBJECTPAGENAME}} !! html

    User:Ævar Arnfjörð Bjarmason

    !! end !! test Magic Word: {{SUBJECTPAGENAMEE}} !! options title=[[User talk:Ævar Arnfjörð Bjarmason]] !! wikitext {{SUBJECTPAGENAMEE}} !! html

    User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test Magic Word: {{NUMBEROFFILES}} !! wikitext {{NUMBEROFFILES}} !! html

    5

    !! end !! test Magic Word: {{PAGENAME}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{PAGENAME}} !! html

    Ævar Arnfjörð Bjarmason

    !! end !! test Magic Word: {{PAGENAME}} with metacharacters !! options title=[['foo & bar = baz']] !! wikitext ''{{PAGENAME}}'' !! html/php

    'foo & bar = baz'

    !! html+tidy

    'foo & bar = baz'

    !! end !! test Magic Word: {{PAGENAME}} with metacharacters (bug 26781) !! options title=[[*RFC 1234 http://example.com/]] !! wikitext {{PAGENAME}} !! html/php

    *RFC 1234 http://example.com/

    !! html+tidy

    *RFC 1234 http://example.com/

    !! end !! test Magic Word: {{PAGENAMEE}} !! options title=[[User:Ævar Arnfjörð Bjarmason]] !! wikitext {{PAGENAMEE}} !! html

    %C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason

    !! end !! test Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781) !! options title=[[*RFC 1234 http://example.com/]] !! wikitext {{PAGENAMEE}} !! html/php

    *RFC_1234_http://example.com/

    !! html+tidy

    *RFC_1234_http://example.com/

    !! end !! test Magic Word: {{REVISIONID}} !! wikitext {{REVISIONID}} !! html

    1337

    !! end !! test Magic Word: {{SCRIPTPATH}} !! wikitext {{SCRIPTPATH}} !! html

    /

    !! end !! test Magic Word: {{STYLEPATH}} !! wikitext {{STYLEPATH}} !! html

    /skins

    !! end !! test Magic Word: {{SERVER}} !! wikitext {{SERVER}} !! html

    http://example.org

    !! end !! test Magic Word: {{SERVERNAME}} !! wikitext {{SERVERNAME}} !! html

    example.org

    !! end !! test Magic Word: {{SITENAME}} !! wikitext {{SITENAME}} !! html

    MediaWiki

    !! end !! test Case-sensitive magic words, when cased differently, should just be template transclusions !! wikitext {{CurrentMonth}} {{currentday}} {{cURreNTweEK}} {{currentHour}} !! html

    Template:CurrentMonth Template:Currentday Template:CURreNTweEK Template:CurrentHour

    !! end !! test Case-insensitive magic words should still work with weird casing. !! wikitext {{sErVeRNaMe}} {{LCFirst:AOEU}} {{ucFIRST:aoeu}} {{SERver}} !! html

    example.org aOEU Aoeu http://example.org

    !! end !! test Namespace 1 {{ns:1}} !! wikitext {{ns:1}} !! html

    Talk

    !! end !! test Namespace 1 {{ns:01}} !! wikitext {{ns:01}} !! html

    Talk

    !! end !! test Namespace 0 {{ns:0}} (bug 4783) !! wikitext {{ns:0}} !! html !! end !! test Namespace 0 {{ns:00}} (bug 4783) !! wikitext {{ns:00}} !! html !! end !! test Namespace -1 {{ns:-1}} !! wikitext {{ns:-1}} !! html

    Special

    !! end !! test Namespace User {{ns:User}} !! wikitext {{ns:User}} !! html

    User

    !! end !! test Namespace User talk {{ns:User_talk}} !! wikitext {{ns:User_talk}} !! html

    User talk

    !! end !! test Namespace User talk {{ns:uSeR tAlK}} !! wikitext {{ns:uSeR tAlK}} !! html

    User talk

    !! end !! test Namespace File {{ns:File}} !! wikitext {{ns:File}} !! html

    File

    !! end !! test Namespace File {{ns:Image}} !! wikitext {{ns:Image}} !! html

    File

    !! end !! test Namespace (lang=de) Benutzer {{ns:User}} !! options language=de !! wikitext {{ns:User}} !! html

    Benutzer

    !! end !! test Namespace (lang=de) Benutzer Diskussion {{ns:3}} !! options language=de !! wikitext {{ns:3}} !! html

    Benutzer Diskussion

    !! end !! test Urlencode !! wikitext {{urlencode:hi world?!}} {{urlencode:hi world?!|WIKI}} {{urlencode:hi world?!|PATH}} {{urlencode:hi world?!|QUERY}} !! html

    hi+world%3F%21 hi_world%3F! hi%20world%3F%21 hi+world%3F%21

    !! end !! test Magic Word: prioritize type info over data-parsoid !! options parsoid=html2wt !! wikitext __FORCETOC__ !! html !! end !! test Magic Word: serialize on separate line (parsoid) !! options parsoid=wt2wt,html2wt !! wikitext foo __NOTOC__ bar !! html foobar !! end !! test Magic Word: rt non-english wikis !! options parsoid=wt2wt language=de !! wikitext __NOEDITSECTION__ !! html !! end ### ### Magic links ### !! test Magic links: internal link to RFC (bug 479) !! wikitext [[RFC 123]] !! html

    RFC 123

    !! end !! test Magic links: RFC (bug 479) !! wikitext RFC 822 !! html

    RFC 822

    !! end !! test Magic links: ISBN (bug 1937) !! wikitext ISBN 0-306-40615-2 !! html

    ISBN 0-306-40615-2

    !! end !! test Magic links: PMID incorrectly converts space to underscore !! wikitext PMID 1234 !! html

    PMID 1234

    !! end ### ### Templates #### !! test Nonexistent template !! wikitext {{thistemplatedoesnotexist}} !! html

    Template:Thistemplatedoesnotexist

    !! end !! test Template with invalid target containing tags !! wikitext {{ab|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} !! html

    {{ab|foo|a=b|a = b}}

    !! end !! test Template with invalid target containing unclosed tag !! wikitext {{a|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} !! html

    {{a|foo|a=b|a = b}}

    !! end !! test Template with invalid target containing wikilink !! wikitext {{[[Main Page]]}} !! html/php

    {{Main Page}}

    !! html/parsoid

    {{Main Page}}

    !! end !! test Template with just whitespace in it, bug #68421 !! wikitext {{echo|{{ }}}} !! html/parsoid

    {{ }}

    !! end !! article Template:test !! text This is a test template !! endarticle !! test Simple template !! wikitext {{test}} !! html

    This is a test template

    !! end !! test Template with explicit namespace !! wikitext {{Template:test}} !! html

    This is a test template

    !! end !! article Template:paramtest !! text This is a test template with parameter {{{param}}} !! endarticle !! test Template parameter !! wikitext {{paramtest|param=foo}} !! html

    This is a test template with parameter foo

    !! end !! article Template:paramtestnum !! text [[{{{1}}}|{{{2}}}]] !! endarticle !! test Template unnamed parameter !! wikitext {{paramtestnum|Main Page|the main page}} !! html

    the main page

    !! end !! article Template:templatesimple !! text (test) !! endarticle !! article Template:templateredirect !! text #redirect [[Template:templatesimple]] !! endarticle !! article Template:templateasargtestnum !! text {{{{{1}}}}} !! endarticle !! article Template:templateasargtest !! text {{template{{{templ}}}}} !! endarticle !! article Template:templateasargtest2 !! text {{{{{templ}}}}} !! endarticle !! test Template with template name as unnamed argument !! wikitext {{templateasargtestnum|templatesimple}} !! html

    (test)

    !! end !! test Template with template name as argument !! wikitext {{templateasargtest|templ=simple}} !! html

    (test)

    !! end !! test Template with template name as argument (2) !! wikitext {{templateasargtest2|templ=templatesimple}} !! html

    (test)

    !! end !! article Template:templateasargtestdefault !! text {{{{{templ|templatesimple}}}}} !! endarticle !! article Template:templa !! text '''templ''' !! endarticle !! test Template with default value !! wikitext {{templateasargtestdefault}} !! html

    (test)

    !! end !! test Template with default value (value set) !! wikitext {{templateasargtestdefault|templ=templa}} !! html

    templ

    !! end !! test Template redirect !! wikitext {{templateredirect}} !! html

    (test)

    !! end !! test Template with argument in separate line !! wikitext {{ templateasargtest | templ = simple }} !! html

    (test)

    !! end !! test Template with complex template as argument !! wikitext {{paramtest| param ={{ templateasargtest | templ = simple }}}} !! html

    This is a test template with parameter (test)

    !! end !! test Template with thumb image (with link in description) !! wikitext {{paramtest| param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} !! html/php This is a test template with parameter !! html+tidy

    This is a test template with parameter

    !! end !! article Template:complextemplate !! text {{{1}}} {{paramtest| param ={{{param}}}}} !! endarticle !! test Template with complex arguments !! wikitext {{complextemplate| param ={{ templateasargtest | templ = simple }}|[[Template:complextemplate|link]]}} !! html

    link This is a test template with parameter (test)

    !! end !! test BUG 553: link with two variables in a piped link !! wikitext {| |[[{{{1}}}|{{{2}}}]] |} !! html
    [[{{{1}}}|{{{2}}}]]
    !! end !! test Magic variable as template parameter !! wikitext {{paramtest|param={{SITENAME}}}} !! html

    This is a test template with parameter MediaWiki

    !! end !! article Template:linktest !! text [[{{{param}}}|link]] !! endarticle !! test Template parameter as link source !! wikitext {{linktest|param=Main Page}} !! html

    link

    !! end !!test Template-generated attribute string (k='v') !! wikitext bar !! html

    bar

    !!end !!article Template:paramtest2 !! text including another template, {{paramtest|param={{{arg}}}}} !! endarticle !! test Template passing argument to another template !! wikitext {{paramtest2|arg='hmm'}} !! html

    including another template, This is a test template with parameter 'hmm'

    !! end !! article Template:Linktest2 !! text Main Page !! endarticle !! test Template as link source !! wikitext [[{{linktest2}}]] [[{{linktest2}}|Main Page]] [[{{linktest2}}]]Page !! html

    Main Page

    Main Page

    Main PagePage

    !! end !! article Template:loop1 !! text {{loop2}} !! endarticle !! article Template:loop2 !! text {{loop1}} !! endarticle !! test Template infinite loop !! wikitext {{loop1}} !! html

    Template loop detected: Template:Loop1

    !! end !! test Template from main namespace !! wikitext {{:Main Page}} !! html

    blah blah

    !! end !! article Template:table !! text {| | 1 || 2 |- | 3 || 4 |} !! endarticle !! test BUG 529: Template with table, not included at beginning of line !! wikitext foo {{table}} !! html

    foo

    1 2
    3 4
    !! end !! test BUG 523: Template shouldn't eat newline (or add an extra one before table) !! wikitext foo {{table}} !! html

    foo

    1 2
    3 4
    !! end !! test BUG 41: Template parameters shown as broken links !! wikitext {{{parameter}}} !! html

    {{{parameter}}}

    !! end !! test Template with targets containing wikilinks !! wikitext {{[[foo]]}} {{[[{{echo|foo}}]]}} {{{{echo|[[foo}}]]}} !! html

    {{foo}}

    {{foo}}

    {{[[foo}}]]

    !! end !! article Template:MSGNW test !! text ''None'' of '''this''' should be * interpreted but rather passed unmodified {{test}} File:Foobar.jpg !! endarticle # hmm, fix this or just deprecate msgnw and document its behavior? !! test msgnw keyword !! wikitext {{msgnw:MSGNW test}} !! html

    ''None'' of '''this''' should be * interpreted but rather passed unmodified {{test}} <gallery> File:Foobar.jpg </gallery>

    !! end !! test int keyword !! wikitext {{int:youhavenewmessages|lots of money|not!}} !! html

    You have lots of money (not!).

    !! end !! article Template:Includes !! text Foozarbar !! endarticle !! test and being included !! wikitext {{Includes}} !! html

    Foobar

    !! end !! article Template:Includes2 !! text Foobar !! endarticle !! test being included !! wikitext {{Includes2}} !! html

    Foo

    !! end !! article Template:Includes3 !! text Foobarzar !! endarticle !! test and being included !! wikitext {{Includes3}} !! html

    Foo

    !! end !! test and on a page !! wikitext Foozarbar !! html

    Foozar

    !! end !! test Un-closed !! wikitext !! html !! end !! test on a page !! wikitext Foobar !! html

    Foobar

    !! end !! test Un-closed !! wikitext !! html !! end !!test Self-closed noinclude, includeonly, onlyinclude tags !! wikitext !! html


    !!end !!test Unbalanced includeonly and noinclude tags !! wikitext {| |a
    |b
    |c
    |d
    |} !! html
    a b c</includeonly> d</includeonly></includeonly>
    !!end !! article Template:Includeonly section !! text ==Includeonly section== ==Section T-1== !!endarticle !! test Bug 6563: Edit link generation for section shown by !! wikitext {{includeonly section}} !! html

    Includeonly section[edit]

    Section T-1[edit]

    !! end # Uses same input as the contents of [[Template:Includeonly section]] !! test Bug 6563: Section extraction for section shown by !! options section=T-2 !! wikitext ==Includeonly section== ==Section T-2== !! html ==Section T-2== !! end !! test Bug 6563: Edit link generation for section suppressed by !! wikitext ==Includeonly section== ==Section 1== !! html

    Section 1[edit]

    !! end !! test Bug 6563: Section extraction for section suppressed by !! options section=1 !! wikitext ==Includeonly section== ==Section 1== !! html ==Section 1== !! end !! test Un-closed !! wikitext !! html !! end !! test Includes and comments at SOL !! wikitext == hu == some * stuff * here can have stuff=== here === !! html/php

    hu

    some

    • stuff
    • here

    here

    !! html/parsoid

    hu

    some

    • stuff
    • here

    here

    !! end # TODO: test with DOM fragment reuse! !! test Parsoid: DOM fragment reuse !! options parsoid=wt2wt,wt2html !! wikitext a{{echo|b
    c}}d a{{echo|b
    c}}d {{echo|a
    b}} !! html ab
    cd

    ab

    cd

    a

    b

    !! end !! test Parsoid: Merge double tds (bug 50603) !! options parsoid !! wikitext {| |{{echo|{{!}} foo}} |} !! html
    foo
    !! end !! test Parsoid: Merge double tds in nested transclusion content (bug 50603) !! options parsoid !! wikitext {{echo|
    }} {| |{{echo|{{!}} foo}} |} {{echo|
    }} !! html
    foo
    !! end ### ### and in attributes ### !!test 0. includeonly around the entire attribute !! wikitext id="v1"id="v2">bar !! html

    bar

    !!end !!test 1. includeonly in html attr key !! wikitext idabout="foo">bar !! html

    bar

    !!end !!test 2. includeonly in html attr value !! wikitext bar "v1""v2">bar !! html

    bar bar

    !!end !!test 3. includeonly in part of an attr value !! wikitext bar !! html

    bar

    !!end !!test 4. includeonly in table attributes !! wikitext {| |- |- |a |- |- |b |} !! html
    a
    !!end ### ### Token Stream Patcher tests ### ### These tests won't always pass wt2wt and other modes because ### on serialization, the table will be output on a new line. ### For now, we are blacklisting them, and using this to test selser. ### !!test 1. Table tag in SOL posn. should get reparsed correctly with valid TSR !!options parsoid=wt2html,wt2wt !!wikitext {{echo|}}{| width = '100%' |foo |} !!html/parsoid
    foo
    !!end !!test 2. Table tag in SOL posn. should get reparsed correctly with valid TSR !!options parsoid=wt2html,wt2wt !!wikitext a{| {{{b}}} |c |} !!html/parsoid
    c
    !!end ### ### Testing parsing of templates where a template arg ### has the same name as the template itself. ### !! article Template:quote !! text {{{quote|{{{1}}}}}} !! endarticle !!test Templates: Template Name/Arg clash: 1. Use of positional param !! wikitext {{quote|foo}} !! html

    foo

    !!end !!test Templates: Template Name/Arg clash: 2. Use of named param !! wikitext {{quote|quote=foo}} !! html

    foo

    !!end !!test Templates: Template Name/Arg clash: 3. Use of named param with empty input !! wikitext {{quote|quote}} !! html

    quote

    !!end ### ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged ### !!test Templates: 1. Simple use !! wikitext {{echo|Foo}} !! html

    Foo

    !!end !!test Templates: 2. Inside a block tag !! wikitext
    {{echo|Foo}}
    {{echo|Foo}}
    !! html
    Foo
    Foo
    !! html+tidy
    Foo

    Foo

    !!end !!test Templates: P-wrapping: 1a. Templates on consecutive lines !! wikitext {{echo|Foo}} {{echo|bar}} !! html

    Foo bar

    !!end !!test Templates: P-wrapping: 1b. Templates on consecutive lines !! wikitext Foo {{echo|bar}} {{echo|baz}} !! html

    Foo

    bar baz

    !!end !!test Templates: P-wrapping: 1c. Templates on consecutive lines !! wikitext {{echo|Foo}} {{echo|bar}}
    baz
    !! html

    Foo

    bar
    baz
    !! html+tidy

    Foo

    bar

    baz
    !! end !!test Templates: P-wrapping: 1d. Template preceded by comment-only line !!options parsoid !! wikitext {{echo|Bar}} !! html

    Bar

    !!end !!test Templates: Inline Text: 1. Multiple template uses !! wikitext {{echo|Foo}}bar{{echo|baz}} !! html

    Foobarbaz

    !!end !!test Templates: Inline Text: 2. Back-to-back template uses !! wikitext {{echo|Foo}}{{echo|bar}} !! html

    Foobar

    !!end !!test Templates: Block Tags: 1. Multiple template uses !! wikitext {{echo|
    Foo
    }}
    bar
    {{echo|
    baz
    }} !! html
    Foo
    bar
    baz
    !!end !!test Templates: Block Tags: 2. Back-to-back template uses !! wikitext {{echo|
    Foo
    }}{{echo|
    bar
    }} !! html
    Foo
    bar
    !!end # This is an edge case relating to paragraph wrapping. !!test Templates: Correctly encapsulate templates producing

    tag without a corresponding

    tag !! wikitext {{echo|a b

    }} !! html/parsoid

    a b

    !!end !!test Templates: Links: 1. Simple example !! wikitext {{echo|[[Foo|bar]]}} !! html

    bar

    !!end !!test Templates: Links: 2. Generation of link href !! wikitext [[{{echo|Foo}}|bar]] !! html

    bar

    !!end !!test Templates: Links: 3. Generation of part of a link href !! wikitext [[Fo{{echo|o}}|bar]] [[Foo{{echo|bar}}]] [[Foo{{echo|bar}}baz]] [[Foo{{echo|bar}}|bar]] [[:Foo{{echo|bar}}]] [[:Foo{{echo|bar}}|bar]] !! html

    bar

    Foobar

    Foobarbaz

    bar

    Foobar

    bar

    !!end !!test Templates: Links: 4. Multiple templates generating link href !! wikitext [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]] !! html

    Foobar

    !!end !!test Templates: Links: 5. Generation of link text !! wikitext [[Foo|{{echo|bar}}]] !! html

    bar

    !!end !!test Templates: Links: 5. Nested templates (only outermost template should be marked) !! wikitext {{echo|[[{{echo|Foo}}|bar]]}} !! html

    bar

    !!end !!test Templates: HTML Tag: 1. Generation of HTML attr. key !! wikitext
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tag: 2. Generation of HTML attr. value !! wikitext
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tag: 3. Generation of HTML attr key and value !! wikitext
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tag: 4. Generation of starting piece of HTML attr value !! wikitext
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tag: 5. Generation of middle piece of HTML attr value !! wikitext
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tag: 6. Generation of end piece of HTML attr value !! wikitext
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tag: 7. Generation of partial attribute key string !! wikitext
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tables: 1. Generating start of a HTML table !! wikitext {{echo|}}
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tables: 2a. Generating middle of a HTML table !! wikitext {{echo|}}
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tables: 2b. Generating middle of a HTML table !! wikitext {{echo|}}
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tables: 3. Generating end of a HTML table !! wikitext {{echo|
    foo
    }} !! html
    foo
    !!end !!test Templates: HTML Tables: 4a. Generating a single tag of a HTML table !! wikitext {{echo|}}
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tables: 4b. Generating a single tag of a HTML table !! wikitext {{echo|}}
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tables: 4c. Generating a single tag of a HTML table !! wikitext {{echo|
    }}foo
    !! html
    foo
    !!end !!test Templates: HTML Tables: 4d. Generating a single tag of a HTML table !! wikitext }}
    foo{{echo|
    !! html
    foo
    !!end !!test Templates: HTML Tables: 4e. Generating a single tag of a HTML table !! wikitext {{echo|}}
    foo
    !! html
    foo
    !!end !!test Templates: HTML Tables: 4f. Generating a single tag of a HTML table !! wikitext {{echo|
    foo
    }} !! html
    foo
    !!end !!test Templates: HTML Tables: 5. Proper fostering of categories from inside !!options parsoid=wt2html,wt2wt !! wikitext [[Category:foo1]]
    foo
    [[Category:bar1]][[Category:bar2]]
    foo
    !! html
    foo
    foo
    !!end !!test Templates: Wiki Tables: 1a. Fostering of entire template content !! wikitext {| {{echo|a}} |} !! html a
    !! html+tidy

    a

    !! end !!test Templates: Wiki Tables: 1b. Fostering of entire template content !! wikitext {| {{echo|
    }} foo {{echo|
    }} |} !! html

    foo

    !! html+tidy

    foo

    !! end !!test Templates: Wiki Tables: 2. Fostering of partial template content !! wikitext {| {{echo|a
    b
    }} |} !! html a
    b
    !! html+tidy

    a

    b
    !! end !!test Templates: Wiki Tables: 3. td-content via multiple templates !! wikitext {| {{echo|{{pipe}}a}}{{echo|b}} |} !! html
    ab
    !!end !!test Templates: Wiki Tables: 4. Templated tags, no content !! wikitext {{tbl-start}} {{tbl-end}} !! html
    !!end !!test Templates: Wiki Tables: 5. Templated tags, regular td-tags !! wikitext {{tbl-start}} |foo {{tbl-end}} !! html
    foo
    !!end !!test Templates: Wiki Tables: 6. Templated tags, templated td-tags !! wikitext {{tbl-start}} {{!}}foo {{tbl-end}} !! html
    foo
    !!end !!test Templates: Lists: Multi-line list-items via templates !! wikitext *{{echo|a {{nonexistent| unused}}}} *{{echo|b {{nonexistent| unused}}}} !! html !!end !!test Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo) !! wikitext {{echo|''a}}{{echo|b''c''d}}{{echo|''e}} !! html

    abcde

    !!end !!test Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span) (PHP parser generates misnested html) !! wikitext {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}} !! html/parsoid

    abcde

    !!end !!test Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div) (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s) !! options parsoid=wt2html,wt2wt !! wikitext {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}} !! html
    a
    bcd
    e
    !!end !!test Templates: Ugly nesting: 4. Divs opened/closed across templates !! wikitext a
    b{{echo|c
    d}}e !! html a
    bc
    de !! html+tidy

    a

    bc

    de

    !! end !!test Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting (Parsoid-centric) !! options parsoid !! wikitext {| |{{echo|foo}} |bar |} !! html
    foo
    |bar |} !!end !!test Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting (Parsoid-centric) !! options parsoid !! wikitext
    1. {{echo|foo
    }}
    bar 2. {{echo|baz
    }} abc xyz !! html
    1. foo
    bar 2. baz
    abc xyz !!end !! test Templates: Ugly templates: 3. newline-only template parameter !! wikitext foo {{echo| }} !! html

    foo

    !! end # This looks like a bug: a single newline triggers p/br for some reason. !! test Templates: Ugly templates: 4. newline-only template parameter inconsistency !! wikitext {{echo| }} !! html


    !! end # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that # have a true overlap (T1-start - T2-start - T1-end - T2-end). !! test Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled !! wikitext {{echo|}} {{echo|
    foo}} {{echo|
    }} !! html/parsoid
    foo
    !! end # Bug 64017 -- ugly wikitext with fostered content generates two template ranges # that are "identical" and generate nesting cycles in the algorithm !! test Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled !! wikitext {{echo|
    }} {{echo|
    }} {{echo|
    }} !! html/parsoid
    !! end !!test Parser Functions: 1. Simple example !! wikitext {{uc:foo}} !! html

    FOO

    !!end !!test Parser Functions: 2. Nested use (only outermost should be marked up) !! wikitext {{uc:{{lc:FOO}}}} !! html

    FOO

    !!end ### ### Pre-save transform tests ### !! test pre-save transform: subst: !! options PST !! wikitext {{subst:test}} !! html This is a test template !! end !! test pre-save transform: normal template !! options PST !! wikitext {{test}} !! html {{test}} !! end !! test pre-save transform: nonexistent template !! options PST !! wikitext {{thistemplatedoesnotexist}} !! html {{thistemplatedoesnotexist}} !! end !! test pre-save transform: subst magic variables !! options PST !! wikitext {{subst:SITENAME}} !! html MediaWiki !! end # This is bug 89, which I fixed. -- wtm !! test pre-save transform: subst: templates with parameters !! options pst !! wikitext {{subst:paramtest|param="something else"}} !! html This is a test template with parameter "something else" !! end !! article Template:nowikitest !! text '''not wiki''' !! endarticle !! test pre-save transform: nowiki in subst (bug 1188) !! options pst !! wikitext {{subst:nowikitest}} !! html '''not wiki''' !! end !! article Template:commenttest !! text This template has in it. !! endarticle !! test pre-save transform: comment in subst (bug 1936) !! options pst !! wikitext {{subst:commenttest}} !! html This template has in it. !! end !! test pre-save transform: unclosed tag !! options pst noxml !! wikitext '''not wiki''' !! html '''not wiki''' !! end !! test pre-save transform: mixed tag case !! options pst noxml !! wikitext '''not wiki''' !! html '''not wiki''' !! end !! test pre-save transform: unclosed comment in !! options pst noxml !! wikitext wikinowiki !! html !!end !! test pre-save transform: comment containing extension !! options pst !! wikitext !! html !!end !! test pre-save transform: comment containing nowiki !! options pst !! wikitext !! html !!end !! test pre-save transform: in subst (bug 3298) !! options pst !! wikitext {{subst:Includes}} !! html Foobar !! end !! test pre-save transform: in subst (bug 3298) !! options pst !! wikitext {{subst:Includes2}} !! html Foo !! end !! article Template:SubstTest !!text {{subst:Includes}} !! endarticle !! article Template:SafeSubstTest !! text {{safesubst:Includes}} !! endarticle !! test bug 22297: safesubst: works during PST !! options pst !! wikitext {{subst:SafeSubstTest}}{{safesubst:SubstTest}} !! html FoobarFoobar !! end !! test bug 22297: safesubst: works during normal parse !! wikitext {{SafeSubstTest}} !! html

    Foobar

    !! end !! test subst: does not work during normal parse !! wikitext {{SubstTest}} !! html

    {{subst:Includes}}

    !! end !! test pre-save transform: context links ("pipe trick") !! options pst !! wikitext [[Article (context)|]] [[Bar:Article|]] [[:Bar:Article|]] [[Bar:Article (context)|]] [[:Bar:Article (context)|]] [[|Article]] [[|Article (context)]] [[Bar:X (Y) Z|]] [[:Bar:X (Y) Z|]] !! html [[Article (context)|Article]] [[Bar:Article|Article]] [[:Bar:Article|Article]] [[Bar:Article (context)|Article]] [[:Bar:Article (context)|Article]] [[Article]] [[Article (context)]] [[Bar:X (Y) Z|X (Y) Z]] [[:Bar:X (Y) Z|X (Y) Z]] !! end !! test pre-save transform: context links ("pipe trick") with interwiki prefix !! options pst !! wikitext [[interwiki:Article|]] [[:interwiki:Article|]] [[interwiki:Bar:Article|]] [[:interwiki:Bar:Article|]] !! html [[interwiki:Article|Article]] [[:interwiki:Article|Article]] [[interwiki:Bar:Article|Bar:Article]] [[:interwiki:Bar:Article|Bar:Article]] !! end !! test pre-save transform: context links ("pipe trick") with parens in title !! options pst title=[[Somearticle (context)]] !! wikitext [[|Article]] !! html [[Article (context)|Article]] !! end !! test pre-save transform: context links ("pipe trick") with comma in title !! options pst title=[[Someplace, Somewhere]] !! wikitext [[|Otherplace]] [[Otherplace, Elsewhere|]] [[Otherplace, Elsewhere, Anywhere|]] !! html [[Otherplace, Somewhere|Otherplace]] [[Otherplace, Elsewhere|Otherplace]] [[Otherplace, Elsewhere, Anywhere|Otherplace]] !! end !! test pre-save transform: context links ("pipe trick") with parens and comma !! options pst title=[[Someplace (IGNORED), Somewhere]] !! wikitext [[|Otherplace]] [[Otherplace (place), Elsewhere|]] !! html [[Otherplace, Somewhere|Otherplace]] [[Otherplace (place), Elsewhere|Otherplace]] !! end !! test pre-save transform: context links ("pipe trick") with comma and parens !! options pst title=[[Who, me? (context)]] !! wikitext [[|Yes, you.]] [[Me, Myself, and I (1937 song)|]] !! html [[Yes, you. (context)|Yes, you.]] [[Me, Myself, and I (1937 song)|Me, Myself, and I]] !! end !! test pre-save transform: context links ("pipe trick") with namespace !! options pst title=[[Ns:Somearticle]] !! wikitext [[|Article]] !! html [[Ns:Article|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace and parens !! options pst title=[[Ns:Somearticle (context)]] !! wikitext [[|Article]] !! html [[Ns:Article (context)|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace and comma !! options pst title=[[Ns:Somearticle, Context, Whatever]] !! wikitext [[|Article]] !! html [[Ns:Article, Context, Whatever|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace, comma and parens !! options pst title=[[Ns:Somearticle, Context (context)]] !! wikitext [[|Article]] !! html [[Ns:Article (context)|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace, parens and comma !! options pst title=[[Ns:Somearticle (IGNORED), Context]] !! wikitext [[|Article]] !! html [[Ns:Article, Context|Article]] !! end !! test pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149) !! options pst !! wikitext [[Article(context)|]] [[Bar:Article(context)|]] [[:Bar:Article(context)|]] [[|Article(context)]] [[Bar:X(Y)Z|]] [[:Bar:X(Y)Z|]] !! html [[Article(context)|Article]] [[Bar:Article(context)|Article]] [[:Bar:Article(context)|Article]] [[Article(context)]] [[Bar:X(Y)Z|X(Y)Z]] [[:Bar:X(Y)Z|X(Y)Z]] !! end !! test pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149) !! options pst !! wikitext [[Article (context)|]] [[Bar:Article (context)|]] [[:Bar:Article (context)|]] [[|Article (context)]] [[Bar:X (Y) Z|]] [[:Bar:X (Y) Z|]] !! html [[Article (context)|Article]] [[Bar:Article (context)|Article]] [[:Bar:Article (context)|Article]] [[Article (context)]] [[Bar:X (Y) Z|X (Y) Z]] [[:Bar:X (Y) Z|X (Y) Z]] !! end !! test pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149) !! options pst !! wikitext [[Article(context)|]] [[Bar:Article(context)|]] [[:Bar:Article(context)|]] [[|Article(context)]] [[Bar:X(Y)Z|]] [[:Bar:X(Y)Z|]] !! html [[Article(context)|Article]] [[Bar:Article(context)|Article]] [[:Bar:Article(context)|Article]] [[Article(context)]] [[Bar:X(Y)Z|X(Y)Z]] [[:Bar:X(Y)Z|X(Y)Z]] !! end !! test pre-save transform: context links ("pipe trick") with commas (bug 21660) !! options pst !! wikitext [[Article (context), context|]] [[Article (context),context|]] [[Bar:Article (context), context|]] [[Bar:Article (context),context|]] [[:Bar:Article (context), context|]] [[:Bar:Article (context),context|]] !! html [[Article (context), context|Article]] [[Article (context),context|Article]] [[Bar:Article (context), context|Article]] [[Bar:Article (context),context|Article]] [[:Bar:Article (context), context|Article]] [[:Bar:Article (context),context|Article]] !! end !! test pre-save transform: trim trailing empty lines !! options pst !! wikitext Empty lines are trimmed !! html Empty lines are trimmed !! end !! test pre-save transform: Signature expansion !! options pst !! wikitext * ~~~ * ~~~ * ~~~ * ~~~ !! html * [[Special:Contributions/127.0.0.1|127.0.0.1]] * [[Special:Contributions/127.0.0.1|127.0.0.1]] * [[Special:Contributions/127.0.0.1|127.0.0.1]] * [[Special:Contributions/127.0.0.1|127.0.0.1]] !! end !! test pre-save transform: Signature expansion in nowiki tags (bug 93) !! options pst disabled !! wikitext Shall not expand: ~~~~ ~~~~ ~~~~ ~~~~ {{subst:Foo}} shall be converted to FOO As well as inside noinclude/onlyinclude {{subst:Foo}} {{subst:Foo}} But not inside includeonly {{subst:Foo}} !! html Shall not expand: ~~~~ ~~~~ ~~~~ ~~~~ FOO shall be converted to FOO As well as inside noinclude/onlyinclude FOO FOO But not inside includeonly {{subst:Foo}} !! end !! test Parsoid: Recognize nowiki with trailing space in tags !! options parsoid=wt2html !! wikitext
    [[foo]] ab cd ef !! html

    <div>[[foo]]

    ab

    cd

    ef

    !! end !! test Parsoid: Recognize nowiki with odd capitalization !! options parsoid=wt2html !! wikitext
    [[foo]] !! html

    <div>[[foo]]

    !! end !! test Parsoid: Escape nowiki with trailing space in tags !! options parsoid=html2wt !! wikitext <nowiki > foo </nowiki > a<nowiki />b c<nowiki/ >d !! html

    <nowiki > foo </nowiki >

    a<nowiki />b

    c<nowiki/ >d

    !! end !! test Parsoid: Escape weird noWikI capitalizations !! options parsoid=html2wt !! wikitext <noWikI > foo </NoWikI > !! html

    <noWikI > foo </NoWikI >

    !! end ### ### Message transform tests ### !! test message transform: magic variables !! options msg !! wikitext {{SITENAME}} !! html MediaWiki !! end !! test message transform: should not transform wiki markup !! options msg !! wikitext ''test'' !! html ''test'' !! end !! test message transform: in transcluded template (bug 4926) !! options msg !! wikitext {{Includes}} !! html Foobar !! end !! test message transform: in transcluded template (bug 4926) !! options msg !! wikitext {{Includes2}} !! html Foo !! end !! test {{#special:}} page name, known !! options msg !! wikitext {{#special:Recentchanges}} !! html Special:RecentChanges !! end !! test {{#special:}} page name with subpage, known !! options msg !! wikitext {{#special:Recentchanges/param}} !! html Special:RecentChanges/param !! end !! test {{#special:}} page name, unknown !! options msg !! wikitext {{#special:foobar nonexistent}} !! html Special:Foobar nonexistent !! end !! test {{#speciale:}} page name, known !! options msg !! wikitext {{#speciale:Recentchanges}} !! html Special:RecentChanges !! end !! test {{#speciale:}} page name with subpage, known !! options msg !! wikitext {{#speciale:Recentchanges/param}} !! html Special:RecentChanges/param !! end !! test {{#speciale:}} page name, unknown !! options msg !! wikitext {{#speciale:foobar nonexistent}} !! html Special:Foobar_nonexistent !! end ### ### Images ### ### For Parsoid-specific tests, see #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images !! test Simple image !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:foobar.jpg]] !! html/php

    Foobar.jpg

    !! html/parsoid

    !! end !! test Simple image (using File: namespace, now canonical) !! wikitext [[File:Foobar.jpg]] !! html/php

    Foobar.jpg

    !! html/parsoid

    !! end !! test Right-aligned image !! wikitext [[File:Foobar.jpg|right]] !! html/php
    Foobar.jpg
    !! html/parsoid
    !! end !! test Image with caption !! wikitext [[File:Foobar.jpg|right|Caption text]] !! html/php
    Caption text
    !! html/parsoid
    Caption text
    !! end !! test Image with caption, bug 53312 #1 !! wikitext [[File:Foobar.jpg|right|Caption page stuff]] !! html/php
    Caption page stuff
    !! html/parsoid
    Caption page stuff
    !! end !! test Image with caption, bug 53312 #2 !! wikitext [[File:Foobar.jpg|right|Caption page=]] !! html/php
    Caption page=
    !! html/parsoid
    Caption page=
    !! end !! test Image with caption, bug 53312 #3 !! wikitext [[File:Foobar.jpg|right|Caption page=stuff]] !! html/php
    Caption page=stuff
    !! html/parsoid
    Caption page=stuff
    !! end !! test Allow empty links in image captions (Bug 60753) !! options thumbsize=220 !! wikitext [[File:Foobar.jpg|thumb|Caption [[Link1]] [[]] [[Link2]] ]] !! html/php
    Caption Link1 [[]] Link2
    !! html/parsoid
    Caption Link1 [[]] Link2
    !! end !! test Link with empty target !! wikitext [[]] !! html

    [[]]

    !! end !! test Image with empty attribute !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|right||Caption text]] !! html/php
    Caption text
    !! html/parsoid
    Caption text
    !! end !! test 1. Block image with individual attributes from templates !! wikitext [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]] !! html/php
    This is a caption
    !! html/parsoid
    This is a caption
    !! end !! test 2. Block Image with individual attributes from templates !! wikitext [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]] !! html/php
    This is a caption
    !! html/parsoid
    This is a caption
    !! end !! test 3. Inline image with individual attributes from templates !! wikitext [[File:Foobar.jpg|{{echo|50px}}]] !! html/php

    Foobar.jpg

    !! html/parsoid

    !! end ## Parsoid does not provide editing support for images where templates produce multiple image attributes. ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future. !! test Image with multiple attributes from the same template !! wikitext [[File:Foobar.jpg|{{image_attribs}}]] !! html/php
    Caption text
    !! html/parsoid
    Caption text
    !! end # Parsoid's output here is broken (incorrect p-wrapping); see bug 64901. !! test Image with link tails !! options thumbsize=220 !! wikitext 123[[File:Foobar.jpg]]456 123[[File:Foobar.jpg|right]]456 123[[File:Foobar.jpg|thumb]]456 !! html/php

    123Foobar.jpg456

    123
    Foobar.jpg
    456 123
    Foobar.jpg
    456 !! html/php+tidy

    123Foobar.jpg456

    123

    Foobar.jpg

    456 123

    Foobar.jpg

    456

    !! html/parsoid

    123456

    123
    456 123
    456 !! end !! test Image with multiple captions -- only last one is accepted !! wikitext [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]] !! html/php
    Caption3 - accepted
    !! html/parsoid
    Caption3 - accepted
    !! end !! test Image with multiple widths -- use last !! wikitext [[File:Foobar.jpg|200px|300px|caption]] !! html/php

    caption

    !! html/parsoid

    !! end !! test Image with multiple alignments -- use first (bug 48664) !! options thumbsize=220 !! wikitext [[File:Foobar.jpg|thumb|left|right|center|caption]] [[File:Foobar.jpg|middle|text-top|caption]] !! html/php
    caption

    caption

    !! html/parsoid
    caption

    !! end !! test Image with width attribute at different positions !! wikitext [[File:Foobar.jpg|200px|right|Caption]] [[File:Foobar.jpg|right|200px|Caption]] [[File:Foobar.jpg|right|Caption|200px]] !! html/php
    Caption
    Caption
    Caption
    !! html/parsoid
    Caption
    Caption
    Caption
    !! end # a sad bit of backward-compatibility !! test Image with size specified with pxpx (bug 13500, 51628) !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|20pxpx]] [[File:Foobar.jpg|200x20pxpx]] !! html/php

    Foobar.jpg Foobar.jpg

    !! html/parsoid

    !! end !! test Image with link parameter, wiki target !! wikitext [[File:Foobar.jpg|link=Main Page]] !! html/php

    Foobar.jpg

    !! html/parsoid

    !! end # parsoid bug 49293 (part 1) !! test Image with link parameter, URL target !! wikitext [[File:Foobar.jpg|link=http://example.com/]] !! html/php

    Foobar.jpg

    !! html/parsoid

    !! end # parsoid bug 49293 (part 2) !! test Image with link parameter, protocol-less URL target !! wikitext [[File:Foobar.jpg|link=//example.com/]] !! html/php

    Foobar.jpg

    !! html/parsoid

    !! end !! test Image with link parameter, wgExternalLinkTarget !! wikitext [[Image:foobar.jpg|link=http://example.com/]] !! config wgExternalLinkTarget='foobar' !! html

    Foobar.jpg

    !! end !! test Image with link parameter, wgNoFollowLinks set to false !! wikitext [[Image:foobar.jpg|link=http://example.com/]] !! config wgNoFollowLinks=false !! html

    Foobar.jpg

    !! end !! test Image with link parameter, wgNoFollowDomainExceptions !! wikitext [[Image:foobar.jpg|link=http://example.com/]] !! config wgNoFollowDomainExceptions='example.com' !! html

    Foobar.jpg

    !! end !! test Image with link parameter, wgExternalLinkTarget, unnamed parameter !! wikitext [[Image:foobar.jpg|link=http://example.com/|Title]] !! config wgExternalLinkTarget='foobar' !! html

    Title

    !! end !! test Image with empty link parameter !! wikitext [[File:Foobar.jpg|link=]] !! html/php

    Foobar.jpg

    !! html/parsoid

    !! end !! test Image with link parameter (wiki target) and unnamed parameter !! wikitext [[File:Foobar.jpg|link=Main_Page|Title]] !! html/php

    Title

    !! html/parsoid

    !! end !! test Image with link parameter (URL target) and unnamed parameter !! wikitext [[File:Foobar.jpg|link=http://example.com/|Title]] !! html/php

    Title

    !! html/parsoid

    !! end !! test Thumbnail image with link parameter !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|link=http://example.com/|Title]] !! html/php
    Title
    !! html/parsoid
    Title
    !! end !! test Manually-specified thumbnail image !! options thumbsize=220 !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|Title]] !! html/php
    Title
    !! html/parsoid
    Title
    !! end !! test Manually-specified thumbnail image with explicit link to wiki page !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]] !! html/php
    Title
    !! html/parsoid
    Title
    !! end !! test Manually-specified thumbnail image with explicit link to url !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]] !! html/php
    Title
    !! html/parsoid
    Title
    !! end !! test Manually-specified thumbnail image with explicit no link !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]] !! html/php
    Title
    !! html/parsoid
    Title
    !! end !! test Manually-specified thumbnail image with explicit link and alt text !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]] !! html/php
    alttext
    Title
    !! html/parsoid
    alttext
    Title
    !! end !! test Image with frame and link !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] !! html/php
    This is a test image Main Page
    !! html/parsoid
    This is a test image Main Page
    !! end !! test Image with frame and link and explicit alt !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]] !! html/php
    Altitude
    This is a test image Main Page
    !! html/parsoid
    Altitude
    This is a test image Main Page
    !! end !! test Image with wiki markup in implicit alt !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|testing '''bold''' in alt]] [[Image:Foobar.jpg|alt=testing '''bold''' in alt]] !! html/php

    testing bold in alt

    testing bold in alt

    !! html/parsoid

    testing bold in alt

    !! end ################### # Conflicting image format options. # First option specified should 'win'. # All three cases in each test should be identical. !! test Image with 'frameless' first. !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frameless|caption]] [[File:Foobar.jpg|frameless|frame|caption]] [[File:Foobar.jpg|frameless|thumb|caption]] !! html/php

    caption

    caption

    caption

    !! html/parsoid

    !! end !! test Image with 'frame' first. !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frame|caption]] [[File:Foobar.jpg|frame|frameless|caption]] [[File:Foobar.jpg|frame|thumb|caption]] !! html/php
    caption
    caption
    caption
    !! html/parsoid
    caption
    caption
    caption
    !! end !! test Image with 'thumb' first. !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|caption]] [[File:Foobar.jpg|thumb|frameless|caption]] [[File:Foobar.jpg|thumb|frame|caption]] !! html/php
    caption
    caption
    caption
    !! html/parsoid
    caption
    caption
    caption
    !! end ################### # Image sizing. # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258 # Foobar has actual size of 1941x220 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's # a scalable format. # 2. Framed images always ignore size options; always render at default size. # 3. "Unspecified format" and border are the only types which can be # enlarged. !! test Image: "unspecified format" and border enlarge !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|2000px]] [[File:Foobar.jpg|border|2000px]] !! html/php

    Foobar.jpg

    Foobar.jpg

    !! html/parsoid

    !! end !! test Image: "unspecified format" and border reduce !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|1000px]] [[File:Foobar.jpg|border|1000px]] !! html/php

    Foobar.jpg

    Foobar.jpg

    !! html/parsoid

    !! end !! test Image: thumbs reduce !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|50px]] !! html/php
    Foobar.jpg
    !! html/parsoid
    !! end !! test Image: bitmap thumbs can't be enlarged past original size, but vector can. !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|2000px]] [[File:Foobar.svg|thumb|2000px]] !! html/php
    Foobar.jpg
    Foobar.svg
    !! html/parsoid
    !! end !! test Image: frameless can reduce in size !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frameless|50px]] !! html/php

    Foobar.jpg

    !! html/parsoid

    !! end !! test Image: bitmap frameless can't be enlarged past original size, but vector can !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frameless|2000px]] [[File:Foobar.svg|frameless|2000px]] !! html/php

    Foobar.jpg

    Foobar.svg

    !! html/parsoid

    !! end !! test Image: framed images are always unscaled. !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frame]] [[File:Foobar.jpg|frame|50px]] [[File:Foobar.jpg|frame|50x50px]] [[File:Foobar.jpg|frame|2000px]] !! html/php
    Foobar.jpg
    Foobar.jpg
    Foobar.jpg
    Foobar.jpg
    !! html/parsoid
    !! end ################### !! test Link to image page- image page normally doesn't exists, hence edit link Add test with existing image page #

    Image:test !! wikitext [[:Image:test]] !! html

    Image:test

    !! end !! test bug 18784 Link to non-existent image page with caption should use caption as link text !! wikitext [[:Image:test|caption]] !! html

    caption

    !! end !! test Frameless image caption with a free URL !! wikitext [[File:Foobar.jpg|http://example.com]] !! html/php

    http://example.com

    !! html/parsoid

    !! end !! test Thumbnail image caption with a free URL !! options thumbsize=220 !! wikitext [[File:Foobar.jpg|thumb|http://example.com]] !! html/php !! html/parsoid
    http://example.com
    !! end !! test Thumbnail image caption with a free URL and explicit alt !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]] !! html/php !! html/parsoid
    Alteration
    http://example.com
    !! end !! test SVG thumbnails with no language set !! options !! wikitext [[File:Foobar.svg|thumb|caption]] !! html/php
    caption
    !! html/parsoid
    caption
    !! end !! test SVG thumbnails with language de !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.svg|thumb|caption|lang=de]] !! html/php
    caption
    !! html/parsoid
    caption
    !! end !! test SVG thumbnails with invalid language code !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]] !! html/php
    lang=invalid.language.code
    !! html/parsoid
    lang=invalid.language.code
    !! end !! test BUG 1887: A ISBN with a thumbnail !! wikitext [[File:Foobar.jpg|thumb|ISBN 1235467890]] !! html/php !! html/parsoid
    ISBN 1235467890
    !! end !! test BUG 1887: A RFC with a thumbnail !! wikitext [[File:Foobar.jpg|thumb|This is RFC 12354]] !! html/php
    This is RFC 12354
    !! html/parsoid
    This is RFC 12354
    !! end !! test BUG 1887: A mailto link with a thumbnail !! wikitext [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]] !! html/php !! html/parsoid
    Please mailto:nobody@example.com
    !! end # Pending resolution to bug 368 !! test BUG 648: Frameless image caption with a link !! wikitext [[File:Foobar.jpg|text with a [[link]] in it]] !! html/php

    text with a link in it

    !! html/parsoid

    !! end !! test BUG 648: Frameless image caption with a link (suffix) !! wikitext [[File:Foobar.jpg|text with a [[link]]foo in it]] !! html/php

    text with a linkfoo in it

    !! html/parsoid

    !! end !! test BUG 648: Frameless image caption with an interwiki link !! wikitext [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]] !! html/php

    text with a MeatBall:Link in it

    !! html/parsoid

    !! end !! test BUG 648: Frameless image caption with a piped interwiki link !! wikitext [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]] !! html/php

    text with a link in it

    !! html/parsoid

    !! end !! test Escape HTML special chars in image alt text !! wikitext [[File:Foobar.jpg|& < > "]] !! html/php

    & < > "

    !! html/parsoid

    !! end !! test BUG 499: Alt text should have Ӓ, not &1234; !! wikitext [[File:Foobar.jpg|♀]] !! html/php

    ♀

    !! html/parsoid

    !! end !! test Broken image caption with link !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link. !! html/php

    [[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link.

    !! html/parsoid

    [[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link.

    !! end !! test Image caption containing another image !! wikitext [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]] !! html/php
    This is a caption with another image inside it!
    !! html/parsoid
    This is a caption with another inside it!
    !! end !! test Image: caption containing a newline !! wikitext [[File:Foobar.jpg|This *is some text]] !! html/php

    This *is some text

    !! html/parsoid

    !!end !!test Image: caption containing leading space (The leading space should not trigger nowiki escaping in wt2wt mode) !! wikitext [[File:Foobar.jpg|thumb| bar]] !! html/php
    bar
    !! html/parsoid
    bar
    !!end !! test Image: caption containing a table !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table {| ! Foo !! Bar |- | Foo1 || Bar1 |} and some more text.]] !! html/php
    This is an example image thumbnail caption with a table
    Foo Bar
    Foo1 Bar1
    and some more text.
    !! html/parsoid
    This is an example image thumbnail caption with a table
    Foo Bar
    Foo1 Bar1
    and some more text.
    !! end !! test Bug 3090: External links other than http: in image captions !! wikitext [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]] !! html/php
    This caption has irc and Secure ext links in it.
    !! html/parsoid
    This caption has irc and Secure ext links in it.
    !! end !! test Custom class !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:foobar.jpg|a|class=b]] !! html/php

    a

    !! html/parsoid

    !! end !! test Localized image handling (1). !! options parsoid=wt2html,wt2wt,html2html language=es !! wikitext [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]] !! html/php
    caption
    !! html/parsoid
    caption
    !! end !! test Localized image handling (2). !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html language=es !! wikitext [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]] !! html/php
    caption
    !! html/parsoid
    caption
    !! end !! test "border", "frameless" and "class" attributes on an image. !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frameless|border|class=extra|caption]] !! html/php

    caption

    !! html/parsoid

    !! end # Note that 'right' is the default alignment, despite the misspelled 'righ' below !! test Invalid image attributes (bug 62500) !! options thumbsize=220 parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|thumb|float|left|caption]] [[File:Foobar.jpg|thumb|righ|caption]] [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]] !! html/php
    caption
    caption
    caption
    !! html/parsoid
    caption
    caption
    caption
    !! end !! article File:Barfoo.jpg !! text #REDIRECT [[File:Barfoo.jpg]] !! endarticle !! test Redirected image !! wikitext [[Image:Barfoo.jpg]] !! html

    File:Barfoo.jpg

    !! end !! test Missing image with uploads disabled !! options wgEnableUploads=0 !! wikitext [[Image:Foobaz.jpg]] !! html

    File:Foobaz.jpg

    !! end # Parsoid-specific testing for images # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images # Currently imperfect due to a flaw in the Parsoid testrunner # Work in progress # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific # image tests. !! test Parsoid-specific image handling - simple image with size and middle alignment !! wikitext [[File:Foobar.jpg|middle|50px]] !! html/parsoid

    !! end !! test Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias !! options parsoid=wt2wt,wt2html,html2html !! wikitext [[Image:Foobar.jpg|middle|50px]] !! html/parsoid

    !! end !! test Parsoid-specific image handling - simple image with size and middle alignment (existing content) !! wikitext [[File:Foobar.jpg|50px|middle]] !! html/parsoid

    !! end !! test Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|50px|middle]] !! html/parsoid

    !! end !! test Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption !! wikitext [[File:Foobar.jpg|500x10px|baseline|caption]] !! html/parsoid

    !! end !! test Parsoid-specific image handling - simple image with border and size spec !! wikitext [[File:Foobar.jpg|50px|border|caption]] !! html/parsoid

    !! end !! test Parsoid-specific image handling - thumbnail with halign, valign, and caption !! wikitext [[File:Foobar.jpg|left|baseline|thumb|caption content]] !! html/parsoid
    caption content
    !! end !! test Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content) !! wikitext [[File:Foobar.jpg|thumb|left|baseline|caption content]] !! html/parsoid
    caption content
    !! end !! test Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption !! wikitext [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]] !! html/parsoid
    caption
    !! end !! test Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content) !! wikitext [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]] !! html/parsoid
    caption
    !! end !! test Parsoid-specific image handling - framed image with specific size and caption (size is ignored) !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frame|500x50px|caption]] !! html/parsoid
    caption
    !! end !! test Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored) !! options parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]] !! html/parsoid
    caption
    !! end !! test Parsoid-specific image handling - frameless image with specific size, border, and caption !! wikitext [[File:Foobar.jpg|frameless|442x50px|border|caption]] !! html/parsoid

    !! end !! test Parsoid-specific image handling - simple image with a formatted caption !! wikitext [[File:Foobar.jpg|
    ab
    c
    ]] !! html/parsoid

    !! end !! test Parsoid-specific image handling - caption with a template in it !! wikitext [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]] !! html/parsoid
    This caption has a transclusion in it.
    !! end !! test Parsoid-specific image handling - caption with unbalanced tags in it !! options parsoid=wt2html,wt2wt,html2html !! wikitext foo [[File:Foobar.jpg|thumb|200x200px|This caption has a
    unbalanced tag in it.]] bar !! html/parsoid

    foo

    This caption has a
    unbalanced tag in it.

    bar

    !! end !! test Parsoid-specific image handling - empty caption (1) !! options parsoid=wt2html,wt2wt !! wikitext [[File:Foobar.jpg|thumb|]] !! html/parsoid
    !! end # empty captions don't get serialized unless we're in the "round trip" case !! test Parsoid-specific image handling - empty caption (2) !! options parsoid=html2wt !! html/parsoid
    !! wikitext [[File:Foobar.jpg|thumb]] !! end !! test Parsoid-specific image handling - whitespace caption !! wikitext [[File:Foobar.jpg|thumb| ]] !! html/parsoid
    !! end !! test Parsoid-specific image handling - lang option !! wikitext foo [[File:Foobar.svg|lang=de|caption]] bar !! html/parsoid

    foo bar

    !! end ### ### Subpages ### !! article Subpage test/subpage !! text foo !! endarticle !! test Subpage link !! options subpage title=[[Subpage test]] !! wikitext [[/subpage]] !! html

    /subpage

    !! end !! test Subpage noslash link !! options subpage title=[[Subpage test]] !! wikitext [[/subpage/]] !! html

    subpage

    !! end # TODO: make this PHP-parser compatible! !! test Relative subpage noslash link !! options parsoid=wt2wt,wt2html,html2html subpage title=[[Subpage test/1/2/3/4]] !! wikitext [[../../subpage/]] [[../../subpage]] !! html

    subpage

    Subpage_test/1/2/subpage

    !! end !! test Parsoid: dot-slash prefixed wikilinks !! wikitext [[./foo]] [[././bar]] [[././baz/]] !! html/php

    [[./foo]]

    [[././bar]]

    [[././baz/]]

    !! html/parsoid

    [[./foo]]

    [[././bar]]

    [[././baz/]]

    !! end !! test Render invalid page names as plain text (bug 51090) !! wikitext [[./../foo|bar]] [[foo�|bar]] [[foo/.|bar]] [[foo/..|bar]] [[foo~~~bar]] [[foo>bar]] [[foo[bar]] [[.]] [[..]] [[foo././bar]] [[{{echo|./../foo}}|bar]] [[{{echo|foo/.}}|bar]] [[{{echo|foo/..}}|bar]] [[{{echo|foo~~~~bar}}]] [[{{echo|foo>bar}}]] [[{{echo|foo././bar}}]] [[{{echo|foo{bar}}]] [[{{echo|foo}bar}}]] [[{{echo|foo[bar}}]] [[{{echo|foo]bar}}]] [[{{echo|foo[[./../foo|bar]] [[foo�|bar]] [[foo/.|bar]] [[foo/..|bar]] [[foo~~~bar]] [[foo>bar]] [[foo[bar]] [[.]] [[..]] [[foo././bar]]

    [[./../foo|bar]] [[foo/.|bar]] [[foo/..|bar]] [[foo~~~~bar]] [[foo>bar]] [[foo././bar]] [[foo{bar]] [[foo}bar]] [[foo[bar]] [[foo]bar]] [[foo<bar]]

    !!html/parsoid

    [[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]

    [[./../foo|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~~bar]][[foo>bar]][[foo././bar]][[foo{bar]][[foo}bar]][[foo[bar]][[foo]bar]][[foo<bar]]

    !!end !! test Disabled subpages !! wikitext [[/subpage]] !! html

    /subpage

    !! end !! test BUG 561: {{/Subpage}} !! options subpage title=[[Page]] !! wikitext {{/Subpage}} !! html

    Page/Subpage

    !! end ### ### Categories ### !! article Category:MediaWiki User's Guide !! text blah !! endarticle !! test Link to category !! wikitext [[:Category:MediaWiki User's Guide]] !! html

    Category:MediaWiki User's Guide

    !! end !! test Simple category !! options cat !! wikitext [[Category:MediaWiki User's Guide]] !! html MediaWiki User's Guide !! end !! test PAGESINCATEGORY invalid title fatal (r33546 fix) !! wikitext {{PAGESINCATEGORY:}} !! html

    0

    !! end !! test Category with different sort key !! options cat !! wikitext [[Category:MediaWiki User's Guide|Foo]] !! html MediaWiki User's Guide !! end !! test Category with identical sort key !! options cat !! wikitext [[Category:MediaWiki User's Guide|MediaWiki User's Guide]] !! html MediaWiki User's Guide !! end !! test Category with empty sort key !! options cat pst !! wikitext [[Category:MediaWiki User's Guide|]] !! html [[Category:MediaWiki User's Guide|MediaWiki User's Guide]] !! end !! test Category with empty sort key and parentheses !! options cat pst !! wikitext [[Category:Foo (bar)|]] !! html [[Category:Foo (bar)|Foo]] !! end !! test Category with link tail !! options cat pst !! wikitext 123[[Category:Foo]]456 !! html 123[[Category:Foo]]456 !! end !! test Category with template !! options cat pst !! wikitext [[Category:{{echo|Foo}}]] !! html [[Category:{{echo|Foo}}]] !! end !! test Category with template in sort key !! options cat pst !! wikitext [[Category:Foo|{{echo|Bar}}]] !! html [[Category:Foo|{{echo|Bar}}]] !! end !! test Category with template in sort key and title !! options cat pst !! wikitext [[Category:{{echo|Foo}}|{{echo|Bar}}]] !! html [[Category:{{echo|Foo}}|{{echo|Bar}}]] !! end !! test Category / paragraph interactions !! wikitext Foo [[Category:Baz]] Bar Foo [[Category:Baz]] Bar Foo [[Category:Baz]] Bar Foo [[Category:Baz]] Bar Foo [[Category:Baz]] [[Category:Baz]] [[Category:Baz]] Bar [[Category:Baz]] [[Category:Baz]] [[Category:Baz]] [[Category:Baz]] {{echo|[[Category:Baz]]}} [[Category:Baz]] !! html

    Foo Bar

    Foo Bar

    Foo Bar

    Foo Bar

    Foo Bar

    !! end !! test Parsoid: Serialize link to category page with colon escape !! options parsoid !! wikitext [[:Category:Foo]] [[:Category:Foo|Bar]] !! html

    Category:Foo Bar

    !! end !! test Parsoid: Link prefix/suffixes aren't applied to category links !! options parsoid=wt2html,wt2wt,html2html language=is !! wikitext x[[Category:Foo]]y !! html

    xy

    !! end !! test Parsoid: Serialize link to file page with colon escape !! options parsoid !! wikitext [[:File:Foo.png]] [[:File:Foo.png|Bar]] !! html

    File:Foo.png Bar

    !! end !! test Parsoid: Serialize a genuine category link without colon escape !! options parsoid !! wikitext [[Category:Foo]] [[Category:Foo|Bar]] !! html !! end !! test Parsoid: Defaultsort !! options parsoid !! wikitext {{DEFAULTSORT:Foo}} !! html !! end ### ### Inter-language links ### !! test Interlanguage links !! options ill !! wikitext [[es:Alimento]] [[fr:Nourriture]] [[zh:食品]] !! html/php es:Alimento fr:Nourriture zh:食品 !! html/parsoid

    !! end !! test Duplicate interlanguage links (bug 24502) !! options ill !! wikitext [[es:1]] [[es:2]] [[fr:1]] [[fr:2]] !! html/php es:1 fr:1 !! html/parsoid

    !! end ### ### Sections ### !! test Basic section headings !! wikitext == Headline 1 == Some text ==Headline 2== More ===Smaller headline=== Blah blah !! html

    Headline 1[edit]

    Some text

    Headline 2[edit]

    More

    Smaller headline[edit]

    Blah blah

    !! end !! test Section headings with TOC !! wikitext == Headline 1 == === Subheadline 1 === ===== Skipping a level ===== ====== Skipping a level ====== == Headline 2 == Some text ===Another headline=== !! html

    Headline 1[edit]

    Subheadline 1[edit]

    Skipping a level[edit]
    Skipping a level[edit]

    Headline 2[edit]

    Some text

    Another headline[edit]

    !! end # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10' !! test Handling of sections up to level 6 and beyond !! wikitext = Level 1 Heading= == Level 2 Heading== === Level 3 Heading=== ==== Level 4 Heading==== ===== Level 5 Heading===== ====== Level 6 Heading====== ======= Level 7 Heading======= ======== Level 8 Heading======== ========= Level 9 Heading========= ========== Level 10 Heading========== !! html

    Level 1 Heading[edit]

    Level 2 Heading[edit]

    Level 3 Heading[edit]

    Level 4 Heading[edit]

    Level 5 Heading[edit]
    Level 6 Heading[edit]
    = Level 7 Heading=[edit]
    == Level 8 Heading==[edit]
    === Level 9 Heading===[edit]
    ==== Level 10 Heading====[edit]
    !! end !! test TOC regression (bug 9764) !! wikitext == title 1 == === title 1.1 === ==== title 1.1.1 ==== === title 1.2 === == title 2 == === title 2.1 === !! html

    title 1[edit]

    title 1.1[edit]

    title 1.1.1[edit]

    title 1.2[edit]

    title 2[edit]

    title 2.1[edit]

    !! end !! test TOC with wgMaxTocLevel=3 (bug 6204) !! options wgMaxTocLevel=3 !! wikitext == title 1 == === title 1.1 === ==== title 1.1.1 ==== === title 1.2 === == title 2 == === title 2.1 === !! html

    title 1[edit]

    title 1.1[edit]

    title 1.1.1[edit]

    title 1.2[edit]

    title 2[edit]

    title 2.1[edit]

    !! end !! test TOC with wgMaxTocLevel=3 and two level four headings (bug 6204) !! options wgMaxTocLevel=3 !! wikitext ==Section 1== ===Section 1.1=== ====Section 1.1.1==== ====Section 1.1.1.1==== ==Section 2== !! html

    Section 1[edit]

    Section 1.1[edit]

    Section 1.1.1[edit]

    Section 1.1.1.1[edit]

    Section 2[edit]

    !! end !! test Resolving duplicate section names !! wikitext == Foo bar == == Foo bar == !! html

    Foo bar[edit]

    Foo bar[edit]

    !! end !! test Resolving duplicate section names with differing case (bug 10721) !! wikitext == Foo bar == == Foo Bar == !! html

    Foo bar[edit]

    Foo Bar[edit]

    !! end !! article Template:sections !! text ===Section 1=== ==Section 2== !! endarticle !! test Template with sections, __NOTOC__ !! wikitext __NOTOC__ ==Section 0== {{sections}} ==Section 4== !! html

    Section 0[edit]

    Section 1[edit]

    Section 2[edit]

    Section 4[edit]

    !! end !! test __NOEDITSECTION__ keyword !! wikitext __NOEDITSECTION__ ==Section 1== ==Section 2== !! html

    Section 1

    Section 2

    !! end !! test Link inside a section heading !! wikitext ==Section with a [[Main Page|link]] in it== !! html

    Section with a link in it[edit]

    !! end !! test TOC regression (bug 12077) !! wikitext __TOC__ == title 1 == === title 1.1 === == title 2 == !! html

    title 1[edit]

    title 1.1[edit]

    title 2[edit]

    !! end !! test BUG 1219 URL next to image (good) !! wikitext http://example.com [[Image:foobar.jpg]] !! html

    http://example.com Foobar.jpg

    !!end !! test Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910) !! wikitext === The line above must have a trailing space! === But just in case it doesn't... !! html

    =[edit]

    The line above must have a trailing space!

    =[edit]

    But just in case it doesn't...

    !! end !! test Header with special characters (bug 25462) !! wikitext The tooltips shall not show entities to the user (ie. be double escaped) == text > text == section 1 == text < text == section 2 == text & text == section 3 == text ' text == section 4 == text " text == section 5 !! html

    The tooltips shall not show entities to the user (ie. be double escaped)

    text > text[edit]

    section 1

    text < text[edit]

    section 2

    text & text[edit]

    section 3

    text ' text[edit]

    section 4

    text " text[edit]

    section 5

    !! end !! test Header with space, plus and underscore as entity !! wikitext Id should not contain + for spaces == Space between Text == section 1 == Space-Entity between Text == section 2 == Plus+between+Text == section 3 == Plus-Entity+between+Text == section 4 == Underscore_between_Text == section 5 == Underscore-Entity_between_Text == section 6 [[#Space between Text]] [[#Space-Entity between Text]] [[#Plus+between+Text]] [[#Plus-Entity+between+Text]] [[#Underscore_between_Text]] [[#Underscore-Entity_between_Text]] !! html

    Id should not contain + for spaces

    Space between Text[edit]

    section 1

    Space-Entity between Text[edit]

    section 2

    Plus+between+Text[edit]

    section 3

    Plus-Entity+between+Text[edit]

    section 4

    Underscore_between_Text[edit]

    section 5

    Underscore-Entity_between_Text[edit]

    section 6

    #Space between Text #Space-Entity between Text #Plus+between+Text #Plus-Entity+between+Text #Underscore_between_Text #Underscore-Entity_between_Text

    !! end !! test Headers with excess '=' characters (Are similar tests necessary beyond the 1st level?) !! wikitext =foo== ==foo= =''italic'' heading== ==''italic'' heading= !! html

    foo=[edit]

    =foo[edit]

    italic heading=[edit]

    =italic heading[edit]

    !! end !! test HTML headers vs TOC (bug 23393) (__NOEDITSECTION__ for clearer output, doesn't matter here) !! wikitext

    Header 1

    == Header 1.1 == == Header 1.2 ==

    Header 2

    == Header 2.1 == == Header 2.2 == __NOEDITSECTION__ !! html

    Header 1

    Header 1.1

    Header 1.2

    Header 2

    Header 2.1

    Header 2.2

    !! end !! test Single-line or multiline-comments can follow headings !! options parsoid=wt2html,wt2wt !! wikitext ==foo== ==bar== ==baz== !! html

    foo

    bar

    baz

    !! end !! test BUG 1219 URL next to image (broken) !! wikitext http://example.com[[Image:foobar.jpg]] !! html

    http://example.comFoobar.jpg

    !!end !! test Bug 1186 news: in the middle of text !! wikitext http://en.wikinews.org/wiki/Wikinews:Workplace !! html

    http://en.wikinews.org/wiki/Wikinews:Workplace

    !!end !! test Namespaced link must have a title !! wikitext [[Project:]] !! html

    [[Project:]]

    !!end !! test Namespaced link must have a title (bad fragment version) !! wikitext [[Project:#fragment]] !! html

    [[Project:#fragment]]

    !!end ### ### HTML tags and HTML attributes ### !! test div with no attributes !! wikitext
    HTML rocks
    !! html
    HTML rocks
    !! end !! test div with double-quoted attribute !! wikitext
    HTML rocks
    !! html
    HTML rocks
    !! end !! test div with single-quoted attribute !! wikitext
    HTML rocks
    !! html
    HTML rocks
    !! end !! test div with unquoted attribute !! wikitext
    HTML rocks
    !! html
    HTML rocks
    !! end !! test div with illegal double attributes !! wikitext
    HTML rocks
    !! html
    HTML rocks
    !!end # FIXME: produce empty string instead of "class" in the PHP parser, following # the HTML5 spec. !! test div with empty attribute value, space before equals !! options parsoid !! wikitext
    HTML rocks
    !! html
    HTML rocks
    !! end !! test div with multiple empty attribute values !! options parsoid !! wikitext
    HTML rocks
    !! html
    HTML rocks
    !! end !! test table with multiple empty attribute values !! options parsoid !! wikitext {| title= id= | hi |} !! html
    hi
    !! end # The PHP parser escapes the opening brace to { for some reason, so # disabled this test for it. !! test div with braces in attribute value !! options parsoid !! wikitext
    Foo
    !! html
    Foo
    !! end # This it very inconsistent in the PHP parser: it returns # class="class" if there is a space between the name and the equal sign (see # 'div with empty attribute value, space before equals'), but strips the # attribute completely if the space is missing. We hope that not much content # depends on this, so are implementing the behavior below in Parsoid for # consistencies' sake. Disabled for the PHP parser. # FIXME: fix this behavior in the PHP parser? !! test div with empty attribute value, no space before equals !! options parsoid !! wikitext
    HTML rocks
    !! html
    HTML rocks
    !! end !! test HTML multiple attributes correction !! wikitext

    Awesome!

    !! html

    Awesome!

    !!end !! test Table multiple attributes correction !! wikitext {| !+ class="error" class="awesome"| status |} !! html
    status
    !!end !! test DIV IN UPPERCASE !! wikitext
    HTML ROCKS
    !! html
    HTML ROCKS
    !!end !! test Non-ASCII pseudo-tags are rendered as text !! wikitext !! html

    <khyô>

    !! end !! test Pseudo-tag with URL 'name' renders as url link !! wikitext !! html

    <http://example.com/>

    !! end !! test text with amp in the middle of nowhere !! wikitext Remember AT&T? !! html

    Remember AT&T?

    !! end !! test text with character entity: eacute !! wikitext I always thought é was a cute letter. !! html

    I always thought é was a cute letter.

    !! html+tidy

    I always thought é was a cute letter.

    !! end !! test text with entity-escaped character entity-like string: eacute !! wikitext I always thought &eacute; was a cute letter. !! html

    I always thought &eacute; was a cute letter.

    !! end !! test text with undefined character entity: xacute !! wikitext I always thought &xacute; was a cute letter. !! html

    I always thought &xacute; was a cute letter.

    !! end # TODO: generalize to PHP parser? !! test HTML5 tags !! options parsoid !! wikitext five This highlighted text !! html

    five This highlighted text

    !! end !! test HTML tag with leading space is parsed as text !! wikitext < div>foo< /div> !! html

    < div>foo< /div>

    !! end ### ### Nesting tests (see bug 41545, 50604, 51081) ### # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604) # Note that html2wt is considerably more difficult if we use in # the test case, instead of !! test Ensure that HTML adoption agency algorithm is properly implemented. !! wikitext XYZ !! html

    XYZ

    !! end # This was bug 41545 in the PHP parser. # Note that tidy doesn't handle this correctly. !! test Nesting of !! wikitext XYZ !! html

    XYZ

    !! end # The following cases were bug 51081 in the PHP parser. # Note that there are some other nestable tags (b, i, etc) which are # not covered; see bug 51081 for discussion. # Note that tidy doesn't handle this correctly. !! test Nesting of !! wikitext XYZ !! html

    XYZ

    !! end # Note that tidy doesn't handle this correctly. !! test Nesting of !! wikitext XYZ !! html

    XYZ

    !! end !! test Nesting of !! wikitext XYZ !! html+tidy

    XYZ

    !! end # Note that tidy doesn't handle this correctly. !! test Nesting of !! wikitext XYZ !! html

    XYZ

    !! end # Note that tidy doesn't handle this correctly. !! test Nesting of !! wikitext XYZ !! html

    XYZ

    !! end ### ### Media links ### !! test Media link !! wikitext [[Media:Foobar.jpg]] !! html

    Media:Foobar.jpg

    !! end !! test Media link with text !! wikitext [[Media:Foobar.jpg|A neat file to look at]] !! html

    A neat file to look at

    !! end # FIXME: this is still bad HTML tag nesting !! test Media link with nasty text fixme: doBlockLevels won't wrap this in a paragraph because it contains a div !! wikitext [[Media:Foobar.jpg|Safe Link
    " onmouseover="alert(document.cookie)" onfoo="
    ]] !! html Safe Link<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div> !! html+tidy

    Safe Link<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>

    !! end !! test Media link to nonexistent file (bug 1702) !! wikitext [[Media:No such.jpg]] !! html

    Media:No such.jpg

    !! end !! test Image link to nonexistent file (bug 1850 - good) !! wikitext [[Image:No such.jpg]] !! html

    File:No such.jpg

    !! end !! test :Image link to nonexistent file (bug 1850 - bad) !! wikitext [[:Image:No such.jpg]] !! html

    Image:No such.jpg

    !! end !! test Character reference normalization in link text (bug 1938) !! wikitext [[Main Page|this&that]] !! html

    this&that

    !!end !! article אַ !! text Test for unicode normalization The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E !! endarticle !! test (bug 19451) Links should refer to the normalized form. !! wikitext [[אַ]] [[אַ]] [[אַ]] [[אַ]] [[אַ]] !! html

    אַ אַ אַ אַ

    !! end !! test Empty attribute crash test (bug 2067) !! wikitext foo !! html

    foo

    !! end !! test Empty attribute crash test single-quotes (bug 2067) !! wikitext foo !! html

    foo

    !! end !! test Attribute test: equals, then nothing !! wikitext foo !! html

    foo

    !! end !! test Attribute test: unquoted value !! wikitext foo !! html

    foo

    !! end !! test Attribute test: unquoted but illegal value (hash) !! wikitext foo !! html

    foo

    !! end !! test Attribute test: no value !! wikitext foo !! html

    foo

    !! end !! test Bug 2095: link with three closing brackets !! wikitext [[Main Page]]] !! html/php

    Main Page]

    !! html/parsoid

    Main Page]

    !! end !! test Bug 2095: link with pipe and three closing brackets !! wikitext [[Main Page|link]]] !! html/php

    link]

    !! html/parsoid

    link]

    !! end !! test Bug 2095: link with pipe and three closing brackets, version 2 !! wikitext [[Main Page|[http://example.com/]]] !! html/php

    [http://example.com/]

    !! html/parsoid

    [http://example.com/]

    !! end ### ### Safety ### !! article Template:Dangerous attribute !! text " onmouseover="alert(document.cookie) !! endarticle !! article Template:Dangerous style attribute !! text border-size: expression(alert(document.cookie)) !! endarticle !! article Template:Div style !! text
    Magic div
    !! endarticle !! test Bug 2304: HTML attribute safety (safe template; regression bug 2309) !! wikitext
    !! html
    !! end # Parsoid has enough context to handle this case !! test Bug 2304: HTML attribute safety (dangerous template; 2309) !! wikitext
    !! html/php
    !! html/parsoid
    !! end !! test Bug 2304: HTML attribute safety (dangerous style template; 2309) !! wikitext
    !! html
    !! end !! test Bug 2304: HTML attribute safety (safe parameter; 2309) !! wikitext {{div style|width: 200px}} !! html
    Magic div
    !! end !! test Bug 2304: HTML attribute safety (unsafe parameter; 2309) !! wikitext {{div style|width: expression(alert(document.cookie))}} !! html
    Magic div
    !! end !! test Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309) !! wikitext {{div style|">}} !! html
    <script>alert(document.cookie)</script>">Magic div
    !! end !! test Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309) !! wikitext {{div style|" >}} !! html
    <script>alert(document.cookie)</script>">Magic div
    !! end !! test Bug 2304: HTML attribute safety (link) !! wikitext
    !! html
    !! end !! test Bug 2304: HTML attribute safety (italics) !! wikitext
    !! html
    !! end !! test Bug 2304: HTML attribute safety (bold) !! wikitext
    !! html
    !! end !! test Bug 2304: HTML attribute safety (ISBN) !! wikitext
    !! html
    !! end !! test Bug 2304: HTML attribute safety (RFC) !! wikitext
    !! html
    !! end !! test Bug 2304: HTML attribute safety (PMID) !! wikitext
    !! html
    !! end !! test Bug 2304: HTML attribute safety (web link) !! wikitext
    !! html
    !! end !! test Bug 2304: HTML attribute safety (named web link) !! wikitext
    !! html
    !! end !! test Bug 3244: HTML attribute safety (extension; safe) !! wikitext
    !! html
    !! end !! test Bug 3244: HTML attribute safety (extension; unsafe) !! wikitext
    !! html
    !! end # More MSIE fun discovered by Tom Gilder !! test MSIE CSS safety test: spurious slash !! wikitext
    evil
    !! html
    evil
    !! end !! test MSIE CSS safety test: hex code !! wikitext
    evil
    !! html
    evil
    !! end !! test MSIE CSS safety test: comment in url !! wikitext
    evil
    !! html
    evil
    !! end !! test MSIE CSS safety test: comment in expression !! wikitext
    evil4
    !! html
    evil4
    !! end !! test CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567) !! wikitext

    A

    !! html

    A

    !! end !! test MSIE 6 CSS safety test: Fullwidth (bug 55332) !! wikitext

    A

    B
    !! html

    A

    B
    !! end !! test MSIE 6 CSS safety test: IPA extensions (bug 55332) !! wikitext
    A

    B

    !! html
    A

    B

    !! end !! test MSIE 6 CSS safety test: sup/sub script (bug 55332) !! wikitext
    A
    B

    C

    !! html
    A
    B

    C

    !! end !! test Opera -o-link CSS !! wikitext
    X
    !! html
    X
    !! end !! test MSIE 6 CSS safety test: Repetition markers (bug 55332) !! wikitext

    A

    B

    C

    D

    E

    F

    G

    !! html

    A

    B

    C

    D

    E

    F

    G

    !! end !! test Table attribute legitimate extension !! wikitext {| !+ style="color:blue"| status |} !! html
    status
    !!end !! test Table attribute safety !! wikitext {| !+ style="border-width:expression(0+alert(document.cookie))"| status |} !! html
    status
    !! end !! test CSS line continuation 1 !! wikitext
    !! html
    !! end !! test CSS line continuation 2 !! wikitext
    !! html
    !! end !! article Template:Identity !! text {{{1}}} !! endarticle !! test Expansion of multi-line templates in attribute values (bug 6255) !! wikitext
    -
    !! html
    -
    !! end !! test Expansion of multi-line templates in attribute values (bug 6255 sanity check) !! wikitext
    -
    !! html
    -
    !! end !! test Expansion of multi-line templates in attribute values (bug 6255 sanity check 2) !! wikitext
    -
    !! html
    -
    !! end !! test evil -wiki-tags without Extension:Math enabled !! wikitext !! html+tidy

    <math><img src="some evil external link"><script>some_evil_javascript();</script></math>

    !! end ### ### Parser hooks (see tests/parser/parserTestsParserHook.php for the extension) ### !! test Parser hook: empty input !! wikitext !! html
    ''
    array (
    )
    
    !! end !! test Parser hook: empty input using terminated empty elements !! wikitext !! html
    NULL
    array (
    )
    
    !! end !! test Parser hook: empty input using terminated empty elements (space before) !! wikitext !! html
    NULL
    array (
    )
    
    !! end !! test Parser hook: basic input !! wikitext input !! html
    'input'
    array (
    )
    
    !! end !! test Parser hook: case insensitive !! wikitext input !! html
    'input'
    array (
    )
    
    !! end !! test Parser hook: case insensitive, redux !! wikitext input !! html
    'input'
    array (
    )
    
    !! end !! test Parser hook: nested tags !! options noxml !! wikitext !! html
    ''
    array (
    )
    
    </tag> !! end !! test Parser hook: basic arguments !! wikitext !! html
    ''
    array (
      'width' => '200',
      'height' => '100',
      'depth' => '50',
      'square' => 'square',
    )
    
    !! end !! test Parser hook: argument containing a forward slash (bug 5344) !! wikitext !! html
    ''
    array (
      'filename' => '/tmp/bla',
    )
    
    !! end !! test Parser hook: empty input using terminated empty elements (bug 2374) !! wikitext text !! html
    NULL
    array (
      'foo' => 'bar',
    )
    
    text !! end #
    should be output literally since there is no matching tag that begins it !! test Parser hook: basic arguments using terminated empty elements (bug 2374) !! wikitext other stuff !! html
    NULL
    array (
      'width' => '200',
      'height' => '100',
      'depth' => '50',
      'square' => 'square',
    )
    

    other stuff </tag>

    !! end ### ### (see tests/parser/parserTestsParserHook.php for the extension) ### !! test Parser hook: static parser hook not inside a comment !! wikitext hello, world !! html

    hello, world

    !! end !! test Parser hook: static parser hook inside a comment !! wikitext !! html


    !! end # Nested template calls; this case was broken by Parser.php rev 1.506, # since reverted. !! article Template:One-parameter !! text (My parameter is: {{{1}}}) !! endarticle !! article Template:Map-one-parameter !! text {{{{{1}}}|{{{2}}}}} !! endarticle !! test Nested template calls !! wikitext {{Map-one-parameter|One-parameter|param}} !! html

    (My parameter is: param)

    !! end ### ### Sanitizer ### !! test Sanitizer: Closing of open tags !! wikitext
    !! html
    !! end !! test Sanitizer: Closing of open but not closed tags !! wikitext foo !! html

    foo

    !! end !! test Sanitizer: Closing of closed but not open tags !! wikitext
    !! html

    </s>

    !! end !! test Sanitizer: Closing of closed but not open table tags !! wikitext Table not started
    !! html

    Table not started</td></tr></table>

    !! end !! test Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" !! wikitext byte[[#æ: v|backlink]] !! html

    bytebacklink

    !! end !! test Sanitizer: Validating the contents of the id attribute (bug 4515) !! options disabled !! wikitext
    !! html Something, but definitely not
    ... !! end !! test Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301) !! options disabled !! wikitext

    !! html Something need to be done. foo-2 ? !! end !! test Sanitizer: Validating that and work, but only for Microdata !! wikitext
    !! html

    <meta http-equiv="refresh" content="5">

    <link rel="stylesheet" href="http://example.org">
    !! end !! test Language converter: output gets cut off unexpectedly (bug 5757) !! options language=zh !! wikitext this bit is safe: }- but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}- then we get cut off here: }- all additional text is vanished !! html

    this bit is safe: }-

    but if we add a conversion instance: xxx

    then we get cut off here: }-

    all additional text is vanished

    !! end !! test Self closed html pairs (bug 5487) !! options !! wikitext
    Centered text
    In div text
    !! html
    <font id="bug" />Centered text
    <font id="bug2" />In div text
    !! end # # # !! test Punctuation: nbsp before exclamation !! wikitext C'est grave ! !! html

    C'est grave !

    !! end !! test Punctuation: CSS !important (bug 11874) !! wikitext
    important
    !! html
    important
    !!end !! test Punctuation: CSS ! important (bug 11874; with space after) !! wikitext
    important
    !! html
    important
    !!end !! test HTML bullet list, closed tags (bug 5497) !! wikitext
    • One
    • Two
    !! html
    • One
    • Two
    !! end !! test HTML bullet list, unclosed tags (bug 5497) !! options disabled !! wikitext
    • One
    • Two
    !! html
    • One
    • Two
    !! end !! test HTML ordered list, closed tags (bug 5497) !! wikitext
    1. One
    2. Two
    !! html
    1. One
    2. Two
    !! end !! test HTML ordered list, unclosed tags (bug 5497) !! options disabled !! wikitext
    1. One
    2. Two
    !! html
    1. One
    2. Two
    !! end !! test HTML nested bullet list, closed tags (bug 5497) !! wikitext
    • One
    • Two:
      • Sub-one
      • Sub-two
    !! html
    • One
    • Two:
      • Sub-one
      • Sub-two
    !! end !! test HTML nested bullet list, open tags (bug 5497) !! options disabled !! wikitext
    • One
    • Two:
      • Sub-one
      • Sub-two
    !! html
    • One
    • Two:
      • Sub-one
      • Sub-two
    !! end !! test HTML nested ordered list, closed tags (bug 5497) !! wikitext
    1. One
    2. Two:
      1. Sub-one
      2. Sub-two
    !! html
    1. One
    2. Two:
      1. Sub-one
      2. Sub-two
    !! end !! test HTML nested ordered list, open tags (bug 5497) !! options disabled !! wikitext
    1. One
    2. Two:
      1. Sub-one
      2. Sub-two
    !! html
    1. One
    2. Two:
      1. Sub-one
      2. Sub-two
    !! end !! test HTML ordered list item with parameters oddity !! wikitext
    1. One
    !! html
    1. One
    !! end # parsoid doesn't explicitly mark autonumbered links, see bug 53505 !!test bug 5918: autonumbering !! wikitext [http://first/] [http://second] [ftp://ftp] ftp://inlineftp [mailto:enclosed@mail.tld With target] [mailto:enclosed@mail.tld] mailto:inline@mail.tld !! html/php

    [1] [2] [3]

    ftp://inlineftp

    With target

    [4]

    mailto:inline@mail.tld

    !! html/parsoid

    ftp://inlineftp

    With target

    mailto:inline@mail.tld

    !! end # # Security and HTML correctness # From Nick Jenkins' fuzz testing # !! test Fuzz testing: Parser13 !! wikitext {| | http://a| !! html
    !! end !! test Fuzz testing: Parser14 !! wikitext == onmouseover= == http://__TOC__ !! html

    onmouseover=[edit]

    http://

    Contents

    !! html+tidy

    onmouseover=[edit]

    http://

    Contents

    !! end !! test Fuzz testing: Parser14-table !! wikitext ==a== {| STYLE=__TOC__ !! html

    a[edit]

    !! html+tidy

    a[edit]

    !! end # Known to produce bogus xml (extra ) !! test Fuzz testing: Parser16 !! options noxml !! wikitext {| !https://|||||| !! html
    https://
    !! html+tidy
    https://
    !! end !! test Fuzz testing: Parser21 !! wikitext {| ! irc://{{ftp://a" onmouseover="alert('hello world');" | !! html
    irc://{{ftp://a" onmouseover="alert('hello world');"
    !! end !! test Fuzz testing: Parser22 !! wikitext http://===r:::https://b {| !! html

    http://===r:::https://b

    !! end # Known to produce bad XML for now !! test Fuzz testing: Parser24 !! options noxml !! wikitext {| {{{| }}}} >
    MOVE YOUR MOUSE CURSOR OVER THIS TEXT | !! html {{{| }}}} >
    MOVE YOUR MOUSE CURSOR OVER THIS TEXT
    !! end # Note: the current result listed for this is not what the original one was, # but the original bug was JavaScript injection, which is fixed in any case. # It's not clear that the original result listed was any more correct than the # current one. Original result: #

    {{{| #

    #
  • # }}}blah" onmouseover="alert('hello world');" align="left"MOVE MOUSE CURSOR OVER HERE !!test Fuzz testing: Parser25 (bug 6055) !! wikitext {{{ |
  • }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE !! html

    <LI CLASS=blah" onmouseover="alert('hello world');" align="left"MOVE MOUSE CURSOR OVER HERE

    !! end !!test Fuzz testing: URL adjacent extension (with space, clean) !! wikitext http://example.com junk !! html

    http://example.com junk

    !!end !!test Fuzz testing: URL adjacent extension (no space, dirty; nowiki) !! wikitext http://example.comjunk !! html

    http://example.comjunk

    !!end !!test Fuzz testing: URL adjacent extension (no space, dirty; pre) !! wikitext http://example.com
    junk
    !! html http://example.com
    junk
    !! html+tidy

    http://example.com

    junk
    
    !!end !!test Fuzz testing: image with bogus manual thumbnail !! wikitext [[Image:foobar.jpg|thumbnail= ]] !! html/php
    Error creating thumbnail:
    !! html/parsoid !!end !! test Fuzz testing: encoded newline in generated HTML replacements (bug 6577) !! wikitext
    
    !! html
    
    
    
    !! end
    
    !! test
    Parsing optional HTML elements (Bug 6171)
    !! options
    !! wikitext
    
    Some tabular data More tabular data ... And yet som tabular data
    !! html
    Some tabular data More tabular data ... And yet som tabular data
    !! end !! test Correct handling of , (Bug 6171) !! options !! wikitext
    Some tabular data More tabular data ... And yet som tabular data
    !! html
    Some tabular data More tabular data ... And yet som tabular data
    !! end !! test Parsing crashing regression (fr:JavaScript) !! wikitext !! html

    </body></x>

    !! end !! test Inline wiki vs wiki block nesting !! wikitext '''Bold paragraph New wiki paragraph !! html

    Bold paragraph

    New wiki paragraph

    !! end !! test Inline HTML vs wiki block nesting !! options disabled !! wikitext Bold paragraph New wiki paragraph !! html

    Bold paragraph

    New wiki paragraph

    !! end # Original result was this: #

    boldboldbolditalics #

    # While that might be marginally more intuitive, maybe, the six-apostrophe # construct is clearly pathological and the result stated here (which is what # the parser actually does) is about as reasonable as anything. !!test Mixing markup for italics and bold !! options !! wikitext '''bold''''''bold''bolditalics''''' !! html

    'bold'boldbolditalics

    !! end !! article Xyzzyx !! text Article for special page transclusion test !! endarticle !! test Special page transclusion !! options !! wikitext {{Special:Prefixindex/Xyzzyx}} !! html
    Xyzzyx
    !! end !! test Special page transclusion twice (bug 5021) !! options !! wikitext {{Special:Prefixindex/Xyzzyx}} {{Special:Prefixindex/Xyzzyx}} !! html
    Xyzzyx
    Xyzzyx
    !! end !! test Transclusion of default MediaWiki message !! wikitext {{MediaWiki:Mainpage}} !! html

    Main Page

    !! end !! test Transclusion of nonexistent MediaWiki message !! wikitext {{MediaWiki:Mainpagexxx}} !! html

    MediaWiki:Mainpagexxx

    !! end !! test Transclusion of MediaWiki message with underscore !! wikitext {{MediaWiki:history_short}} !! html

    History

    !! end !! test Transclusion of MediaWiki message with space !! wikitext {{MediaWiki:history short}} !! html

    History

    !! end !! test Invalid header with following text !! wikitext = x = y !! html

    = x = y

    !! end !! test Section extraction test (section 0) !! options section=0 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start !! end !! test Section extraction test (section 1) !! options section=1 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ==a== ===aa=== ====aaa==== !! end !! test Section extraction test (section 2) !! options section=2 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ===aa=== ====aaa==== !! end !! test Section extraction test (section 3) !! options section=3 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ====aaa==== !! end !! test Section extraction test (section 4) !! options section=4 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ==b== ===ba=== ===bb=== ====bba==== ===bc=== !! end !! test Section extraction test (section 5) !! options section=5 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ===ba=== !! end !! test Section extraction test (section 6) !! options section=6 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ===bb=== ====bba==== !! end !! test Section extraction test (section 7) !! options section=7 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ====bba==== !! end !! test Section extraction test (section 8) !! options section=8 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ===bc=== !! end !! test Section extraction test (section 9) !! options section=9 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ==c== ===ca=== !! end !! test Section extraction test (section 10) !! options section=10 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html ===ca=== !! end !! test Section extraction test (nonexistent section 11) !! options section=11 !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html !! end !! test Section extraction test with bogus heading (section 1) !! options section=1 !! wikitext ==a== ==bogus== not a legal section ==b== !! html ==a== ==bogus== not a legal section !! end !! test Section extraction test with bogus heading (section 2) !! options section=2 !! wikitext ==a== ==bogus== not a legal section ==b== !! html ==b== !! end !! test Section extraction test with comment after heading (section 1) !! options section=1 !! wikitext ==a== ==b== ==c== !! html ==a== !! end !! test Section extraction test with comment after heading (section 2) !! options section=2 !! wikitext ==a== ==b== ==c== !! html ==b== !! end !! test Section extraction test with bogus heading (section 1) !! options section=1 !! wikitext ==a== ==bogus== not a legal section ==b== !! html ==a== ==bogus== not a legal section !! end !! test Section extraction test with bogus heading (section 2) !! options section=2 !! wikitext ==a== ==bogus== not a legal section ==b== !! html ==b== !! end # Formerly testing for bug 2587, now resolved by the use of unmarked sections # instead of respecting commented sections !! test Section extraction prefixed by comment (section 1) !! options section=1 !! wikitext ==sec1== ==sec2== !! html ==sec2== !!end !! test Section extraction prefixed by comment (section 2) !! options section=2 !! wikitext ==sec1== ==sec2== !! html !!end # Formerly testing for bug 2607, now resolved by the use of unmarked sections # instead of respecting HTML-style headings !! test Section extraction, mixed wiki and html (section 1) !! options section=1 !! wikitext

    unmarked

    unmarked ==1== one ==2== two !! html ==1== one !! end !! test Section extraction, mixed wiki and html (section 2) !! options section=2 !! wikitext

    unmarked

    unmarked ==1== one ==2== two !! html ==2== two !! end # Formerly testing for bug 3342 !! test Section extraction, heading surrounded by !! options section=1 !! wikitext ==unmarked== ==marked== !! html ==marked== !!end # Test behavior of bug 19910 !! test Sectiion with all-equals !! options section=2 !! wikitext === The line above must have a trailing space === But just in case it doesn't... !! html === But just in case it doesn't... !! end !! test Section replacement test (section 0) !! options replace=0,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html xxx ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! end !! test Section replacement test (section 1) !! options replace=1,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start xxx ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! end !! test Section replacement test (section 2) !! options replace=2,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== xxx ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! end !! test Section replacement test (section 3) !! options replace=3,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== ===aa=== xxx ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! end !! test Section replacement test (section 4) !! options replace=4,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== ===aa=== ====aaa==== xxx ==c== ===ca=== !! end !! test Section replacement test (section 5) !! options replace=5,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== ===aa=== ====aaa==== ==b== xxx ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! end !! test Section replacement test (section 6) !! options replace=6,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== ===aa=== ====aaa==== ==b== ===ba=== xxx ===bc=== ==c== ===ca=== !! end !! test Section replacement test (section 7) !! options replace=7,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== xxx ===bc=== ==c== ===ca=== !! end !! test Section replacement test (section 8) !! options replace=8,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== xxx ==c== ===ca=== !!end !! test Section replacement test (section 9) !! options replace=9,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== xxx !! end !! test Section replacement test (section 10) !! options replace=10,"xxx" !! wikitext start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== ===ca=== !! html start ==a== ===aa=== ====aaa==== ==b== ===ba=== ===bb=== ====bba==== ===bc=== ==c== xxx !! end !! test Section replacement test with initial whitespace (bug 13728) !! options replace=2,"xxx" !! wikitext Preformatted initial line ==a== ===a=== !! html Preformatted initial line ==a== xxx !! end !! test Section extraction, heading followed by pre with 20 spaces (bug 6398) !! options section=1 !! wikitext ==a== a !! html ==a== a !! end !! test Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check) !! options section=1 !! wikitext ==a== a !! html ==a== a !! end !! test Section extraction,
     around bogus header (bug 10309)
    !! options
    noxml section=2
    !! wikitext
    == Section One ==
    
    =======
    
    == Section Two == stuff !! html == Section Two == stuff !! end !! test Section replacement,
     around bogus header (bug 10309)
    !! options
    noxml replace=2,"xxx"
    !! wikitext
    == Section One ==
    
    =======
    
    == Section Two == stuff !! html == Section One ==
    =======
    
    xxx !! end !! test Handling of in URLs !! wikitext ** irc:// a !! html/php !! html/parsoid !! end !! test Handling of %0A in URLs !! wikitext ** irc://%0Aa !! html/php !! html/parsoid !! end # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test 5 quotes, code coverage +1 line !! options parsoid=wt2html !! wikitext ''''' !! html/php !! html/parsoid

    !! end # same html as previous, but wikitext adjusted to match parsoid html2wt # note that wt2html and html2html will put the before the !! test 5 quotes, code coverage +1 line w/ nowiki (1) !! options parsoid=wt2wt,html2wt !! wikitext '''''''''' !! html/php

    !! html/parsoid

    !! end # same as previous, just swapping the and !! test 5 quotes, code coverage +1 line w/ nowiki (2) !! wikitext '''''''''' !! html/php

    !! html/parsoid

    !! end !! test Special:Search page linking. !! wikitext {{Special:search}} !! html

    Special:Search

    !! end !! test Say the magic word !! options title=[[Parser test]] !! wikitext * {{PAGENAME}} * {{PAGENAMEE}} * {{FULLPAGENAME}} * {{FULLPAGENAMEE}} * {{BASEPAGENAME}} * {{BASEPAGENAMEE}} * {{SUBPAGENAME}} * {{SUBPAGENAMEE}} * {{ROOTPAGENAME}} * {{ROOTPAGENAMEE}} * {{TALKPAGENAME}} * {{TALKPAGENAMEE}} * {{SUBJECTPAGENAME}} * {{SUBJECTPAGENAMEE}} * {{NAMESPACEE}} * {{NAMESPACE}} * {{NAMESPACENUMBER}} * {{TALKSPACE}} * {{TALKSPACEE}} * {{SUBJECTSPACE}} * {{SUBJECTSPACEE}} * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}} !! html
    • Parser test
    • Parser_test
    • Parser test
    • Parser_test
    • Parser test
    • Parser_test
    • Parser test
    • Parser_test
    • Parser test
    • Parser_test
    • Talk:Parser test
    • Talk:Parser_test
    • Parser test
    • Parser_test
    • 0
    • Talk
    • Talk
    • Template:Dynamic
    !! end ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included. !! test Gallery !! wikitext image1.png | image2.gif||||| image3| image4 |300px| centre image5.svg| http:///////// [[x|xx]]]] * image6 !! html !! end !! test Gallery (with options) !! wikitext File:Nonexistant.jpg|caption File:Nonexistant.jpg image:foobar.jpg|some '''caption''' [[Main Page]] image:foobar.jpg image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! html !! end !! test Gallery with link that has fragment !! wikitext image:foobar.jpg|link=Main_Page image:foobar.jpg|link=Main_Page#section image:foobar.jpg|link=Main Page#section|caption !! html !! end !! test Gallery with wikitext inside caption !! wikitext File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt !! html !! end !! test gallery (with showfilename option) !! wikitext File:Nonexistant.jpg|caption File:Nonexistant.jpg image:foobar.jpg|some '''caption''' [[Main Page]] File:Foobar.jpg !! html !! end !! test Gallery (with namespace-less filenames) !! wikitext File:Nonexistant.jpg Nonexistant.jpg image:foobar.jpg foobar.jpg !! html !! end !! test HTML Hex character encoding (spells the word "JavaScript") !! options parsoid=wt2html,wt2wt,html2html !! wikitext JavaScript !! html/php

    JavaScript

    !! html/php+tidy

    JavaScript

    !! html/parsoid

    JavaScript

    !! end !! test HTML Hex character encoding bogus encoding (bug 26437 regression check) !! wikitext &#xsee;&#XSEE; !! html/php

    &#xsee;&#XSEE;

    !! html/parsoid

    &#xsee;&#XSEE;

    !! end !! test HTML Hex character encoding mixed case !! options parsoid=wt2html,wt2wt,html2html !! wikitext îî !! html/php

    îî

    !! html/php+tidy

    îî

    !! html/parsoid

    îî

    !! end !! test __FORCETOC__ override !! wikitext __NEWSECTIONLINK__ __FORCETOC__ !! html


    !! end !! test ISBN code coverage !! wikitext ISBN 978-0-1234-56 789 !! html

    ISBN 978-0-1234-56 789

    !! html+tidy

    ISBN 978-0-1234-56 789

    !! end !! test ISBN followed by 5 spaces !! wikitext ISBN !! html

    ISBN

    !! end !! test Double ISBN !! wikitext ISBN ISBN 1234567890 !! html

    ISBN ISBN 1234567890

    !! end !! test ISBN with an X !! wikitext ISBN 3-462-04561-X !! html

    ISBN 3-462-04561-X

    !! end !! test ISBN with empty prefix (parsoid test) !! wikitext ISBN 1234567890 !! html/parsoid

    ISBN 1234567890

    !! end !! test Bug 22905: followed by ISBN followed by !! wikitext (fr) ISBN 2753300917 [http://www.example.com example.com] !! html

    (fr) ISBN 2753300917 example.com

    !! end !! test Double RFC !! wikitext RFC RFC 1234 !! html

    RFC RFC 1234

    !! end !! test Double RFC with a wiki link !! wikitext RFC [[RFC 1234]] !! html

    RFC RFC 1234

    !! end !! test RFC code coverage !! wikitext RFC 983 987 !! html

    RFC 983 987

    !! html+tidy

    RFC 983 987

    !! end !! test Centre-aligned image !! wikitext [[Image:foobar.jpg|centre]] !! html
    Foobar.jpg
    !!end !! test None-aligned image !! wikitext [[Image:foobar.jpg|none]] !! html
    Foobar.jpg
    !!end !! test Width + Height sized image (using px) (height is ignored) !! wikitext [[Image:foobar.jpg|640x480px]] !! html

    Foobar.jpg

    !!end !! test Width-sized image (using px, no following whitespace) !! wikitext [[Image:foobar.jpg|640px]] !! html

    Foobar.jpg

    !!end !! test Width-sized image (using px, with following whitespace - test regression from r39467) !! wikitext [[Image:foobar.jpg|640px ]] !! html

    Foobar.jpg

    !!end !! test Width-sized image (using px, with preceding whitespace - test regression from r39467) !! wikitext [[Image:foobar.jpg| 640px]] !! html

    Foobar.jpg

    !!end !! test Image with page parameter !! options djvu !! wikitext [[File:LoremIpsum.djvu|page=2]] !! html

    LoremIpsum.djvu

    !! end !! test Another italics / bold test !! wikitext ''' ''x' !! html
    ' x'
    
    !!end # Note the results may be incorrect, as parserTest output included this: # XML error: Mismatched tag at byte 6120: # ...
    !!end # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "" tag. !! test Images with the "|" character in the comment !! wikitext [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]] !! html/php
    An external URL
    !! html/parsoid
    An external URL
    !! end !! test [Before] HTML without raw HTML enabled ($wgRawHtml==false) !! wikitext !! html

    <html><script>alert(1);</script></html>

    !! end !! test HTML with raw HTML ($wgRawHtml==true) !! options wgRawHtml=1 !! wikitext !! html

    !! end !! test Parents of subpages, one level up !! options subpage title=[[Subpage test/L1/L2/L3]] !! wikitext [[../|L2]] !! html

    L2

    !! end !! test Parents of subpages, one level up, not named !! options subpage title=[[Subpage test/L1/L2/L3]] !! wikitext [[../]] !! html

    Subpage test/L1/L2

    !! end !! test Parents of subpages, two levels up !! options subpage title=[[Subpage test/L1/L2/L3]] !! wikitext [[../../|L1]]2 [[../../|L1]]l !! html

    L12

    L1l

    !! end !! test Parents of subpages, two levels up, without trailing slash or name. !! options subpage title=[[Subpage test/L1/L2/L3]] !! wikitext [[../..]] !! html

    [[../..]]

    !! end !! test Parents of subpages, two levels up, with lots of extra trailing slashes. !! options subpage title=[[Subpage test/L1/L2/L3]] !! wikitext [[../../////]] !! html

    ///

    !! end !! article Subpage test/L1/L2/L3Sibling !! text Sibling article !! endarticle !! test Transclusion of a sibling page (one level up) !! options subpage title=[[Subpage test/L1/L2/L3]] !! wikitext {{../L3Sibling}} !! html

    Sibling article

    !! end !! test Transclusion of a child page !! options subpage title=[[Subpage test/L1/L2]] !! wikitext {{/L3Sibling}} !! html

    Sibling article

    !! end !! test Non-transclusion because of too many up levels !! options subpage title=[[Subpage test/L1/L2/L3]] !! wikitext {{../../../../More than parent}} !! html

    {{../../../../More than parent}}

    !! end !! test Definition list code coverage !! wikitext ; title : def ; title : def ;title: def !! html
    title  
    def
    title 
    def
    title
    def
    !! end !! test Don't fall for the self-closing div !! wikitext
    hello world
    !! html
    hello world
    !! end !! test MSGNW magic word !! wikitext {{MSGNW:msg}} !! html

    [[:Template:Msg]]

    !! end !! test RAW magic word !! wikitext {{RAW:QUERTY}} !! html

    Template:QUERTY

    !! end # This isn't needed for XHTML conformance, but would be handy as a fallback security measure !! test Always escape literal '>' in output, not just after '<' !! wikitext ><> !! html

    ><>

    !! end !! test Template caching !! wikitext {{Test}} {{Test}} !! html

    This is a test template This is a test template

    !! end !! article MediaWiki:Fake !! text ==header== !! endarticle !! test Inclusion of !userCanEdit() content !! wikitext {{MediaWiki:Fake}} !! html

    header[edit]

    !! end !! test Out-of-order TOC heading levels !! wikitext ==2== ======6====== ===3=== =1= =====5===== ==2== !! html

    2[edit]

    6[edit]

    3[edit]

    1[edit]

    5[edit]

    2[edit]

    !! end !! test ISBN with a dummy number !! wikitext ISBN --- !! html

    ISBN ---

    !! end !! test ISBN with space-delimited number !! wikitext ISBN 92 9017 032 8 !! html

    ISBN 92 9017 032 8

    !! end !! test ISBN with multiple spaces, no number !! wikitext ISBN foo !! html

    ISBN foo

    !! end !! test ISBN length !! wikitext ISBN 123456789 ISBN 1234567890 ISBN 12345678901 !! html

    ISBN 123456789

    ISBN 1234567890

    ISBN 12345678901

    !! end !! test ISBN with trailing year (bug 8110) !! wikitext ISBN 1-234-56789-0 - 2006 ISBN 1 234 56789 0 - 2006 !! html

    ISBN 1-234-56789-0 - 2006

    ISBN 1 234 56789 0 - 2006

    !! end !! test anchorencode !! wikitext {{anchorencode:foo bar©#%n}} !! html

    foo_bar.C2.A9.23.25n

    !! end !! test anchorencode trims spaces !! wikitext {{anchorencode: __pretty__please__}} !! html

    pretty_please

    !! end !! test anchorencode deals with links !! wikitext {{anchorencode: [[hello|world]] [[hi]]}} !! html

    world_hi

    !! end !! test anchorencode deals with templates !! wikitext {{anchorencode: {{Foo}} }} !! html

    FOO

    !! end !! test anchorencode encodes like the TOC generator: (bug 18431) !! wikitext === _ +:.3A%3A&&]] === {{anchorencode: _ +:.3A%3A&&]] }} __NOEDITSECTION__ !! html

    _ +:.3A%3A&&]]

    .2B:.3A.253A.26.26.5D.5D

    !! end !! test Bug 6200: blockquotes and paragraph formatting !! wikitext
    foo
    bar baz !! html

    foo

    bar

    baz
    
    !! end !! test Bug 8293: Use of center tag ruins paragraph formatting !! wikitext
    foo
    bar baz !! html

    foo

    bar

    baz
    
    !! end !!test Parsing of overlapping (improperly nested) inline html tags !! wikitext x !! html/php

    x</span>

    !! html/parsoid

    x

    !!end ### ### Language variants related tests ### !! test Self-link in language variants !! options title=[[Dunav]] language=sr !! wikitext Both [[Dunav]] and [[Дунав]] are names for this river. !! html

    Both Dunav and Дунав are names for this river.

    !!end !! article Дуна !! text content !! endarticle !! test Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title !! options title=[[Duna]] language=sr !! wikitext [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links. !! html

    Дуна is not a self-link while Duna and Dуна are still self-links.

    !! end !! test Link to a section of a variant of this title shouldn't be parsed as self-link !! options title=[[Duna]] language=sr !! wikitext [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links. !! html

    Dуна is a self-link while Dunа#Foo and Dуна#Foo are not self-links.

    !! end !! test Link to pages in language variants !! options language=sr !! wikitext Main Page can be written as [[Маин Паге]] !! html

    Main Page can be written as Маин Паге

    !!end !! test Multiple links to pages in language variants !! options language=sr !! wikitext [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]]. !! html

    Main Page can be written as Маин Паге same as Маин Паге.

    !!end !! test Simple template in language variants !! options language=sr !! wikitext {{тест}} !! html

    This is a test template

    !! end !! test Template with explicit namespace in language variants !! options language=sr !! wikitext {{Template:тест}} !! html

    This is a test template

    !! end !! test Basic test for template parameter in language variants !! options language=sr !! wikitext {{парамтест|param=foo}} !! html

    This is a test template with parameter foo

    !! end !! test Simple category in language variants !! options language=sr cat !! wikitext [[Category:МедиаWики Усер'с Гуиде]] !! html MediaWiki User's Guide !! end !! article Category:分类 !! text blah !! endarticle !! article Category:分類 !! text blah !! endarticle !! test Don't convert blue categorylinks to another variant (bug 33210) !! options language=zh cat !! wikitext [[A]][[Category:分类]] !! html 分类 !! end !! test Stripping -{}- tags (language variants) !! options language=sr !! wikitext Latin proverb: -{Ne nuntium necare}- !! html

    Latin proverb: Ne nuntium necare

    !! end !! test Prevent conversion with -{}- tags (language variants) !! options language=sr variant=sr-ec !! wikitext Latinski: -{Ne nuntium necare}- !! html

    Латински: Ne nuntium necare

    !! end !! test Prevent conversion of text with -{}- tags (language variants) !! options language=sr variant=sr-ec !! wikitext Latinski: -{Ne nuntium necare}- !! html

    Латински: Ne nuntium necare

    !! end !! test Prevent conversion of links with -{}- tags (language variants) !! options language=sr variant=sr-ec !! wikitext -{[[Main Page]]}- !! html

    Main Page

    !! end !! test -{}- tags within headlines (within html for parserConvert()) !! options language=sr variant=sr-ec !! wikitext == -{Naslov}- == !! html

    Naslov[уреди]

    !! end !! test Explicit definition of language variant alternatives !! options language=zh variant=zh-tw !! wikitext -{zh:China;zh-tw:Taiwan}-, not China !! html

    Taiwan, not China

    !! end !! test Conversion around HTML tags !! options language=sr variant=sr-ec !! wikitext -{H|span=>sr-ec:script;title=>sr-ec:src;}- ski !! html

    ски

    !! end !! test Explicit session-wise language variant mapping (A flag and - flag) !! options language=zh variant=zh-tw !! wikitext Taiwan is not China. But -{A|zh:China;zh-tw:Taiwan}- is China, (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!) and -{China}- is China. !! html

    Taiwan is not China. But Taiwan is Taiwan, (This should be stripped!) and China is China.

    !! end !! test Explicit session-wise language variant mapping (H flag for hide) !! options language=zh variant=zh-tw !! wikitext (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!) Taiwan is China. !! html

    (This should be stripped!) Taiwan is Taiwan.

    !! end !! test Adding explicit conversion rule for title (T flag) !! options language=zh variant=zh-tw showtitle !! wikitext Should be stripped-{T|zh:China;zh-tw:Taiwan}-! !! html Taiwan

    Should be stripped!

    !! end !! test Testing that changing the language variant here in the tests actually works !! options language=zh variant=zh showtitle !! wikitext Should be stripped-{T|zh:China;zh-tw:Taiwan}-! !! html China

    Should be stripped!

    !! end !! test Recursive conversion of alt and title attrs shouldn't clear converter state !! options language=zh variant=zh-cn showtitle !! wikitext -{H|zh-cn:Exclamation;zh-tw:exclamation;}- Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-! !! html China

    Should be stripped!

    !! end !! test Bug 24072: more test on conversion rule for title !! options language=zh variant=zh-tw showtitle !! wikitext This should be stripped-{T|zh:China;zh-tw:Taiwan}-! This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-. !! html Taiwan

    This should be stripped! This won't take interferes with the title rule.

    !! end !! test Partly disable title conversion if variant == main language code !! options language=zh variant=zh title=[[ZH]] showtitle !! wikitext -{T|zh-cn:CN;zh-tw:TW}- !! html ZH

    !! end !! test Partly disable title conversion if variant == main language code, more !! options language=zh variant=zh title=[[ZH]] showtitle !! wikitext -{T|TW}- !! html ZH

    !! end !! test Raw output of variant escape tags (R flag) !! options language=zh variant=zh-tw !! wikitext Raw: -{R|zh:China;zh-tw:Taiwan}- !! html

    Raw: zh:China;zh-tw:Taiwan

    !! end !! test Nested using of manual convert syntax !! options language=zh variant=zh-hk !! wikitext Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-! !! html

    Nested: Hello Hong Kong!

    !! end !! test Proper conversion of text in external links !! options language=sr variant=sr-ec !! wikitext http://www.google.com gopher://www.google.com [http://www.google.com http://www.google.com] [gopher://www.google.com gopher://www.google.com] [https://www.google.com irc://www.google.com] [ftp://www.google.com www.google.com/ftp://dir] [//www.google.com www.google.com] !! html

    http://www.google.com gopher://www.google.com http://www.google.com gopher://www.google.com irc://www.google.com www.гоогле.цом/фтп://дир www.гоогле.цом

    !! end !! test Do not convert roman numbers to language variants !! options language=sr variant=sr-ec !! wikitext Fridrih IV je car. !! html

    Фридрих IV је цар.

    !! end !! test Unclosed language converter markup "-{" !! options language=sr !! wikitext -{T|hello !! html

    -{T|hello

    !! end !! test Don't convert raw rule "-{R|=>}-" to "=>" !! options language=sr !! wikitext -{R|=>}- !! html

    =>

    !!end !! test Don't break link parsing if language converter markup is in the caption. !! options language=sr variant=sr-ec !! wikitext [[Main Page|-{R|main page}-]] !! html

    main page

    !! end # This test is currently broken in the PHP parser (bug 52661) !! test Don't break image parsing if language converter markup is in the caption. !! options language=sr disabled !! wikitext [[File:Foobar.jpg|-{R|caption}-]] !! html

    caption

    !! end # This test is currently broken in the PHP parser (bug 52661) !! test Don't break list handling if language converter markup is in the item. !! options language=zh variant=zh-cn disabled !! wikitext ;-{zh-cn:AAA;zh-tw:BBB}- !! html
    AAA
    !! end # This test is currently broken in the PHP parser (bug 52661) !! test Don't break table handling if language converter markup is in the cell. !! options language=sr variant=sr-ec disabled !! wikitext {| |- | -{R|B}- |} !! html
    B
    !! end !! test Bug 529: Uncovered bullet !! wikitext * Foo {{bullet}} !! html
    • Foo
    • Bar
    !! end # Plain MediaWiki does not remove empty lists, but tidy actually does. # Templates in Wikipedia rely on this behavior, as tidy has always been # enabled there. These tests are normally run *without* tidy, so specify the # full output here. # To test realistic parsing behavior, apply a tidy-like transformation to both # the expected output and your parser's output. !! test Bug 529: Uncovered bullet leaving empty list, normally removed by tidy !! wikitext ******* Foo {{bullet}} !! html
                • Foo
    • Bar
    !! end !! test Bug 529: Uncovered table already at line-start !! wikitext x {{table}} y !! html

    x

    1 2
    3 4

    y

    !! end !! test Bug 529: Uncovered bullet in parser function result !! wikitext * Foo {{lc:{{bullet}} }} !! html
    • Foo
    • bar
    !! end !! test Bug 5678: Double-parsed template argument !! wikitext {{lc:{{{1}}}|hello}} !! html

    {{{1}}}

    !! end !! test Bug 5678: Double-parsed template invocation !! wikitext {{lc:{{paramtest {{!}} param = hello }} }} !! html

    {{paramtest | param = hello }}

    !! end !! test Case insensitivity of parser functions for non-ASCII characters (bug 8143) !! options language=cs title=[[Main Page]] !! wikitext {{PRVNÍVELKÉ:ěščř}} {{prvnívelké:ěščř}} {{PRVNÍMALÉ:ěščř}} {{prvnímalé:ěščř}} {{MALÁ:ěščř}} {{malá:ěščř}} {{VELKÁ:ěščř}} {{velká:ěščř}} !! html

    Ěščř Ěščř ěščř ěščř ěščř ěščř ĚŠČŘ ĚŠČŘ

    !! end !! test Morwen/13: Unclosed link followed by heading !! wikitext [[link ==heading== !! html

    [[link

    heading[edit]

    !! end !! test HHP2.1: Heuristics for headings in preprocessor parenthetical structures !! wikitext {{foo| =heading= !! html

    {{foo|

    heading

    !! end !! test HHP2.2: Heuristics for headings in preprocessor parenthetical structures !! wikitext {{foo| ==heading== !! html

    {{foo|

    heading[edit]

    !! end !! test Tildes in comments !! options pst !! wikitext !! html !! end !! test Paragraphs inside divs (no extra line breaks) !! wikitext
    Line one Line two
    !! html
    Line one Line two
    !! end !! test Paragraphs inside divs (extra line break on open) !! wikitext
    Line one Line two
    !! html

    Line one

    Line two
    !! end !! test Paragraphs inside divs (extra line break on close) !! wikitext
    Line one Line two
    !! html
    Line one

    Line two

    !! end !! test Paragraphs inside divs (extra line break on open and close) !! wikitext
    Line one Line two
    !! html

    Line one

    Line two

    !! end !! test Nesting tags, paragraphs on lines which begin with
    !! options disabled !! wikitext
    A B !! html

    A B

    !! end # Bug 6200:
    should behave like
    with respect to line breaks !! test Bug 6200: paragraphs inside blockquotes (no extra line breaks) !! wikitext
    Line one Line two
    !! html
    Line one Line two
    !! html+tidy

    Line one Line two

    !! end !! test Bug 6200: paragraphs inside blockquotes (extra line break on open) !! wikitext
    Line one Line two
    !! html

    Line one

    Line two
    !! html+tidy

    Line one

    Line two
    !! end !! test Bug 6200: paragraphs inside blockquotes (extra line break on close) !! wikitext
    Line one Line two
    !! html
    Line one

    Line two

    !! html+tidy

    Line one

    Line two

    !! end !! test Bug 6200: paragraphs inside blockquotes (extra line break on open and close) !! wikitext
    Line one Line two
    !! html

    Line one

    Line two

    !! html+tidy

    Line one

    Line two

    !! end !! test Paragraphs inside blockquotes/divs (no extra line breaks) !! wikitext
    Line one Line two
    !! html
    Line one Line two
    !! end !! test Paragraphs inside blockquotes/divs (extra line break on open) !! wikitext
    Line one Line two
    !! html

    Line one

    Line two
    !! end !! test Paragraphs inside blockquotes/divs (extra line break on close) !! wikitext
    Line one Line two
    !! html
    Line one

    Line two

    !! end !! test Paragraphs inside blockquotes/divs (extra line break on open and close) !! wikitext
    Line one Line two
    !! html

    Line one

    Line two

    !! end !! test Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion !! options wgLinkHolderBatchSize=0 !! wikitext [[meatball:1]] [[meatball:2]] [[meatball:3]] !! html

    meatball:1 meatball:2 meatball:3

    !! end !! test Free external link invading image caption !! wikitext [[Image:Foobar.jpg|thumb|http://x|hello]] !! html
    hello
    !! end !! test Bug 15196: localised external link numbers !! options language=fa !! wikitext [http://en.wikipedia.org/] !! html/php

    [۱]

    !! html/parsoid

    !! end !! test Multibyte character in padleft !! wikitext {{padleft:-Hello|7|Æ}} !! html

    Æ-Hello

    !! end !! test Multibyte character in padright !! wikitext {{padright:Hello-|7|Æ}} !! html

    Hello-Æ

    !! end !!test formatdate parser function !! wikitext {{#formatdate:2009-03-24}} !! html

    2009-03-24

    !! end !!test formatdate parser function, with default format !! wikitext {{#formatdate:2009-03-24|mdy}} !! html

    March 24, 2009

    !! end !! test Spacing of numbers in formatted dates !! wikitext {{#formatdate:January 15}} !! html

    January 15

    !! end !! test formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language !! options language=nl title=[[MediaWiki:Common.css]] !! wikitext {{#formatdate:2009-03-24|dmy}} !! html

    24 March 2009

    !! end # # # # # Edit comments # !! test Edit comment with link !! options comment !! wikitext I like the [[Main Page]] a lot !! html I like the Main Page a lot !!end !! test Edit comment with link and link text !! options comment !! wikitext I like the [[Main Page|best pages]] a lot !! html I like the best pages a lot !!end !! test Edit comment with link and link text with suffix !! options comment !! wikitext I like the [[Main Page|best page]]s a lot !! html I like the best pages a lot !!end !! test Edit comment with section link (non-local, eg in history list) !! options comment title=[[Main Page]] !! wikitext /* External links */ removed bogus entries !! html External links: removed bogus entries !!end !! test Edit comment with section link and text before it (non-local, eg in history list) !! options comment title=[[Main Page]] !! wikitext pre-comment text /* External links */ removed bogus entries !! html pre-comment text External links: removed bogus entries !!end !! test Edit comment with section link (local, eg in diff view) !! options comment local title=[[Main Page]] !! wikitext /* External links */ removed bogus entries !! html External links: removed bogus entries !!end !! test Edit comment with subpage link (bug 14080) !! options comment subpage title=[[Subpage test]] !! wikitext Poked at a [[/subpage]] here... !! html Poked at a /subpage here... !!end !! test Edit comment with subpage link and link text (bug 14080) !! options comment subpage title=[[Subpage test]] !! wikitext Poked at a [[/subpage|neat little page]] here... !! html Poked at a neat little page here... !!end !! test Edit comment with bogus subpage link in non-subpage NS (bug 14080) !! options comment title=[[Subpage test]] !! wikitext Poked at a [[/subpage]] here... !! html Poked at a /subpage here... !!end !! test Edit comment with bare anchor link (local, as on diff) !! options comment local title=[[Main Page]] !! wikitext [[#section]] !! html #section !! end !! test Edit comment with bare anchor link (non-local, as on history) !! options comment title=[[Main Page]] !! wikitext [[#section]] !! html #section !! end !! test Anchor starting with underscore !! wikitext [[#_ref|One]] !! html

    One

    !! end !! test Id starting with underscore !! wikitext
    !! html
    !! end !! test Space normalisation on autocomment (bug 22784) !! options comment title=[[Main Page]] !! wikitext /* __hello__world__ */ !! html __hello__world__ !! end !! test percent-encoding and + signs in comments (Bug 26410) !! options comment !! wikitext [[ABC%33D% ++]] [[ABC%33D% ++|+%20]] !! html ABC3D% ++ +%20 !! end !! test Bad images - basic functionality !! options disabled !! wikitext [[File:Bad.jpg]] !! html !! end !! test Bad images - bug 16039: text after bad image disappears !! options disabled !! wikitext Foo bar [[File:Bad.jpg]] Bar foo !! html

    Foo bar

    Bar foo

    !! end !! test Verify that displaytitle works (bug #22501) no displaytitle !! options showtitle !! config wgAllowDisplayTitle=true wgRestrictDisplayTitle=false !! wikitext this is not the the title !! html Parser test

    this is not the the title

    !! end !! test Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false !! options showtitle title=[[Screen]] !! config wgAllowDisplayTitle=true wgRestrictDisplayTitle=false !! wikitext this is not the the title {{DISPLAYTITLE:whatever}} !! html whatever

    this is not the the title

    !! end !! test Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch !! options showtitle title=[[Screen]] !! config wgAllowDisplayTitle=true wgRestrictDisplayTitle=true !! wikitext this is not the the title {{DISPLAYTITLE:whatever}} !! html Screen

    this is not the the title

    !! end !! test Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching !! options showtitle title=[[Screen]] !! config wgAllowDisplayTitle=true wgRestrictDisplayTitle=true !! wikitext this is not the the title {{DISPLAYTITLE:screen}} !! html screen

    this is not the the title

    !! end !! test Verify that displaytitle works (bug #22501) AllowDisplayTitle=false !! options showtitle title=[[Screen]] !! config wgAllowDisplayTitle=false !! wikitext this is not the the title {{DISPLAYTITLE:screen}} !! html Screen

    this is not the the title Template:DISPLAYTITLE:screen

    !! end !! test Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE !! options showtitle title=[[Screen]] !! config wgAllowDisplayTitle=false !! wikitext this is not the the title !! html Screen

    this is not the the title

    !! end !! test Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value !! options showtitle title=[[Screen]] !! config wgAllowDisplayTitle=true wgRestrictDisplayTitle=true !! wikitext this is not the the title {{DISPLAYTITLE:screen}} !! html screen

    this is not the the title

    !! end !! test Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value !! options showtitle title=[[Screen]] !! config wgAllowDisplayTitle=true wgRestrictDisplayTitle=true !! wikitext this is not the the title {{DISPLAYTITLE:screen}} !! html screen

    this is not the the title

    !! end !! test preload: check and !! options preload !! wikitext Hello cruelkind world. !! html Hello kind world. !! end !! test preload: check !! options preload !! wikitext Goodbye Hello world !! html Hello world !! end !! test preload: can pass tags through if we want to !! options preload !! wikitext <includeonly>Hello world</includeonly> !! html Hello world !! end !! test preload: check that it doesn't try to do tricks !! options preload !! wikitext * ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}} !! html * ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}} !! end !! test Play a bit with r67090 and bug 3158 !! options disabled !! wikitext
     
     
     
     
    !! html
     
     
     
     
    !! end !! test HTML5 data attributes !! wikitext Baz

    Quuz

    !! html

    Baz

    Quuz

    !! end !! test percent-encoding and + signs in internal links (Bug 26410) !! wikitext [[User:+%]] [[Page+title%]] [[%+]] [[%+|%20]] [[%+ ]] [[%+r]] [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]] [[%33%45]] [[%33%45+]] !! html

    User:+% Page+title% %+ %20 %+ %+r % + bar 3E 3E+

    !! end !! test Special characters in embedded file links (bug 27679) !! wikitext [[File:Contains & ampersand.jpg]] [[File:Does not exist.jpg|Title with & ampersand]] !! html

    File:Contains & ampersand.jpg Title with & ampersand

    !! end !! test Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4) !! wikitext Text's been normalized? !! html

    Text's been normalized?

    !! end !! test Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links !! wikitext http://www.example.org/ <-- U+3000 (vim: ^Vu3000) !! html

    http://www.example.org/ <-- U+3000 (vim: ^Vu3000)

    !! end !! test Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links !! wikitext [http://www.example.org/ ideograms] !! html

    ideograms

    !! end !! test Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links !! wikitext http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000) !! html

    pic.png <-- U+3000 (vim: ^Vu3000)

    !! end !! article Mediawiki:loop1 !! text {{Identical|A}} !! endarticle !! article Mediawiki:loop2 !! text {{Identical|B}} !! endarticle !! article Template:Identical !! text {{int:loop1}} {{int:loop2}} !! endarticle !! test Bug 31098 Template which includes system messages which includes the template !! wikitext {{Identical}} !! html

    Template loop detected: Template:Identical Template loop detected: Template:Identical

    !! end !! test Bug31490 Turkish: ucfirst 'blah' !! options language=tr !! wikitext {{ucfirst:blah}} !! html

    Blah

    !! end !! test Bug31490 Turkish: ucfirst 'ix' !! options language=tr !! wikitext {{ucfirst:ix}} !! html

    İx

    !! end !! test Bug31490 Turkish: lcfirst 'BLAH' !! options language=tr !! wikitext {{lcfirst:BLAH}} !! html

    bLAH

    !! end !! test Bug31490 Turkish: ucfırst (with a dotless i) !! options language=tr !! wikitext {{ucfırst:blah}} !! html

    Şablon:Ucfırst:blah

    !! end !! test Bug31490 ucfırst (with a dotless i) with English language !! options language=en !! wikitext {{ucfırst:blah}} !! html

    Template:Ucfırst:blah

    !! end !! test Bug 26375: TOC with italics !! options title=[[Main Page]] !! wikitext __TOC__ == ''Lost'' episodes == !! html

    Contents

    Lost episodes[edit]

    !! end !! test Bug 26375: TOC with bold !! options title=[[Main Page]] !! wikitext __TOC__ == '''should be bold''' then normal text == !! html

    should be bold then normal text[edit]

    !! end !! test Bug 33845: Headings become cursive in TOC when they contain an image !! options title=[[Main Page]] !! wikitext __TOC__ == Image [[Image:foobar.jpg]] == !! html

    Contents

    Image Foobar.jpg[edit]

    !! end !! test Bug 33845 (2): Headings become bold in TOC when they contain a blockquote !! options title=[[Main Page]] !! wikitext __TOC__ ==
    Quote
    == !! html

    Contents

    Quote
    [edit]

    !! html+tidy

    Contents

    Quote

    [edit]

    !! end !! test Unclosed tags in TOC !! options title=[[Main Page]] !! wikitext __TOC__ == Proof: 2 < 3 == Hanc marginis exiguitas non caperet. QED !! html

    Contents

    Proof: 2 < 3[edit]

    Hanc marginis exiguitas non caperet. QED

    !! end !! test Multiple tags in TOC !! wikitext __TOC__ == Foo Bar == == Foo
    Bar
    == !! html

    Foo Bar[edit]

    Foo
    Bar
    [edit]

    !! html+tidy

    Contents

    Foo Bar[edit]

    Foo

    Bar

    [edit]

    !! end !! test Tags with parameters in TOC !! wikitext __TOC__ == Hello == == Evilbye == !! html

    Hello[edit]

    b">Evilbye[edit]

    !! end !! test span tags with directionality in TOC !! wikitext __TOC__ == C++ == == זבנג! == == The attributes on these span tags must be deleted from the TOC == == All attributes on these span tags must be deleted from the TOC == == Attributes after dir on these span tags must be deleted from the TOC == !! html

    C++[edit]

    זבנג![edit]

    The attributes on these span tags must be deleted from the TOC[edit]

    All attributes on these span tags must be deleted from the TOC[edit]

    Attributes after dir on these span tags must be deleted from the TOC[edit]

    !! end !! article MediaWiki:Bug32057 !! text == {{int:headline_sample}} == !! endarticle !! test Bug 32057: Title needed when expanding nodes. !! options title=[[Main Page]] !! wikitext {{int:Bug32057}} !! html

    Headline text[edit]

    !! end !! test Strip marker in urlencode !! wikitext {{urlencode:xy}} {{urlencode:xy|wiki}} {{urlencode:xy|path}} !! html

    xy xy xy

    !! end !! test Strip marker in lc !! wikitext {{lc:xy}} !! html

    xy

    !! end !! test Strip marker in uc !! wikitext {{uc:xy}} !! html

    XY

    !! end !! test Strip marker in formatNum !! wikitext {{formatnum:12}} {{formatnum:12|R}} !! html

    12 12

    !! end !! test Check noCommafy in formatNum !! options language=be-tarask !! wikitext {{formatnum:123456.78}} {{formatnum:123456.78|NOSEP}} !! html

    123 456,78 123456.78

    !! end !! test Wrong option for formatNum (bug 56199) !! wikitext {{formatnum:1,234.56|Random}} {{formatnum:1,234.56|EVERYTHING}} {{formatnum:1234.56|any argument that has the string 'NOSEP'}} !! html

    1,234.56 1,234.56 1,234.56

    !! end !! test Strip marker in grammar !! options language=fi !! wikitext {{grammar:elative|foobar}} !! html

    foobarista

    !! end !! test Strip marker in padleft !! wikitext {{padleft:|2|xy}} !! html

    xy

    !! end !! test Strip marker in padright !! wikitext {{padright:|2|xy}} !! html

    xy

    !! end !! test Strip marker in anchorencode !! wikitext {{anchorencode:xy}} !! html

    xy

    !! end !! test nowiki inside link inside heading (bug 18295) !! wikitext ==[[foo|xyz]]== !! html

    xyz[edit]

    !! end !! test new support for bdi element (bug 31817) !! wikitext

    ולדימיר לנין (ברוסית: Владимир Ленин, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.

    !! html

    ולדימיר לנין (ברוסית: Владимир Ленин, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.

    !!end !! test Ignore pipe between table row attributes !! wikitext {| | quux |- id=foo | style='color: red' | bar |} !! html
    quux
    bar
    !! end !!test Gallery override link with WikiLink (bug 34852) !! wikitext File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink !! html !! end !!test Gallery override link with absolute external link (bug 34852) !! wikitext File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org !! html !! end !!test Gallery override link with malicious javascript (bug 34852) !! wikitext File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!'); !! html !! end !!test Gallery with invalid title as link (bug 43964) !! wikitext File:foobar.jpg|link=< !! html !! end !!test Language parser function !! wikitext {{#language:ar}} !! html

    العربية

    !! end !!test Padleft and padright as substr !! wikitext {{padleft:|3|abcde}} {{padright:|3|abcde}} !! html

    abc abc

    !! end !!test Special parser function !! wikitext {{#special:RandomPage}} {{#special:BaDtItLe}} {{#special:Foobar}} !! html

    Special:Random Special:Badtitle Special:Foobar

    !! end !!test Bug 34939 - Case insensitive link parsing ([HttP://]) !! wikitext [HttP://MediaWiki.Org/] !! html/php

    [1]

    !! html/parsoid

    !! end !!test Bug 34939 - Case insensitive link parsing ([HttP:// title]) !! wikitext [HttP://MediaWiki.Org/ MediaWiki] !! html

    MediaWiki

    !! end !!test Bug 34939 - Case insensitive link parsing (HttP://) !! wikitext HttP://MediaWiki.Org/ !! html/php

    HttP://MediaWiki.Org/

    !! html/parsoid

    HttP://MediaWiki.Org/

    !! end !!test Disable TOC !! options notoc !! wikitext Lead == Section 1 == == Section 2 == == Section 3 == == Section 4 == == Section 5 == !! html

    Lead

    Section 1[edit]

    Section 2[edit]

    Section 3[edit]

    Section 4[edit]

    Section 5[edit]

    !! end ### ### Parsoid-specific tests ### Parsoid-PHP parser incompatibilities ### !!test 1. SOL-sensitive wikitext tokens as template-args !!options parsoid=wt2html,wt2wt !! wikitext {{echo|*a}} {{echo|#a}} {{echo|:a}} !! html
    • a
    1. a
    a
    !!end #### ----------------------------------------------------------------- #### Parsoid-specific functionality tests #### ----------------------------------------------------------------- # Bug 63642: Formatting elt fixup is cleaned up. # We know wt2wt will fail, but we expect selser to pass. # Due to the nature of our testing, wt2wt and selser tests will enter the # blacklist and we'll catch selser regressions based on changes to the # blacklist entries for selser tests. !! test Bad treebuilder fixup of formatting elt is cleaned up !! options parsoid=wt2html,wt2wt !! wikitext {| | [[Image:Foobar.jpg|right|Test]] |} !! html/parsoid

    Test

    !! 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 !!options parsoid !! wikitext A foo B foo C !! html

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

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

    A [1] B [1]

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

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

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

    A [1]

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

    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 !!options parsoid !! wikitext A foo bar baz !! html

    A [1]

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

    A [1]

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

    A [1] B C}}

    1. foo {{echo|
    !!end !!test Ref: 9. unclosed comments should not leak out of ref-body !!options parsoid !! wikitext A foo "},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref">[1] B C

    1. foo
    !!end !!test Ref: 10. Unclosed HTML tags should not leak out of ref-body !!options parsoid !! wikitext A foo B C !! html

    A [1] B C

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

    A [1] B C [2] D

    !!end !!test Ref: 12. ref-tags act as trailing newline migration barrier !!options parsoid !! wikitext a b c !! html

    a

    b [1] [2]

    c

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

    [1] A [2] B

    !!end !!test Ref: 14. A nested ref-tag should be emitted as plain text !!options parsoid !! wikitext foo bar baz !! html

    [1]

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

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

    1. 1.0 1.1 foo
    2. 2.0 2.1 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

    A [1]

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

      A [a 1] B [b 1]

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

      A [1]

      1. foo

      B [1]

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

      A [a 1] B [1]

      1. afoo

      C [2]

      1. bfoo
      2. cfoo
      !!end !!test References: 5. ref tags in references should be processed while ignoring all other content !!options parsoid !! wikitext A B bar foo This should just get lost. !! html

      A [1] B [2]

      1. foo
      2. bar
      !!end !!test References: 6. from a transclusion !!options parsoid !! wikitext Foo {{echo|}} !! html [1]
      1. Foo
      !!end !! test References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled !! options parsoid !! wikitext A foo bar for a B foo !! html

      A [1] B [X 1]

      1. foo bar for a
      1. foo
      !! end !! test Entities in ref name !! options parsoid !! wikitext hi !! html

      [1]

      !! end # This test is wt2html only because we're permitting the serializer to produce # dirty diffs, normalizing the unclosed references to the self-closed version. !! test Generate references for unclosed references tag !! options parsoid=wt2html !! wikitext afoo !! html

      a[1]

      1. foo
      !! end !! test New reference serializes on its own line !! options parsoid=wt2wt,html2wt !! wikitext foo !! html foo
        !! end #### ---------------------------------------------------------------- #### The following section of tests are primarily to test #### wikitext escaping capabilities of Parsoid. Given that #### escaping can be done any number of ways, the wikitext (input) #### is always adjusted to reflect how Parsoid adds nowiki #### escape tags. #### #### We are marking several tests as parsoid-only since the #### HTML in the result section is different from what the #### PHP parser generates for it. #### ---------------------------------------------------------------- #### --------------- Headings --------------- #### 0. Unnested #### 1. Nested inside html

        =foo=

        #### 2. Outside heading nest on a single line

        foo

        *bar #### 3. Nested inside html with wikitext split by html tags #### 4. No escape needed #### 5. Empty headings

        #### 6. Heading chars in SOL context #### ---------------------------------------- !! test Headings: 0. Unnested !! options parsoid !! wikitext =foo= =foo= =foo= =foo''a''= !! html

        =foo=

        =foo= =foo=

        =fooa=

        !!end !! test Headings: 1. Nested inside html (New headings and existing headings are handled differently) !! options parsoid=html2wt !! wikitext = =foo= = == =foo= == === =foo= === ==foo== ===foo=== ====foo==== =====foo===== ======foo====== =======foo======= !! html

        =foo=

        =foo=

        =foo=

        =foo=

        =foo=

        =foo=

        =foo=

        =foo=
        =foo=
        !!end !! test Headings: 2. Outside heading nest on a single line

        foo

        *bar !! options parsoid=html2wt !! wikitext = foo = *bar = foo = =bar = foo = =bar= !! html

        foo

        *bar

        foo

        =bar

        foo

        =bar= !!end !! test Headings: 3. Nested inside html with wikitext split by html tags !! options parsoid=html2wt !! wikitext = ='''bold'''foo= = !! html

        =boldfoo=

        !!end !! test Headings: 4a. No escaping needed (testing just h1 and h2) !! options parsoid=html2wt !! wikitext = =foo = = foo= = = =foo= = = =foo= bar = == =foo == == foo= == = ''=''foo= = = = = !! html

        =foo

        foo=

        =foo=

        =foo= bar

        =foo

        foo=

        =foo=

        =

        !!end !! test Headings: 4b. No escaping needed (inside p-tags) !! options parsoid=html2wt !! wikitext === =foo= x =foo= !! html

        === =foo= x =foo=

        !!end !! test Headings: 5. Empty headings !! options parsoid !! wikitext == ==== ====== ======== ========== ============ !! html

        !!end !! test Headings: 6a. Heading chars in SOL context (with trailing spaces) !! options parsoid !! wikitext =a= =a= =a= =a= !! html

        =a=

        =a=

        =a=

        =a=

        !!end !! test Headings: 6b. Heading chars in SOL context (with trailing newlines) !! options parsoid !! wikitext =a= b =a= b =a= b =a= b !! html

        =a= b

        =a= b

        =a= b

        =a= b

        !!end !! test Headings: 6c. Heading chars in SOL context (leading newline break) !! options parsoid !! wikitext a =b= !! html

        a =b=

        !!end !! test Headings: 6d. Heading chars in SOL context (with interspersed comments) !! options parsoid !! wikitext =a= =a= !! html

        =a=

        =a=

        !!end !! test Headings: 6d. Heading chars in SOL context (No escaping needed) !! options parsoid=html2wt !! wikitext =a=
        b
        !! html =a=
        b
        !!end #### --------------- Lists --------------- #### 0. Outside nests (*foo, etc.) #### 1. Nested inside html
        • *foo
        #### 2. Inside definition lists #### 3. Only bullets at start should be escaped #### 4. No escapes needed #### 5. No unnecessary escapes #### 6. Escape bullets in SOL position #### 7. Escape bullets in a multi-line context #### ---------------------------------------- !! test Lists: 0. Outside nests !! wikitext *foo #foo ;Foo:bar !! html

        *foo

        #foo

        ;Foo:bar

        !!end !! test Lists: 1. Nested inside html !! wikitext **foo *#foo *:foo *;foo #*foo ##foo #:foo #;foo !! html
        • *foo
        • #foo
        • :foo
        • ;foo
        1. *foo
        1. #foo
        1. :foo
        1. ;foo
        !!end !! test Lists: 2. Inside definition lists !! wikitext ;;foo ;:foo ;:foo :bar ::foo !! html
        ;foo
        :foo
        :foo
        bar
        :foo
        !!end !! test Lists: 3. Only bullets at start of text should be escaped !! wikitext **foo*bar **foo''it''*bar !! html
        • *foo*bar
        • *fooit*bar
        !!end !! test Lists: 4. No escapes needed !! options parsoid !! wikitext *foo*bar *''foo''*bar *[[Foo]]: bar *[[Foo]]*bar !! html
        • foo*bar
        • foo*bar
        !!end !! test Lists: 5. No unnecessary escapes !! wikitext * bar [[foo]] *=bar [[foo]] *[[bar [[foo]] *]]bar [[foo]] *=bar foo]]= * : a !! html
        • bar [[foo]]
        • =bar [[foo]]
        • [[bar [[foo]]
        • ]]bar [[foo]]
        • =bar foo]]=
        • : a
        !!end !! test Lists: 6. Escape bullets in SOL position !! options parsoid !! wikitext *foo !! html

        *foo

        !!end !! test Lists: 7. Escape bullets in a multi-line context !! wikitext a *b !! html

        a *b

        !!end #### --------------- HRs --------------- #### 1. Single line #### ----------------------------------- !! test HRs: 1. Single line !! options parsoid !! wikitext -------- ----=foo= ----*foo !! html
        ----
        =foo=
        *foo !! end #### --------------- Tables --------------- #### 1a. Simple example #### 1b. No escaping needed (!foo) #### 1c. No escaping needed (|foo) #### 1d. No escaping needed (|}foo) #### #### 2a. Nested in td (foo|bar) #### 2b. Nested in td (foo||bar) #### 2c. Nested in td -- no escaping needed(foo!!bar) #### #### 3a. Nested in th (foo!bar) #### 3b. Nested in th (foo!!bar) #### 3c. Nested in th -- no escaping needed(foo||bar) #### #### 4a. Escape - #### 4b. Escape + #### 4c. No escaping needed #### -------------------------------------- !! test Tables: 1a. Simple example !! wikitext {| |} !! html

        {| |}

        !! end !! test Tables: 1b. No escaping needed !! wikitext !foo !! html

        !foo

        !! end !! test Tables: 1c. No escaping needed !! wikitext |foo !! html

        |foo

        !! end !! test Tables: 1d. No escaping needed !! wikitext |}foo !! html

        |}foo

        !! end !! test Tables: 2a. Nested in td !! options parsoid=html2wt !! wikitext {| |foo|bar |- |x
        a|b
        |} !! html
        foo|bar
        x
        a|b
        !! end !! test Tables: 2b. Nested in td !! options parsoid !! wikitext {| |foo||bar |''it''foo||bar |} !! html
        foo||bar itfoo||bar
        !! end !! test Tables: 2c. Nested in td -- no escaping needed !! options parsoid !! wikitext {| |foo!!bar |} !! html
        foo!!bar
        !! end !! test Tables: 3a. Nested in th !! options parsoid !! wikitext {| !foo!bar |} !! html
        foo!bar
        !! end !! test Tables: 3b. Nested in th !! options parsoid !! wikitext {| !foo!!bar |} !! html
        foo!!bar
        !! end !! test Tables: 3c. Nested in th -- no escaping needed !! options parsoid !! wikitext {| !foo||bar |} !! html
        foo||bar
        !! end !! test Tables: 4a. Escape - !! options parsoid !! wikitext {| !-bar |- |-bar |} !! html
        -bar
        -bar
        !! end !! test Tables: 4b. Escape + !! options parsoid !! wikitext {| !+bar |- |+bar |} !! html
        +bar
        +bar
        !! end !! test Tables: 4c. No escaping needed !! options parsoid !! wikitext {| |foo-bar |foo+bar |- |''foo''-bar |''foo''+bar |- |foo bar|baz +bar -bar |- |x
        a|b
        |} !! html
        foo-barfoo+bar
        foo-barfoo+bar
        foo

        bar|baz +bar -bar

        x
        a|b
        !! end !! test Tables: 4d. No escaping needed !! options parsoid !! wikitext {| |[[Foo]]-bar ||+1 ||-2 |} !! html
        Foo-bar +1 -2
        !! end !! test Tables: Digest broken attributes on table and tr tag !! options parsoid=wt2html !! wikitext {| || |} ++ |- || || ++ -- |- > [ |} !! html
        !! end #### --------------- Links ---------------- #### 1. Quote marks in link text #### 2. Wikilinks: Escapes needed #### 3. Wikilinks: No escapes needed #### 4. Extlinks: Escapes needed #### 5. Extlinks: No escapes needed #### -------------------------------------- !! test Links 1. Quote marks in link text !! options parsoid !! wikitext [[Foo|Foo''boo'']] !! html Foo''boo'' !! end !! test Links 2. WikiLinks: Escapes needed !! options parsoid !! wikitext [[Foo|[Foobar]]] [[Foo|Foobar]]] [[Foo|x [Foobar] x]] [[Foo|x [http://google.com g] x]] [[Foo|[[Bar]]]] [[Foo|x [[Bar]] x]] [[Foo||Bar]] [[Foo|]]bar]] [[Foo|[[bar]] [[Foo|x [[ y]] [[Foo|x ]] y]] [[Foo|x ]] y [[ z]] !! html [Foobar] Foobar] x [Foobar] x x [http://google.com g] x [[Bar]] x [[Bar]] x |Bar ]]bar [[bar x [[ y x ]] y x ]] y [[ z !! end !! test Links 3. WikiLinks: No escapes needed !! options parsoid !! wikitext [[Foo|[Foobar]] [[Foo|foo|bar]] !! html [Foobar foo|bar !! end !! test Links 4. ExtLinks: Escapes needed !! options parsoid !! wikitext [http://google.com [google]] [http://google.com google]] [http://google.com] [http://google.com google] !! html

        [google] google]

        [http://google.com]

        [http://google.com google]

        !! end !! test Links 5. ExtLinks: No escapes needed !! options parsoid !! wikitext [http://google.com [google] !! html [google !! end !! test Links 6. Add s between text-nodes and url-links when required (bug 64300) !! html/parsoid

        xhttp://example.comy http://example.com?x http://example.com&x http://example.com'x http://example.com,x http://example.com.x http://example.com;x http://example.com:x http://example.com;x http://example.com!x http://example.com=x http://example.com(x) http://example.com(x)

        !! wikitext xhttp://example.comy http://example.com?x http://example.com&x http://example.com'x http://example.com,x http://example.com.x http://example.com;x http://example.com:x http://example.com;x http://example.com!x http://example.com=x http://example.com(x) http://example.com(x) !! end !! test Links 7a. Don't add spurious s between text-nodes and url-links (bug 64300) !! html/parsoid

        x http://example.com y "http://example.com" (http://example.com) (http://example.com) foo http://example.com, http://example.com, foo

        !! wikitext x http://example.com y "http://example.com" (http://example.com) (http://example.com) foo http://example.com, http://example.com, foo !! end ## Parsoid currently fails wt2html on this one! !! test Links 7b. Don't add spurious s between text-nodes and url-links (bug 64300) !! html/parsoid

        http://example.com.,;:!?

        !! wikitext http://example.com.,;:!? !! end !! test Links 8. Add s between text-nodes and RFC-links when required (bug 64300) !! html/parsoid

        RFC 1234

        !! wikitext RFC 1234 !! end !! test Links 9. Don't add spurious s between text-nodes and RFC-links (bug 64300) !! html/parsoid

        xRFC 123y XRFC 123y RFC 123?foo RFC 123&foo

        !! wikitext xRFC 123y XRFC 123y RFC 123?foo RFC 123&foo !! end !! test Links 10. Add s between text-nodes and PMID-links when required (bug 64300) !! html/parsoid

        PMID 1234 !! wikitext PMID 1234 !! end !! test Links 11. Don't add spurious s between text-nodes and PMID-links (bug 64300) !! html/parsoid

        xPMID 123y XPMID 123y PMID 123?foo PMID 123&foo

        !! wikitext xPMID 123y XPMID 123y PMID 123?foo PMID 123&foo !! end !! test Links 12. Add s between text-nodes and ISBN-links when required (bug 64300) !! html/parsoid

        ISBN 12345678901 ISBN 1234567890x ISBN 1234567890b

        !! wikitext ISBN 12345678901 ISBN 1234567890x ISBN 1234567890b !! end !! test Links 12. Don't add spurious s between text-nodes and ISBN-links (bug 64300) !! html/parsoid

        ISBN 1234567890's !! wikitext ISBN 1234567890's !! end #### --------------- Quotes --------------- #### 1. Quotes inside and #### 2. Link fragments separated by and tags #### 3. Link fragments inside and #### 4. No escaping needed #### -------------------------------------- !! test 1. Quotes inside and !! options parsoid=html2wt,wt2wt !! wikitext '''foo''' ''''foo'''' '''''foo''''' ''foo'''s ''''foo'''' '''''foo''''' ''''''foo'''''' '''foo'''bar'''baz''' '''foo''''s '''foo'' ''foo''' '''foo''' ''''foo''' '''foo'''' ''''foo'''' ''fools' errand'' ''fool's errand'' !! html

        'foo' ''foo'' '''foo''' foo's 'foo' ''foo'' '''foo''' foo'bar'baz foo's 'foo foo' 'foo' 'foo foo' 'foo'

        fools' errand fool's errand !! end !! test 2. Link fragments separated by and tags !! wikitext [[''foo''hello]] [['''foo'''hello]] !! html

        [[foohello]]

        [[foohello]]

        !! end !! test 3. Link fragments inside and (FIXME: Escaping one or both of [[ and ]] is also acceptable -- this is one of the shortcomings of this format) !! wikitext ''[[foo'']] '''[[foo''']] !! html

        [[foo]]

        [[foo]]

        !! end !! test 4. No escaping needed !! wikitext '''bar''' ''''bar'''' !! html

        'bar' 'bar'

        !! end #### ----------- Paragraphs --------------- #### 1. No unnecessary escapes #### -------------------------------------- !! test 1. No unnecessary escapes !! wikitext bar [[foo]] =bar [[foo]] [[bar [[foo]] ]]bar [[foo]] =bar foo]]= !! html

        bar [[foo]]

        =bar [[foo]]

        [[bar [[foo]]

        ]]bar [[foo]]

        =bar foo]]=

        !!end #### ----------------------- PRE -------------------------- #### 1. Leading whitespace in SOL context should be escaped #### ------------------------------------------------------ !! test 1. Leading whitespace in SOL context should be escaped !! options parsoid !! wikitext a a a(tab) a a a b a b a b !! html

        a

        a

        a(tab)

        a

        a

        a b

        a b

        a b

        !! end !! test 2. Leading whitespace in non-indent-pre contexts should not be escaped !! options parsoid !! wikitext foo ''a'' b !! html

        foo [1]

        !! end !! test 3. Leading whitespace in indent-pre suppressing contexts should not be escaped !! options parsoid !! wikitext
        a b c
        !! html

        a b c

        !! end !! test 4. Leading whitespace in indent-pre suppressing contexts should not be escaped !! options parsoid !! wikitext [[File:Foobar.jpg|thumb|caption]] !! html !! html/parsoid
        caption
        !! end !! test 5. Nowiki escaping should account for indent-pres !! options parsoid=html2wt !! html
        ==foo==
        !! wikitext ==foo== !! end #### --------------- Behavior Switches -------------------- !! test 1. Valid behavior switches should be escaped !! options parsoid=html2wt !! wikitext __TOC__ ''__TOC__'' !! html __TOC__ __TOC__ !! end !! test 2. Invalid behavior switches should not be escaped !! options parsoid=html2wt !! wikitext __TOO__ __|__ !! html __TOO__ __|__ !! end #### --------------- HTML tags --------------- #### 1. a tags #### 2. other tags #### 3. multi-line html tag #### 4. extension tags #### ----------------------------------------- !! test 1. a tags !! options parsoid !! wikitext google !! html <a href="http://google.com">google</a> !! end !! test 2. other tags !! wikitext
        foo
        foo
        !! html

        <div>foo</div> <div style="color:red">foo</div>

        !! end !! test 3. multi-line html tag !! wikitext
        foo
        !! html

        <div >foo</div >

        !! end !! test 4. extension tags !! wikitext foo bar baz
        !! html

        <ref>foo</ref>

        <ref>bar

        baz</ref>

        !! end #### --------------- Others --------------- !! test Escaping nowikis !! wikitext <nowiki>foo</nowiki> !! html

        <nowiki>foo</nowiki>

        !! end ## The quote-char in the input is necessary for triggering the bug !! test (Bug 52035) Nowiki-escaping should not get tripped by " :" in text !! options parsoid=wt2wt,html2wt !! wikitext foo's bar : !! html

        foo's bar :

        !! end !! test Tag-like HTML structures are passed through as text !! wikitext 1>2 xb 1f !! html

        <x y>

        <x.y>

        <x-y>

        1>2

        x<y

        a>b

        1<d e>f

        !! end # This was a bug in the PHP parser (see bug 17663 and its dups, # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663) !! test Tag names followed by punctuation should not be recognized as tags !! wikitext text !! html

        <s.ome> text

        !! end !! test HTML tag with necessary entities in attributes !! wikitext foo !! html

        foo

        !! end !! test HTML tag with 'unnecessary' entity encoding in attributes !! wikitext foo !! html

        foo

        !! end !! test HTML tag with broken attribute value quoting !! wikitext Foo

        !! end !! test Parsoid-only: HTML tag with broken attribute value quoting !! options parsoid !! wikitext Foo

        !! end !! test Table with broken attribute value quoting !! wikitext {| | title="Hello world|Foo |} !! html/php
        Foo
        !! html/parsoid
        Foo
        !! end !! test Table with broken attribute value quoting on consecutive lines !! wikitext {| | title="Hello world|Foo | style="color:red|Bar |} !! html
        Foo Bar
        !! end !! test Parsoid-only: Table with broken attribute value quoting on consecutive lines !! options parsoid !! wikitext {| | title="Hello world|Foo | style="color:red|Bar |} !! html
        Foo Bar
        !! end !! test Parsoid-only: Don't wrap broken template tags in on wt2wt (Bug 42353) !! options parsoid !! wikitext {{}} !! html {{}} !! end !! test Parsoid-only: Don't wrap broken template tags in on wt2wt (Bug 42353) !! options parsoid !! wikitext }}{{ !! html }}{{ !! end !!test Accept empty td cell attribute !! wikitext {| | align="center" | foo || | |} !! html
        foo
        !!end !!test Non-empty attributes in th-cells !! wikitext {| ! Foo !! style="color: red" | Bar |} !! html
        Foo Bar
        !!end !!test Accept empty attributes in th-cells !! wikitext {| !| foo !!| bar |} !! html
        foo bar
        !!end !!test Empty table rows go away !! wikitext {| | Hello | there |- class="foo" |- |} !! html
        Hello there
        !! end ### ### Parsoid-centric tests for testing RTing of inter-element separators ### Edge cases not tested by existing parser tests and specific to ### Parsoid-specific serialization strategies. ### !!test RT-ed inter-element separators should be valid separators !! wikitext {| |- [[foo]] |} !! html
        !!end !!test Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out (Parsoid-only since PHP parser relies on Tidy for correct output) !!options parsoid !! wikitext {| |foo bar |} {| |foo |} !! html !!end !!test Empty TD followed by TD with tpl-generated attribute !! wikitext {| |- | |{{echo|style='color:red'}}|foo |} !! html
        foo
        !!end !!test Indented table with an empty td !! wikitext {| |- | |foo |} !! html
        foo
        !!end !!test Indented block & table !! wikitext
        foo
        {| |foo |} !! html/php
        foo
        foo
        !! html/parsoid
        foo
        foo
        !!end !! test Indent and comment before table row !! wikitext {| |- | there |} !! html/php
        there
        !! html/parsoid
        there
        !! end !!test Empty TR followed by a template-generated TR (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext) !!options parsoid !! wikitext {| |- {{echo|foo}} |} !! html
        foo
        !!end ## PHP and parsoid output differ for this, and since this is primarily ## for testing Parsoid's serializer, marking this Parsoid only !!test Empty TR followed by mixed-ws-comment line should RT correctly !!options parsoid !! wikitext {| |- |- |} !! html
        !!end !!test Multi-line image caption generated by templates with/without trailing newlines !!options parsoid !! wikitext [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]] [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]] !! html
        File:Foo.jpg
        foo\nA\nB\nC
        File:Foo.jpg
        foo\nA\nB\nC\n\n
        !!end !! test New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly !! options parsoid=html2wt !! wikitext foo new para [[./Category:Foo]] = new heading = !! html

        new para

        new heading

        !! end ## PHP emits broken html for this, and since this is primarily ## a Parsoid serializer test, marking this Parsoid only !!test Improperly nested inline or quotes tags with whitespace in between !!options parsoid !! wikitext x ''' ''x''' '' !! html

        x x

        !!end !!test Encapsulate protected attributes from wt !!options parsoid !! wikitext
        foo
        !! html
        foo
        !!end ## Currently the p-wrapper is fragile in how it adds / removes transformations. ## Having nested or stray pre tags results in the attempt to add duplicates, ## causing an assertion fail. This test tries to prevent that situation. !!test Ensure ParagraphWrapper can deal with stray closing pre tags !!options parsoid=wt2html !! wikitext plain text
        !! html plain text !!end !!test 1. Ensure fostered text content is wrapped in spans !!options parsoid=wt2html !! wikitext hi
        ho
        !! html hi
        ho
        !!end !!test 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost) !!options parsoid=wt2html,wt2wt !! wikitext || ||
        a
        !! html || ||
        a
        !!end !!test Encapsulation properly handles null DSR information from foster box !!options parsoid=wt2html,wt2wt !! wikitext {{echo|foo
        bar
        }} !! html foo
        bar
        !!end !!test 1. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext {{echo|foo}}
        bar
        !! html foo
        bar
        !!end !!test 2. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext
        {{echo|foo}}
        bar
        !! html
        foo
        bar
        !!end !!test 3. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext

        {{echo|foo

        }}bar
        !! html

        foo

        bar
        !!end !!test 4. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext

        {{echo|foo

        }}bar
        !! html

        foo

        bar
        !!end !!test 5. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext foo}}

        {{echo|foo

        !! html foo

        foo

        !!end !!test 6. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext foo

        {{echo|foo

        }}

        ok

        !! html foo

        foo

        ok

        !!end !!test 7. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext {{echo|

        foo

        }}
        bar
        !! html

        foo

        bar
        !!end !!test 8. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext {{echo|a }}{|{{echo|style='color:red'}} |- |b |} !! html

        a

        {{{1}}}
        b
        !!end !!test 9. Encapsulate foster-parented transclusion content !!options parsoid=wt2wt,wt2html !! wikitext {{echo|hi
        hello}} !! html hi
        hello !!end !!test Table in fosterable position !!options parsoid=wt2html,wt2wt !! wikitext {{OpenTable}}
        {| |}
        |} !! html
        !!end # Parsoid only for bug 64747 !! test Properly encapsulate empty-content transclusions in fosterable positions !! wikitext {{#if:| }}
        foo
        !! html/parsoid
        !! end !!test Support element with .data attribute !!options parsoid=html2wt !! wikitext !! html !!end # ----------------------------------------------------------------- # The following section of tests are primarily to spec requirements # around serialization of new/edited content. # # All these tests are marked Parsoid html2wt and html2html only # ---------------------------------------------------------------- !! test Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869) !! options parsoid=html2wt language=es !! wikitext [[Foo]] !! html

        Foo

        !! end !! test Image: Modifying size of an image (1) !! options parsoid={ "modes": ["wt2wt"], "changes": [ ["img[height]", "attr", "height", "22"], ["img[width]", "attr", "width", "200"] ] } !! wikitext [[Image:Foobar.jpg|230x230px]] !! wikitext/edited [[Image:Foobar.jpg|200x200px]] !!end !! test Image: Modifying size of an image (2) !! options parsoid={ "modes": ["wt2wt"], "changes": [ ["img[height]", "attr", "height", "100"], ["img[width]", "attr", "width", "500"] ] } !! wikitext [[Image:Foobar.jpg|230x230px]] !! wikitext/edited [[Image:Foobar.jpg|500x500px]] !!end # Change in size is ignored so long as class='mw-default-size' !! test Image: Modifying size of an image (3) !! options parsoid={ "modes": ["wt2wt"], "changes": [ ["figure[class]", "removeClass", "mw-default-size"], ["figure img", "attr", "height", "19"], ["figure img", "attr", "width", "170"] ] } !! wikitext [[Image:Foobar.jpg|thumb]] !! wikitext/edited [[Image:Foobar.jpg|thumb|170x170px]] !!end !! test Image: Modifying alignment of an image (bug 48665) !! options parsoid={ "modes": ["wt2wt"], "changes": [ ["figure[class]", "removeClass", "mw-halign-right"], ["figure[class]", "addClass", "mw-halign-left"] ] } !! wikitext [[Image:Foobar.jpg|thumb|caption|right]] !! wikitext/edited [[Image:Foobar.jpg|thumb|caption|left]] !! end !! test Image: Modifying mw-default-size of an frameless image (bug 62805) !! options parsoid={ "modes": ["wt2wt"], "changes": [ ["figure.mw-default-size", "removeClass", "mw-default-size"] ] } !! wikitext [[Image:Foobar.jpg|frameless|right]] !! wikitext/edited [[Image:Foobar.jpg|frameless|right|220x220px]] !! end !! test Image: Modifying valign of an image (bug 49221) !! options parsoid={ "modes": ["wt2wt"], "changes": [ ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"], ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"] ] } !! wikitext [[File:Foobar.jpg|20px|middle]] !! wikitext/edited [[File:Foobar.jpg|20px|text-top]] !! end !! test Image: Modifying alt attribute of an image (bug 56400) !! options parsoid={ "modes": ["wt2wt"], "changes": [ ["img[alt]", "attr", "alt", "some alternate edited text"] ] } !! wikitext [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]] !! wikitext/edited [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]] !!end !! test Image: Modifying caption of an image !! options parsoid={ "modes": ["wt2wt"], "changes": [ ["figcaption", "text", "new caption"] ] } !! wikitext [[Image:Foobar.jpg|thumb|original caption]] !! wikitext/edited [[Image:Foobar.jpg|thumb|new caption]] !!end !! test Image: empty alt attribute (bug 48924) !! options parsoid !! wikitext [[File:Foobar.jpg|thumb|alt=|bar]] !! html
        bar
        !! end #!! test #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852) #!! options #parsoid=html2wt #language=ar #!! input #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]] #!! result #
        #!! end !! test Image: Block level image should have \n before and after !! options parsoid !! wikitext 123 [[File:Foobar.jpg|right|thumb|150x150px]] 456 !! html

        123

        456

        !!end !! test Image: New block level image should have \n before and after (existing content) !! options parsoid !! wikitext 123 [[File:Foobar.jpg|right|thumb|150x150px]] 456 !! html

        123

        456

        !!end !! test Image: upright option (parsoid) !! options parsoid !! wikitext [[File:Foobar.jpg|thumb|upright|caption]] [[File:Foobar.jpg|thumb|upright=0.5|caption]] [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]] !! html
        caption
        caption
        caption
        !!end !! test Image: upright option is ignored on inline and frame images (parsoid) !! options parsoid !! wikitext [[File:Foobar.jpg|500x500px|upright=0.5|caption]] !! html

        !!end !! test Image: from basic HTML (1) !! options parsoid=html2wt !! html/parsoid Alt !! wikitext [[File:Foobar.jpg|link=|alt=Alt|100x100px]] !! end !! test Image: from basic HTML (2) !! options parsoid=html2wt !! html/parsoid Alt !! wikitext [[File:Foobar.jpg|link=|alt=Alt|100x100px]] !! end !! test Image: from basic HTML (3) !! options parsoid=html2wt !! html/parsoid Alt !! wikitext [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]] !! end !! test Image: from basic HTML (4) !! options parsoid=html2wt !! html/parsoid !! wikitext [[File:Foobar.jpg|link=]] !! end !! test Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does) !! options parsoid=html2wt !! wikitext * foo !! html
        • foo

        !! end !! test Lists: Serialize correctly even when list tags has unneeded whitespace between tags !! options parsoid=html2wt !! wikitext * foo !! html
        • foo
        !! end !! test Don't strip leading whitespace when handling indent-pre suppressing tags !! options parsoid=html2wt !! wikitext {| | indented row |}
        '''This is very bold of you!''' {| | indented cell (no pre-wrapping!) |}
        foo
        bar
        !! html
        indented row

        This is very bold of you!

        indented cell (no pre-wrapping!)

        foo

        bar
        !! end !! test Nowiki-wrap leading whitespace when handling indent-pre inducing tags !! options parsoid=html2wt !! wikitext foo bar foo2 bar2
        foo
        bar
        foo
        !! html

        foo

        bar foo2 bar2
        foo
        bar
        foo
        !! end !! test Lists: Add space after bullets !! options parsoid=html2wt !! wikitext * foo * bar * baz !! html
        • foo
        • bar
        • baz
        !! end !! test Lists: Dont insert newlines in a serialized list item. !! options parsoid=html2wt !! wikitext * a
        b * c !! html
        • a
          b
        • c
        !! end !! test Headings: Add space before/after == (Bug 51744) !! options parsoid=html2wt !! wikitext == foo == == bar == == baz == == baz == !! html

        foo

        bar

        baz

        baz

        !! end !! test Parsoid: Serialize positional parameters with = in them as named parameter !! options parsoid=html2wt !! wikitext {{echo|1 = f=oo}} {{echo|1 = f=oo|2 = bar}} {{echo|f=oo|bar}} !! html

        foo

        foo

        foo

        !! end !! test Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes !! options parsoid=html2wt !! wikitext
        a b
        a b
        a b
        !! html
        a

        b

        a

        b

        a

        b

        !! end !! test Substrings resembling wikitext in hrefs should not get nowiki escapes !! options parsoid=html2wt !! wikitext [[Foo''bar''baz]] !! html Foo''bar''baz !! end #----------------------------- # I/B quote minimization tests #----------------------------- !! test 1. I/B quote minimization: wikitext-only tags should be combined !! options parsoid=html2wt !! wikitext ''AB'' '''AB''' ''A'''B''''' '''A''B''''' '''A''BC''D''' '''''AB''''' '''''AB''''' '''''AB''''' !! html

        AB

        AB

        AB

        AB

        ABCD

        AB

        AB

        AB

        !! end !! test 2. I/B quote minimization: wikitext and html tags should not be combined !! options parsoid=html2wt !! wikitext ''A''B ''A'''''B''' !! html

        AB

        AB

        !! end !! test 3. I/B quote minimization: templated content stops minimization !! options parsoid=html2wt !! wikitext ''A''{{echo|''B''}} ''A''{{echo|'''''B'''''}} !! html

        AB

        AB !! end !! test 4. I/B quote minimization: new content should be mimimized with adjacent old content !! options parsoid=html2wt !! wikitext ''AB'' '''AB''' ''A'''B''''' !! html

        AB

        AB

        AB

        !! end #------------------------------------ # End of I/B quote minimization tests #------------------------------------ !!test Bug 54262: New entities !! options parsoid=html2wt !! wikitext   !! html   !! end ## Note that there is no wikitext output for 'unknownproperty' ## ## Unknown magic words are silently dropped ## !! test Magic words !! options parsoid=html2wt !! wikitext __TOC__ __NOTOC__ __FORCETOC__ __INDEX__ __NOINDEX__ __NOGALLERY__ __NOEDITSECTION__ __NOTITLECONVERT__ __NOCONTENTCONVERT__ !! html !! end !! test Consecutive
        s should not get merged
        !! options
        parsoid=html2wt,html2html
        !! wikitext
         a
        
         b
        
         c
        
         d
        
         e
         
        
         
         f
        !! html
        
        a
        b
        c
        
        d
        e
        
        
        
        f
        !! end !! test Edited ISBN links not serializable as ISBN links should serialize as wikilinks !! options parsoid=html2wt !! wikitext [[Special:BookSources/1234567890|ISBN 1234567895]] !! html ISBN 1234567895 !! end !! test Edited RFC links not serializable as RFC links should serialize as extlinks !! options parsoid=html2wt !! wikitext [//tools.ietf.org/html/rfc123 New RFC] !! html New RFC !! end !! test Edited PMID links not serializable as PMID links should serialize as extlinks !! options parsoid=html2wt !! wikitext [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID] !! html New PMID !! end !! test Edited Redirect link should emit a non-piped wikitext link !! options parsoid=html2wt !! wikitext #REDIRECT [[Bar]] !! html !! end # ----------------------------------------------------------------- # End of section for Parsoid-only html2wt tests for serialization # of new content # ----------------------------------------------------------------- TODO: more images more tables character entities and much more Try for 100% code coverage