Templat:Module function link
| Templat ini menggunakan Lua: |
{{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
[sunting sumber]| Code | Result | Notes |
|---|---|---|
{{mfl|Example}} |
{{#invoke:Example}} | Omits the function name |
{{mfl|Example|hello}} |
{{#invoke:Example|hello}} | Usage with a function name. |
{{mfl|Example|count_fruit|3=bananas=10|4=kiwis=5}} |
{{#invoke:Example|count_fruit|bananas=10|kiwis=5}} | Usage with a function name and parameters. |
{{mfl|Example|count_fruit|Fred|bananas{{=}}10|apples{{=}}5}} |
{{#invoke:Example|count_fruit|Fred|bananas=10|apples=5}} | Usage with a function name and parameters, using {{=}}. |
{{mfl|Example|}} |
{{#invoke:Example|function}} | Usage with a generic function name. This does not produce a usable invocation. |
TemplateData
[sunting sumber]TemplateData untuk Module function link
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 | Keterangan | Jenis | Status | |
|---|---|---|---|---|
| module name | 1 | the module name without the namespace prefix “Module:”, which is added automatically | Rentetan | diperlukan |
| function name | 2 | the function name within the module to call, expected to be documented | Rentetan | pilihan |
| parameter 1 | 3 | the name (and value) of the first parameter, use {{=}} to add an equal sign | Rentetan | pilihan |
| parameter 2 | 4 | the name (and value) of the second parameter, use {{=}} to add an equal sign | Rentetan | pilihan |
| parameter 3 | 5 | the name (and value) of the third parameter, use {{=}} to add an equal sign | Rentetan | pilihan |
See also
[sunting sumber]- {{ml}} - Similar function but without generating links
- {{tl}} - A version of this template for templates instead of modules.
| Link style | Linked | Unlinked | Linked with subst | Linked including braces | Linked with alternative text | |
|---|---|---|---|---|---|---|
| Text style | {{tlg}} option |
— | nolink=yes |
subst=yes |
braceinside=yes |
alttext=FOO |
| Normal | — | {{tl}} · {{tlp}} · {{tlg}} |
{{tlf}} |
{{tls}} · {{tlsp}} |
{{tn}} |
{{tla}} |
| Teletype | tt=yes |
{{tlx}} |
{{tld}} · {{tnull}} |
{{tlxs}} |
||
| Bold | bold=yes |
{{tlb}} |
||||
| Bold teletype | bold=yes|tt=yes |
{{tlxb}} |
||||
| Italic teletype | italic=yes|tt=yes |
{{tlxi}} |
||||
Code |
code=yes |
{{tlc}} |
{{tlg}} is the most general, allowing any combination of the above options.- Style comparison
- {{tlf|Milford Haven Line|弘安源氏論議}} ...renders... {{Milford Haven Line|弘安源氏論議}}
- {{tld|Milford Haven Line|弘安源氏論議}} ...renders...
{{Milford Haven Line|弘安源氏論議}} - {{tlc|Milford Haven Line|弘安源氏論議}} ...renders...
{{Milford Haven Line|弘安源氏論議}}
- For parameter description
- {{para|<var>name</var>|value}} ...renders...
|name=value - {{tlx|Milford Haven Line|first parameter{{=}}first value}} ...renders...
{{Milford Haven Line|first parameter=first value}}