Template:Data Table

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search

Purpose

Displays tabular data in a way that is mobile-friendly. Minimizes the amount of boilerplate wikitext that most Zelda Wiki tables require. Automatically center-aligns columns and applies templates such as {{Amounts}}, {{Icon List}}, {{Rupee}}, etc.

The table data can stored in Cargo so that the table (or a subset of its rows or columns) can be displayed on other relevant pages using {{Data Table Copy}}.

Usage

SyntaxBoilerplate
{{Data Table
|game= 
|storeAs= 
|caption= 
|collapse= 
|responsiveModeEnabled= 
|vertical= 
|sortable= 
|stretch= 
|columns= 
|<cell1>
|<cell2>
|<cell3>
|...
|<cellN>
}}
{{Data Table
|game= 
|storeAs= 
|caption= 
|collapse= 
|responsiveModeEnabled= 
|vertical= 
|sortable= 
|stretch= 
|columns= 
|
|
|
}}
ParameterStatusDescription
gamesuggestedA game code. Used to automatically apply game-based templates (e.g. {{Term}}, {{Amounts}}, {{Rupee}}) to table cells.
storeAsoptional

If present, the data is stored in the DataTables Cargo table under the given name. Other pages can retrieve the data by that name using {{Data Table Copy}}.

When a page has multiple data tables, each storeAs value must be unique.

captionoptionalA table caption.
collapseoptionalCollapses the table such that only a small preview of the data is shown, with a "show more" button that reveals the full table when clicked. This functionality depends on MediaWiki:Gadget-Collapse.js.
responsiveModeEnabledoptionalData tables have a responsive "mobile-friendly" mode which by default is turned on when:
  • The template estimates the width of the widest row to be greater than 40 characters.
  • The table has less than 100 rows.
Responsive mode generates a lot of HTML and therefore cannot be used with excessively long tables due to the risk of exceeding $wgMaxArticleSize.
  • The page is in the main namespace.
Data tables are sometimes used in template and module documentation. Since these pages are not reader-facing, page loading speed matters more than mobile support.
Responsive mode can be forced on or off by setting this parameter to true or false, respectively.
verticaloptionalLays out the table columns vertically instead of horizontally
sortableoptionalIf set to false, the data table will not be sortable.
stretchoptionalIf present and set to anything other than false, the data table will stretch to the full width of the page.
columnsrequiredComma-separated list of column headers. One or more tag can be appended to each column to indicate how the template should handle data in that column. See #Tags below.
  • 1
  • .
  • .
  • N
cellsrequiredCell values. Type |- to separate rows, as shown in the examples below.

<p>Displays tabular data in a way that is mobile-friendly. Minimizes the amount of boilerplate wikitext that most {{SITENAME}} tables require. Automatically center-aligns columns and applies templates such as {{Template|Term}}, {{Template|Amounts}}, {{Template|Rupee}}, etc.</p><p>The table data can stored in [[Special:CargoTables/DataTables|Cargo]] so that the table (or a subset of its rows) can be displayed on other relevant pages using {{Template|Data Table Copy}}.

Template parameters

This template has custom formatting.

ParameterDescriptionTypeStatus
gamegame

A game code. Used to automatically apply game-based templates (e.g. {{Template|Term}}, {{Template|Amounts}}, {{Template|Rupee}}) to table cells.

Stringsuggested
storeAsstoreAs

<p>If present, the data is stored in the [[Special:CargoTables/DataTables|DataTables]] Cargo table under the given name. Other pages can retrieve the data by that name using {{Template|Data Table Copy}}.</p><p>When a page has multiple data tables, each <code>storeAs</code> value must be unique.</p>

Stringoptional
captioncaption

A table caption.

Stringoptional
collapsecollapse

Collapses the table such that only a small preview of the data is shown, with a "show more" button that reveals the full table when clicked. This functionality depends on [[MediaWiki:Gadget-Collapse.js]].

Booleanoptional
responsiveModeEnabledresponsiveModeEnabled

Data tables have a responsive "mobile-friendly" mode which by default is turned on when:

  • <b>The template estimates the width of the widest row to be greater than 40 characters.</b>
  • <b>The table has less than 100 rows.</b>
Responsive mode generates a lot of HTML and therefore cannot be used with excessively long tables due to the risk of exceeding {{MediaWiki|Manual:$wgMaxArticleSize|$wgMaxArticleSize}}.
  • <b>The page is in the main namespace.</b>
