Template:Module link code: Difference between revisions
mNo edit summary Tag: Reverted |
mNo edit summary Tag: Manual revert |
||
Line 1: | Line 1: | ||
<code>{{{{{{{|safesubst:}}}#invoke:Separated entries|main|Module:{{{1}}}{{{section|}}}|#invoke:{{{1}}}|{{{2|''function''}}}|separator=|}}}}</code><noinclude> | <code>{{{{{{{|safesubst:}}}#invoke:Separated entries|main|[[Module:{{{1}}}{{{section|}}}|#invoke:{{{1}}}]]|{{{2|''function''}}}|separator=|}}}}</code><noinclude> | ||
{{Documentation}} | {{Documentation}} | ||
<!-- Add categories to the /doc subpage, not here! --> | <!-- Add categories to the /doc subpage, not here! --> | ||
</noinclude> | </noinclude> |
Latest revision as of 23:06, 16 June 2023
{{[[Module:{{{1}}}|#invoke:{{{1}}}]]|function}}
This template uses Lua: |
{{Module link code}} (often abbreviated {{mlc}}) is used to display a module name as a link surrounded by braces with the {{#invoke}} parser function, thus showing the module name as code rather than actually invoking it. Its primary use is in instruction and documentation where it is used to refer to a module by name without invoking it. It is also supports the definition of a function and parameters.
Examples
Code | Result | Notes |
---|---|---|
{{mlc|Example}}
|
{{#invoke:Example|function}}
|
Usage without function name. This does not produce a usable invocation. |
{{mlc|Example|hello}}
|
{{#invoke:Example|hello}}
|
Usage with a function name. |
{{mlc|Example|count_fruits|4=bananas=5|5=apples=10}}
|
{{#invoke:Example|count_fruits|bananas=5|apples=10}}
|
Usage with a function name and parameters. |
{{mlc|Example|count_fruits|bananas{{=}}5|apples{{=}}10}}
|
{{#invoke:Example|count_fruits|bananas=5|apples=10}}
|
Usage with a function name and parameters, using {{=}}. |
See also
- {{ml}} – similar function but not surrounded in
<code>...</code>
tags
TemplateData
This template displays a module name as a link surrounded by braces with the {{#invoke}} parser function, thus showing how the module name would be used in code. Its primary use is in instruction and documentation.
Parameter | Description | Type | Status | |
---|---|---|---|---|
module name | 1 | the module name without the namespace prefix “Module:”, which is added automatically | String | required |
function name | 2 | the function name within the module to call | String | required |
parameter 1 | 3 | the name (and value) of the first parameter, use {{=}} to add an equal sign | String | optional |
parameter 2 | 4 | the name (and value) of the second parameter, use {{=}} to add an equal sign | String | optional |
parameter 3 | 5 | the name (and value) of the third parameter, use {{=}} to add an equal sign | String | optional |