Template talk:Module link

(Redirected from Template talk:Module link/doc)
Latest comment: 4 years ago by Sceptre in topic Edit request November 16, 2019

Edit request November 16, 2019

edit

Replace the first line of {{ml}} with &#123;&#123;#invoke:{{{{{|safesubst:}}}#invoke:Separated entries|main|[[Module:{{{1}}}|{{{1}}}]]|{{{2|''function''}}}|separator=&#124;}}&#125;&#125;<noinclude>.

Replace the first line of {{mlx}} with <code>&#123;&#123;#invoke:{{{{{|safesubst:}}}#invoke:Separated entries|main|[[Module:{{{1}}}|{{{1}}}]]|{{{2|''function''}}}|separator=&#124;}}&#125;&#125;</code><noinclude>.

These edits allow the templates to accept an unlimited number of parameters as intended initially. See {{ml/testcases}} and {{mlx/testcases}}.

Replace {{ml/doc}} with:

{{Documentation subpage}}
{{lua|Module:Separated entries}}

{{lt|ml}} is used to display a module name as a link surrounded by braces with the {{((}}#invoke{{))}} [[WP:PF|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 ==

{| class="wikitable"
! Code
! Result
! Notes
|-
| <code>{{ml|Bananas}}</code>
| {{ml|Bananas}}
| Usage without function name. This does not produce a usable invocation.
|-
| <code>{{ml|Bananas|hello}}</code>
| {{ml|Bananas|hello}}
| Usage with a function name.
|-
| <code>{{ml|BananasArgs|custom_fruit_2|Fred|4=pineapples=10|5=kiwis=5}}</code>
| {{ml|BananasArgs|custom_fruit_2|Fred|4=pineapples=10|5=kiwis=5}}
| Usage with a function name and parameters.
|-
| <code>{{ml|BananasArgs|custom_fruit_2|Fred|pineapples{{=}}10|kiwis{{=}}5}}</code>
| {{ml|BananasArgs|custom_fruit_2|Fred|pineapples{{=}}10|kiwis{{=}}5}}
| Usage with a function name and parameters, using {{((}}={{))}}.
|}

== TemplateData ==
{{TemplateData header}}
<templatedata>{
"description": "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.",
"params": {
  "1": {
    "label": "module name",
    "description": "the module name without the namespace prefix “Module:”, which is added automatically",
    "type": "string",
    "required": true
  },
  "2": {
    "label": "function name",
    "description": "the function name within the module to call",
    "type": "string",
    "required": true
  },
  "3": {
    "label": "parameter 1",
    "description": "the name (and value) of the first parameter, use {{=}} to add an equal sign",
    "type": "string"
  },
  "4": {
    "label": "parameter 2",
    "description": "the name (and value) of the second parameter, use {{=}} to add an equal sign",
    "type": "string"
  },
  "5": {
    "label": "parameter 3",
    "description": "the name (and value) of the third parameter, use {{=}} to add an equal sign",
    "type": "string"
  }
}}</templatedata>

== See also ==
* {{tl|mlx}} - Similar function but surrounded in {{tag|code}} tags.
* {{tl|tl}} - A version of this template for templates instead of modules.

{{Template:Template-linking templates}}

[[Category:Internal module-link templates]]

Replace {{mlx/doc}} with:

{{Documentation subpage}}
{{lua|Module:Separated entries}}

{{lt|mlx}} is used to display a module name as a link surrounded by braces with the {{((}}#invoke{{))}} [[WP:PF|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 ==

{| class="wikitable"
! Code
! Result
! Notes
|-
| <code>{{mlx|Bananas}}</code>
| {{mlx|Bananas}}
| Usage without function name. This does not produce a usable invocation.
|-
| <code>{{mlx|Bananas|hello}}</code>
| {{mlx|Bananas|hello}}
| Usage with a function name.
|-
| <code>{{mlx|BananasArgs|custom_fruit_2|Fred|4=pineapples=10|5=kiwis=5}}</code>
| {{mlx|BananasArgs|custom_fruit_2|Fred|4=pineapples=10|5=kiwis=5}}
| Usage with a function name and parameters.
|-
| <code>{{mlx|BananasArgs|custom_fruit_2|Fred|pineapples{{=}}10|kiwis{{=}}5}}</code>
| {{mlx|BananasArgs|custom_fruit_2|Fred|pineapples{{=}}10|kiwis{{=}}5}}
| Usage with a function name and parameters, using {{((}}={{))}}.
|}

== TemplateData ==
{{TemplateData header}}
<templatedata>{
"description": "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.",
"params": {
  "1": {
    "label": "module name",
    "description": "the module name without the namespace prefix “Module:”, which is added automatically",
    "type": "string",
    "required": true
  },
  "2": {
    "label": "function name",
    "description": "the function name within the module to call",
    "type": "string",
    "required": true
  },
  "3": {
    "label": "parameter 1",
    "description": "the name (and value) of the first parameter, use {{=}} to add an equal sign",
    "type": "string"
  },
  "4": {
    "label": "parameter 2",
    "description": "the name (and value) of the second parameter, use {{=}} to add an equal sign",
    "type": "string"
  },
  "5": {
    "label": "parameter 3",
    "description": "the name (and value) of the third parameter, use {{=}} to add an equal sign",
    "type": "string"
  }
}}</templatedata>

== See also ==
* {{tl|ml}} - Similar function but not surrounded in {{tag|code}} tags.
* {{tl|tlx}} - A version of this template for templates instead of modules.

{{Template:Template-linking templates}}

[[Category:Internal module-link templates]]

These changes fix any issues with the documentation, add {{lua}}, and BrandonXLF (t@lk) 07:50, 16 November 2019 (UTC)Reply

  Done Sceptre (talk) 06:59, 17 November 2019 (UTC)Reply
@Sceptre: I just realized I forgot to update the code so <code>...</code> tags in the "Examples" sections of the documentation pages have <nowiki>...</nowiki> aswell. <code> should be replaced with <code><nowiki> and </code> should be replaced with </nowiki><code> here and here. BrandonXLF (t@lk) 09:29, 17 November 2019 (UTC)Reply
  Done Sceptre (talk) 09:46, 17 November 2019 (UTC)Reply