Template:TblHdr: Difference between revisions

Jump to navigation Jump to search
(Created page with "<includeonly><th>{{{1|}}}</th></includeonly><noinclude> {{Documentation}} Category:Table Templates </noinclude>")
 
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly><th>{{{1|}}}</th></includeonly><noinclude>
<includeonly>{{#if:{{{colspan|}}}|{{#if:{{{rowspan|}}}|<th colspan="{{{colspan}}}" rowspan="{{{rowspan}}}">{{{1|}}}</th>|<th colspan="{{{colspan}}}">{{{1|}}}</th>}}|{{#if:{{{rowspan|}}}|<th rowspan="{{{rowspan}}}">{{{1|}}}</th>|<th>{{{1|}}}</th>}}}}</includeonly><noinclude>
{{Documentation}}
{{Template:Tbl/Documentation}}
[[Category:Table Templates]]
[[Category:Table Templates]]
</noinclude>
</noinclude>

Latest revision as of 01:11, 23 August 2024

Purpose

Tbl, TblRow, TblHdr, and TblDta are a set of templates used to create specialized wikitables using templates as opposed to standard wikitext, specifically for the purpose of overcoming limitations that regular wikitables may face under certain circumstances. These templates allow custom wikitables to use tabs, which are otherwise incompatible with wikitables using wikitext code.

Tbl should only be used to create wikitables if a limitation would otherwise make the use of wikitext impossible, such as tabs. It is otherwise advised to use regular wikitables where permissible.

Usage

Tbl

{{Tbl}} is used to begin the table and to specify its class, equivalent to {| class="wikitable". The class is defined similarly to wikitext, only without the use of quotation marks. I.e. {{Tbl|class=wikitable|.

The contents of the table (headers, rows, data templates) must be enclosed between Tbl. I.e.,

{{Tbl|class=wikitable|
{{TblRow|
{{TblHdr|Header}}
{{TblDta|Content}}
}}
}}
TblRow

{{TblRow}} creates a new row, equivalent to |- in regular wikitables. This needs to be added for every new row.

Similarly to Tbl, the contents within an individual row must all be enclosed between TblRow, and another instance of TblRow must be used for every additional row. I.e.,

{{Tbl|class=wikitable|
{{TblRow|
{{TblHdr|colspan=3|Header}}
}}
{{TblRow|
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
}}

Be sure to include a closing }} for every instance of TblRow. You may find it helpful to enable the Syntax Highlighter in Preferences under Gadgets to visually see if all templates have been closed. (The page's proceeding content will all be highlighted yellow if any templates are not properly closed.)

TblHdr

{{TblHdr}} creates a header, equivalent to using ! in regular wikitables. colspan= and rowspan= can be used as parameters to specify the span of the header. The last parameter is the titling of the header. I.e.,

{{TblHdr|colspan=3|Header}}
TblDta

{{TblDta}} creates a table data, equivalent to using | in regular wikitables. This can also use colspan= and rowspan= to specify the table data's span. The data's content is entered as the last parameter. I.e.,

{{Tbl|class=wikitable|
{{TblRow|
{{TblDta|colspan=3|Content}}
}}
{{TblRow|
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
}}

Construction

Using all of the above templates, a custom wikitable can be constructed in multiple formats as necessary. Some examples are below,

Horizontal table
{{Tbl|class=wikitable|
{{TblRow|
{{TblHdr|colspan=2|rowspan=2|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
{{TblRow|
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
}}
Content Content Content Content
Content Content Content
Vertical table
{{Tbl|class=wikitable|
{{TblRow|
{{TblHdr|colspan=3|Content}}
}}
{{TblRow|
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
{{TblRow|
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
}}
Content
Content Content Content
Content Content Content

With Tabs

Tbl supports Template:Tabs where regular wikitables made with wikitext would not be possible. This merely requires that the Tbl templates be placed between each tab label. For example:

{{Tabs|Tab1|
{{Tbl|class=wikitable|
{{TblRow|
{{TblHdr|colspan=2|rowspan=2|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
{{TblRow|
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
}}
|Tab2|
{{Tbl|class=wikitable|
{{TblRow|
{{TblHdr|colspan=3|Content}}
}}
{{TblRow|
{{TblDta|Content}}
{{TblDta|Content}}
{{TblDta|Content}}
}}
}}
}}
Tab1Tab2
Content Content Content Content
Content Content Content
Content
Content Content Content