X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FparserTests.txt;h=03763613a80f9574631d22ae7363b13c3ed81a61;hb=1bb1a2c843a6defa2961ea5acb66397e0ecd0f86;hp=72ea016ffc66a13da59cd63814dca529a2b2d9f4;hpb=56dcef68206b0b86e403306817a3c6f1465be140;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 72ea016ffc..03763613a8 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1,12 +1,45 @@ # MediaWiki Parser test cases -# see also http://meta.wikimedia.org/wiki/Parser_testing +# 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) +# title=[[XXX]] run test using article title XXX +# disabled do not run test +# +# 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 + +### +### Basic tests +### !! test Blank input !! input !! result !! end + !! test Simple paragraph !! input @@ -25,6 +58,7 @@ Simple list + !! end !! test @@ -60,6 +94,7 @@ Italics and bold
  • plainboldbold-italicplain
  • plain l'italicplain
  • + !! end ### @@ -117,23 +152,25 @@ nowiki 3 + !! end ### -### comment test cases +### Comments ### !! test -comment test 1 +Comment test 1 !! input asdf !! result
    asdf
     
    + !! end !! test -comment test 2 +Comment test 2 !! input asdf @@ -145,7 +182,7 @@ jkl !! end !! test -comment test 3 +Comment test 3 !! input asdf @@ -158,7 +195,7 @@ jkl !! end !! test -comment test 4 +Comment test 4 !! input asdfjkl !! result @@ -166,63 +203,411 @@ asdfjkl

    !! end +!! test +Comment spacing +!! input +a + b +c +!! result +

    a +

    +
     b 
    +
    +

    c +

    +!! end + +### +### Preformatted text +### +!! test +Preformatted text +!! input + This is some + Preformatted text + With ''italic'' + And '''bold''' + And a [[Main Page|link]] +!! result +
    This is some
    +Preformatted text
    +With italic
    +And bold
    +And a link
    +
    +!! end + +### +### Definition lists +### +!! test +Simple definition +!! input +; name : Definition +!! result +
    name 
    Definition +
    + +!! end + +!! test +Simple definition +!! input +: Indented text +!! result +
    Indented text +
    + +!! end + +!! test +Definition list with no space +!! input +;name:Definition +!! result +
    name
    Definition +
    + +!!end + +!! test +Definition list with URL link +!! input +; http://example.com/ : definition +!! result +
    http://example.com/ 
    definition +
    + +!! end + +!! test +Definition list with bracketed URL link +!! input +;[http://www.google.com/ Google]:Number one search engine +!! result +
    Google
    Number one search engine +
    + +!! end + +!! test +Definition list with wikilink containing colon +!! input +; [[Help:FAQ]]: The least-read page on Wikipedia +!! result +
    Help:FAQ
    The least-read page on Wikipedia +
    + +!! end + +# At Brion's and JeLuF's insistence... :) +!! test +Definition list with wikilink containing colon +!! input +; news:alt.wikipedia.rox: This isn't even a real newsgroup! +!! result +
    news:alt.wikipedia.rox
    This isn't even a real newsgroup! +
    + +!! end + +!! test +Malformed definition list with colon +!! input +; news:alt.wikipedia.rox -- don't crash or enter an infinite loop +!! result +
    news:alt.wikipedia.rox — don't crash or enter an infinite loop +
    + +!! end + +!! test +Definition lists: colon in external link text +!! input +; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up +!! result +
    Wikipedia : The Next Generation
    OK, I made that up +
    + +!! end + + ### ### External links ### !! test -External links 1-4 +External links: non-bracketed !! input Non-bracketed: http://example.com +!! result +

    Non-bracketed: http://example.com +

    +!! end +!! test +External links: numbered +!! input Numbered: [http://example.com] +Numbered: [http://example.net] +Numbered: [http://example.org] +!! result +

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

    +!!end +!! test +External links: specified text +!! input Specified text: [http://example.com link] +!! result +

    Specified text: link +

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

    Linktrails should not work for external links: links +

    +!! end -Trail (not sure if this is meant to work): [http://example.com link]s +!! test +External links: dollar sign in URL +!! input +http://example.com/1$2345 !! result -

    Non-bracketed: http://example.com -

    Numbered: [1] (http://example.com) -

    Specified text: link (http://example.com) -

    Trail (not sure if this is meant to work): links (http://example.com) +

    http://example.com/1$2345

    !! end -# todo: enable these !! test -!! disabled -External links +External links: dollar sign in URL (named) +!! input +[http://example.com/1$2345] +!! result +

    [1] +

    +!!end + +!! test +External image !! input -Unrecognised characters (for no good reason): http://example.com/1$2345 [http://example.com/1$2345] External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png +!! result +

    External image: Ncwikicol.png +

    +!! end + +!! test +External image from https +!! input External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png +!! result +

    External image from https: Ncwikicol.png +

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

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

    +!! end + +!! test +External links: terminating separator +!! input Terminating separator: http://example.com/thing, +!! result +

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

    +!! end + +!! test +External links: intervening separator +!! input Intervening separator: http://example.com/1,2,3 +!! result +

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

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

    Old bug with URL in query: link +

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

    And again with mixed protocols: link +

    +!!end + +!! test +External links: URL in text +!! input URL in text: [http://example.com http://example.com] +!! result +

    URL in text: http://example.com +

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

    ja-style clickable images: Ncwikicol.png +

    +!!end + +!! test +External links: raw ampersand +!! input Old & use: http://x&y -Escaping without &: http://x&y -!! result -

    Unrecognised characters (for no good reason): http://example.com/1$2345 -[http://example.com/1$2345]

    -

    External image: test.jpg

    -

    External image from https: test.jpg

    -

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

    -

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

    -

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

    -

    Old bug with URL in query: [http://example.com/thing?url=http://example.com -link]

    -

    And again with mixed protocols: [ftp://example.com?url=http://example.com -link]

    -

    URL in text: http://example.com (http://example.com)

    -

    ja-style clickable images: Ncwikicol.png (http://example.com)

    -

    Old & use: http://x&y

    -

    Escaping without &: http://x&y

    +!! result +

    Old & use: http://x&y +

    +!! end + +!! test +External links: encoded ampersand +!! input +Old & use: http://x&y +!! result +

    Old & use: http://x&y +

    +!! end + +!! test +External links: [raw ampersand] +!! input +Old & use: [http://x&y] +!! result +

    Old & use: [1] +

    +!! end + +!! test +External links: [encoded ampersand] +!! input +Old & use: [http://x&y] +!! result +

    Old & use: [1] +

    +!! end + +!! test +External links: www.jpeg.org (bug 554) +!! input +http://www.jpeg.org +!!result +

    http://www.jpeg.org +

    +!! end + +!! test +External links: URL within URL (original bug 2) +!! input +[http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp] +!! result +

    [1] +

    +!! end + +!! test +BUG 361: URL inside bracketed URL +!! input +[http://www.example.com/foo http://www.example.com/bar] +!! result +

    http://www.example.com/bar +

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

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

    +!! end + +!! test +BUG 289: ">"-token in URL-tail +!! input +http://www.example.com/ +!! result +

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

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

    http://www.example.com/html +

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

    <hello> stuff +

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

    html stuff +

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

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

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

    "hello" stuff +

    +!!end + +!! test +External links: invalid character +!! input +[http://www.example.com test] +!! result +

    [http://www.example.com test] +

    !! end ### @@ -277,62 +662,1612 @@ Normal text. !! end ### -### Internal links +### Tables +### +### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables ### + +# This should not produce
    as
    +# is the bare minimun required by the spec, see: +# http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables !! test -Internal links +A table with no data. !! input -Plain link, capitalized: [[Main Page]] - -Plain link, uncapitalized: [[main Page]] +{||} !! result -

    Plain link, capitalized: Main Page -

    Plain link, uncapitalized: main Page -

    !! end +# A table with nothing but a caption is invalid XHTML, we might want to render +# this as

    caption

    !! test -Internal links 2 -!! disabled -!!input +A table with nothing but a caption +!! input +{| +|+ caption +|} +!! result + + + +
    caption +
    +
    +!! end -Piped link: [[Main Page|The Main Page]] +!! test +Simple table +!! input +{| +| 1 || 2 +|- +| 3 || 4 +|} +!! result + + + + +
    1 2 +
    3 4 +
    -Broken link: [[Zigzagzogzagzig]] +!! end -Link with prefix: XXX[[main Page]], XXX[[Main Page]] +!! test +Multiplication table +!! input +{| 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 +|} +!! result + + + + + + + + + + + + + +
    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 +Table rowspan +!! input +{| align=right 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 +|} +!! result + + + + +
    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 +!! input +{| border=1 +| α +| +{| bgcolor=#ABCDEF border=2 +|nested +|- +|table +|} +|the original table again +|} +!! result + + +
    α + + + + + +
    nested +
    table +
    +
    the original table again +
    + +!! end + +!! test +Invalid attributes in table cell (bug 1830) +!! input +{| +|Cell:|broken +|} +!! result + + +
    broken +
    + +!! end + + +### +### Internal links +### +!! test +Plain link, capitalized +!! input +[[Main Page]] +!! result +

    Main Page +

    +!! end + +!! test +Plain link, uncapitalized +!! input +[[main Page]] +!! result +

    main Page +

    +!! end + +!! test +Piped link +!! input +[[Main Page|The Main Page]] +!! result +

    The Main Page +

    +!! end + +!! test +Broken link +!! input +[[Zigzagzogzagzig]] +!! result +

    Zigzagzogzagzig +

    +!! end + +!! test +Link with prefix +!! input +xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]] +!! result +

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

    +!! end + +!! test +Link with suffix +!! input +[[Main Page]]xxx, [[Main Page]]XXX +!! result +

    Main Pagexxx, Main PageXXX +

    +!! end + +!! test +Link with 3 brackets +!! input +[[[main page]]] +!! result +

    [[[main page]]] +

    +!! end + +!! test +Piped link with 3 brackets +!! input +[[[main page|the main page]]] +!! result +

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

    +!! end -Link with suffix: [[Main Page]]XXX +!! test +Link with multiple pipes +!! input +[[Main Page|The|Main|Page]] +!! result +

    The|Main|Page +

    +!! end -Link with 3 brackets: [[[main page]]] +!! test +Link to namespaces +!! input +[[Talk:Parser testing]], [[Meta:Disclaimers]] +!! result +

    Talk:Parser testing, Meta:Disclaimers +

    +!! end -Piped link with 3 brackets: [[[main page|the main page]]] +!! test +Piped link to namespace +!! input +[[Meta:Disclaimers|The disclaimers]] +!! result +

    The disclaimers +

    +!! end -Link to namespaces: [[Talk:Parser testing]], [[Meta:Disclaimers]] +!! test +Link containing } +!! input +[[Usually caused by a typo (oops}]] +!! result +

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

    +!! end -Piped link to namespace: [[Meta:Disclaimers|The disclaimers]] +!! test +Link containing % (not as a hex sequence) +!! input +[[7% Solution]] +!! result +

    7% Solution +

    +!! end -Link to category: [[:Category:MediaWiki User's Guide]] +!! test +Link containing % as a single hex sequence interpreted to char +!! input +[[7%25 Solution]] +!! result +

    7% Solution +

    +!!end -Link to image page: [[:Image:Ncwikicol.png]] +!! test +Link containing % as a double hex sequence interpreted to hex sequence +!! input +[[7%2525 Solution]] +!! result +

    [[7%2525 Solution]] +

    +!!end -Plain link to URL: [[http://www.example.org]] +!! test +Plain link to URL +!! input +[[http://www.example.org]] +!! result +

    [[1]] +

    +!! 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 +!! input Piped link to URL: [[http://www.example.org|an example URL]] !! result -

    Piped link: The Main Page

    -

    Broken link: Zigzagzogzagzig

    -

    Link with prefix: xxxmain Page, xxxMain Page, Xxxmain Page XXXmain Page, XXXMain Page

    -

    Link with suffix: Main Pagexxx, Main PageXXX

    -

    Link with 3 brackets: [[[main page]]]

    -

    Piped link with 3 brackets: [[[main page|the main page]]]

    -

    Link to namespaces: Talk:Parser testing, -Meta:Disclaimers

    -

    Piped link to namespace: The disclaimers

    -

    Link to category: Category:MediaWiki User's Guide

    -

    Link to image page: Image:Ncwikicol.png

    -

    Plain link to URL: [[1] (http://www.example.org)]

    -

    Piped link to URL: an example URL

    +

    Piped link to URL: [example URL] +

    +!! end + +!! test +BUG 2: [[page|http://url/]] should link to page, not http://url/ +!! input +[[Main Page|http://url/]] +!! result +

    http://url/ +

    +!! end + +!! test +BUG 337: Escaped self-links should be bold +!! options +title=[[Bug462]] +!! input +[[Bug462]] [[Bug462]] +!! result +

    Bug462 Bug462 +

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

    Main Page#section +

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

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

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

    MeatBall:SoftSecurity +

    +!! end + +!! test +Interwiki link encoding conversion (bug 1636) +!! input +*[[Wikipedia:ro:Olteniţa]] +*[[Wikipedia:ro:Olteniţa]] +!! result + + +!! end + +## +## XHTML tidiness +### + +!! test +
    to
    +!! input +1
    2
    3 +!! result +

    1
    2
    3 +

    +!! end + +!! test +Incorrecly removing closing slashes from correctly formed XHTML +!! input +
    +!! result +


    +

    +!! end + +!! test +Failing to transform badly formed HTML into correct XHTML +!! input +
    +
    +
    +!! result +


    +
    +
    +

    +!!end + +!! test +Horizontal ruler (should it add that extra space?) +!! input +
    +
    +foo
    bar +!! result +
    +
    +foo
    bar +!! end + +### +### Block-level elements +### +!! test +Common list +!! input +*Common list +* item 2 +*item 3 +!! result +
    • Common list +
    • item 2 +
    • item 3 +
    + +!! end + +!! test +Numbered list +!! input +#Numbered list +#item 2 +# item 3 +!! result +
    1. Numbered list +
    2. item 2 +
    3. item 3 +
    + +!! end + +!! test +Mixed list +!! input +*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 +!! result +
    • 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 +
    + +!! end + +### +### Magic variables +### +!! test +Magic variables +!! input +{{SITENAME}} +!! result +

    MediaWiki +

    +!! end + +### +### Magic links +### +!! test +Magic links: internal link to RFC +!! input +[[RFC 123]] +!! result +

    RFC 123 +

    +!! end + +!! test +Magic links: RFC +!! input +RFC 822 +!! result +

    RFC 822 +

    +!! end + +!! test +Magic links: ISBN (bug 1937 unresolved) +!! input +ISBN 0-306-40615-2 +!! result +

    ISBN 0-306-40615-2 +

    +!! end + +!! test +Magic links: PMID incorrectly converts space to underscore +!! input +PMID 1234 +!! result +

    PMID 1234 +

    +!! end + +### +### Templates +#### + +!! test +Nonexistant template +!! input +{{thistemplatedoesnotexist}} +!! result +

    Template:Thistemplatedoesnotexist +

    +!! end + +!! article +Template:test +!! text +This is a test template +!! endarticle + +!! test +Simple template +!! input +{{test}} +!! result +

    This is a test template +

    !! end + +!! test +Template with explicit namespace +!! input +{{Template:test}} +!! result +

    This is a test template +

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

    This is a test template with parameter foo +

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

    the main page +

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

    This is a test template with parameter MediaWiki +

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

    link +

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

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

    +!! end + +!! article +Template:Linktest2 +!! text +Main Page +!! endarticle + +!! test +Template as link source +!! input +[[{{linktest2}}]] +!! result +

    Main Page +

    +!! end + + +!! article +Template:loop1 +!! text +{{loop2}} +!! endarticle + +!! article +Template:loop2 +!! text +{{loop1}} +!! endarticle + +!! test +Template infinite loop +!! input +{{loop1}} +!! result +

    {{loop1}} +

    +!! end + +!! test +Template from main namespace +!! input +{{:Main Page}} +!! result +

    blah blah +

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

    foo +

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

    foo +

    + + + + +
    1 2 +
    3 4 +
    + +!! end + +!! test +BUG 41: Template parameters shown as broken links +!! input +{{{parameter}}} +!! result +

    {{{parameter}}} +

    +!! end + + +!! article +Template:MSGNW test +!! text +''None'' of '''this''' should be +* interepreted + but rather passed unmodified +{{test}} +!! endarticle + +# hmm, fix this or just deprecate msgnw and document its behavior? +!! test +msgnw keyword +!! options +disabled +!! input +{{msgnw:MSGNW test}} +!! result +

    ''None'' of '''this''' should be +* interepreted + but rather passed unmodified +{{test}} +

    +!! end + +!! test +int keyword +!! input +{{int:newmessages|lots of money}} +!! result +

    You have lots of money. +

    +!! end + +### +### Pre-save transform tests +### +!! test +pre-save transform: subst: +!! options +PST +!! input +{{subst:test}} +!! result +This is a test template +!! end + +!! test +pre-save transform: normal template +!! options +PST +!! input +{{test}} +!! result +{{test}} +!! end + +!! test +pre-save transform: nonexistant template +!! options +PST +!! input +{{thistemplatedoesnotexist}} +!! result +{{thistemplatedoesnotexist}} +!! end + + +!! test +pre-save transform: subst magic variables +!! options +PST +!! input +{{subst:SITENAME}} +!! result +MediaWiki +!! end + +# This is bug 89, which I fixed. -- wtm +!! test +pre-save transform: subst: templates with parameters +!! options +pst +!! input +{{subst:paramtest|param="something else"}} +!! result +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 +!! input +{{subst:nowikitest}} +!! result +'''not wiki''' +!! end + + +!! article +Template:commenttest +!! text +This template has in it. +!! endarticle + +!! test +pre-save transform: comment in subst (bug 1936) +!! options +pst +!! input +{{subst:commenttest}} +!! result +This template has in it. +!! end + + +!! article +Template:dangerous +!!text +Oh no +!!endarticle + +!!test +(confirming safety of fix for subst bug 1936) +!! input +{{Template:dangerous}} +!! result +

    Oh no +

    +!! end + + +### +### Message transform tests +### +!! test +message transform: magic variables +!! options +msg +!! input +{{SITENAME}} +!! result +MediaWiki +!! end + +!! test +message transform: should not transform wiki markup +!! options +msg +!! input +''test'' +!! result +''test'' +!! end + +### +### Images +### +!! test +Simple image +!! input +[[Image:foobar.jpg]] +!! result +

    Image:foobar.jpg +

    +!! end + +!! test +Right-aligned image +!! input +[[Image:foobar.jpg|right]] +!! result +
    + +!! end + +!! test +Image with caption +!! input +[[Image:foobar.jpg|right|Caption text]] +!! result +
    Caption text
    + +!! end + +!! test +Image with frame and link +!! input +[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] +!! result +
    This is a test image Main Page
    This is a test image Main Page
    + +!! end + +!! test +Link to image page +!! input +[[:Image:test]] +!! result +

    Image:test +

    +!! end + +!! test +Frameless image caption with a free URL +!! input +[[Image:foobar.jpg|http://example.com]] +!! result +

    http://example.com +

    +!! end + +!! test +Thumbnail image caption with a free URL +!! input +[[Image:foobar.jpg|thumb|http://example.com]] +!! result + + +!! end + +# Pending resolution to bug 368 +!! test +BUG 648: Frameless image caption with a link +!! input +[[Image:foobar.jpg|text with a [[link]] in it]] +!! result +

    text with a link in it +

    +!! end + +!! test +Escape HTML special chars in image alt text +!! input +[[Image:foobar.jpg|& < > "]] +!! result +

    & < > " +

    +!! end + +!! test +BUG 499: Alt text should have Ӓ, not &1234; +!! input +[[Image:foobar.jpg|♀]] +!! result +

    ♀ +

    +!! end + +!! test +Broken image caption with link +!! input +[[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link. +!! result +

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

    +!! end + +!! test +Image caption containing another image +!! input +[[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]] +!! result +
    This is a caption with another Image:Icon.png inside it!
    Enlarge
    This is a caption with another Image:Icon.png inside it!
    + +!! end + +!! test +Image caption containing a newline +!! input +[[Image:Foobar.jpg|This +*is some text]] +!! result +

    This *is some text +

    +!!end + + + +### +### Subpages +### +!! article +Subpage test/subpage +!! text +foo +!! endarticle + +!! test +Subpage link +!! options +subpage title=[[Subpage test]] +!! input +[[/subpage]] +!! result +

    /subpage +

    +!! end + +!! test +Subpage noslash link +!! options +subpage title=[[Subpage test]] +!!input +[[/subpage/]] +!! result +

    subpage +

    +!! end + +!! test +Disabled subpages +!! input +[[/subpage]] +!! result +

    /subpage +

    +!! end + +!! test +BUG 561: {{/Subpage}} +!! options +subpage title=[[Page]] +!! input +{{/Subpage}} +!! result +

    Page/Subpage +

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

    Category:MediaWiki User's Guide +

    +!! end + +!! test +Simple category +!! options +cat +!! input +[[Category: MediaWiki User's Guide]] +!! result +MediaWiki User's Guide +!! end + +### +### Inter-language links +### +!! test +Inter-language links +!! options +ill +!! input +[[es:Alimento]] +[[fr:Nourriture]] +[[zh:食品]] +!! result +es:Alimento fr:Nourriture zh:食品 +!! end + +### +### Sections +### +!! test +Basic section headings +!! options +title=[[Parser test script]] +!! input +== Headline 1 == +Some text + +==Headline 2== +More +===Smaller headline=== +Blah blah +!! result +

    Headline 1

    +

    Some text +

    +

    Headline 2

    +

    More +

    +

    Smaller headline

    +

    Blah blah +

    +!! end + +!! test +Section headings with TOC +!! options +title=[[Parser test script]] +!! input +== Headline 1 == +=== Subheadline 1 === +===== Skipping a level ===== +====== Skipping a level ====== + +== Headline 2 == +Some text +===Another headline=== +!! result +

    Table of contents

    + +
    + +

    Headline 1

    +

    Subheadline 1

    +
    Skipping a level
    +
    Skipping a level
    +

    Headline 2

    +

    Some text +

    +

    Another headline

    + +!! end + +# perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10' +!! test +Handling of sections up to level 6 and beyond +!! input += 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========== +!! result +

    Table of contents

    + +
    +

    +

    +

    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====
    + +!! end + +!! test +Resolving duplicate section names +!! options +title=[[Parser test script]] +!! input +== Foo bar == +== Foo bar == +!! result +

    Foo bar

    +

    Foo bar

    + +!! end + +!! article +Template:sections +!! text +===Section 1=== +==Section 2== +!! endarticle + +!! test +Template with sections, __NOTOC__ +!! options +title=[[Parser test script]] +!! input +__NOTOC__ +==Section 0== +{{sections}} +==Section 4== +!! result +

    Section 0

    +

    Section 1

    +

    Section 2

    +

    Section 4

    + +!! end + +!! test +__NOEDITSECTION__ keyword +!! input +__NOEDITSECTION__ +==Section 1== +==Section 2== +!! result +

    Section 1

    +

    Section 2

    + +!! end + +!! test +Link inside a section heading +!! options +title=[[Parser test script]] +!! input +==Section with a [[Main Page|link]] in it== +!! result +

    Section with a link in it

    + +!! end + + +!! test +Bug 1219 URL next to image (good) +!! input +http://example.com [[Image:foobar.jpg]] +!! result +

    http://example.com Image:foobar.jpg +

    +!!end + +!! test +Bug 1219 URL next to image (broken) +!! input +http://example.com[[Image:foobar.jpg]] +!! result +

    http://example.comImage:foobar.jpg +

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

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

    +!!end + + +!! test +Namespaced link must have a title +!! input +[[Project:]] +!! result +

    [[Project:]] +

    +!!end + +!! test +Namespaced link must have a title (bad fragment version) +!! input +[[Project:#fragment]] +!! result +

    [[Project:#fragment]] +

    +!!end + + +!! test +div with no attributes +!! input +
    HTML rocks
    +!! result +
    HTML rocks
    + +!! end + +!! test +div with double-quoted attribute +!! input +
    HTML rocks
    +!! result +
    HTML rocks
    + +!! end + +!! test +div with single-quoted attribute +!! input +
    HTML rocks
    +!! result +
    HTML rocks
    + +!! end + +!! test +div with unquoted attribute +!! input +
    HTML rocks
    +!! result +
    HTML rocks
    + +!! end + +!! test +div with illegal double attributes +!! input +
    HTML rocks
    +!! result +
    HTML rocks
    + +!!end + +!! test +DIV IN UPPERCASE +!! input +
    HTML ROCKS
    +!! result +
    HTML ROCKS
    + +!!end + + +!! test +text with amp in the middle of nowhere +!! input +Remember AT&T? +!!result +

    Remember AT&T? +

    +!! end + +!! test +text with character entity: eacute +!! input +I always thought é was a cute letter. +!! result +

    I always thought é was a cute letter. +

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

    I always thought &xacute; was a cute letter. +

    +!! end + + +### +### Media links +### + +!! test +Media link +!! input +[[Media:Foobar.jpg]] +!! result +

    Media:Foobar.jpg +

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

    A neat file to look at +

    +!! end + +# FIXME: this is still bad HTML tag nesting +!! test +Media link with nasty text +!! input +[[Media:Foobar.jpg|Safe Link
    " onmouseover="alert(document.cookie)" onfoo="
    ]] +!! result +

    Safe Link

    " onmouseover="alert(document.cookie) onfoo="
    +

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

    this&that +

    +!!end + +!! test +Empty attribute crash test (bug 2067) +!! input +foo +!! result +

    foo +

    +!! end + +!! test +Empty attribute crash test single-quotes (bug 2067) +!! input +foo +!! result +

    foo +

    +!! end + +!! test +Attribute test: equals, then nothing +!! input +foo +!! result +

    foo +

    +!! end + +!! test +Attribute test: unquoted value +!! input +foo +!! result +

    foo +

    +!! end + +!! test +Attribute test: unquoted but illegal value (hash) +!! input +foo +!! result +

    foo +

    +!! end + +!! test +Attribute test: no value +!! input +foo +!! result +

    foo +

    +!! end + + +TODO: +more images +more tables +math +character entities +and much more