Anonymous

Template:Examples/Documentation: Difference between revisions

From Zelda Wiki, the Zelda encyclopedia
m
no edit summary
No edit summary
mNo edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Purpose==
==Purpose==
This template is for generating examples in [[:Category:Template Documentation]].
This template is for generating examples in [[:Category:Template documentation]].


==Usage==
==Usage==
{{Tabs
|tab1= Basic Syntax
|content1=
<pre>
{{Examples
|<nowiki><nowiki>example-1</nowiki></nowiki>
|<nowiki><nowiki>example-2</nowiki></nowiki>
|...
|<nowiki><nowiki>example-n</nowiki></nowiki>
}}
</pre>
{{#vardefineecho:examplen|{{Parameter|example-n|Whatever syntax you're trying to demonstrate (probably a template call). It needs to be wrapped in <code><nowiki><nowiki></nowiki></code> tags.|Required}}}}
|tab2= All Parametrs
|content2=
<pre>
<pre>
{{Examples
{{Examples
  |vertical=
|caption=
|wrapLines= true
  |vertical= true
|showNumbers= false
  |<nowiki><nowiki>example-1</nowiki></nowiki>
  |<nowiki><nowiki>example-1</nowiki></nowiki>
  |<nowiki><nowiki>example-2</nowiki></nowiki>
  |<nowiki><nowiki>example-2</nowiki></nowiki>
Line 13: Line 31:
</pre>
</pre>


{{Parameter|example-n|Whatever syntax you're trying to demonstrate (probably a template call). It needs to be wrapped in <code><nowiki><nowiki></nowiki></nowiki></code> tags for it to work.|Required}}
{{Parameter|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.|Optional}}
{{Parameter|vertical|Putting any value here causes one table to be generated per example, with row headers instead of column headers.|Optional}}
{{Parameter|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.|Optional}}
{{Parameter|wrapLines|Enables word wrapping for input shown in <code><nowiki><pre></nowiki></code> 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.|Optional}}
{{Parameter|showNumbers|If set to <code>false</code> the link to the example number is suppressed.}}
{{#var:examplen}}
}}


===Examples===
===Examples===
{| class="wikitable"
{| class="wikitable"
!colspan=2|Inline input
|-
! Input
! Input
|
|
Line 37: Line 61:
|}
|}
{| class="wikitable"
{| class="wikitable"
!colspan=2| With header rows for descriptions
|-
! Input
|
<pre>
{{Examples
|- {{TP|-}}
|<nowiki><nowiki>{{Icon|TP A}}</nowiki></nowiki>
|<nowiki><nowiki>{{Icon|TP B}}</nowiki></nowiki>
|- {{TPHD|-}}
|<nowiki><nowiki>{{Icon|TPHD A}}</nowiki></nowiki>
|<nowiki><nowiki>{{Icon|TPHD B}}</nowiki></nowiki>
}}
</pre>
|-
! Output
|
{{Examples
|- {{TP|-}}
|<nowiki>{{Icon|TP A}}</nowiki>
|<nowiki>{{Icon|TP B}}</nowiki>
|- {{TPHD|-}}
|<nowiki>{{Icon|TPHD A}}</nowiki>
|<nowiki>{{Icon|TPHD B}}</nowiki>
}}
|}
{| class="wikitable"
!colspan=2|Block input (respects newlines)
|-
! Input
|
<pre>
{{Examples
|<nowiki><nowiki>{{Tabs|align=center
|tab1= Foo Tab
|content1= Foo
|tab2= Bar Tab
|content 2 = Bar}}</nowiki></nowiki>
}}
</pre>
|-
! Output
|
{{Examples
|
<nowiki>{{Tabs|align=center
|tab1= Foo Tab
|content1= Foo
|tab2= Bar Tab
|content2 = Bar
}}</nowiki>
}}
|}
{| class="wikitable"
!colspan=2|Block input with wrapLines enabled
|-
! Input
|
<pre>
{{Examples
|wrapLines= true
|<nowiki><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></nowiki>
</pre>
|-
! Output
|
{{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>
}}
|}
{| class="wikitable"
!colspan="2"|Vertical format
|-
! Input
! Input
|
|
Line 42: Line 146:
{{Examples
{{Examples
  |vertical= true
  |vertical= true
  |<nowiki><nowiki>{{Term|Series|Crisp Tomato|link}}</nowiki></nowiki>
  |<nowiki><nowiki>{{Transcript Copy|fromPage= Aryll|storedAs= Letter|withFormatting= true}}</nowiki></nowiki>
  |<nowiki><nowiki>{{Color|TWWHD Vermilion|merchant's oath}}</nowiki></nowiki>
  |<nowiki><nowiki>{{Transcript Copy|fromPage= Baito|storedAs= Letter|withFormatting= true}}</nowiki></nowiki>
|<nowiki><nowiki>{{Icon|LADX|Bananas}}</nowiki></nowiki>
}}
}}
</pre>
</pre>
Line 52: Line 155:
{{Examples
{{Examples
  |vertical= true
  |vertical= true
  |<nowiki>{{Term|Series|Crisp Tomato|link}}</nowiki>
  |<nowiki>{{Transcript Copy|fromPage= Aryll|storedAs= Letter|withFormatting= true}}</nowiki>
  |<nowiki>{{Color|TWWHD Vermilion|merchant's oath}}</nowiki>
  |<nowiki>{{Transcript Copy|fromPage= Baito|storedAs= Letter|withFormatting= true}}</nowiki>
|<nowiki>{{Icon|LADX Bananas}}</nowiki>
}}
}}
|}
|}


{{Documentation Footer}}
{{Documentation Footer}}
autopatrol, curators, retiredstaff
14,214

edits