Template:Sandbox: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (tweak & doc)
m (tweaking)
Line 2: Line 2:
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).
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).


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


Please leave this comment/text for others to read.
Please leave this comment/text for others to read.
Line 10: Line 10:
: <big>'''Testing: Missing translation<strike></strike>'''</big>
: <big>'''Testing: Missing translation<strike></strike>'''</big>


</noinclude>
</noinclude>{{#switch:{{lc:{{{2|{{{action|}}}}}}}}
{{#switch:{{lc:{{{2|{{{action|}}}}}}}}
|<!-- include action --> include={{:{{{page|{{#rel2abs:..}}}}}}}
|<!-- include action --> include={{:{{{page|{{#rel2abs:..}}}}}}}
|<!-- redirect action --> redirect
|<!-- redirect action --> redirect
|<!-- missing action --> #default=#REDIRECT [[{{{page|{{#rel2abs:..}}}}}]]
|<!-- missing action --> #default=#REDIRECT [[{{{page|{{#rel2abs:..}}}}}]]
}}
}}
[[Category:Missing translation|{{PAGENAME}}]]

[[Category:Missing translation|{{PAGENAME}}]]
<includeonly>[[Category:Missing translation lang-{{{lang|{{{1}}}}}}|{{PAGENAME}}]]</includeonly><noinclude>
[[Category:Missing translation lang-{{{lang|{{{1}}}}}}|{{PAGENAME}}]]


'''What is the result of:'''
<tt><nowiki>{{#rel2abs:..}}</nowiki>? [{{#rel2abs:..}}]</tt>
<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 ==
== Usage ==


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

Revision as of 16:59, 7 July 2007

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).

The idea of this {{Sandbox}} is to have that, a simple testing zone 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
Testing: Missing translation


  1. REDIRECT [[]]


Usage

{{Sandbox
 | 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 -->
 }}

NOTE: If you name one of the parameters, the other also has to be named.

Sample

The following are all equivalents, as they all generate a REDIRECT directive to the upper level

{{Missing translation|es}}
{{Missing translation|es|redirect}}
{{Missing translation|lang=es}}
{{Missing translation|lang=es|redirect}}                 #  Doesn't work due to naming inconsistency
{{Missing translation|lang=es|action=redirect}}
{{Missing translation|lang=es|action=redirect|page=Foo}} # assuming the including page is [[Foo/subpage]]

If instead of REDIRECTing you want to include the parent page, the following are equivalent:

{{Missing translation|es|include}}
{{Missing translation|lang=es|include}}                 #  Doesn't work due to naming inconsistency
{{Missing translation|lang=es|action=include}}
{{Missing translation|lang=es|action=include|page=Foo}} # assuming the including page is [[Foo/subpage]]

# This would include the [[Bar]] page regardless of what the including page is.
{{Missing translation|lang=es|action=include|page=Bar}}