The official discord link if you wish to join the discord: https://discord.gg/j5RKwCvAFu

Support the wiki on our official Ko-Fi page or Patreon page!

Template:Examples

From The Codex

Template:WIP

Purpose

This template is for generating examples in Category:Template Documentation.

Usage

{{Examples
[|caption= ]
[|wrapLines= true]
[|vertical= true]
 |<nowiki>example-1</nowiki>
 |<nowiki>example-2</nowiki>
 |...
 |<nowiki>example-n</nowiki>
}}
  • example-n — Whatever syntax you're trying to demonstrate (probably a template call). It needs to be wrapped in <nowiki></nowiki> tags for it to work.
  • caption — Adds a caption to the the table of examples. Use this if you call the template multiple times on the same page. See Template:Cite Book/Documentation for example.
  • vertical — When enabled, examples are listed separately instead of them all being in one table. This display is more suitable for some examples with wider input/output.
  • wrapLines — Enables word wrapping for input shown in <pre> tags. Use this when the input lines are too long for the width of the screen. Otherwise, leave word wrapping off so that readers can see where the actual newlines are supposed to go in the template input.

Examples

Inline input
Input
{{Examples
 |<nowiki>{{Term|Series|Crisp Tomato|link}}</nowiki>
 |<nowiki>{{Color|TWWHD Vermilion|merchant's oath}}</nowiki>
 |<nowiki>{{Icon|LADX|Bananas}}</nowiki>
}}
Output

Script error: No such module "Documentation".

With header rows for descriptions
Input
{{Examples
 |- {{TP|-}}
 |<nowiki>{{Icon|TP A}}</nowiki>
 |<nowiki>{{Icon|TP B}}</nowiki>
 |- {{TPHD|-}}
 |<nowiki>{{Icon|TPHD A}}</nowiki>
 |<nowiki>{{Icon|TPHD B}}</nowiki>
}}
Output

Script error: No such module "Documentation".

Block input (respects newlines)
Input
{{Examples
|<nowiki>{{Tabs|align=center
 |tab1= Foo Tab
 |content1= Foo
 |tab2= Bar Tab
 |content 2 = Bar}}</nowiki>
}}
Output

Script error: No such module "Documentation".

Block input with wrapLines enabled
Input
{{Examples
|wrapLines= true
|<nowiki>{{Midna
 |quote1= Sometimes templates (namely ones that quote game dialogue) can have input lines that are long like this: bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
 |context1= If wrapLines wasn't enabled here, the above would all be forced onto one line and it would take a really wide screen to see it properly. For shorter input, disabling line wrapping is good because it shows you where the newlines should actually go when using the template.
}}</nowiki>
Output

Script error: No such module "Documentation".

Vertical format
Input
{{Examples
 |vertical= true
 |<nowiki>{{Letter|TWW|Kashiko|display=blockquote, italics, nowrap}}</nowiki>
 |<nowiki>{{Letter|TWW|Beedle's Shop Ship|display=italics, collapsed}}</nowiki>
}}
Output

Script error: No such module "Documentation".

The above documentation is transcluded from Template:Examples/Documentation. (edit | history)