Difference between revisions of "Template:Param2"
Jump to navigation
Jump to search
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{ | <includeonly>{{ | ||
− | #if:{{{ | + | type|{{data|{{{name}}}|function{{{func}}}.param{{{param}}}.type}}}}{{ |
− | + | #if: {{data|{{{name}}}|function{{{func}}}.param{{{param}}}.optional}} | |
− | }}{{ | + | | <span style="text-decoration: underline dotted" title="This parameter is optional">?</span> |
− | # | + | }}{{ |
− | }}{{ | + | #ifeq: {{{format}}} | signature || {{ |
− | + | #if: {{data|{{{name}}}|function{{{func}}}.param{{{param}}}}} | |
− | + | | {{Pspan|{{data|{{{name}}}|function{{{func}}}.param{{{param}}}}}}}{{ | |
+ | #if: {{data|{{{name}}}|function{{{func}}}.param{{{param}}}.default}} | ||
+ | | = {{data|{{{name}}}|function{{{func}}}.param{{{param}}}.default}} | ||
+ | }} | ||
+ | }} | ||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
<templatedata> | <templatedata> | ||
{ | { | ||
− | "description": " | + | "description": "Despite the similar name, this is completely different from [[Template:Param]].", |
"params": { | "params": { | ||
− | " | + | "name": { |
− | "label": " | + | "label": "Function page name", |
− | "description": " | + | "description": "Name of a function page. '''This must be a data page.'''", |
− | + | "type": "wiki-page-name", | |
− | "type": " | + | "required": true |
− | " | ||
}, | }, | ||
− | " | + | "func": { |
− | "label": "Parameter | + | "label": "Overloaded function number", |
− | "description": " | + | "description": "A function page may describe multiple overloaded functions under the same name. This parameter allows you to select one. Allowed values are 1-5, inclusive.", |
− | "required": true, | + | "type": "number", |
+ | "required": true | ||
+ | }, | ||
+ | "param": { | ||
+ | "label": "Parameter number", | ||
+ | "description": "Specify which parameter to extract. Allowed values are 1-5, inclusive.", | ||
+ | "type": "number", | ||
+ | "required": true | ||
+ | }, | ||
+ | "format": { | ||
+ | "label": "Rendering format", | ||
+ | "description": "\"\" (empty string) = show everything, \"signature\" = only show parameter types (i.e. function signature). Default value is empty string (show everything).", | ||
"type": "line" | "type": "line" | ||
} | } | ||
Line 33: | Line 47: | ||
===Types and parameters=== | ===Types and parameters=== | ||
<pre> | <pre> | ||
− | *{{param2| | + | *"{{param2|name=visit_url|func=1|param=1}}" |
− | *{{param2| | + | *"{{param2|name=visit_url|func=2|param=1}}" |
− | *{{param2| | + | *"{{param2|name=visit_url|func=2|param=2}}" |
+ | *"{{param2|name=visit_url|func=2|param=3}}" | ||
</pre> | </pre> | ||
− | *{{param2| | + | *"{{param2|name=visit_url|func=1|param=1}}" |
− | *{{param2| | + | *"{{param2|name=visit_url|func=2|param=1}}" |
− | *{{param2| | + | *"{{param2|name=visit_url|func=2|param=2}}" |
+ | *"{{param2|name=visit_url|func=2|param=3}}" | ||
===Types only=== | ===Types only=== | ||
<pre> | <pre> | ||
− | *"{{param2| | + | *"{{param2|name=visit_url|func=1|param=1|format=signature}}" |
− | *"{{param2| | + | *"{{param2|name=visit_url|func=2|param=1|format=signature}}" |
− | *"{{param2| | + | *"{{param2|name=visit_url|func=2|param=2|format=signature}}" |
+ | *"{{param2|name=visit_url|func=2|param=3|format=signature}}" | ||
</pre> | </pre> | ||
− | *"{{param2| | + | *"{{param2|name=visit_url|func=1|param=1|format=signature}}" |
− | *"{{param2| | + | *"{{param2|name=visit_url|func=2|param=1|format=signature}}" |
− | *"{{param2| | + | *"{{param2|name=visit_url|func=2|param=2|format=signature}}" |
+ | *"{{param2|name=visit_url|func=2|param=3|format=signature}}" | ||
+ | |||
+ | [[Category:Basic Templates]] | ||
</noinclude> | </noinclude> |
Latest revision as of 14:13, 31 December 2020
Despite the similar name, this is completely different from [[Template:Param]].
Parameter | Description | Type | Status | |
---|---|---|---|---|
Function page name | name | Name of a function page. '''This must be a data page.''' | Page | required |
Overloaded function number | func | A function page may describe multiple overloaded functions under the same name. This parameter allows you to select one. Allowed values are 1-5, inclusive. | Number | required |
Parameter number | param | Specify which parameter to extract. Allowed values are 1-5, inclusive. | Number | required |
Rendering format | format | "" (empty string) = show everything, "signature" = only show parameter types (i.e. function signature). Default value is empty string (show everything). | Line | optional |
Examples
Types and parameters
*"{{param2|name=visit_url|func=1|param=1}}" *"{{param2|name=visit_url|func=2|param=1}}" *"{{param2|name=visit_url|func=2|param=2}}" *"{{param2|name=visit_url|func=2|param=3}}"
Types only
*"{{param2|name=visit_url|func=1|param=1|format=signature}}" *"{{param2|name=visit_url|func=2|param=1|format=signature}}" *"{{param2|name=visit_url|func=2|param=2|format=signature}}" *"{{param2|name=visit_url|func=2|param=3|format=signature}}"