# The parsoid-compatible option below is only relevant when we are running # parser tests in integrated mode with Parsoid. This option is ignored # when this test file is run with Parsoid in standalone mode. !! options parsoid-compatible=wt2html,wt2wt version=2 !! end !! 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 !! article Template:Includes2 !! text Foobar !! endarticle !! test pre-save transform: subst: !! options pst !! wikitext {{subst:test}} !! html/php This is a test template !! end !! test pre-save transform: normal template !! options pst !! wikitext {{test}} !! html/php {{test}} !! end !! test pre-save transform: nonexistent template !! options pst !! wikitext {{thistemplatedoesnotexist}} !! html/php {{thistemplatedoesnotexist}} !! end !! test pre-save transform: subst magic variables !! options pst !! wikitext {{subst:SITENAME}} !! html/php MediaWiki !! end # This is T2089, which I fixed. -- wtm !! test pre-save transform: subst: templates with parameters !! options pst !! wikitext {{subst:paramtest|param="something else"}} !! html/php This is a test template with parameter "something else" !! end !! article Template:nowikitest !! text '''not wiki''' !! endarticle !! test pre-save transform: nowiki in subst (T3188) !! options pst !! wikitext {{subst:nowikitest}} !! html/php '''not wiki''' !! end !! article Template:commenttest !! text This template has in it. !! endarticle !! test pre-save transform: comment in subst (T3936) !! options pst !! wikitext {{subst:commenttest}} !! html/php This template has in it. !! end !! test pre-save transform: unclosed tag !! options pst !! wikitext '''not wiki''' !! html/php '''not wiki''' !! end !! test pre-save transform: mixed tag case !! options pst !! wikitext '''not wiki''' !! html/php '''not wiki''' !! end !! test pre-save transform: unclosed comment in !! options pst !! wikitext wikinowiki !! html/php !!end !! test pre-save transform: comment containing extension !! options pst !! wikitext !! html/php !!end !! test pre-save transform: comment containing nowiki !! options pst !! wikitext !! html/php !!end !! test pre-save transform: in subst (T5298) !! options pst !! wikitext {{subst:Includes}} !! html/php Foobar !! end !! test pre-save transform: in subst (T5298) !! options pst !! wikitext {{subst:Includes2}} !! html/php Foo !! end !! article Template:SubstTest !!text {{subst:Includes}} !! endarticle !! article Template:SafeSubstTest !! text {{safesubst:Includes}} !! endarticle !! article Template:SafeSubstSelfTest !! text {{safesubst:SafeSubstSelfTest}} !! endarticle !! article Template:safesubst !! text {{{1}}} !! endarticle !! test T24297: safesubst: works during PST !! options pst !! wikitext {{subst:SafeSubstTest}}{{safesubst:SubstTest}} !! html/php FoobarFoobar !! end !! test T24297: safesubst: works during normal parse !! wikitext {{SafeSubstTest}} !! html

Foobar

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

{{subst:Includes}}

!! html/parsoid+integrated

{{subst:Includes}}

!! end !! test safesubst self: does not work during normal parse - T276476 !! options pst title=[[Template:SafeSubstSelfTest]] !! wikitext {{SafeSubstSelfTest}} !! html/php {{SafeSubstSelfTest}} !! end ## Non-PST test !! test Template named safesubst - T309405 !! wikitext {{safesubst|123}} !! html/php

123

!! html/parsoid

123

!! end !! test pre-save transform: context links ("pipe trick") !! options pst !! wikitext [[Article (context)|]] [[Bar:Article|]] [[:Bar:Article|]] [[Bar:Article (context)|]] [[:Bar:Article (context)|]] [[|Article]] [[|Article (context)]] [[Bar:X (Y) Z|]] [[:Bar:X (Y) Z|]] !! html/php [[Article (context)|Article]] [[Bar:Article|Article]] [[:Bar:Article|Article]] [[Bar:Article (context)|Article]] [[:Bar:Article (context)|Article]] [[Article]] [[Article (context)]] [[Bar:X (Y) Z|X (Y) Z]] [[:Bar:X (Y) Z|X (Y) Z]] !! end !! test pre-save transform: context links ("pipe trick") with interwiki prefix !! options pst !! wikitext [[interwiki:Article|]] [[:interwiki:Article|]] [[interwiki:Bar:Article|]] [[:interwiki:Bar:Article|]] !! html/php [[interwiki:Article|Article]] [[:interwiki:Article|Article]] [[interwiki:Bar:Article|Bar:Article]] [[:interwiki:Bar:Article|Bar:Article]] !! end !! test pre-save transform: context links ("pipe trick") with parens in title !! options pst title=[[Somearticle (context)]] !! wikitext [[|Article]] !! html/php [[Article (context)|Article]] !! end !! test pre-save transform: context links ("pipe trick") with single, double-width and Arabic comma in title !! options pst title=[[Someplace, Somewhere]] !! wikitext [[|Otherplace]] [[Otherplace, Elsewhere|]] [[Otherplace, Elsewhere, Anywhere|]] [[Otherplace,Elsewhere|]] [[Otherplace، Elsewhere|]] !! html/php [[Otherplace, Somewhere|Otherplace]] [[Otherplace, Elsewhere|Otherplace]] [[Otherplace, Elsewhere, Anywhere|Otherplace]] [[Otherplace,Elsewhere|Otherplace]] [[Otherplace، Elsewhere|Otherplace]] !! end !! test pre-save transform: context links ("pipe trick") with parens and comma !! options pst title=[[Someplace (IGNORED), Somewhere]] !! wikitext [[|Otherplace]] [[Otherplace (place), Elsewhere|]] !! html/php [[Otherplace, Somewhere|Otherplace]] [[Otherplace (place), Elsewhere|Otherplace]] !! end !! test pre-save transform: context links ("pipe trick") with comma and parens !! options pst title=[[Who, me? (context)]] !! wikitext [[|Yes, you.]] [[Me, Myself, and I (1937 song)|]] !! html/php [[Yes, you. (context)|Yes, you.]] [[Me, Myself, and I (1937 song)|Me, Myself, and I]] !! end !! test pre-save transform: context links ("pipe trick") with namespace !! options pst title=[[Ns:Somearticle]] !! wikitext [[|Article]] !! html/php [[Ns:Article|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace and parens !! options pst title=[[Ns:Somearticle (context)]] !! wikitext [[|Article]] !! html/php [[Ns:Article (context)|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace and comma !! options pst title=[[Ns:Somearticle, Context, Whatever]] !! wikitext [[|Article]] !! html/php [[Ns:Article, Context, Whatever|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace, comma and parens !! options pst title=[[Ns:Somearticle, Context (context)]] !! wikitext [[|Article]] !! html/php [[Ns:Article (context)|Article]] !! end !! test pre-save transform: context links ("pipe trick") with namespace, parens and comma !! options pst title=[[Ns:Somearticle (IGNORED), Context]] !! wikitext [[|Article]] !! html/php [[Ns:Article, Context|Article]] !! end !! test pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149) !! options pst !! wikitext [[Article(context)|]] [[Bar:Article(context)|]] [[:Bar:Article(context)|]] [[|Article(context)]] [[Bar:X(Y)Z|]] [[:Bar:X(Y)Z|]] !! html/php [[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, T32149) !! options pst !! wikitext [[Article (context)|]] [[Bar:Article (context)|]] [[:Bar:Article (context)|]] [[|Article (context)]] [[Bar:X (Y) Z|]] [[:Bar:X (Y) Z|]] !! html/php [[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, T32149) !! options pst !! wikitext [[Article(context)|]] [[Bar:Article(context)|]] [[:Bar:Article(context)|]] [[|Article(context)]] [[Bar:X(Y)Z|]] [[:Bar:X(Y)Z|]] !! html/php [[Article(context)|Article]] [[Bar:Article(context)|Article]] [[:Bar:Article(context)|Article]] [[Article(context)]] [[Bar:X(Y)Z|X(Y)Z]] [[:Bar:X(Y)Z|X(Y)Z]] !! end !! test pre-save transform: context links ("pipe trick") with commas (T23660) !! options pst !! wikitext [[Article (context), context|]] [[Article (context),context|]] [[Bar:Article (context), context|]] [[Bar:Article (context),context|]] [[:Bar:Article (context), context|]] [[:Bar:Article (context),context|]] !! html/php [[Article (context), context|Article]] [[Article (context),context|Article]] [[Bar:Article (context), context|Article]] [[Bar:Article (context),context|Article]] [[:Bar:Article (context), context|Article]] [[:Bar:Article (context),context|Article]] !! end !! test Parsoid: backwards pipe trick !! wikitext [[|'''bar''']] !! html/php

[[|bar]]

!! html/parsoid

[[|bar]]

!! end !! test pre-save transform: trim trailing empty lines !! options pst !! wikitext Empty lines are trimmed !! html/php Empty lines are trimmed !! end !! test pre-save transform: Signature expansion !! options pst !! wikitext * ~~~ * ~~~~ * ~~~~~ * ~~~ * ~~~ * ~~~ !! html/php * [[Special:Contributions/127.0.0.1|127.0.0.1]] * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC) * 00:02, 1 January 1970 (UTC) * [[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 ParserOutput flags from signature expansion (T84843) !! options pst showflags !! wikitext ~~~~ !! metadata flags=!no-toc-conversion, user-signature !! html/php [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC) !! end !! test pre-save transform: Signature expansion in nowiki tags (T2093) !! options pst disabled !! wikitext Shall not expand: ~~~~ ~~~~ ~~~~ ~~~~ {{subst:Foo}} shall be converted to FOO As well as inside noinclude/onlyinclude {{subst:Foo}} {{subst:Foo}} But not inside includeonly {{subst:Foo}} !! html/php Shall not expand: ~~~~ ~~~~ ~~~~ ~~~~ FOO shall be converted to FOO As well as inside noinclude/onlyinclude FOO FOO But not inside includeonly {{subst:Foo}} !! end !! test Parsoid: Recognize nowiki with trailing space in tags !! options parsoid=wt2html !! wikitext
[[foo]] ab cd ef !! html/php

<div>[[foo]]

a<nowiki / >b

cd

e<nowiki/ >f

!! html/parsoid

<div>[[foo]]

a<nowiki / >b

cd

e<nowiki/ >f

!! end !! test Category with empty sort key !! options cat pst !! wikitext [[Category:MediaWiki User's Guide|]] !! html/php [[Category:MediaWiki User's Guide|MediaWiki User's Guide]] !! end !! test Category with empty sort key and parentheses !! options cat pst !! wikitext [[Category:Foo (bar)|]] !! html/php [[Category:Foo (bar)|Foo]] !! end !! test Category with link tail !! options cat pst !! wikitext 123[[Category:Foo]]456 !! html/php 123[[Category:Foo]]456 !! end !! test Category with template !! options cat pst !! wikitext [[Category:{{1x|Foo}}]] !! html/php [[Category:{{1x|Foo}}]] !! end !! test Category with template in sort key !! options cat pst !! wikitext [[Category:Foo|{{1x|Bar}}]] !! html/php [[Category:Foo|{{1x|Bar}}]] !! end !! test Category with template in sort key and title !! options cat pst !! wikitext [[Category:{{1x|Foo}}|{{1x|Bar}}]] !! html/php [[Category:{{1x|Foo}}|{{1x|Bar}}]] !! end !! test Tildes in comments !! options pst !! wikitext !! html/php !! end