Template:Mlx
{{#invoke:[[Module:{{{1}}}|{{{1}}}]]|function}}
Uses Lua: |
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.
is used to display a module name as a link surrounded by braces with the {{#invoke}}Examples
[edit]Code | Result | Notes |
---|---|---|
{{mlx|Example}}
|
{{#invoke:Example|function}}
|
Usage without function name. This does not produce a usable invocation. |
{{mlx|Example|hello}}
|
{{#invoke:Example|hello}}
|
Usage with a function name. |
{{mlx|Example|count_fruits|4=bananas=5|5=apples=10}}
|
{{#invoke:Example|count_fruits|bananas=5|apples=10}}
|
Usage with a function name and parameters. |
{{mlx|Example|count_fruits|bananas{{=}}5|apples{{=}}10}}
|
{{#invoke:Example|count_fruits|bananas=5|apples=10}}
|
Usage with a function name and parameters, using {{=}}. |
TemplateData
[edit]- TemplateData
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.
Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either useTemplateData=1
or useTemplateData=only
on the /doc
subpage and transcluding it with {{Documentation}} into the template. <nowiki>
-tags can be wrapped around the arguments, if required, to avoid templates being expanded.
Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>
-tags into the Wikitext of the template, as described in various Wikipediae.
Wikipedia's help about TemplateData • Commons-specific information
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 |
See also
[edit]- {{Ml}} - Similar function but not surrounded in
<code>...</code>
tags. - {{Tlx}} - A version of this template for templates instead of modules.
- {{Tlc}} –
{{Example}}
– Not linked, several parameters and text in<code></code>
style. - {{Tld}} – {{Example}} – Template link, several parameters and teletype text style[clarification needed].
- {{Tle}} – {{ Tle | Example }} – Linked or not, expanded parameter description
- {{Tlf}} – {{Example}} – Not linked, several parameters and normal text style.
- {{Tl}} – {{Example}} – Linked, no parameters or simple ones[clarification needed], and teletype text style[clarification needed].
- {{Tlx}} – {{Example}} – Template link, several parameters and normal text style.
- {{Tlp}} – {{Example}} – Template link, several non-blank parameters and normal text style.
- {{Tlu}} – {{Example}} – Link to arbitrary other namespace.
- with subst
- Template:Tls – {{subst:template}}
- Template:Tlsx –
{{subst:template}}
- Template:Tlsp – {{subst:template}}
For more see: Commons:Link templates