Template:Default

From PCSAR

(Difference between revisions)
Jump to: navigation, search
(New page: <noinclude> If arg 1 is blank use arg 2 instead. Test cases: <pre><nowiki> * {{default|non-blank|subst}} * {{default||subst}} </nowiki></pre> gives: * {{default|non-blank|subst}} * {{defa...)
Current revision (14:24, 8 February 2012) (edit) (undo)
 
Line 1: Line 1:
-
<noinclude>
+
<noinclude>{{documentation}}</noinclude><includeonly><!--
-
If arg 1 is blank use arg 2 instead.
+
-
Test cases:
+
Test for too many arguments
-
<pre><nowiki>
+
 
-
* {{default|non-blank|subst}}
+
-->{{#if:{{{6|}}}<!--
-
* {{default||subst}}
+
 
-
</nowiki></pre>
+
-->|'''Template:Default should have at most 5 arguments'''<!--
-
gives:
+
 
-
* {{default|non-blank|subst}}
+
-->}}<!--
-
* {{default||subst}}
+
 
-
</noinclude><includeonly>{{#if:{{{1}}}|{{{1}}}|{{{2}}}|}}</includeonly>
+
-->{{#if:{{{1|}}}|{{{1}}}<!--
 +
 
 +
-->|{{#if:{{{2|}}}|{{{2}}}<!--
 +
 
 +
-->|{{#if:{{{3|}}}|{{{3}}}<!--
 +
 
 +
-->|{{#if:{{{4|}}}|{{{4}}}<!--
 +
 
 +
-->|{{#if:{{{5|}}}|{{{5}}}<!--
 +
 
 +
-->}}<!--
 +
-->}}<!--
 +
-->}}<!--
 +
-->}}<!--
 +
-->}}<!--
 +
 
 +
--></includeonly>

Current revision

This is the documentation for the template Template:Default

Template:Default/Doc:

[edit] Description

This template returns the first argument which is not blank, or nothing if they all are blank.

[edit] Usage

  {{default|arg1|arg2|arg3|arg4|arg5}}

All arguments are optional

[edit] Examples

Test cases:

You type... You get...
{{default}}        
{{default|}}        
{{default|arg1}}        
arg1
{{default||}}        
{{default||arg2}}        
arg2
{{default|arg1|}}        
arg1
{{default|arg1|arg2}}        
arg1
{{default|||}}        
{{default|||arg3}}        
arg3
{{default||arg2|}}        
arg2
{{default||arg2|arg3}}        
arg2
{{default|arg1||}}        
arg1
{{default|arg1||arg3}}        
arg1
{{default|arg1|arg2|}}        
arg1
{{default|arg1|arg2|arg3}}        
arg1
{{default||||}}        
{{default||||arg4}}        
arg4
{{default|||arg3|}}        
arg3
{{default|||arg3|arg4}}        
arg3
{{default||arg2||}}        
arg2
{{default||arg2||arg4}}        
arg2
{{default||arg2|arg3|}}        
arg2
{{default||arg2|arg3|arg4}}        
arg2
{{default|arg1|||}}        
arg1
{{default|arg1|||arg4}}        
arg1
{{default|arg1||arg3|}}        
arg1
{{default|arg1||arg3|arg4}}        
arg1
{{default|arg1|arg2||}}        
arg1
{{default|arg1|arg2||arg4}}        
arg1
{{default|arg1|arg2|arg3|}}        
arg1
{{default|arg1|arg2|arg3|arg4}}        
arg1
{{default|||||}}        
{{default|||||arg5}}        
arg5
{{default||||arg4|}}        
arg4
{{default||||arg4|arg5}}        
arg4
{{default|||arg3||}}        
arg3
{{default|||arg3||arg5}}        
arg3
{{default|||arg3|arg4|}}        
arg3
{{default|||arg3|arg4|arg5}}        
arg3
{{default||arg2|||}}        
arg2
{{default||arg2|||arg5}}        
arg2
{{default||arg2||arg4|}}        
arg2
{{default||arg2||arg4|arg5}}        
arg2
{{default||arg2|arg3||}}        
arg2
{{default||arg2|arg3||arg5}}        
arg2
{{default||arg2|arg3|arg4|}}        
arg2
{{default||arg2|arg3|arg4|arg5}}        
arg2
{{default|arg1||||}}        
arg1
{{default|arg1||||arg5}}        
arg1
{{default|arg1|||arg4|}}        
arg1
{{default|arg1|||arg4|arg5}}        
arg1
{{default|arg1||arg3||}}        
arg1
{{default|arg1||arg3||arg5}}        
arg1
{{default|arg1||arg3|arg4|}}        
arg1
{{default|arg1||arg3|arg4|arg5}}        
arg1
{{default|arg1|arg2|||}}        
arg1
{{default|arg1|arg2|||arg5}}        
arg1
{{default|arg1|arg2||arg4|}}        
arg1
{{default|arg1|arg2||arg4|arg5}}        
arg1
{{default|arg1|arg2|arg3||}}        
arg1
{{default|arg1|arg2|arg3||arg5}}        
arg1
{{default|arg1|arg2|arg3|arg4|}}        
arg1
{{default|arg1|arg2|arg3|arg4|arg5}}        
arg1
{{default|arg1|arg2|arg3|arg4|arg5|arg6}}        
Template:Default should have at most 5 argumentsarg1


To see how this template is implemented, edit this page and examine the portion between <includeonly> and </includeonly>.

Personal tools