Template:Sandbox: Difference between revisions
Jump to navigation
Jump to search
m (tweaking) |
(reorganize) |
||
(14 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]]. |
|||
⚫ | |||
⚫ | |||
</noinclude>{{#switch:{{lc:{{{2|{{{action|}}}}}}}} |
|||
⚫ | |||
|<!-- include action --> include={{:{{{page|{{#rel2abs:..}}}}}}} |
|||
|<!-- redirect action --> redirect |
|||
|<!-- missing action --> #default=#REDIRECT [[{{{page|{{#rel2abs:..}}}}}]] |
|||
⚫ | |||
[[Category:Missing translation|{{PAGENAME}}]] |
|||
<includeonly>[[Category:Missing translation lang-{{{lang|{{{1}}}}}}|{{PAGENAME}}]]</includeonly><noinclude> |
|||
⚫ | |||
== Usage == |
|||
---- |
|||
⚫ | |||
<nowiki>{{</nowiki>{{PAGENAME}} |
|||
| lang = <!-- UNNAMED #1 — language code of the missing translation (see [[Translating]] for codes) --> |
|||
| ''action'' = <!-- UNNAMED #2 — OPTIONAL — what to do. Default is to '''REDIRECT''' to the ''parent page''. --> |
|||
| ''page'' = <!-- OPTIONAL — the page name (sans enclosing ''[[]]'') to include or redirect to --> |
|||
<nowiki>}}</nowiki> |
|||
; Goal |
|||
'''NOTE:''' If you '''name''' one of the parameters, the other also has to be named. |
|||
: Given "Feature roadmap/Name of feature", return "Name of feature" |
|||
: Given "Just a title", return "Just a title" |
|||
⚫ | |||
== Sample == |
|||
{{#sub: |
|||
{{{1}}} | |
|||
{{#if: {{#pos:{{{1}}}|/}} | |
|||
{{#expr: {{#pos:{{{1}}}|/}} + 1}} | |
|||
{{#pos:{{{1}}}|/}} |
|||
}} |
|||
⚫ | |||
pos={{#pos:{{{1}}}|/}} |
|||
The following are all equivalents, as they all generate a <tt>REDIRECT</tt> directive to the upper level |
|||
iftest={{#if: {{#pos:{{{1}}}|/}} | |
|||
<nowiki>{{Missing translation|es}}</nowiki> |
|||
yes | |
|||
<nowiki>{{Missing translation|es|redirect}}</nowiki> |
|||
no |
|||
<nowiki>{{Missing translation|lang=es}}</nowiki> |
|||
}} |
|||
<s><nowiki>{{Missing translation|lang=es|redirect}}</nowiki></s> # Doesn't work due to naming inconsistency |
|||
<nowiki>{{Missing translation|lang=es|action=redirect}}</nowiki> |
|||
<nowiki>{{Missing translation|lang=es|action=redirect|page=Foo}}</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>{{Missing translation|es|include}}</nowiki> |
|||
<s><nowiki>{{Missing translation|lang=es|include}}</nowiki></s> # Doesn't work due to naming inconsistency |
|||
<nowiki>{{Missing translation|lang=es|action=include}}</nowiki> |
|||
<nowiki>{{Missing translation|lang=es|action=include|page=Foo}}</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>{{Missing translation|lang=es|action=include|page=Bar}}</nowiki> |
|||
[[Category:Template|{{PAGENAME}}]] |
|||
[[Category:Templates using ParserFunctions|{{PAGENAME}}]] |
|||
⚫ |
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