Difference between revisions of "Template:Docparam"
Jump to navigation
Jump to search
m (1 revision imported: Docparam template) |
Tag: 2017 source edit |
||
Line 2: | Line 2: | ||
--><div class="va-docparam"><!-- | --><div class="va-docparam"><!-- | ||
− | --><div class="va-docparam-icon">{{#switch:{{{req}}}|no= | + | --><div class="va-docparam-icon">{{#switch:{{{req}}}|no=Optional|semi=Semi-required|yes|#default=Required}}</div><!-- |
-->{{#if:{{{default|}}}|<div class="va-docparam-default">(default: {{#switch:{{lc:{{{default}}}}}|none|-=none|#default="{{{default}}}"}}{{#if:{{{default2|}}}| or {{#switch:{{lc:{{{default2}}}}}|none|-=none|#default="{{{default2}}}"}}}})</div>}}<!-- | -->{{#if:{{{default|}}}|<div class="va-docparam-default">(default: {{#switch:{{lc:{{{default}}}}}|none|-=none|#default="{{{default}}}"}}{{#if:{{{default2|}}}| or {{#switch:{{lc:{{{default2}}}}}|none|-=none|#default="{{{default2}}}"}}}})</div>}}<!-- | ||
--><span class="va-docparam-params">'''{{#if:{{{name|{{{1|}}}}}}|{{#replace:{{#replace:{{#replace:{{#replace:{{{name|{{{1|}}}}}}|| }}| >> |''' up to '''}}| // |''' or '''}}| ++ |''', '''}}|Name?}}</span>'''<!-- | --><span class="va-docparam-params">'''{{#if:{{{name|{{{1|}}}}}}|{{#replace:{{#replace:{{#replace:{{#replace:{{{name|{{{1|}}}}}}|| }}| >> |''' up to '''}}| // |''' or '''}}| ++ |''', '''}}|Name?}}</span>'''<!-- |
Revision as of 09:41, 11 June 2020
Name?
Description?
Usage
{{Docparam|name=parameter|req=yes|desc=description}}
Parameters
{{#replace:{{#replace:{{#replace:{{#replace:<unnamed 1> // name|| }}| >> | up to }}| // | or }}| ++ |, }}
Name of the parameter(s). Certain strings are automatically translated to allow for specification of alternative choices or parameter ranges.
Translated strings (all of these need to be enclosed by spaces):
>>
is converted to a dash with spaces around it (" - "); used to indicate parameter ranges (e.g. "game1 - game5").//
is converted to " or "; used for alternative choices (e.g. "<unnamed 1> or title").++
is converted to a comma with a trailing space (", "); used for listing parameters which are separate but work the same (e.g. "contentA1, contentB1").
{{#replace:{{#replace:{{#replace:{{#replace:default ++ default2|| }}| >> | up to }}| // | or }}| ++ |, }}
The default value(s) of the parameter.
{{#replace:{{#replace:{{#replace:{{#replace:desc|| }}| >> | up to }}| // | or }}| ++ |, }}
Description of the parameter.
(default: "yes")
{{#replace:{{#replace:{{#replace:{{#replace:req|| }}| >> | up to }}| // | or }}| ++ |, }}Specifies whether this parameter is required for the template to function.
Available options:
- no: Completely optional.
- semi: Parameter is required in certain circumstances but optional in others. For a range of parameters (set via
up to
, this means that at least one of them is required. - yes: Always required.
Copy/paste
{{Docparam|name=|req=|default=|desc= }}
Examples
Simple
{{Docparam|name=parameter|req=yes|default=|desc= Description }}
results in:
{{#replace:{{#replace:{{#replace:{{#replace:parameter|| }}| >> | up to }}| // | or }}| ++ |, }}
Description
Advanced
{{Docparam|name=parameter // alternative ++ similar1 >> similar3|req=no|default=default setting|desc= Description }}
results in:
(default: "default setting")
{{#replace:{{#replace:{{#replace:{{#replace:parameter // alternative ++ similar1 >> similar3|| }}| >> | up to }}| // | or }}| ++ |, }}Description
The above documentation is transcluded from Template:Docparam/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |