Template:Sandbox: Difference between revisions

From OLPC
Jump to navigation Jump to search
(doesn't seem to work :( last try before ditching it)
(reorganize)
 
(13 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.
Many times you may want to just 'test' an idea for a template, 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).


: 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 {{tl|Sandbox}} is to have that, a simple testing zone that will not interfere with others and avoid leaving a trail of botched attempts.


The idea of this {{tl|Sandbox}} page is to have that, a simple testing template that will not interfere with others and avoid leaving a trail of botched attempts.
Please leave this comment/text for others to read.
'''See Also''' http://meta.wikimedia.org/wiki/Help:Template
[[Category:Template]]


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]].
: <big>'''Testing: Missing translation<strike></strike>'''</big>


'''See Also''' http://meta.wikimedia.org/wiki/Help:Template
</noinclude>{{#switch:{{lc:{{{2|{{{action|}}}}}}}}
[[Category:Template]]
|<!-- include action --> include={{:{{{page|{{#rel2abs:..}}}}}}}
|<!-- redirect action --> redirect
|<!-- missing action --> #default=#REDIRECT <nowiki>[[</nowiki>{{{page|{{#rel2abs:..}}}}}<nowiki>]]</nowiki>
}}
[[Category:Missing translation|{{PAGENAME}}]]
<includeonly>[[Category:Missing translation lang-{{{lang|{{{1}}}}}}|{{PAGENAME}}]]</includeonly><noinclude>


''Please leave this comment/text above for others to read.''
== Usage ==
----


: <big>'''Testing: subpage parsing'''</big>
<nowiki>{{</nowiki>{{PAGENAME}}
| lang = &lt;!-- UNNAMED #1 &mdash; language code of the missing translation (see [[Translating]] for codes) --&gt;
| ''action'' = &lt;!-- UNNAMED #2 &mdash; OPTIONAL &mdash; what to do. Default is to '''REDIRECT''' to the ''parent page''. --&gt;
| ''page'' = &lt;!-- OPTIONAL &mdash; the page name (sans enclosing ''[[]]'') to include or redirect to --&gt;
<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"


</noinclude>
== 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}}]]
</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