Template:Prettytable: Difference between revisions

From StrategyWiki, the video game walkthrough and strategy guide wiki
rules=all is deprecated
m (|then doesn't like spaces)
(rules=all is deprecated)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
border="1" cellspacing="4" cellpadding="1" class="wikitable {{qif|test={{{sortable|}}}|then=sortable}}" rules="all" style="margin:1em;border:solid 1px #AAA; border-collapse:collapse;empty-cells:show;{{qif|test={{{notwide|}}}|then=|else=width:100%;}}{{qif|test={{{text center|}}}|then=text-align:center;}}{{{style|}}}"<noinclude>
<includeonly>class="wikitable prettytable {{#if:{{{sortable|}}}|sortable}} {{{class|}}}" style="{{#if:{{{notwide|{{{float|}}}}}}||width:100%;}}{{#if:{{{text center|}}}|text-align:center;}}{{#if:{{{float|}}}|float:{{{float}}};}}{{{style|}}}"</includeonly><noinclude>


Template to put at the top of table declarations to standardise and prettify their appearance.
{{Documentation}}
By default it will make the table occupy all the page's width. If you want to turn it off, call the template as follows: <nowiki>{{prettytable|notwide=1}}</nowiki>. Additionally, you can mark the table as sortable (i.e. if it's a table of sortable values, such as {{t|yes}} or {{t|no}}), by using the "sortable" parameter: <nowiki>{{prettytable|sortable=1}}</nowiki>. Text can be centred in the table using <nowiki>{{prettytable|text center=1}}</nowiki>. Finally, extra styling can be added using the "style" parameter.


== Example ==
[[Category:Templates]]</noinclude>
 
=== Wide ===
 
<pre>{| {{prettytable}}
| Boo!
| Foo
| Bar
|-
| Test
| 2
| 3
|}</pre>
 
{| {{prettytable}}
| Boo!
| Foo
| Bar
|-
| Test
| 2
| 3
|}
 
=== Not wide ===
 
<pre>{| {{prettytable|notwide=1}}
| Boo!
| Foo
| Bar
|-
| Test
| 2
| 3
|}</pre>
 
{| {{prettytable|notwide=1}}
| Boo!
| Foo
| Bar
|-
| Test
| 2
| 3
|}
 
[[Category:Templates|P]]</noinclude>