Template:Template demo: Difference between revisions
(Switched table format to use <pre> tags for proper multiline formatting) |
(Updated documentation and added category) |
||
Line 16: | Line 16: | ||
}} | }} | ||
| #default = Unknown style option <code>{{{style|}}}</code>. Expected <code>table</code> (default) or <code>list</code>. | | #default = Unknown style option <code>{{{style|}}}</code>. Expected <code>table</code> (default) or <code>list</code>. | ||
}}</includeonly><noinclude> | }}</includeonly><noinclude>{{documentation|content= | ||
This template is designed to easily demo template usage and is intended for use within template documentation pages. It lets you display a set of template examples with the markup and rendered output displayed side-by-side. | This template is designed to easily demo template usage and is intended for use within template documentation pages. It lets you display a set of template examples with the markup and rendered output displayed side-by-side. | ||
Line 87: | Line 87: | ||
}}</nowiki> | }}</nowiki> | ||
}} | }} | ||
== Template data == | |||
<templatedata> | |||
{ | |||
"description": "Display a quote with an accompanying image which are aligned with each other. The template supports an arbitrary number of examples as unnamed arguments.", | |||
"format": "block", | |||
"params": { | |||
"1": { | |||
"label": "Example 1", | |||
"description": "Example markup/wikitext to demo.", | |||
"type": "content", | |||
"required": false | |||
}, | |||
"2": { | |||
"label": "Example 2", | |||
"description": "Example markup/wikitext to demo.", | |||
"type": "content", | |||
"required": false | |||
}, | |||
"3...": { | |||
"label": "And so on...", | |||
"description": "Example markup/wikitext to demo.", | |||
"type": "content", | |||
"required": false | |||
}, | |||
"style": { | |||
"label": "Style", | |||
"description": "Select the layout style appropriate for the template being demoed.", | |||
"type": "string", | |||
"suggestedvalues": ["table", "list"], | |||
"default": "table" | |||
} | |||
} | |||
} | |||
</templatedata>}} | |||
[[Category: Templates]] | |||
</noinclude> | </noinclude> |
Revision as of 18:54, 21 July 2024
This template is designed to easily demo template usage and is intended for use within template documentation pages. It lets you display a set of template examples with the markup and rendered output displayed side-by-side.
This template has two styles: a two-column table (style = table
) and a list (style = list
). The table is appropriate for shorter, inline templates. For larger templates, the list style may be preferred.
As with Template:Demo on Wikipedia, the arguments to this template must be wrapped in <nowiki>...</nowiki>
tags or the parameters with be expanded before being passed to this template.
Examples
Table style
Select this style with style = table
. It is also the default style used if the optional style parameter is omitted. This style should be used for shorter, inline templates that can fit nicely within a two-column table.
Input
{{Template demo | style = table | <nowiki>{{CharLink|Shadowheart}}</nowiki> | <nowiki>{{DamageText|2d4 + 1|Fire}}</nowiki> | <nowiki>{{RarityItem|Hat of Fire Acuity}}</nowiki> | <nowiki>{{SAI|Fireball}}</nowiki> }}
Output
Markup | Renders as |
---|---|
{{CharLink|Shadowheart}} | Shadowheart |
{{DamageText|2d4 + 1|Fire}} | 2d4 + 1Fire |
{{RarityItem|Hat of Fire Acuity}} | Hat of Fire Acuity |
{{SAI|Fireball}} |
List style
Select this style with style = list
. This should be used to demo templates too large to fit within a table.
Input
{{Template demo | style = list | <nowiki>{{ImageQuote | quote = The operations of these huge steel juggernauts are powered by engines of churning hellfire. | image = Portrait Steel Watcher.png | link = Adamantine Golem }}</nowiki> | <nowiki>{{ImageQuote | quote = These levitating eyes transmit all that they see to the one who created them. | image = Portrait Scrying Eye.png | link = Scrying Eye | height = 60px | rounding = 20% | font-size = 100% }}</nowiki> }}
Output
{{ImageQuote | quote = The operations of these huge steel juggernauts are powered by engines of churning hellfire. | image = Portrait Steel Watcher.png | link = Adamantine Golem }}Renders as
{{ImageQuote | quote = These levitating eyes transmit all that they see to the one who created them. | image = Portrait Scrying Eye.png | link = Scrying Eye | height = 60px | rounding = 20% | font-size = 100% }}Renders as
Template data
Display a quote with an accompanying image which are aligned with each other. The template supports an arbitrary number of examples as unnamed arguments.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Example 1 | 1 | Example markup/wikitext to demo. | Content | optional |
Example 2 | 2 | Example markup/wikitext to demo. | Content | optional |
And so on... | 3... | Example markup/wikitext to demo. | Content | optional |
Style | style | Select the layout style appropriate for the template being demoed.
| String | optional |