Template:Data Table Copy

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

Purpose

Creates a copy of a {{Data Table}} located on another page.

Usage

Required ParametersAll Parameters
{{Data Table Copy
|fromPage= 
|storedAs= 
}}
{{Data Table Copy
|fromPage= 
|storedAs= 
|columns= 
|excludeColumns= 
|rowsWith= 
|rowsExcluding= 
|responsiveModeEnabled= 
}}
ParameterStatusDescription
fromPagerequiredThe name of the wiki page containing the data table to be copied.
storedAsrequiredThe internal name of the table to be copied, as specified by the storeAs parameter of Template:Data Table.
columnsoptionalA comma-separated list of columns to copy. If absent, all columns are copied.
excludeColumnsoptionalA comma-separated list of columns not to copy. If absent, all columns are copied. Ignored if columns is present.
rowsWithoptionalIf specified, only rows containing the given string will be copied. If absent, all rows are copied.
rowsExcludingoptionalIf specified, only rows which do not contain the given string will be copied.
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.

Creates a copy of a {{Template|Data Table}} located on another page.

Template parameters

ParameterDescriptionTypeStatus
fromPagefromPage

The name of the wiki page containing the data table to be copied.

Page namerequired
storedAsstoredAs

The internal name of the table to be copied, as specified by the <code>storeAs</code> parameter of [[Template:Data Table]].

Stringrequired
columnscolumns

A comma-separated list of columns to copy. If absent, all columns are copied.

Stringoptional
excludeColumnsexcludeColumns

A comma-separated list of columns ''not'' to copy. If absent, all columns are copied. Ignored if <code>columns</code> is present.

Stringoptional
rowsWithrowsWith

If specified, only rows containing the given string will be copied. If absent, all rows are copied.

Stringoptional
rowsExcludingrowsExcluding

If specified, only rows which do ''not'' contain the given string will be copied.

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

Examples

Copying the table from the example at Template:Data Table
Input
{{Data Table Copy
|fromPage= Template:Data Table
|storedAs= TMC Figurines
}}
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

Using the columns parameter to copy specific columns
Input
{{Data Table Copy
|fromPage= Template:Data Table
|storedAs= TMC Figurines
|columns= Figurine, Description
}}
Output
Figurine
TMC Capless Link Figurine Sprite.png
Capless Link
Description

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

Figurine
TMC Princess Zelda Figurine Sprite.png
Princess Zelda
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)
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
Description

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

FigurineDescription
TMC Princess Zelda Figurine Sprite.png
Princess Zelda

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)

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

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

Categories Added

If one or more specified columns do not exist, a warning is issued and all columns are returned.
Input
{{Data Table Copy
|fromPage= Template:Data Table
|storedAs= TMC Figurines
|columns= Figurine, Not a Column
}}
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

Using rowsWith to copy rows containing a certain string, and using excludeColumns to prevent certain columns from being copied.

Note that a Link figurine is returned as the description mentions the word "Zelda".

Input
{{Data Table Copy
|fromPage= Template:Data Table
|storedAs= TMC Figurines
|rowsWith= Zelda
|excludeColumns= Subject(s), Pictured
}}
Output
Figurine
TMC Capless Link Figurine Sprite.png
Capless Link
Number
001
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
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.

FigurineNumberDescription
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.

Categories Added

The rowsWith and rowsExcluding parameters accept Lua patterns. This is particularly useful for doing exact matches with ^ (string beginning) and $ (string ending).
Input
{{Data Table Copy
|fromPage= Template:Data Table
|storedAs= TMC Figurines
|rowsWith= ^Princess Zelda$
|excludeColumns= Subject(s), Pictured
}}
Output
Figurine
TMC Princess Zelda Figurine Sprite.png
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, Link.

FigurineNumberDescription
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.

Categories Added

Using the rowsExcluding to copy all rows except those containing a certain string
Input
{{Data Table Copy
|fromPage= Template:Data Table
|storedAs= TMC Figurines
|rowsExcluding= Zelda
|excludeColumns= Subject(s), Pictured
}}
Output
Figurine
TMC Ezlo (Cap) Figurine Sprite.png
Ezlo (Cap)
Number
004
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
Description

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

FigurineNumberDescription
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

Using the As tag to rename a column
Input
{{Data Table Copy
|fromPage= Monster Part
|storedAs= Monster Parts
|columns= Monster Part [As:Material], Sell Price [Colspan:2], Rupees, Mon
|rowsWith= Ancient
}}
Output
MaterialRupeesMon
Categories Added

Error: Table not found
Input
{{Data Table Copy
|fromPage= Not a Page
|storedAs= Not a Table
}}
Output
Categories Added

Error: No matching rows found
Input
{{Data Table Copy
|fromPage= Template:Data Table
|storedAs= SS Upgrades
|rowsWith= invalid row query
}}
Output
Categories Added
The above documentation is transcluded from Template:Data Table Copy/Documentation. (edit | history)