960
edits
(Fix the default value usage) |
|||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{{ {{{switch}}}|{{{default|{{{switch | <includeonly>{{{ {{{switch|}}}|{{IsEmpty|{{{default|}}}|empty={{{switch|}}}}}}}}</includeonly><noinclude> | ||
This template allows you to conditionally show one of a predefined set of arguments, depending on another named argument. | This template allows you to conditionally show one of a predefined set of arguments, depending on another named argument. | ||
=Usage= | =Usage= | ||
Line 9: | Line 9: | ||
The "default" argument will be used when the "switch" value doesn't match any of the options or that's empty: | The "default" argument will be used when the "switch" value doesn't match any of the options or that's empty: | ||
*<nowiki>{{Switch|yes=yay|no=nay|default=maybe|switch=err}}</nowiki> shows "{{Switch|yes=yay|no=nay|default=maybe|switch=err}}" | *<nowiki>{{Switch|yes=yay|no=nay|default=maybe|switch=err}}</nowiki> shows "{{Switch|yes=yay|no=nay|default=maybe|switch=err}}" | ||
The "default" argument is ignored when it's empty: | |||
*<nowiki>{{Switch|yes=yay|no=nay|default=|switch=err}}</nowiki> shows "{{Switch|yes=yay|no=nay|default=|switch=err}}" | |||
</noinclude> | </noinclude> |
edits