Template:Module function link/doc
{{Mfl}} is similar to {{Ml}}, but assumes that the function specified is documented, and thus creates a link to a section of the same name expected to be found in the documentation. Another difference with {{Ml}} is that the behaviour of empty and undefined in the second parameter here is inverted.
Examples
| Code | Result | Notes |
|---|---|---|
| Template:Tji | {{#invoke:Example}} | Omits the function name |
| Template:Tji | {{#invoke:Example|hello}} | Usage with a function name. |
| Template:Tji | {{#invoke:Example|count_fruit|bananas=10|kiwis=5}} | Usage with a function name and parameters. |
| Template:Tji | {{#invoke:Example|count_fruit|Fred|bananas=10|apples=5}} | Usage with a function name and parameters, using {{=}}. |
| Template:Tji | {{#invoke:Example|function}} | Usage with a generic function name. This does not produce a usable invocation. |
TemplateData
- 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, itself linked, 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, expected to be documented | String | optional |
| 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
- {{Ml}} - Similar function but without generating links
- {{Tl}} - A version of this template for templates instead of modules.
[ subpage]
Template links
| Code | Result | Notes | lock |
|---|---|---|---|
|
{{T|example}} |
{{Example}} | makes brackets part of the link | |
|
{{T0|example}} |
Example | just link, without the brackets | |
|
{{T1|example}} |
{{Example}} | inner brackets are part of the link | |
|
{{T2|example}} |
{{Example}} | brackets are not a part of the link | |
|
{{Tl|example}} |
{{Example}} | makes brackets around the link | |
|
{{Tlr|User:Example}} |
{{User:Example}} | like {{tl}} but for any namespace | |
|
{{Tls|example}} |
{{subst:example}} | no parameters, adds "subst:" | |
| Templates showing parameters 0 Meta template {{Tle}} is easiest to parametrize. | |||
|
{{Tle|T=F|p1=1|v1|p2=2|v2|p3=3|v3}} |
{{ F | 1 = v1 | 2 = v2 | 3 = v3 }} | describes template parameters by names and values | |
|
{{Tlx|example|1|2|3|4|5||7|8|9}} |
{{example|1|2|3|4|5|7|8|...}} | up to 8 parameters | |
|
{{Tlf|example|1|2|3|...up to 8}} |
{{example|1|2|3|...up to 8}} | up to 8 parameters, no link | |
|
{{Tlc|example|1|2|3|4|||7|up to 8|9 is ignored.}} |
{{example|1|2|3|4|||7|up to 8}} | up to 8 parameters, no link, <code> style | |
|
{{Tld|example|1|2||3||}} |
{{example|1||2|3||}} | up to 8 parameters, <code> style[clarification needed] | |
|
{{Tlsu|User:Example}} |
{{subst:User:Example}} | like {{Tls}}, but supporting parameters | |
| Alternative forms 0 These ignore empty parameters. | |||
|
{{Tlp|example|1|2|3|4|5||7|8|9 is ignored.}} |
{{example|1|2|3|4|5|7|8}} | up to 8 parameters; ignores empty parms | |
|
{{Tl2|example|p1|p2}} |
{{example|p1|p2}} | up to 2 parameters, <code> style | |
|
{{Tlsp|example|1|2|3|4|5|6|7|8|9}} |
{{subst:example|1|2|3|4|5|6|7|8|...}} | up to 8 parameters, adds linked "subst:" | |
|
{{Tlsx|example|1|2|3|4|5|6 and above are ignored.|7}} |
{{subst:example|1|2|3|4|5|...}} | up to 5 parameters, adds linked "subst:", <code> style | |
General-purpose formatting
| Text style ↓ | {{tlg}} options[note 1] to achieve text style |
Link style | ||||
|---|---|---|---|---|---|---|
| Linked | Unlinked | Linked with subst | Unlinked with subst | Linked including braces | ||
| {{tlg}} options[note 1] to achieve link style |
N/A | DEFAULT | nolink=yes |
subst=yes |
nolink=yes |
braceinside=yes |
| normal | DEFAULT |
|
|
N/A | ||
code |
code=yes |
|
|
N/A | ||
| monospace | mono=yes |
N/A | N/A | |||
plaincode |
plaincode=yes | |||||
| kbd[clarification needed] | kbd=yes | |||||
- 1 2 3
{{tlg}}is the most general template, allowing any combination of text style and/or link style options. - 1 2 3 4 5 Prevents wrapping of text by placing it inside
<span class="nowrap">...</span>tags. - 1 2 3 Allows links to templates in any namespace.
- 1 2 3 4 Displays monospaced font using
<span style="font-family: monospace;">...</span>. - ↑
{{tlg|plaincode=yes}}uses<code style="border: none; background-color: transparent;">...</code>. - ↑
{{tlg|kbd=yes}}uses<kbd>...</kbd>.