Template:Sandbox: Difference between revisions
Jump to navigation
Jump to search
m (tweak) |
(reorganize) |
||
(17 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude> |
<noinclude> |
||
Often you need to test an idea for a template, so try it out here. |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
If you try out the template here, you have to save the template and then preview to see how it works. You can instead edit [[Test sandbox template]]. |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{{#switch:{{lc:{{{2|{{{action|}}}}}}}} |
|||
|<!-- include action --> include={{:{{{page|{{#rel2abs:..}}}}}}} |
|||
|<!-- redirect action --> redirect |
|||
|<!-- missing action --> default=#REDIRECT [[{{{page|{{#rel2abs:..}}}}}]] |
|||
⚫ | |||
⚫ | |||
[[Category:Missing translation|{{PAGENAME}}]] |
|||
---- |
|||
[[Category:Missing translation lang-{{{lang|{{{1}}}}}}|{{PAGENAME}}]] |
|||
⚫ | |||
; Goal |
|||
'''What is the result of:''' |
|||
: Given "Feature roadmap/Name of feature", return "Name of feature" |
|||
<tt><nowiki>{{#rel2abs:..}}</nowiki>? [{{#rel2abs:..}}]</tt> |
|||
: Given "Just a title", return "Just a title" |
|||
<tt><nowiki>{{{page|{{#rel2abs:..}}}}}</nowiki>? [{{{page|{{#rel2abs:..}}}}}]</tt> |
|||
<tt><nowiki>{{lc:{{{2|{{{action|}}}}}}}}</nowiki>? [{{lc:{{{2|{{{action|}}}}}}}}]</tt> |
|||
<tt><nowiki>default=#REDIRECT [[{{{page|{{#rel2abs:..}}}}}]]</nowiki>? [default=#REDIRECT [[{{{page|{{#rel2abs:..}}}}}]]]</tt> |
|||
<noinclude> |
|||
⚫ | |||
== Usage == |
|||
{{#sub: |
|||
{{{1}}} | |
|||
{{#if: {{#pos:{{{1}}}|/}} | |
|||
{{#expr: {{#pos:{{{1}}}|/}} + 1}} | |
|||
{{#pos:{{{1}}}|/}} |
|||
}} |
|||
⚫ | |||
pos={{#pos:{{{1}}}|/}} |
|||
<nowiki>{{</nowiki>{{PAGENAME}} |
|||
iftest={{#if: {{#pos:{{{1}}}|/}} | |
|||
| lang = <!-- UNNAMED #1 -- language code of the missing translation (see [[Translating]] for codes) --> |
|||
yes | |
|||
| ''action'' = <!-- UNNAMED #2 -- OPTIONAL — what to do. Default is to REDIRECT to the base ''page''. --> |
|||
no |
|||
| ''page'' = <!-- OPTIONAL — the page name (sans enclosing ''[[]]'') to include or redirect to --> |
|||
}} |
|||
<nowiki>}}</nowiki> |
|||
== Sample == |
|||
The following are all equivalents, as they all generate a <tt>REDIRECT</tt> directive to the upper level |
|||
<nowiki>{{</nowiki>Missing translation|es<nowiki>}}</nowiki> |
|||
<nowiki>{{</nowiki>Missing translation|lang=es<nowiki>}}</nowiki> |
|||
<nowiki>{{</nowiki>Missing translation|lang=es|redirect<nowiki>}}</nowiki> |
|||
<nowiki>{{</nowiki>Missing translation|lang=es|action=redirect<nowiki>}}</nowiki> |
|||
<nowiki>{{</nowiki>Missing translation|lang=es|action=redirect|page=Foo<nowiki>}}</nowiki> # assuming the including page is <tt><nowiki>[[Foo/subpage]]</nowiki></tt> |
|||
If instead of <tt>REDIRECT</tt>ing you want to include the ''parent'' page, the following are equivalent: |
|||
<nowiki>{{</nowiki>Missing translation|es|include<nowiki>}}</nowiki> |
|||
<nowiki>{{</nowiki>Missing translation|lang=es|include<nowiki>}}</nowiki> |
|||
<nowiki>{{</nowiki>Missing translation|lang=es|action=include<nowiki>}}</nowiki> |
|||
<nowiki>{{</nowiki>Missing translation|lang=es|action=include|page=Foo<nowiki>}}</nowiki> # assuming the including page is <tt><nowiki>[[Foo/subpage]]</nowiki></tt> |
|||
# This would include the <tt><nowiki>[[Bar]]</nowiki></tt> page regardless of what the including page is. |
|||
<nowiki>{{</nowiki>Missing translation|lang=es|action=include|page=Bar<nowiki>}}</nowiki> |
|||
[[Category:Template|{{PAGENAME}}]] |
|||
[[Category:Templates using ParserFunctions|{{PAGENAME}}]] |
|||
</noinclude> |
Latest revision as of 01:31, 16 March 2009
Often you need to test an idea for a template, so try it out here.
- I haven't found a sensible way of fully testing templates by themselves (as they will not get included in the edited version, but rather the saved version). -- User:Xavi
The idea of this {{Sandbox}} page is to have that, a simple testing template that will not interfere with others and avoid leaving a trail of botched attempts.
If you try out the template here, you have to save the template and then preview to see how it works. You can instead edit Test sandbox template.
See Also http://meta.wikimedia.org/wiki/Help:Template
Please leave this comment/text above for others to read.
- Testing: subpage parsing
- Goal
- Given "Feature roadmap/Name of feature", return "Name of feature"
- Given "Just a title", return "Just a title"
{{#sub:
{{{1}}} | Expression error: Unrecognized punctuation character "{".
}}
pos={{#pos:{{{1}}}|/}} iftest=yes