Template:Sandbox: Difference between revisions

From OLPC
Jump to navigation Jump to search
(testing a template for semi-automatic fake translation redirects)
(reorganize)
 
(19 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 [[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}} 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>
[[Category:Template]]
{{#switch:{{lc:{{{2|{{{action|}}}}}}}}
|<!-- include action --> include={{:{{{page|{{#rel2abs:..}}}}}}}
|<!-- redirect action --> redirect
|<!-- missing action --> default=#REDIRECT [[{{{page|{{#rel2abs:..}}}}}}}]]
}}
<pre>
[[Category:Missing translation|{{PAGENAME}}]]
[[Category:Missing translation lang-{{{lang|{{{1}}}}}}|{{PAGENAME}}]]
</pre>


''Please leave this comment/text above for others to read.''
:What is the result of <nowiki>{{#rel2abs:..}}</nowiki>? [{{#rel2abs:..}}] that is.
----
:What is the result of <nowiki>{{#rel2abs:'..'}}</nowiki>? [{{#rel2abs:'..'}}] that is.
:What is the result of <nowiki>{{#rel2abs:".."}}</nowiki>? [{{#rel2abs:".."}}] that is.
:What is the result of <nowiki>{{#rel2abs:The OLPC wiki/translations}}</nowiki>? [{{#rel2abs:The OLPC wiki/translations}}] that is.


: <big>'''Testing: subpage parsing'''</big>
== Usage ==


; Goal
<nowiki>{{</nowiki>{{PAGENAME}}
: Given "Feature roadmap/Name of feature", return "Name of feature"
| lang = &lt;!-- UNNAMED #1 -- language code of the missing translation (see [[Translating]] for codes) --&gt;
: Given "Just a title", return "Just a title"
| ''action'' = &lt;!-- UNNAMED #2 -- OPTIONAL &mdash; what to do. Default is to REDIRECT to the base ''page''. --&gt;
| ''page'' = &lt;!-- OPTIONAL &mdash; the page name (sans enclosing ''[[]]'') to include or redirect to --&gt;
<nowiki>}}</nowiki>


</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>{{</nowiki>Missing translation|es<nowiki>}}</nowiki>
yes |
<nowiki>{{</nowiki>Missing translation|lang=es<nowiki>}}</nowiki>
no
<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