Template:Switcher: Difference between revisions
m (Simplify code - one <includeonly> instead of multiple <noinclude/> and linebreaks within #if tags rather than no-included.) |
(Created page with "<includeonly><div class="switcher-container">{{ safesubst:#if:{{{2|}}}|<div>{{{1|}}}<span class="switcher-label" style="display:none" {{ safesubst:#ifeq:{{{default|}}}|1|data-switcher-default=""}}>{{safesubst:#if:trim|{{{2|}}}}}</span></div>}}{{ safesubst:#if:{{{4|}}}|<div>{{{3|}}}<span class="switcher-label" style="display:none" {{ safesubst:#ifeq:{{{default|}}}|2|data-switcher-default=""}}>{{safesubst:#if:trim|{{{4|}}}}}</span></div>}}{{ safesubst:#if:{{{6|}}}|...") |
(No difference)
|
Revision as of 19:21, 21 June 2023
This template is used to create a switchable image with caption, for use in infoboxes. Note that this template does not work in the editing preview.
Parameters
Odd numbered parameters provide the image in wikitext; even numbered parameters provide the captions. Up to 20 images are supported.
Example
{{Switcher
| [[File:Example.png|300px]]
| An example
| [[File:Example image not to be used in article namespace.jpg|300px]]
| A different example
}}
Output:
TemplateData
<templatedata> { "params": { "1": { "description": "Image 1 wikitext", "example": "File:Example.png", "type": "unbalanced-wikitext" }, "2": { "description": "Image 1 caption", "example": "This is just an example.", "type": "string" }, "3": { "description": "See {{{1}}} (recursive)", "type": "unbalanced-wikitext" }, "4": { "description": "See {{{2}}} (recursive)", "type": "string" } }, "description": "Creates a switchable image with caption for use in infoboxes" } </templatedata>