Template:Mlx/doc

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Template:Mlx (Edit Discussion links Page history) 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

[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>JSON</templatedata> ./. {{TemplateBox}}
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 TemplateDataCommons-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.

Template parameters

ParameterDescriptionTypeStatus
module name1

the module name without the namespace prefix “Module:”, which is added automatically

Stringrequired
function name2

the function name within the module to call

Stringrequired
parameter 13

the name (and value) of the first parameter, use {{=}} to add an equal sign

Stringoptional
parameter 24

the name (and value) of the second parameter, use {{=}} to add an equal sign

Stringoptional
parameter 35

the name (and value) of the third parameter, use {{=}} to add an equal sign

Stringoptional

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}} – {{ TleExample }} – Linked or not, expanded parameter description
  • {{Tlf}}{{Example}} – Not linked, several parameters and normal text style.
  • {{Tl}}0{{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

For more see: Commons:Link templates