X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2FparserTests.txt;h=c0d8f6f71693dce78fca86c80628111ac9920d3b;hb=16047ca2b774ca2e025cc566b0b3c5d20a99f676;hp=23bf77b44f4086a4cccd977467e1953a6fe90565;hpb=4b42f18b66e843f362e5e159d95fee9d2c26ef9c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 23bf77b44f..c0d8f6f716 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1,4 +1,4 @@ -# MediaWiki Parser test cases +# MediaWiki Parser test cases # Some taken from http://meta.wikimedia.org/wiki/Parser_testing # All (C) their respective authors and released under the GPL # @@ -16,6 +16,7 @@ # 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 # disabled do not run test # @@ -156,7 +157,7 @@ nowiki 3 !! end ### -### comment test cases +### Comments ### !! test Comment test 1 @@ -218,6 +219,53 @@ c

!! end +!! test +Comment whitespace +!! input + +!! result + +!! end + +!! test +Comment semantics and delimiters +!! input + +!! result + +!! end + +!! test +Comment semantics and delimiters, redux +!! input + +!! result + +!! end + +!! test +Comment semantics and delimiters: directors cut +!! input +--> +!! result +

--> +

+!! end + +!! test +Comment semantics: nesting +!! input +--> +!! result +

--> +

+!! end + + ### ### Preformatted text ### @@ -239,7 +287,7 @@ And a link !! end ### -### Definition list +### Definition lists ### !! test Simple definition @@ -276,7 +324,7 @@ Definition list with URL link !! input ; http://example.com/ : definition !! result -
http://example.com/ 
definition +
http://example.com/ 
definition
!! end @@ -286,7 +334,7 @@ Definition list with bracketed URL link !! input ;[http://www.google.com/ Google]:Number one search engine !! result -
Google (http://www.google.com/)
Number one search engine +
Google
Number one search engine
!! end @@ -294,9 +342,9 @@ Definition list with bracketed URL link !! test Definition list with wikilink containing colon !! input -; [[Wikipedia:FAQ]]: The least-read page on Wikipedia +; [[Help:FAQ]]: The least-read page on Wikipedia !! result -
Wikipedia:FAQ
The least-read page on Wikipedia +
Help:FAQ
The least-read page on Wikipedia
!! end @@ -307,7 +355,7 @@ 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! +
news:alt.wikipedia.rox
This isn't even a real newsgroup!
!! end @@ -317,7 +365,7 @@ 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 +
news:alt.wikipedia.rox -- don't crash or enter an infinite loop
!! end @@ -327,7 +375,7 @@ 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 (http://www.wikipedia2.org/)
OK, I made that up +
Wikipedia : The Next Generation
OK, I made that up
!! end @@ -341,7 +389,7 @@ External links: non-bracketed !! input Non-bracketed: http://example.com !! result -

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

Non-bracketed: http://example.com

!! end @@ -349,8 +397,12 @@ Non-bracketed: http://example.com External links: numbered !! input Numbered: [http://example.com] +Numbered: [http://example.net] +Numbered: [http://example.org] !! result -

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

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

!!end @@ -359,16 +411,16 @@ External links: specified text !! input Specified text: [http://example.com link] !! result -

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

Specified text: link

!!end !! test External links: trail !! input -Trail (not sure if this is meant to work): [http://example.com link]s +Linktrails should not work for external links: [http://example.com link]s !! result -

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

Linktrails should not work for external links: links

!! end @@ -377,7 +429,7 @@ External links: dollar sign in URL !! input http://example.com/1$2345 !! result -

http://example.com/1$2345 +

http://example.com/1$2345

!! end @@ -386,7 +438,25 @@ External links: dollar sign in URL (named) !! input [http://example.com/1$2345] !! result -

[1] (http://example.com/1$2345) +

[1] +

+!!end + +!! test +External links: open square bracket forbidden in URL (bug 4377) +!! input +http://example.com/1[2345 +!! result +

http://example.com/1[2345 +

+!! end + +!! test +External links: open square bracket forbidden in URL (named) (bug 4377) +!! input +[http://example.com/1[2345] +!! result +

[2345

!!end @@ -413,7 +483,7 @@ 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 +

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

!! end @@ -422,7 +492,7 @@ External links: terminating separator !! input Terminating separator: http://example.com/thing, !! result -

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

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

!! end @@ -431,7 +501,7 @@ External links: intervening separator !! input Intervening separator: http://example.com/1,2,3 !! result -

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

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

!! end @@ -440,7 +510,7 @@ 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 (http://example.com/thing?url=http://example.com) +

Old bug with URL in query: link

!! end @@ -449,7 +519,7 @@ 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 (ftp://example.com?url=http://example.com) +

And again with mixed protocols: link

!!end @@ -458,7 +528,7 @@ External links: URL in text !! input URL in text: [http://example.com http://example.com] !! result -

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

URL in text: http://example.com

!! end @@ -467,7 +537,7 @@ 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 (http://example.com) +

ja-style clickable images: Ncwikicol.png

!!end @@ -476,7 +546,34 @@ External links: raw ampersand !! input Old & use: http://x&y !! result -

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

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 @@ -485,7 +582,7 @@ External links: www.jpeg.org (bug 554) !! input http://www.jpeg.org !!result -

http://www.jpeg.org +

http://www.jpeg.org

!! end @@ -494,7 +591,7 @@ 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] (http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp) +

[1]

!! end @@ -503,7 +600,16 @@ BUG 361: URL inside bracketed URL !! input [http://www.example.com/foo http://www.example.com/bar] !! result -

http://www.example.com/bar (http://www.example.com/foo) +

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 @@ -512,7 +618,7 @@ BUG 289: ">"-token in URL-tail !! input http://www.example.com/ !! result -

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

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

!!end @@ -521,7 +627,7 @@ BUG 289: literal ">"-token in URL-tail !! input http://www.example.com/html !! result -

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

http://www.example.com/html

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

<hello> stuff (http://www.example.com/) +

<hello> stuff

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

html stuff (http://www.example.com/) +

html stuff

!!end @@ -548,7 +654,7 @@ BUG 289: literal double quote at end of URL !! input http://www.example.com/"hello" !! result -

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

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

!!end @@ -557,19 +663,134 @@ BUG 289: literal double quote in bracketed URL !! input [http://www.example.com/"hello" stuff] !! result -

"hello" stuff (http://www.example.com/) +

"hello" stuff

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

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

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

test +

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

http:/example.com +

[http:/example.com title] +

+!! end + +!! test +Bug 2702: Mismatched and tags are invalid +!! input +''[http://example.com text''] +!! result +

text +

+!! end + + +!! test +Bug 4781: %26 in URL +!! input +http://www.example.com/?title=AT%26T +!! result +

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

+!! end + +!! test +Bug 4781, 5267: %26 in URL +!! input +http://www.example.com/?title=100%25_Bran +!! result +

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

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

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

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

[1] +

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

[1] +

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

[1] +

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

link +

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

link +

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

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

link

!! end + ### ### Quotes ### @@ -624,8 +845,36 @@ Normal text. ### ### Tables ### -### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_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 +A table with no data. +!! input +{||} +!! result +!! end + +# A table with nothing but a caption is invalid XHTML, we might want to render +# this as

caption

+!! test +A table with nothing but a caption +!! input +{| +|+ caption +|} +!! result + + + +
caption +
+
+!! end + !! test Simple table !! input @@ -635,11 +884,11 @@ Simple table | 3 || 4 |} !! result - - +
+ - +
1 2
3 4
@@ -672,26 +921,26 @@ Multiplication table - + - + - + - + - + - +
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
@@ -710,13 +959,13 @@ Table rowspan | Cell 3, row 2 |} !! result - - +
+ - +
Cell 1, row 1 - Cell 2, row 1 (and 2) + Cell 2, row 1 (and 2) Cell 3, row 1
Cell 1, row 2 Cell 3, row 2
@@ -737,15 +986,15 @@ Nested table |the original table again |} !! result - - +
+
α - - +
+ - +
nested
table
the original table again @@ -753,6 +1002,21 @@ Nested table !! end +!! test +Invalid attributes in table cell (bug 1830) +!! input +{| +|Cell:|broken +|} +!! result + + +
broken +
+ +!! end + + ### ### Internal links ### @@ -828,6 +1092,15 @@ Piped link with 3 brackets

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

The|Main|Page +

+!! end + !! test Link to namespaces !! input @@ -882,12 +1155,30 @@ Link containing % as a double hex sequence interpreted to hex sequence

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

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

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

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

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

[[1] (http://www.example.org)] +

[[1]]

!! end @@ -907,7 +1198,7 @@ Piped link to URL !! input Piped link to URL: [[http://www.example.org|an example URL]] !! result -

Piped link to URL: [example URL (http://www.example.org|an)] +

Piped link to URL: [example URL]

!! end @@ -952,7 +1243,7 @@ title=[[Main Page]] !! end ### -### Interwiki links +### Interwiki links (see maintenance/interwiki.sql) ### !! test @@ -960,7 +1251,37 @@ Inline interwiki link !! input [[MeatBall:SoftSecurity]] !! result -

MeatBall:SoftSecurity +

MeatBall:SoftSecurity +

+!! end + +!! test +Inline interwiki link with empty title (bug 2372) +!! input +[[MeatBall:]] +!! result +

MeatBall: +

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

MeatBall:SoftSecurity#foo

!! end @@ -977,6 +1298,42 @@ Inline interwiki link

!! 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 ### @@ -1050,721 +1407,2244 @@ Mixed list !! end -### -### Magic variables -### !! test -Magic variables +List items are not parsed correctly following a
 block (bug 785)
 !! input
-{{SITENAME}}
+* 
foo
+*
bar
+* zar !! result -

MediaWiki -

+
  • foo
    +
  • bar
    +
  • zar +
+ !! end ### -### Magic links +### Magic Words ### + !! test -Magic links: internal link to RFC +Magic Word: {{CURRENTDAY}} !! input -[[RFC 123]] +{{CURRENTDAY}} !! result -

RFC 123 +

1

!! end !! test -Magic links: RFC +Magic Word: {{CURRENTDAY2}} !! input -RFC 822 +{{CURRENTDAY2}} !! result -

RFC 822 +

01

!! end !! test -Magic links: ISBN +Magic Word: {{CURRENTDAYNAME}} !! input -ISBN 0-306-40615-2 +{{CURRENTDAYNAME}} !! result -

ISBN 0-306-40615-2 +

Thursday

!! end -### -### Templates -#### - !! test -Nonexistant template +Magic Word: {{CURRENTDOW}} !! input -{{thistemplatedoesnotexist}} +{{CURRENTDOW}} !! result -

Template:Thistemplatedoesnotexist +

4

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

This is a test template +

01

!! end !! test -Template with explicit namespace +Magic Word: {{CURRENTMONTHABBREV}} !! input -{{Template:test}} +{{CURRENTMONTHABBREV}} !! result -

This is a test template +

Jan

!! end - -!! article -Template:paramtest -!! text -This is a test template with parameter {{{param}}} -!! endarticle +!! test +Magic Word: {{CURRENTMONTHNAME}} +!! input +{{CURRENTMONTHNAME}} +!! result +

January +

+!! end !! test -Template parameter +Magic Word: {{CURRENTMONTHNAMEGEN}} !! input -{{paramtest|param=foo}} +{{CURRENTMONTHNAMEGEN}} !! result -

This is a test template with parameter foo +

January

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

the main page +

00:02

!! 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 +Magic Word: {{CURRENTWEEK}} (@bug 4594) !! input -{{paramtest|param={{SITENAME}}}} +{{CURRENTWEEK}} !! result -

This is a test template with parameter MediaWiki +

1

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

link +

1970

!! end - -!!article -Template:paramtest2 -!! text -including another template, {{paramtest|param={{{arg}}}}} -!! endarticle - !! test -Template passing argument to another template +Magic Word: {{FULLPAGENAME}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{paramtest2|arg='hmm'}} +{{FULLPAGENAME}} !! result -

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

User:Ævar Arnfjörð Bjarmason

!! end -!! article -Template:Linktest2 -!! text -Main Page -!! endarticle - !! test -Template as link source +Magic Word: {{FULLPAGENAMEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -[[{{linktest2}}]] +{{FULLPAGENAMEE}} !! result -

Main Page +

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

!! end - -!! article -Template:loop1 -!! text -{{loop2}} -!! endarticle - -!! article -Template:loop2 -!! text -{{loop1}} -!! endarticle - !! test -Template infinite loop +Magic Word: {{NAMESPACE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] +disabled # FIXME !! input -{{loop1}} +{{NAMESPACE}} !! result -

{{loop2}} +

User

!! end !! test -Template from main namespace +Magic Word: {{NAMESPACEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] +disabled # FIXME !! input -{{:Main Page}} +{{NAMESPACEE}} !! result -

blah blah +

User

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

foo +

-1

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

foo +

1

- - - - -
1 2 -
3 4 -
- !! end !! test -BUG 41: Template parameters shown as broken links +Magic Word: {{PAGENAME}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] +disabled # FIXME !! input -{{{parameter}}} +{{PAGENAME}} !! result -

{{{parameter}}} +

Ævar Arnfjörð Bjarmason

!! 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 +Magic Word: {{PAGENAMEE}} !! options -disabled +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{msgnw:MSGNW test}} +{{PAGENAMEE}} !! result -

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

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

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

You have lots of money. +

1337

!! 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 +Magic Word: {{SCRIPTPATH}} !! input -{{thistemplatedoesnotexist}} +{{SCRIPTPATH}} !! result -{{thistemplatedoesnotexist}} +

/ +

!! end - !! test -pre-save transform: subst magic variables -!! options -PST +Magic Word: {{SERVER}} !! input -{{subst:SITENAME}} +{{SERVER}} !! result -MediaWiki +

http://localhost +

!! end -# This is bug 89, which I fixed. -- wtm !! test -pre-save transform: subst: templates with parameters -!! options -pst +Magic Word: {{SERVERNAME}} !! input -{{subst:paramtest|param="something else"}} +{{SERVERNAME}} !! result -This is a test template with parameter "something else" +

Britney Spears +

!! end -### -### Message transform tests -### !! test -message transform: magic variables -!! options -msg +Magic Word: {{SITENAME}} !! input {{SITENAME}} !! result -MediaWiki +

MediaWiki +

!! end !! test -message transform: should not transform wiki markup -!! options -msg +Namespace 1 {{ns:1}} !! input -''test'' +{{ns:1}} !! result -''test'' +

Talk +

!! end -### -### Images -### !! test -Simple image +Namespace 1 {{ns:01}} !! input -[[Image:foobar.jpg]] +{{ns:01}} !! result -

Image:foobar.jpg +

Talk

!! end !! test -Right-aligned image +Namespace 0 {{ns:0}} (bug 4783) !! input -[[Image:foobar.jpg|right]] +{{ns:0}} !! result -
!! end !! test -Image with caption +Namespace 0 {{ns:00}} (bug 4783) !! input -[[Image:foobar.jpg|right|Caption text]] +{{ns:00}} !! result -
Caption text
!! end !! test -Image with frame and link +Namespace -1 {{ns:-1}} !! input -[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] +{{ns:-1}} !! result -
This is a test image
This is a test image Main Page
- +

Special +

!! end !! test -Link to image page +Namespace Project {{ns:User}} !! input -[[:Image:test]] +{{ns:User}} !! result -

Image:test +

User

!! end + +### +### Magic links +### !! test -Frameless image caption with a free URL +Magic links: internal link to RFC (bug 479) !! input -[[Image:foobar.jpg|http://example.com]] +[[RFC 123]] !! result -

http://example.com +

RFC 123

!! end !! test -Thumbnail image caption with a free URL +Magic links: RFC (bug 479) !! input -[[Image:foobar.jpg|thumb|http://example.com]] +RFC 822 !! result - - +

RFC 822 +

!! end -# Pending resolution to bug 368 !! test -BUG 648: Frameless image caption with a link +Magic links: ISBN (bug 1937) !! input -[[Image:foobar.jpg|text with a [[link]] in it]] +ISBN 0-306-40615-2 !! result -

text with a link in it +

ISBN 0-306-40615-2

!! end !! test -Escape HTML special chars in image alt text +Magic links: PMID incorrectly converts space to underscore !! input -[[Image:foobar.jpg|& < > "]] +PMID 1234 !! result -

& < > " +

PMID 1234

!! end +### +### Templates +#### + !! test -BUG 499: Alt text should have Ӓ, not &1234; +Nonexistant template !! input -[[Image:foobar.jpg|♀]] +{{thistemplatedoesnotexist}} !! result -

♀ +

Template:Thistemplatedoesnotexist

!! end +!! article +Template:test +!! text +This is a test template +!! endarticle + !! test -Broken image caption with link +Simple template !! input -[[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link. +{{test}} !! result -

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

This is a test template

!! end !! test -Image caption containing another image +Template with explicit namespace !! input -[[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]] +{{Template:test}} !! result -
Missing image
Foobar.jpg
This is a caption with another image inside it!
- +

This is a test template +

!! end -### -### Subpages -### + !! article -Subpage test/subpage +Template:paramtest !! text -foo +This is a test template with parameter {{{param}}} !! endarticle !! test -Subpage link -!! options -subpage title=[[Subpage test]] +Template parameter !! input -[[/subpage]] +{{paramtest|param=foo}} !! result -

/subpage +

This is a test template with parameter foo

!! end +!! article +Template:paramtestnum +!! text +[[{{{1}}}|{{{2}}}]] +!! endarticle + !! test -Subpage noslash link -!! options -subpage title=[[Subpage test]] -!!input -[[/subpage/]] +Template unnamed parameter +!! input +{{paramtestnum|Main Page|the main page}} !! result -

subpage +

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 -Disabled subpages +Template with template name as unnamed argument !! input -[[/subpage]] +{{templateasargtestnum|templatesimple}} !! result -

/subpage +

(test)

!! end !! test -BUG 561: {{/Subpage}} -!! options -subpage title=[[Page]] +Template with template name as argument !! input -{{/Subpage}} +{{templateasargtest|templ=simple}} !! result -

Page/Subpage +

(test) +

+!! end + +!! test +Template with template name as argument (2) +!! input +{{templateasargtest2|templ=templatesimple}} +!! result +

(test)

!! end -### -### Categories -### !! article -Category:MediaWiki User's Guide +Template:templateasargtestdefault !! text -blah +{{{{{templ|templatesimple}}}}} +!! endarticle + +!! article +Template:templa +!! text +'''templ''' !! endarticle !! test -Link to category +Template with default value !! input -[[:Category:MediaWiki User's Guide]] +{{templateasargtestdefault}} !! result -

Category:MediaWiki User's Guide +

(test)

!! end !! test -Simple category -!! options -cat +Template with default value (value set) !! input -[[Category: MediaWiki User's Guide]] +{{templateasargtestdefault|templ=templa}} !! result -MediaWiki User's Guide +

templ +

!! end -### -### Inter-language links -### !! test -Inter-language links -!! options -ill +Template redirect !! input -[[es:Alimento]] -[[fr:Nourriture]] -[[zh:食品]] +{{templateredirect}} !! result -es:Alimento fr:Nourriture zh:食品 +

(test) +

!! end -### -### Sections -### !! test -Basic section headings -!! options -title=[[Parser test script]] +Template with argument in separate line !! input -== Headline 1 == -Some text - -==Headline 2== -More -===Smaller headline=== -Blah blah +{{ templateasargtest | + templ = simple }} !! result -

Headline 1

-

Some text +

(test)

-

Headline 2

-

More -

-

Smaller headline

-

Blah blah +!! end + +!! test +Template with complex template as argument +!! input +{{paramtest| + param ={{ templateasargtest | + templ = simple }}}} +!! result +

This is a test template with parameter (test)

!! end !! test -Section headings with TOC -!! options -title=[[Parser test script]] +Template with thumb image (wiht link in description) !! input -== Headline 1 == -=== Subheadline 1 === -===== Skipping a level ===== -====== Skipping a level ====== +{{paramtest| + param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} +!! result +This is a test template with parameter -== Headline 2 == -Some text -===Another headline=== +!! end + +!! article +Template:complextemplate +!! text +{{{1}}} {{paramtest| + param ={{{param}}}}} +!! endarticle + +!! test +Template with complex arguments +!! input +{{complextemplate| + param ={{ templateasargtest | + templ = simple }}|[[Template:complextemplate|link]]}} !! result -
-Table of contents
- - - -
-

2.1 Another headline
+

link This is a test template with parameter (test)

-
+!! end + +!! test +BUG 553: link with two variables in a piped link +!! input +{| +|[[{{{1}}}|{{{2}}}]] +|} +!! result + + +
[[{{{1}}}|{{{2}}}]]
-

Headline 1

-

Subheadline 1

-
Skipping a level
-
Skipping a level
-

Headline 2

-

Some text -

-

Another headline

!! end !! test -Resolving duplicate section names -!! options -title=[[Parser test script]] +Magic variable as template parameter !! input -== Foo bar == -==Foo bar== +{{paramtest|param={{SITENAME}}}} !! result -

Foo bar

-

Foo bar

- +

This is a test template with parameter MediaWiki +

!! end !! article -Template:sections +Template:linktest !! text -===Section 1=== -==Section 2== +[[{{{param}}}|link]] !! endarticle !! test -Template with sections, __NOTOC__ -!! options -title=[[Parser test script]] +Template parameter as link source !! input -__NOTOC__ -==Section 0== -{{sections}} -==Section 4== +{{linktest|param=Main Page}} !! result -

Section 0

-

Section 1

-

Section 2

-

Section 4

+

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 -__NOEDITSECTION__ keyword +Template as link source !! input -__NOEDITSECTION__ -==Section 1== -==Section 2== +[[{{linktest2}}]] !! result -

Section 1

-

Section 2

+

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 -Link inside a section heading -!! options -title=[[Parser test script]] +Template from main namespace !! input -==Section with a [[Main Page|link]] in it== +{{:Main Page}} !! result -

Section with a link in it

+

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:youhavenewmessages|lots of money|not!}} +!! result +

You have lots of money (not!). +

+!! end + +!! article +Template:Includes +!! text +Foozarbar +!! endarticle + +!! test + and being included +!! input +{{Includes}} +!! result +

Foobar +

+!! end + +!! article +Template:Includes2 +!! text +Foobar +!! endarticle + +!! test + being included +!! input +{{Includes2}} +!! result +

Foo +

+!! end + + +!! article +Template:Includes3 +!! text +Foobarzar +!! endarticle + +!! test + and being included +!! input +{{Includes3}} +!! result +

Foo +

+!! end + +!! test + and on a page +!! input +Foozarbar +!! result +

Foozar +

+!! end + +!! test + on a page +!! input +Foobar +!! result +

Foobar +

+!! 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 + +!! test +pre-save transform: comment containing gallery (bug 5024) +!! options +pst +!! input + +!!result + +!!end + +!! test +pre-save transform: comment containing extension +!! options +pst +!! input + +!!result + +!!end + +!! test +pre-save transform: comment containing nowiki +!! options +pst +!! input + +!!result + +!!end + +!! test +pre-save transform: comment containing math +!! options +pst +!! input + +!!result + +!!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 + +!! test +BUG 1887: A ISBN with a thumbnail +!! input +[[Image:foobar.jpg|thumb|ISBN 12354]] +!! result + +!! end + +!! test +BUG 1887: A with a thumbnail +!! input +[[Image:foobar.jpg|thumb|2+2]] +!! result +
2+2
Enlarge
<math>2+2<math>
+!! 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 +BUG 648: Frameless image caption with a link (suffix) +!! input +[[Image:foobar.jpg|text with a [[link]]foo in it]] +!! result +

text with a linkfoo in it +

+!! end + +!! test +BUG 648: Frameless image caption with an interwiki link +!! input +[[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]] +!! result +

text with a MeatBall:Link in it +

+!! end + +!! test +BUG 648: Frameless image caption with a piped interwiki link +!! input +[[Image:foobar.jpg|text with a [[MeatBall:Link|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 + + +!! test +Bug 3090: External links other than http: in image captions +!! input +[[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]] +!! result +
This caption has irc and Secure ext links in it.
Enlarge
This caption has irc and Secure ext links in it.
+ +!! 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 +

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 +

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 +HTML multiple attributes correction +!! input +

Awesome!

+!! result +

Awesome!

+ +!!end + +!! test +Table multiple attributes correction +!! input +{| +!+ class="error" class="awesome"| status +|} +!! result + + +
status +
+ +!!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

+

+!! end + +!! test +Media link to nonexistent file (bug 1702) +!! input +[[Media:No such.jpg]] +!! result +

Media:No such.jpg +

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

Image:No such.jpg +

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

Image:No such.jpg +

+!! 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 + +!! test +Bug 2095: link with three closing brackets +!! input +[[Main Page]]] +!! result +

Main Page] +

+!! end + +!! test +Bug 2095: link with pipe and three closing brackets +!! input +[[Main Page|link]]] +!! result +

link] +

+!! 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) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (dangerous template; 2309) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (dangerous style template; 2309) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (safe parameter; 2309) +!! input +{{div style|width: 200px}} +!! result +
Magic div
+ +!! end + +!! test +Bug 2304: HTML attribute safety (unsafe parameter; 2309) +!! input +{{div style|width: expression(alert(document.cookie))}} +!! result +
Magic div
+ +!! end + +!! test +Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309) +!! input +{{div style|">}} +!! result +
Magic div
+ +!! end + +!! test +Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309) +!! input +{{div style|" >}} +!! result +
Magic div
+ +!! end + +!! test +Bug 2304: HTML attribute safety (link) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (italics) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (bold) +!! input +
+!! result +
+ +!! end + + +!! test +Bug 2304: HTML attribute safety (ISBN) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (RFC) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (PMID) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (web link) +!! input +
+!! result +
+ +!! end + +!! test +Bug 2304: HTML attribute safety (named web link) +!! input +
+!! result +
+ +!! end + +!! test +Bug 3244: HTML attribute safety (extension; safe) +!! input +
+!! result +
+ +!! end + +!! test +Bug 3244: HTML attribute safety (extension; unsafe) +!! input +
+!! result +
+ +!! end + +!! test +Math section safety when disabled +!! input + +!! result +

<math><script>alert(document.cookies);</script></math> +

+!! end + +# More MSIE fun discovered by Tom Gilder + +!! test +MSIE CSS safety test: spurious slash +!! input +
evil
+!! result +
evil
+ +!! end + +!! test +MSIE CSS safety test: hex code +!! input +
evil
+!! result +
evil
+ +!! end + +!! test +MSIE CSS safety test: comment in url +!! input +
evil
+!! result +
evil
+ +!! end + +!! test +MSIE CSS safety test: comment in expression +!! input +
evil4
+!! result +
evil4
+ +!! end + + +!! test +Table attribute legitimate extension +!! input +{| +!+ style="color:blue"| status +|} +!! result + + +
status +
+ +!!end + +!! test +Table attribute safety +!! input +{| +!+ style="border-width:expression(0+alert(document.cookie))"| status +|} +!! result + + +
status +
+ +!! end + +### +### Parser hooks (see maintenance/parserTestsParserHook.php for the extension) +### +!! test +Parser hook: empty input +!! input + +!! result +
+string(0) ""
+array(0) {
+}
+
+ +!! end + +!! test +Parser hook: empty input using terminated empty elements +!! input + +!! result +
+NULL
+array(0) {
+}
+
+ +!! end + +!! test +Parser hook: basic input +!! input +input +!! result +
+string(5) "input"
+array(0) {
+}
+
+ +!! end + + +!! test +Parser hook: case insensetive +!! input +input +!! result +
+string(5) "input"
+array(0) {
+}
+
+ +!! end + + +!! test +Parser hook: case insensetive, redux +!! input +input +!! result +
+string(5) "input"
+array(0) {
+}
+
+ +!! end + +!! test +Parser hook: nested tags +!! options +noxml +!! input + +!! result +
+string(5) ""
+array(0) {
+}
+
</tag> + +!! end + +!! test +Parser hook: basic arguments +!! input + +!! result +
+string(0) ""
+array(4) {
+  ["width"]=>
+  string(3) "200"
+  ["height"]=>
+  string(3) "100"
+  ["depth"]=>
+  string(2) "50"
+  ["square"]=>
+  string(6) "square"
+}
+
+ +!! end + +!! test +Parser hook: empty input using terminated empty elements (bug 2374) +!! input +text +!! result +
+NULL
+array(1) {
+  ["foo"]=>
+  string(3) "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) +!! input + +other stuff + +!! result +
+NULL
+array(4) {
+  ["width"]=>
+  string(3) "200"
+  ["height"]=>
+  string(3) "100"
+  ["depth"]=>
+  string(2) "50"
+  ["square"]=>
+  string(6) "square"
+}
+
+

other stuff +</tag> +

+!! end + +### +### (see maintenance/parserTestsStaticParserHook.php for the extension) +### + +!! test +Parser hook: static parser hook not inside a comment +!! input +hello, world + +!! result +

hello, world +

+!! end + + +!! test +Parser hook: static parser hook inside a comment +!! input + + +!! result +


+

+!! 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 +!! input +{{Map-one-parameter|One-parameter|param}} +!! result +

(My parameter is: param) +

+!! end + + +### +### Sanitizer +### +!! test +Sanitizer: Closing of open tags +!! input +
+!! result +
+ +!! end + +!! test +Sanitizer: Closing of open but not closed tags +!! input +foo +!! result +

foo +

+!! end + +!! test +Sanitizer: Closing of closed but not open tags +!! input +
+!! result +

</s> +

+!! end + +!! test +Sanitizer: Closing of closed but not open table tags +!! input +Table not started
+!! result +

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

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

bytebacklink +

+!! end + +!! test +Sanitizer: Validating the contents of the id attribute (bug 4515) +!! input +
+!! result +Something, but defenetly not
... !! end TODO: