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 {{Term}}, {{Amounts}}, {{Rupee}}, etc.

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

Usage

SyntaxBoilerplate
{{Data Table
|game= 
|storeAs= 
|caption= 
|responsiveModeEnabled= 
|vertical= 
|sortable= 
|stretch= 
|columns= 
|<cell1>
|<cell2>
|<cell3>
|...
|<cellN>
}}
{{Data Table
|game= 
|storeAs= 
|caption= 
|responsiveModeEnabled= 
|vertical= 
|sortable= 
|stretch= 
|columns= 
|
|
|
}}
ParameterStatusDescriptionAccepted values
gamesuggestedA game code. Used to automatically apply game-based templates (e.g. {{Term}}, {{Amounts}}, {{Rupee}}) to table cells.See Data:Franchise
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.
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

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
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
Unsortable
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, like [TermList] but without the terms.

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
[Plural]
[Plural:Series]
Alignment
Center
Sortability
Sortable
Effects
  • Applies {{Plural}} to each cell in the column. The game from the Data Table game parameter is used
  • unless Series or another game is specified in the tag.
Tag
[PluralList]
[PluralList:Series]
Alignment
Left
Sortability
Unsortable
Effects
  • Applies {{Term List}} to each cell in the column with the plural parameter enabled and listType set to bullet. The game from the Data Table game parameter is used
  • unless Series or another game is specified in the tag.
Tag
[Rupees][Rupees:game:format]
Alignment
Left
Sortability
Sortable
Effects
  • Applies {{Rupee}} to each cell in the column.
Tag
[SortValue]
Alignment
Center
Sortability
Sortable
Effects
  • Applies {{Sort Value}} 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]
[Term:Series]
Alignment
Center
Sortability
Sortable
Effects
  • Applies {{Term}} to each cell in the column using the game from the Data Table game parameter
  • unless Series or another game is specified in the tag.
Tag
[Terms]
[Terms:Series]
Alignment
Center
Sortability
Unsortable
Effects
  • Applies {{Term List}} to each cell in the column using the game from the Data Table game parameter
  • unless Series or another game is specified in the tag.
Tag
[TermList]
[TermList:Series]
Alignment
Left
Sortability
Unsortable
Effects
  • Applies {{Term List}} to each cell in the column with the listType parameter set to bullet. The game from the Data Table game parameter is used
  • unless Series or another game is specified in the tag.
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
Unsortable
  • 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, like [TermList] but without the terms.

[Name]
Center
Sortable

Text is shown as-is.

[Mon]
Left
Sortable

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

[Plural]
[Plural:Series]
Center
Sortable
  • Applies {{Plural}} to each cell in the column. The game from the Data Table game parameter is used
  • unless Series or another game is specified in the tag.
[PluralList]
[PluralList:Series]
Left
Unsortable
  • Applies {{Term List}} to each cell in the column with the plural parameter enabled and listType set to bullet. The game from the Data Table game parameter is used
  • unless Series or another game is specified in the tag.
[Rupees][Rupees:game:format]
Left
Sortable
  • Applies {{Rupee}} to each cell in the column.
[SortValue]
Center
Sortable
  • Applies {{Sort Value}} 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]
[Term:Series]
Center
Sortable
  • Applies {{Term}} to each cell in the column using the game from the Data Table game parameter
  • unless Series or another game is specified in the tag.
[Terms]
[Terms:Series]
Center
Unsortable
  • Applies {{Term List}} to each cell in the column using the game from the Data Table game parameter
  • unless Series or another game is specified in the tag.
[TermList]
[TermList:Series]
Left
Unsortable
  • Applies {{Term List}} to each cell in the column with the listType parameter set to bullet. The game from the Data Table game parameter is used
  • unless Series or another game is specified in the tag.
[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?
Copied
Effects

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

Tag
[ID]
Copied?
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?
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?
Copied
Effects

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

Tag
[Unsortable]
Copied?
Copied
Effects

Renders the column unsortable.

Tag
[Width:width]
Copied?
Not Copied
Effects

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

TagCopied?Effects
[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
Location
Description

Increased durability.

Item
Upgrade
Materials
Cost
Location
Description

Further increased durability.

Item
Upgrade
Materials
Cost
Location
Description

Ability to grab items.

ItemUpgradeMaterialsCostLocationDescription

Increased durability.

Further increased durability.

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, Terms, Unsortable, and Width.

[Player Name] is automatically replaced with Link or {{Player Name}} depending on the context.

Input
{{Data Table
|game= TMC
|storeAs= TMC Figurines
|columns= Figurine [ID][Image:Figurine Sprite][Name], Number, Subject(s) [Terms], Pictured [Unsortable][Width:20%], Description [Description]
|-
| Capless [Player Name]
| 001
| Link
| {{Term|TMC|Link|link}}
| A young boy who lives in Hyrule. He is<br/>close friends with Princess Zelda.
|-
| Princess Zelda
| 003
| Princess Zelda
| {{Term|TMC|Princess Zelda|link}}
| A bright and cheery princess from<br/>Hyrule's royal family.<br/>She loves to sneak out of the castle<br/>to visit her good friend, [Player Name].
|- 
| Ezlo (Cap)
| 004
| Ezlo
| {{Term|TMC|Ezlo|link}}
| A strange creature that looks at first<br/>like a cap. He speaks roughly and<br/>treats [Player Name] like a child, but he<br/>actually really likes [Player Name].
|- 
| Chuchu
| 118
| Chuchu, Blue Chuchu, Green Chuchu, Red Chuchu
| A {{Term|TMC|Blue Chuchu|link}}, a {{Term|TMC|Green Chuchu|link}}, and a {{Term|TMC|Red Chuchu|link}}
| Appears in various areas.<br/>Chuchus come in many colors.<br/>Each color is a little different, but<br/>ranged weapons work well against all.
}}
Output
Figurine
TMC Capless Link Figurine Sprite.png
Capless Link
Number
001
Subject(s)
Pictured
Description

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

Figurine
TMC Princess Zelda Figurine Sprite.png
Princess Zelda
Number
003
Subject(s)
Pictured
Description

A bright and cheery princess from
Hyrule's royal family.
She loves to sneak out of the castle
to visit her good friend, Link.

Figurine
TMC Ezlo (Cap) Figurine Sprite.png
Ezlo (Cap)
Number
004
Subject(s)
Pictured
Description

A strange creature that looks at first
like a cap. He speaks roughly and
treats Link like a child, but he
actually really likes Link.

Figurine
TMC Chuchu Figurine Sprite.png
Chuchu
Number
118
Subject(s)
Pictured
Description

Appears in various areas.
Chuchus come in many colors.
Each color is a little different, but
ranged weapons work well against all.

FigurineNumberSubject(s)PicturedDescription
TMC Princess Zelda Figurine Sprite.png
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, Link.

TMC Ezlo (Cap) Figurine Sprite.png
Ezlo (Cap)
004

A strange creature that looks at first
like a cap. He speaks roughly and
treats Link like a child, but he
actually really likes Link.

TMC Chuchu Figurine Sprite.png
Chuchu
118

Appears in various areas.
Chuchus come in many colors.
Each color is a little different, but
ranged weapons work well against all.

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) [Terms], 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
TWW Darknut Figurine Model.png
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
TWW Darknut Figurine Model 2.png
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
TWW Darknut Figurine Model.png
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.

TWW Darknut Figurine Model 2.png
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.
Input
{{Data Table
|game= BotW
|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
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 TermList tags. Rupees is also used with custom games.
Input
{{Data Table
|game= TWWHD
|storeAs= Spoils
|columns= Spoil [Image:Artwork][Term][Nowrap], Enemies [TermList][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
Spoil
Enemies
Sell PriceThe Wind Waker
The Wind Waker HD
Spoil
Enemies
Sell PriceThe Wind Waker
The Wind Waker HD
Spoil
Enemies
Sell PriceThe Wind Waker
The Wind Waker HD
SpoilEnemiesSell Price
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 [TermList], Sell Price [Rupees]
|-
| Blue Chu Jelly
| 
| 
| 
}}
Output
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/Figurines stores data in the Figurines table for use by Template:Figurines.

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)