!! article Template:test !! text This is a test template !! endarticle !! article Template:paramtest !! text This is a test template with parameter {{{param}}} !! endarticle !! article Template:Includes !! text Foozarbar !! endarticle !! 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: nonexistent 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 !! test pre-save transform: unclosed tag !! options pst noxml !! input '''not wiki''' !! result '''not wiki''' !! end !! test pre-save transform: mixed tag case !! options pst noxml !! input '''not wiki''' !! result '''not wiki''' !! end !! test pre-save transform: unclosed comment in !! options pst noxml !! input wikinowiki !!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: in subst (bug 3298) !! options pst !! input {{subst:Includes}} !! result Foobar !! end !! article Template:Includes2 !! text Foobar !! endarticle !! test pre-save transform: in subst (bug 3298) !! options pst !! input {{subst:Includes2}} !! result 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 !! input {{subst:SafeSubstTest}}{{safesubst:SubstTest}} !! result FoobarFoobar !! end !! test pre-save transform: context links ("pipe trick") !! options pst !! input [[Article (context)|]] [[Bar:Article|]] [[:Bar:Article|]] [[Bar:Article (context)|]] [[:Bar:Article (context)|]] [[|Article]] [[|Article (context)]] [[Bar:X (Y) Z|]] [[:Bar:X (Y) Z|]] !! result [[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 !! input [[interwiki:Article|]] [[:interwiki:Article|]] [[interwiki:Bar:Article|]] [[:interwiki:Bar:Article|]] !! result [[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)]] !! input [[|Article]] !! result [[Article (context)|Article]] !! end !! test pre-save transform: context links ("pipe trick") with comma in title !! options pst title=[[Someplace, Somewhere]] !! input [[|Otherplace]] [[Otherplace, Elsewhere|]] [[Otherplace, Elsewhere, Anywhere|]] !! result [[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]] !! input [[|Otherplace]] [[Otherplace (place), Elsewhere|]] !! result [[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)]] !! input [[|Yes, you.]] [[Me, Myself, and I (1937 song)|]] !! result [[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]] !! input [[|Article]] !! result [[Ns:Article|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace and parens !! options pst title=[[Ns:Somearticle (context)]] !! input [[|Article]] !! result [[Ns:Article (context)|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace and comma !! options pst title=[[Ns:Somearticle, Context, Whatever]] !! input [[|Article]] !! result [[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)]] !! input [[|Article]] !! result [[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]] !! input [[|Article]] !! result [[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 !! input [[Article(context)|]] [[Bar:Article(context)|]] [[:Bar:Article(context)|]] [[|Article(context)]] [[Bar:X (Y) Z|]] [[:Bar:X (Y) Z|]] !! result [[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 !! input [[Article (context)|]] [[Bar:Article (context)|]] [[:Bar:Article (context)|]] [[|Article (context)]] [[Bar:X (Y) Z|]] [[:Bar:X (Y) Z|]] !! result [[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 !! input [[Article(context)|]] [[Bar:Article(context)|]] [[:Bar:Article(context)|]] [[|Article(context)]] [[Bar:X(Y)Z|]] [[:Bar:X(Y)Z|]] !! result [[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: trim trailing empty lines !! options pst !! input Empty lines are trimmed !! result Empty lines are trimmed !! end !! test pre-save transform: Signature expansion !! options pst !! input * ~~~ * ~~~ * ~~~ * ~~~ !! result * [[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 !! input 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}} !! result 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 Pipe trick in gallery !! options pst !! input image1.png | image2.gif||||| image3| image4 |300px| centre image5.svg| http:///////// [[x (y)|]]]] * image6 !! result image1.png | image2.gif||||| image3| image4 |300px| centre image5.svg| http:///////// [[x (y)|x]]]] * image6 !! end !! test Pipe trick in gallery (with options) !! options pst !! input File:Nonexistant.jpg|caption File:Nonexistant.jpg image:foobar.jpg|some '''caption''' [[Main Page (not)|]] image:foobar.jpg image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! result File:Nonexistant.jpg|caption File:Nonexistant.jpg image:foobar.jpg|some '''caption''' [[Main Page (not)|Main Page]] image:foobar.jpg image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! end !! test Error in File: syntax within gallery !! options pst !! input File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt|]]|alt=galleryalt File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt !! result File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt|]]|alt=galleryalt File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt !! end !! test Imagemap content !! options pst !! input File:Name.jpg|thumb|left|400px|alt=some alt text|A caption [[link (test)|]] poly 133 343 124 287 159 224 189 228 195 291 222 311 209 343 209 354 243 362 292 466 250 463 [[a link]] !! result File:Name.jpg|thumb|left|400px|alt=some alt text|A caption [[link (test)|link]] poly 133 343 124 287 159 224 189 228 195 291 222 311 209 343 209 354 243 362 292 466 250 463 [[a link]] !! end