Data tables are sometimes used in template and module documentation. Since these pages are not reader-facing, page loading speed matters more than mobile support.
Responsive mode can be forced on or off by setting this parameter to <code>true</code> or <code>false</code>, respectively.

Booleanoptional
verticalvertical

Lays out the table columns vertically instead of horizontally

Booleanoptional
sortablesortable

If set to <code>false</code>, the data table will not be sortable.

Booleanoptional
stretchstretch

If present and set to anything other than <code>false</code>, the data table will stretch to the full width of the page.

Booleanoptional
columnscolumns

Comma-separated list of column headers. One or more '''tag''' can be appended to each column to indicate how the template should handle data in that column. See [[#Tags]] below.

Contentrequired
cells...

Cell values. Type <code>|-</code> to separate rows, as shown in the examples below.

Contentrequired

Tags

The following tags can be added to columns to format their content:

Tag
[Amounts]
Alignment
Left
Sortability
Unsortable
Effects
  • Applies {{Amounts}} to each cell in the column.
Tag
[Code]
Alignment
Center
Sortability
Sortable
Effects

Applies <code> tags to each cell in the column.

Tag
[Defense]
Alignment
Center
Sortability
Sortable
Effects

Applies {{Defense}} to each cell in the column.

Tag
[Description]
Alignment
Left
Sortability
Unsortable
Effects

Text is shown as-is.

Tag
[HeartAmount]
Alignment
Center
Sortability
Sortable
Effects

Applies {{HeartAmount}} to each cell in the column.

Tag
[IconList]
Alignment
Center
Sortability
Unsortable
Effects

Applies {{Icon List}} to each cell in the column.

Tag
[Image]
[Image:fileType:size]
Alignment
Center
Sortability
UnsortableUnless [Name], [Term] or [SortValue] is applied to the same row.
Effects
  • Displays an image in each cell. fileType defaults to Icon for 3D games, Sprite for 2D games. size defaults to 64x64px.
  • Supports {{Gallery List}}'s variant syntax.
  • Bolds cells in the column.
Tag
[Link]
Alignment
Center
Sortability
Sortable
Effects

Renders each cell as an article link.

Tag
[List]
[List:listType]
Alignment
Center
Sortability
Unsortable
Effects

Renders each cell in the column as a list, using commas as list item delimiters. Accepted values for listType include:

Tag
[LinkList]
Alignment
Left
Sortability
Unsortable
Effects

Renders each comma-separated value in a cell as a link in a bullet list.

Tag
[Name]
Alignment
Center
Sortability
Sortable
Effects

Text is shown as-is.

Tag
[Mon]
Alignment
Left
Sortability
Sortable
Effects

Applies {{Mon}} to each cell in the column.

Tag
[Rupees][Rupees:game:format]
Alignment
Left
Sortability
Sortable
Effects
  • Applies {{Rupee}} to each cell in the column.
Tag
[SyntaxHighlight]
[SyntaxHighlight:lang]
Alignment
Center
Sortability
Sortable
Effects

Applies Extension:SyntaxHighlight tags to each cell in the column. lang defaults to lua.

Tag
[Term]
Alignment
Center
Sortability
Sortable
Effects
  • Applies {{Term Lite}} to each cell in the column.
Tag
[Transcript]
Alignment
Left
Sortability
Unsortable
Effects

Text is italicized.

TagAlignmentSortabilityEffects
[Amounts]
Left
Unsortable
  • Applies {{Amounts}} to each cell in the column.
[Code]
Center
Sortable

Applies <code> tags to each cell in the column.

[Defense]
Center
Sortable

Applies {{Defense}} to each cell in the column.

[Description]
Left
Unsortable

Text is shown as-is.

[HeartAmount]
Center
Sortable

Applies {{HeartAmount}} to each cell in the column.

[IconList]
Center
Unsortable

Applies {{Icon List}} to each cell in the column.

[Image]
[Image:fileType:size]
Center
UnsortableUnless [Name], [Term] or [SortValue] is applied to the same row.
  • Displays an image in each cell. fileType defaults to Icon for 3D games, Sprite for 2D games. size defaults to 64x64px.
  • Supports {{Gallery List}}'s variant syntax.
  • Bolds cells in the column.
[Link]
Center
Sortable

Renders each cell as an article link.

[List]
[List:listType]
Center
Unsortable

Renders each cell in the column as a list, using commas as list item delimiters. Accepted values for listType include:

[LinkList]
Left
Unsortable

Renders each comma-separated value in a cell as a link in a bullet list.

[Name]
Center
Sortable

Text is shown as-is.

[Mon]
Left
Sortable

Applies {{Mon}} to each cell in the column.

[Rupees][Rupees:game:format]
Left
Sortable
  • Applies {{Rupee}} to each cell in the column.
[SyntaxHighlight]
[SyntaxHighlight:lang]
Center
Sortable

Applies Extension:SyntaxHighlight tags to each cell in the column. lang defaults to lua.

[Term]
Center
Sortable
  • Applies {{Term Lite}} to each cell in the column.
[Transcript]
Left
Unsortable

Text is italicized.

The following tags modify other aspects of the table besides the actual cell content. Some of these do not carry over to copies of the table.

Tag
[Colspan:n]
Copied?Non-copied tags are applied only to the original table and not tables created with Template:Data Table Copy
Copied
Effects

The specified text spans over the next n columns, grouping them together.

Tag
[ID]
Copied?Non-copied tags are applied only to the original table and not tables created with Template:Data Table Copy
Copied
Effects

Sets the value of the cell as the ID of the table row so that the table row can be linked by that name. See Template:Section for more information.

Only one column can have this tag.

Bolds cells in the column.

Tag
[Nowrap]
Copied?Non-copied tags are applied only to the original table and not tables created with Template:Data Table Copy
Copied
Effects

Ensures that the column is wide enough to render all cells on a single line by setting the white-space property to nowrap. Use carefully—on smaller screens the table may be too wide to render the column on a single line, causing the table to overflow the page.

Tag
[Rowspan]
Copied?Non-copied tags are applied only to the original table and not tables created with Template:Data Table Copy
Copied
Effects

When cells in adjacent rows have the same value for the given column, the cells are merged together.

Tag
[Unsortable]
Copied?Non-copied tags are applied only to the original table and not tables created with Template:Data Table Copy
Copied
Effects

Renders the column unsortable.

Tag
[Width:width]
Copied?Non-copied tags are applied only to the original table and not tables created with Template:Data Table Copy
Not Copied
Effects

Sets the width of the column, where width is a CSS length unit.

TagCopied?Non-copied tags are applied only to the original table and not tables created with Template:Data Table CopyEffects
[Colspan:n]
Copied

The specified text spans over the next n columns, grouping them together.

[ID]
Copied

Sets the value of the cell as the ID of the table row so that the table row can be linked by that name. See Template:Section for more information.

Only one column can have this tag.

Bolds cells in the column.

[Nowrap]
Copied

Ensures that the column is wide enough to render all cells on a single line by setting the white-space property to nowrap. Use carefully—on smaller screens the table may be too wide to render the column on a single line, causing the table to overflow the page.

[Rowspan]
Copied

When cells in adjacent rows have the same value for the given column, the cells are merged together.

[Unsortable]
Copied

Renders the column unsortable.

[Width:width]
Not Copied

Sets the width of the column, where width is a CSS length unit.

Examples

Upgrading data table, using the tags Amounts, Description, Image, Rupees, and Term, as well as the special N/A value.
Input
{{Data Table
|game= SS
|storeAs= SS Upgrades
|sortable= false
|stretch= true
|columns= Item [Image][Term], Upgrade [Image][Term], Materials [Amounts], Cost [Rupees], Location [Term], Description [Description]
|-
| Wooden Shield
| Banded Shield
| 2 Amber Relic, 1 Monster Claw, 1 Jelly Blob
| 30
| Scrap Shop
| Increased durability.
|-
| Banded Shield
| Braced Shield
| 3 Amber Relic, 2 Monster Claw, 2 Tumbleweed, 1 Ornamental Skull
| 50
| Scrap Shop
| Further increased durability.
|-
| Beetle
| Hook Beetle
| N/A
| N/A
| Lanayru Desert
| Ability to grab items.
}}
Output
Item
Upgrade
Materials
Cost
  • 30 Rupees
Location
Description

Increased durability.

Item
Upgrade
Materials
Cost
Location
Description

Further increased durability.

Item
Upgrade
Materials
Not Applicable
Cost
Not Applicable
Location
Description

Ability to grab items.

ItemUpgradeMaterialsCostLocationDescription

Increased durability.

Further increased durability.

Not Applicable
Not Applicable

Ability to grab items.

Categories Added

Figurines in The Minish Cap data table, using the [Image] tag with a custom file type, as well as the tags ID, Name, LinkList, Unsortable, and Width.

[Player Name] is automatically replaced with Link or {{Player Name}} depending on what each tag needs for its output. This is supported only for tags: ID, Image, and Name.

Input
{{Data Table
|game= TMC
|storeAs= TMC Figurines
|columns= Figurine [ID][Image:Figurine Sprite][Name], Number, Description [Description], Subject(s) [LinkList], Pictured [Unsortable][Width:20%]
|- 
| Capless [Player Name]
| 001
| A young boy who lives in Hyrule. He is close friends with Princess Zelda.
| Link
| {{Term|TMC|Link|link}}
|- 
| Ezlo and [Player Name]
| 002
| A young boy on a quest with Ezlo to restore the Four Sword.<br/>With the sword's power, he hopes to remove the curse on Princess Zelda.
| Ezlo, Link
| {{Term|TMC|Ezlo|link}} and {{Term|TMC|Link|link}}
|- 
| Princess Zelda
| 003
| A bright and cheery princess from Hyrule's royal family.<br/>She loves to sneak out of the castle to visit her good friend, {{Player Name}}.
| Princess Zelda
| {{Term|TMC|Princess Zelda|link}}
}}
Output
Figurine
Capless LinkAppears in-game as the player's chosen name.
Number
001
Description

A young boy who lives in Hyrule. He is close friends with Princess Zelda.

Subject(s)
Pictured
Figurine
Ezlo and LinkAppears in-game as the player's chosen name.
Number
002
Description

A young boy on a quest with Ezlo to restore the Four Sword.
With the sword's power, he hopes to remove the curse on Princess Zelda.

Subject(s)
Pictured
Figurine
Princess Zelda
Number
003
Description

A bright and cheery princess from Hyrule's royal family.
She loves to sneak out of the castle to visit her good friend, LinkAppears in-game as the player's chosen name..

Subject(s)
Pictured
FigurineNumberDescriptionSubject(s)Pictured
Princess Zelda
003

A bright and cheery princess from Hyrule's royal family.
She loves to sneak out of the castle to visit her good friend, LinkAppears in-game as the player's chosen name..

Categories Added

Figurines in The Wind Waker data table, using the variant syntax for generating filenames. Image is used with a custom image size.
Input
{{Data Table
|game= TWW
|storeAs= TWW Figurines
|columns= Figurine [ID][Image:Figurine Model:x150px][Name], Subject(s) [LinkList], Description [Description]
|-
| Darknut
| Darknut
| Habitat: [[Tower of the Gods]]<br/>Spoils: [[Knight's Crest]]<br/><br/>These mighty knights are protected by heavy-duty armor. Rather than attacking from the front, it might be best to slip around behind them and cut their armor off.
|-
| Darknut [2]
| Darknut
| Habitat: [[Earth Temple (The Wind Waker)|Earth Temple]]<br/>Spoil: [[Knight's Crest]]<br/><br/>These knights are well protected by their round bucklers and mighty armor. If you use a [[Parry|parry attack]] to jump up and knock off their helmets, it'll spell their doom.
}}
Output
Figurine
Darknut
Subject(s)
Description

Habitat: Tower of the Gods
Spoils: Knight's Crest

These mighty knights are protected by heavy-duty armor. Rather than attacking from the front, it might be best to slip around behind them and cut their armor off.

Figurine
Darknut
Subject(s)
Description

Habitat: Earth Temple
Spoil: Knight's Crest

These knights are well protected by their round bucklers and mighty armor. If you use a parry attack to jump up and knock off their helmets, it'll spell their doom.

FigurineSubject(s)Description
Darknut

Habitat: Tower of the Gods
Spoils: Knight's Crest

These mighty knights are protected by heavy-duty armor. Rather than attacking from the front, it might be best to slip around behind them and cut their armor off.

Darknut

Habitat: Earth Temple
Spoil: Knight's Crest

These knights are well protected by their round bucklers and mighty armor. If you use a parry attack to jump up and knock off their helmets, it'll spell their doom.

Categories Added

Hateno Dye data table, using the [IconList] tag and collapse parameter.
Input
{{Data Table
|game= BotW
|collapse= true
|columns= Dye [ID][Image:Icon:144px][Name], Materials [IconList]
|-
| Blue Dye
| Chillshroom, Blue Nightshade, Winterwing Butterfly, Cold Darner, Hearty Lizard, Sapphire, Icy Lizalfos Tail, Ice Keese Wing
|-
| Red Dye
| Apple, Spicy Pepper, Hylian Shroom, Sunshroom, Summerwing Butterfly, Warm Darner, Ruby, Red Lizalfos Tail, Red Chuchu Jelly, Fire Keese Wing 
}}
Output
Dye
Blue Dye
Materials
Dye
Red Dye
Materials
Categories Added

Armor Upgrade data table, using the Rowspan and Defense tags.
Input
{{Data Table
|game= BotW
|columns= Armor [Rowspan][Term], Level, Defense [Defense]
|-
| Amber Earrings
| ★
| 7
|-
| Amber Earrings
| ★★
| 12
|-
| Ancient Set
| ★★★
| 18
|- 
| Ancient Set
| ★★★★
| 28
}}
Output
ArmorLevelDefense
★★
★★★
★★★★
Categories Added

Spoil data table, using the Colspan, Nowrap, and LinkList tags. Rupees is also used with custom games.
Input
{{Data Table
|game= TWWHD
|storeAs= Spoils
|columns= Spoil [Image:Artwork][Term][Nowrap], Enemies [LinkList][Nowrap], Sell Price [Colspan:2], {{TWW|-}} [Rupees:TWW], {{TWWHD|-}} [Rupees:TWWHD], Uses [Description]
|-
| Red Chu Jelly
| Red ChuChu, Yellow ChuChu, Dark ChuChu
| 1
| 10
| Making [[Red Potion]] by giving five of them to Doc Bandam.
|-
| Green Chu Jelly
| Green ChuChu, Yellow ChuChu, Dark ChuChu
| 2
| 10
| Making [[Green Potion]] by giving 15 of them to Doc Bandam (five each subsequent time).
|-
| Blue Chu Jelly
| Blue ChuChu
| 3
| 15
| Making [[Blue Potion]] by giving 15 of them to [[Doc Bandam]] (five each subsequent time).
|-
| Boko Baba Seed
| Boko Baba
| 5
| 20
| Making [[Blue Potion]] by giving four of them to [[Hollo]].
}}
Output
Spoil
Enemies
Sell PriceThe Wind Waker
The Wind Waker HD
Uses

Making Red Potion by giving five of them to Doc Bandam.

Spoil
Enemies
Sell PriceThe Wind Waker
The Wind Waker HD
Uses

Making Green Potion by giving 15 of them to Doc Bandam (five each subsequent time).

Spoil
Enemies
Sell PriceThe Wind Waker
The Wind Waker HD
Uses

Making Blue Potion by giving 15 of them to Doc Bandam (five each subsequent time).

Spoil
Enemies
Sell PriceThe Wind Waker
The Wind Waker HD
Uses

Making Blue Potion by giving four of them to Hollo.

SpoilEnemiesSell PriceUses
The Wind WakerThe Wind Waker HD

Making Red Potion by giving five of them to Doc Bandam.

Making Green Potion by giving 15 of them to Doc Bandam (five each subsequent time).

Making Blue Potion by giving 15 of them to Doc Bandam (five each subsequent time).

Making Blue Potion by giving four of them to Hollo.

Categories Added

An incomplete data table
Input
{{Data Table
|game= TWWHD
|columns= Jelly [Term], Potion [Image][Term], Enemies [LinkList], Sell Price [Rupees]
|-
| Blue Chu Jelly
| 
| 
| 
}}
Output

The following data table is incomplete. You can help Zelda Wiki by editing the page to fill in the empty cells.
JellyPotionEnemiesSell Price
Categories Added

Error: Invalid tags
Input
{{Data Table
|game= TWWHD
|columns= Foo [InvalidTag]
|-
| bar
}}
Output
Foo
bar
Categories Added

Extensions

The following templates extend the functionality of this template:

These generally templates work the same way, but in addition store some or all of the data in a dedicated Cargo table for use by Cargo Query Templates. For example, Template:Data Table/Upgrades stores data in the Upgrades table for use by Template:Upgrades.

Guidelines

  • When editing a data table that uses the storedAs parameter, be aware that this may break copies of the table that look for specific columns or row data.
    • This is also the case for any of the data table extensions listed above. Be especially careful with this data as it is usually used in several articles.
    • Category:Pages with data tables lists all the pages that copy a particular data table. After changing a data table, it is recommended to check all the pages that query it. You may need to purge the copying page's cache for any changes to appear in the copy.
  • When a column does not apply to a particular row, use the special N/A value rather than leaving the cell blank.
The above documentation is transcluded from Template:Data Table/Documentation. (edit | history)