Template:TemplatePreview/doc: Difference between revisions

From IdleOn MMO Wiki
(Created page with "This template formats usage previews for templates and accepts up to 8 parameters. == Usage == {{TemplatePreview|TemplatePreview|name|arg1?|arg2?|arg3?|...|arg8?}} {| class="wikitable" style="width: 80%" ! Parameter !! Description |- | ''name'' | The name of the template. |- | ''argN'' (optional) | The names of the parameters that can be passed to the template. Currently up to 8 parameters are supported. Parameters that are optional should end with a "?" character. |}...")
 
No edit summary
 
Line 1: Line 1:
This template formats usage previews for templates and accepts up to 8 parameters.
This template formats previews for template usage. It supports both positional and named arguments.


== Usage ==
== Examples ==
{{TemplatePreview|TemplatePreview|name|arg1?|arg2?|arg3?|...|arg8?}}
{| class="wikitable" style="width: 100%"
{| class="wikitable" style="width: 80%"
! What you type !! What it produces
! Parameter !! Description
|-
|-
| ''name''
| {{TemplatePreview|TemplatePreview|PageType}} || {{TemplatePreview|PageType}}
| The name of the template.
|-
|-
| ''argN'' (optional)
| {{TemplatePreview|TemplatePreview|Bitsdisplay|1000}} || {{TemplatePreview|Bitsdisplay|1000}}
| The names of the parameters that can be passed to the template. Currently up to 8 parameters are supported. Parameters that are optional should end with a "?" character.
|-
| {{TemplatePreview|TemplatePreview|MessageBox|title=Hello|content=World}} || {{TemplatePreview|MessageBox|title=Hello|content=World}}
|}
|}


== Example Usage ==
<templatedata>
 
{
=== What you type ===
    "description": "",
<syntaxhighlight lang="html">
"params": {
{{TemplatePreview|Dubious|message?}}
"1": {
</syntaxhighlight>
"label": "Template Name",
 
"description": "The name of the template to generate a usage preview for.",
=== What you get ===
"type": "wiki-template-name",
{{TemplatePreview|Dubious|message?}}
"required": true
},
"args": {
"label": "Arguments",
"description": "The template arguments, can be either positional or named."
}
},
"paramOrder": [
"1",
"args"
],
"format": "inline"
}
</templatedata>

Latest revision as of 22:32, 13 June 2024

This template formats previews for template usage. It supports both positional and named arguments.

Examples

What you type What it produces
{{TemplatePreview|PageType}} {{PageType}}
{{TemplatePreview|Bitsdisplay|1000}} {{Bitsdisplay|1000}}
{{TemplatePreview|MessageBox|title=Hello|content=World}} {{MessageBox|title=Hello|content=World}}

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Template Name1

The name of the template to generate a usage preview for.

Templaterequired
Argumentsargs

The template arguments, can be either positional or named.

Unknownoptional