Address
:
[go:
up one dir
,
main page
]
Include Form
Remove Scripts
Accept Cookies
Show Images
Show Referer
Rotate13
Base64
Strip Meta
Strip Title
Session Cookies
Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2121
pipeTrickTests.txt
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 8:36 PM
2014-11-21 20:36:06 (UTC+0)
Size
12 KB
Referenced Files
None
Subscribers
None
pipeTrickTests.txt
View Options
!! 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
Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
!! endarticle
!! test
pre-save transform: subst:
!! options
PST
!! input
<ref>{{subst:test}}</ref>
!! result
<ref>This is a test template</ref>
!! end
!! test
pre-save transform: normal template
!! options
PST
!! input
<ref>{{test}}</ref>
!! result
<ref>{{test}}</ref>
!! end
!! test
pre-save transform: nonexistent template
!! options
PST
!! input
<ref>{{thistemplatedoesnotexist}}</ref>
!! result
<ref>{{thistemplatedoesnotexist}}</ref>
!! end
!! test
pre-save transform: subst magic variables
!! options
PST
!! input
<ref>{{subst:SITENAME}}</ref>
!! result
<ref>MediaWiki</ref>
!! end
# This is bug 89, which I fixed. -- wtm
!! test
pre-save transform: subst: templates with parameters
!! options
pst
!! input
<ref>{{subst:paramtest|param="something else"}}</ref>
!! result
<ref>This is a test template with parameter "something else"</ref>
!! end
!! article
Template:nowikitest
!! text
<nowiki>'''not wiki'''</nowiki>
!! endarticle
!! test
pre-save transform: nowiki in subst (bug 1188)
!! options
pst
!! input
<ref>{{subst:nowikitest}}</ref>
!! result
<ref><nowiki>'''not wiki'''</nowiki></ref>
!! end
!! article
Template:commenttest
!! text
This template has <!-- a comment --> in it.
!! endarticle
!! test
pre-save transform: comment in subst (bug 1936)
!! options
pst
!! input
<ref>{{subst:commenttest}}</ref>
!! result
<ref>This template has <!-- a comment --> in it.</ref>
!! end
!! test
pre-save transform: unclosed tag
!! options
pst noxml
!! input
<ref><nowiki>'''not wiki'''</ref>
!! result
<ref><nowiki>'''not wiki'''</ref>
!! end
!! test
pre-save transform: mixed tag case
!! options
pst noxml
!! input
<ref><NOwiki>'''not wiki'''</noWIKI></ref>
!! result
<ref><NOwiki>'''not wiki'''</noWIKI></ref>
!! end
!! test
pre-save transform: unclosed comment in <nowiki>
!! options
pst noxml
!! input
<ref>wiki<nowiki>nowiki<!--nowiki</nowiki>wiki</ref>
!! result
<ref>wiki<nowiki>nowiki<!--nowiki</nowiki>wiki</ref>
!!end
!! test
pre-save transform: comment containing gallery (bug 5024)
!! options
pst
!! input
<ref><!-- <gallery>data</gallery> --></ref>
!!result
<ref><!-- <gallery>data</gallery> --></ref>
!!end
!! test
pre-save transform: comment containing extension
!! options
pst
!! input
<ref><!-- <tag>data</tag> --></ref>
!!result
<ref><!-- <tag>data</tag> --></ref>
!!end
!! test
pre-save transform: comment containing nowiki
!! options
pst
!! input
<ref><!-- <nowiki>data</nowiki> --></ref>
!!result
<ref><!-- <nowiki>data</nowiki> --></ref>
!!end
!! test
pre-save transform: <noinclude> in subst (bug 3298)
!! options
pst
!! input
<ref>{{subst:Includes}}</ref>
!! result
<ref>Foobar</ref>
!! end
!! article
Template:Includes2
!! text
<onlyinclude>Foo</onlyinclude>bar
!! endarticle
!! test
pre-save transform: <onlyinclude> in subst (bug 3298)
!! options
pst
!! input
<ref>{{subst:Includes2}}</ref>
!! result
<ref>Foo</ref>
!! end
!! article
Template:SubstTest
!!text
{{<includeonly>subst:</includeonly>Includes}}
!! endarticle
!! article
Template:SafeSubstTest
!! text
{{<includeonly>safesubst:</includeonly>Includes}}
!! endarticle
!! test
bug 22297: safesubst: works during PST
!! options
pst
!! input
<ref>{{subst:SafeSubstTest}}{{safesubst:SubstTest}}</ref>
!! result
<ref>FoobarFoobar</ref>
!! end
!! test
pre-save transform: context links ("pipe trick")
!! options
pst
!! input
<ref>[[Article (context)|]]</ref>
<ref>[[Bar:Article|]]</ref>
<ref>[[:Bar:Article|]]</ref>
<ref>[[Bar:Article (context)|]]</ref>
<ref>[[:Bar:Article (context)|]]</ref>
<ref>[[|Article]]</ref>
<ref>[[|Article (context)]]</ref>
<ref>[[Bar:X (Y) Z|]]</ref>
<ref>[[:Bar:X (Y) Z|]]</ref>
!! result
<ref>[[Article (context)|Article]]</ref>
<ref>[[Bar:Article|Article]]</ref>
<ref>[[:Bar:Article|Article]]</ref>
<ref>[[Bar:Article (context)|Article]]</ref>
<ref>[[:Bar:Article (context)|Article]]</ref>
<ref>[[Article]]</ref>
<ref>[[Article (context)]]</ref>
<ref>[[Bar:X (Y) Z|X (Y) Z]]</ref>
<ref>[[:Bar:X (Y) Z|X (Y) Z]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with interwiki prefix
!! options
pst
!! input
<ref>[[interwiki:Article|]]</ref>
<ref>[[:interwiki:Article|]]</ref>
<ref>[[interwiki:Bar:Article|]]</ref>
<ref>[[:interwiki:Bar:Article|]]</ref>
!! result
<ref>[[interwiki:Article|Article]]</ref>
<ref>[[:interwiki:Article|Article]]</ref>
<ref>[[interwiki:Bar:Article|Bar:Article]]</ref>
<ref>[[:interwiki:Bar:Article|Bar:Article]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with parens in title
!! options
pst title=[[Somearticle (context)]]
!! input
<ref>[[|Article]]</ref>
!! result
<ref>[[Article (context)|Article]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with comma in title
!! options
pst title=[[Someplace, Somewhere]]
!! input
<ref>[[|Otherplace]]</ref>
<ref>[[Otherplace, Elsewhere|]]</ref>
<ref>[[Otherplace, Elsewhere, Anywhere|]]</ref>
!! result
<ref>[[Otherplace, Somewhere|Otherplace]]</ref>
<ref>[[Otherplace, Elsewhere|Otherplace]]</ref>
<ref>[[Otherplace, Elsewhere, Anywhere|Otherplace]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with parens and comma
!! options
pst title=[[Someplace (IGNORED), Somewhere]]
!! input
<ref>[[|Otherplace]]</ref>
<ref>[[Otherplace (place), Elsewhere|]]</ref>
!! result
<ref>[[Otherplace, Somewhere|Otherplace]]</ref>
<ref>[[Otherplace (place), Elsewhere|Otherplace]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with comma and parens
!! options
pst title=[[Who, me? (context)]]
!! input
<ref>[[|Yes, you.]]</ref>
<ref>[[Me, Myself, and I (1937 song)|]]</ref>
!! result
<ref>[[Yes, you. (context)|Yes, you.]]</ref>
<ref>[[Me, Myself, and I (1937 song)|Me, Myself, and I]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace
!! options
pst title=[[Ns:Somearticle]]
!! input
<ref>[[|Article]]</ref>
!! result
<ref>[[Ns:Article|Article]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace and parens
!! options
pst title=[[Ns:Somearticle (context)]]
!! input
<ref>[[|Article]]</ref>
!! result
<ref>[[Ns:Article (context)|Article]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace and comma
!! options
pst title=[[Ns:Somearticle, Context, Whatever]]
!! input
<ref>[[|Article]]</ref>
!! result
<ref>[[Ns:Article, Context, Whatever|Article]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace, comma and parens
!! options
pst title=[[Ns:Somearticle, Context (context)]]
!! input
<ref>[[|Article]]</ref>
!! result
<ref>[[Ns:Article (context)|Article]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace, parens and comma
!! options
pst title=[[Ns:Somearticle (IGNORED), Context]]
!! input
<ref>[[|Article]]</ref>
!! result
<ref>[[Ns:Article, Context|Article]]</ref>
!! 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
<ref>[[Article(context)|]]</ref>
<ref>[[Bar:Article(context)|]]</ref>
<ref>[[:Bar:Article(context)|]]</ref>
<ref>[[|Article(context)]]</ref>
<ref>[[Bar:X (Y) Z|]]</ref>
<ref>[[:Bar:X (Y) Z|]]</ref>
!! result
<ref>[[Article(context)|Article]]</ref>
<ref>[[Bar:Article(context)|Article]]</ref>
<ref>[[:Bar:Article(context)|Article]]</ref>
<ref>[[Article(context)]]</ref>
<ref>[[Bar:X (Y) Z|X (Y) Z]]</ref>
<ref>[[:Bar:X (Y) Z|X (Y) Z]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
!! options
pst
!! input
<ref>[[Article (context)|]]</ref>
<ref>[[Bar:Article (context)|]]</ref>
<ref>[[:Bar:Article (context)|]]</ref>
<ref>[[|Article (context)]]</ref>
<ref>[[Bar:X (Y) Z|]]</ref>
<ref>[[:Bar:X (Y) Z|]]</ref>
!! result
<ref>[[Article (context)|Article]]</ref>
<ref>[[Bar:Article (context)|Article]]</ref>
<ref>[[:Bar:Article (context)|Article]]</ref>
<ref>[[Article (context)]]</ref>
<ref>[[Bar:X (Y) Z|X (Y) Z]]</ref>
<ref>[[:Bar:X (Y) Z|X (Y) Z]]</ref>
!! end
!! test
pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
!! options
pst
!! input
<ref>[[Article(context)|]]</ref>
<ref>[[Bar:Article(context)|]]</ref>
<ref>[[:Bar:Article(context)|]]</ref>
<ref>[[|Article(context)]]</ref>
<ref>[[Bar:X(Y)Z|]]</ref>
<ref>[[:Bar:X(Y)Z|]]</ref>
!! result
<ref>[[Article(context)|Article]]</ref>
<ref>[[Bar:Article(context)|Article]]</ref>
<ref>[[:Bar:Article(context)|Article]]</ref>
<ref>[[Article(context)]]</ref>
<ref>[[Bar:X(Y)Z|X(Y)Z]]</ref>
<ref>[[:Bar:X(Y)Z|X(Y)Z]]</ref>
!! end
!! test
pre-save transform: trim trailing empty lines
!! options
pst
!! input
<ref>Empty lines are trimmed</ref>
!! result
<ref>Empty lines are trimmed</ref>
!! end
!! test
pre-save transform: Signature expansion
!! options
pst
!! input
<ref>* ~~~</ref>
<ref>* <noinclude>~~~</noinclude></ref>
<ref>* <includeonly>~~~</includeonly></ref>
<ref>* <onlyinclude>~~~</onlyinclude></ref>
!! result
<ref>* [[Special:Contributions/127.0.0.1|127.0.0.1]]</ref>
<ref>* <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude></ref>
<ref>* <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly></ref>
<ref>* <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude></ref>
!! end
!! test
pre-save transform: Signature expansion in nowiki tags (bug 93)
!! options
pst disabled
!! input
<ref>Shall not expand:</ref>
<ref><nowiki>~~~~</nowiki></ref>
<ref><includeonly><nowiki>~~~~</nowiki></includeonly></ref>
<ref><noinclude><nowiki>~~~~</nowiki></noinclude></ref>
<ref><onlyinclude><nowiki>~~~~</nowiki></onlyinclude></ref>
<ref>{{subst:Foo}} shall be converted to FOO</ref>
<ref>As well as inside noinclude/onlyinclude</ref>
<ref><noinclude>{{subst:Foo}}</noinclude></ref>
<ref><onlyinclude>{{subst:Foo}}</onlyinclude></ref>
<ref>But not inside includeonly</ref>
<ref><includeonly>{{subst:Foo}}</includeonly></ref>
!! result
<ref>Shall not expand:</ref>
<ref><nowiki>~~~~</nowiki></ref>
<ref><includeonly><nowiki>~~~~</nowiki></includeonly></ref>
<ref><noinclude><nowiki>~~~~</nowiki></noinclude></ref>
<ref><onlyinclude><nowiki>~~~~</nowiki></onlyinclude></ref>
<ref>FOO shall be converted to FOO</ref>
<ref>As well as inside noinclude/onlyinclude</ref>
<ref><noinclude>FOO</noinclude></ref>
<ref><onlyinclude>FOO</onlyinclude></ref>
<ref>But not inside includeonly</ref>
<ref><includeonly>{{subst:Foo}}</includeonly></ref>
!! end
!! test
Pipe trick in gallery
!! options
pst
!! input
<gallery>
image1.png |
image2.gif|||||
image3|
image4 |300px| centre
image5.svg| http://///////
[[x (y)|]]]]
* image6
</gallery>
!! result
<gallery>
image1.png |
image2.gif|||||
image3|
image4 |300px| centre
image5.svg| http://///////
[[x (y)|x]]]]
* image6
</gallery>
!! end
!! test
Pipe trick in gallery (with options)
!! options
pst
!! input
<gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page (yes)|]]' >
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.
</gallery>
!! result
<gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page (yes)|Main Page]]' >
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.
</gallery>
!! end
!! test
Error in File: syntax within gallery
!! options
pst
!! input
<gallery>
File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt|]]|alt=galleryalt
File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
</gallery>
!! result
<gallery>
File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt|]]|alt=galleryalt
File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
</gallery>
!! end
!! test
Imagemap content
!! options
pst
!! input
<imagemap>
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]]
</imagemap>
!! result
<imagemap>
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]]
</imagemap>
!! end
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1698
Default Alt Text
pipeTrickTests.txt (12 KB)
Attached To
Mode
T4700: Pre-save transform skips extensions using wikitext (gallery, references, footnotes, Cite, status indicators, pipe trick, subst, signatures)
Attached
Detach File
Event Timeline
Log In to Comment