Template:Sandbox: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (tweaking)
(reorganize)
 
(27 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: Status box<strike></strike>'''</big>


'''See Also''' http://meta.wikimedia.org/wiki/Help:Template
</noinclude>
[[Category:Template]]


''Please leave this comment/text above for others to read.''
{| cellpadding="2" cellspacing="0" style="float:right; border:1px solid #aaa; font-size:small; background:#f9f9f9; width:15em; margin:5px 0px 5px 5px;"
----


: <big>'''Testing: subpage parsing'''</big>
|-
| colspan="2" style="font-size:large; text-align:center; background:#6bbe45; color:white" | '''{{{component|{{PAGENAME}}}}}'''<span style="font-size:small;"><br>[[:Category:{{{type|activity}}}|({{{type|activity}}})]]</span>
{{ #if: {{{icon|}}} | {{!}}-
{{!}} colspan="2" style="valign:middle; padding:5px"{{!}} [[Image:{{{icon}}}{{!}}center]] |}}
|-
| style="text-align:right;" | '''Status:'''
| style="text-align:left;" | {{{status}}}
<!--
IF source -->
{{ #if: {{{source|foo}}} | <!--
IF build -->
{{ #if: {{{build|}}} |


; Goal
{{!}}-
: Given "Feature roadmap/Name of feature", return "Name of feature"
{{!}} style="text-align:right;" {{!}} '''Build:'''
: Given "Just a title", return "Just a title"
{{!}} style="text-align:left;" {{!}} {{{build}}} | <!--
ELSE build --> }} <!-- ENDIF build -->


</noinclude>
{{!}}-
{{#sub:
{{!}} style="text-align:right;" {{!}} '''Source:'''
{{{1}}} |
{{!}} style="text-align:left;" {{!}} {{{source}}} <!--
{{#if: {{#pos:{{{1}}}|/}} |
IF language -->
{{ #if: {{{language|}}} |
{{#expr: {{#pos:{{{1}}}|/}} + 1}} |
{{#pos:{{{1}}}|/}}
}}
}}


pos={{#pos:{{{1}}}|/}}
{{!}}-
iftest={{#if: {{#pos:{{{1}}}|/}} |
{{!}} style="text-align:right;" {{!}} '''Language:'''
yes |
{{!}} style="text-align:left;" {{!}} {{{language}}} | <!--
no
ELSE language --> }} <!-- ENDIF language --> <!--
}}
IF l10n -->
{{ #if: {{{l10n|}}} |

{{!}}-
{{!}} style="text-align:right;" {{!}} '''[[Localization|l10n]]:'''
{{!}} style="text-align:left;" {{!}} {{ #ifexist: {{PAGENAME}}/Localization|[[{{PAGENAME}}/Localization]]|{{{l10n|''<span class="plainlinks">[{{fullurl:{{PAGENAME}}}}/Localization add it here]</span>''}}} }} | <!--
ELSE l10n --> }} <!-- ENDIF l10n --> | <!--
ELSE source --> }} <!-- ENDIF source --> <!--
IF testplan -->
{{ #if: {{{testplan|{{#ifexist:{{PAGENAME}}/Test plan|gotpage}}|}}} |

{{!}}-
{{!}} style="text-align:right;" {{!}} '''[[:Category:Test Plans|Test plans]]:'''
{{!}} style="text-align:left;" {{!}} {{#ifexist:{{PAGENAME}}/Test plan|[[{{PAGENAME}}/Test plan]]|{{{testplan}}}}} | <!--
ELSE testplan --> }} <!-- ENDIF testplan -->

|-
| colspan="2" style="text-align:center;" | '''Contributors'''

|-
| colspan="2" style="text-align:center" | {{{contributors}}}
|}
<!-- CATEGORIZATION -- TESTING -->
Testing parameterized categorizations:
<!-- CATEGORIZATION -- type -->
<nowiki>[[</nowiki>Category:{{ #switch: {{lc:{{{type}}}}} | activity=Activity | core=Core | #default=Unknown Component }}<nowiki>]]</nowiki>
''type => {{{type}}} | {{lc:{{{type}}}}}''
<!-- CATEGORIZATION -- type & source & status -->
<nowiki>[[</nowiki>Category:{{ #if: {{{source|}}} | {{ #switch: {{lc:{{{type}}}}} | activity=Activity | core=Core | #default=Unknown Component }} {{{status}}} | Software idea }}<nowiki>]]</nowiki>
''source => {{{source}}} | {{ #if: {{{source|}}} | has source | no source }}''
''type => {{{type}}} | {{lc:{{{type}}}}}''
''status => {{{status}}} | {{lc:{{{status}}}}}''
<!-- CATEGORIZATION -- l10n -->
<nowiki>[[</nowiki>Category:{{ #if: {{{l10n|}}} | l10n | Pending i18n }}<nowiki>]]</nowiki>
''l10n => {{{l10n}}}''


<includeonly>[[Category:Activity]]</includeonly><noinclude>
This template automatically includes the page in the <nowiki>[[:Category:</nowiki>{{{type}}}]].

Many of the 'parameters' only make sense under certain circumstances (ie: no point in mentioning l10n if there's no source code).

== Usage ==

<nowiki>{{</nowiki>Status box
| ''component'' = &lt;!-- OPTIONAL -- Name of the component (defaults to page title) --&gt;
| type = &lt;!-- Type of the component {activity, core, support} --&gt;
| ''icon'' = &lt;!-- OPTIONAL -- ''file name.ext'' (sans <tt><nowiki>[[Image:</nowiki>''file name.ext''<nowiki>]]</nowiki></tt> --&gt;
| status = &lt;!-- Status of the activity --&gt;
| ''build'' = &lt;!-- OPTIONAL -- Build # where it first appeared --&gt;
| ''source'' = &lt;!-- OPTIONAL -- Repository / location of the source --&gt;
| ''language'' = &lt;!-- OPTIONAL -- Computer language of the ''source'' --&gt;
| ''l10n'' = &lt;!-- OPTIONAL -- Repository / location of the l10n resources --&gt;
| [[:Category:Test Plans|''testplan'']] = &lt;!-- OPTIONAL -- link to the [[:Category:Test Plans|test plan page]] --&gt;
| contributors = &lt;!-- People contributing to the activity --&gt;
| <s>version = &lt;!-- Current/latest version available --&gt;</s>''dropping it''
| <s>base = &lt;!-- Yes/No if it's included in the [[OS images]]
/ Could be the first ''build'' number --&gt;</s>''dropping it''
<nowiki>}}</nowiki>

== Sample ==

=== Empty ===
Raw invocation.

<br clear="all">
{{ Sandbox }}
<nowiki>{{</nowiki> Sandbox <nowiki>}}</nowiki>
; Notes : Nothing else should show.

=== Simplest ===
Basically an idea; using the page name; and misclassified by type.

<br clear="all">
{{ Sandbox | type = Bar }}
<nowiki>{{</nowiki> Sandbox
| type = Bar
<nowiki>}}</nowiki>
; Notes : the ''type'' is not recognized, so defaults to a ''<tt>Unknown Component</tt>''. Nothing else should show.

=== Simple 1 ===
Basically an idea; using the page name; and misclassified by type.

<br clear="all">
{{ Sandbox | type = activity }}
<nowiki>{{</nowiki> Sandbox
| type = activity
<nowiki>}}</nowiki>
; Notes : the ''type'' is recognized. Nothing else should show.

=== Simple 2 ===
Basically an idea; not using the page name; and classified by type.

<br clear="all">
{{ Sandbox | component = Foo | type = activity | icon = Xo s.png }}
<nowiki>{{</nowiki> Sandbox
| component = Foo
| type = activity
| icon = Xo s.png
<nowiki>}}</nowiki>
; Notes : specifying a name for the component, the ''type'' is recognized. Apart from the icon, nothing else should show.

=== Simple 3 ===
An idea that has some code; not using the page name; and classified by type.

<br clear="all">
{{ Sandbox | component = Foo | type = activity | icon = Xo s.png | source = [[foo]] }}
<nowiki>{{</nowiki> Sandbox
| component = Foo
| type = activity
| icon = Xo s.png
| source = [[foo]]
<nowiki>}}</nowiki>
; Notes : specifying a name for the component, the ''type'' is recognized. Apart from the icon, nothing else should show.

== Sample ==

<br clear="all">
{{ Sandbox | component = Foo | type = Bar | icon = Xo s.png | testplan = [[some page]] }}
<nowiki>{{</nowiki> Sandbox
| component = Foo
| type = Bar
| icon = Xo s.png
| testplan = <nowiki>[[some page]]</nowiki>
<nowiki>}}</nowiki>
; Notes : the ''type'' is not recognized, so defaults to a general one, ''testplan'' shows because it has one specified, ''icon'' shows, goes into ''pending 18n'' as no ''l10n'' resource is given.

<br clear="all">
{{ Sandbox | type = Activity | status = beta | l10n = [[Localization]] }}
<nowiki>{{</nowiki> Sandbox
| type = activity
| status = beta
| l10n = <nowiki>[[Localization]]</nowiki>
<nowiki>}}</nowiki>
; Notes : Taking the ''component'' name from the <nowiki>{{PAGENAME}}</nowiki>, ''icon'' is undefined. Goes into the l10n category, as it can be l10n'ed.

=== Sample Full? ===
<br clear="all">
{{ Sandbox | component = original name |icon = Xo s.png | testplan = [[some plan]] | type = Activity | status = beta | source = [[foo]] | l10n = [[Localization]] | contributors = Xavier, [[User:Xavi|Xavi]]}}
<nowiki>{{</nowiki> Sandbox
| type = activity
| status = beta
| source = [[foo]]
| l10n = <nowiki>[[Localization]]</nowiki>
<nowiki>}}</nowiki>
; Notes : Taking the ''component'' name from the <nowiki>{{PAGENAME}}</nowiki>, ''icon'' is undefined. Goes into the l10n category, as it can be l10n'ed.

[[Category:Template]]
</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