From Wikipedia, the free encyclopedia
Content deleted Content added
|
 |
|||
| Line 70: | Line 70: | ||
|
* [[Template:Wikidata list]] |
* [[Template:Wikidata list]] |
||
|
<!– |
|||
|
<includeonly> |
<includeonly> |
||
|
[[Category:Lua-based templates]] |
[[Category:Lua-based templates]] |
||
|
[[Category:Table templates]] |
[[Category:Table templates]] |
||
|
</includeonly> |
</includeonly> |
||
|
–> |
|||
Latest revision as of 17:29, 10 January 2026
This template lets you display tabular data stored on Wikimedia Commons as a regular wiki table.
It is adapted from the former template at the English Wikipedia (now deleted there and replaced by templates based on en:Module:Tabular data).
{{User:McBayne/Template:Json2table|dataset=...}}
dataset – **required**. Page name in the Commons “Data:” namespace, omitting both the “Data:” prefix and the “.tab” suffix, e.g. for c:Data:Area of Glacier de la Plaine Morte by year.tab, this would beArea of Glacier de la Plaine Morte by year.tab.row_header – (defaulttrue) make the first column header-styled (bold).col_header – (defaulttrue) use the column names as table headers.caption – (defaulttrue) use the dataset’s description as the table caption.empty_cell – (default ” “) text to show when the JSON value isnull.columns – (default *all*) list of column keys (defined inschema.fields.name) to include, separated with “/”.table_format – (defaultclass="wikitable") extra wikitext for the opening<table>tag.bare – (defaultfalse) output only the table’s rows and cells (wrap them yourself).nowiki – (defaultfalse) show the table’s wikitext instead of rendering it (debugging aid).lang – language code to pick the correct translation from multilingual fields; if omitted the site’s content language (English on Commons) is used.
Using c:Data:Chart Example Data.tab. (Note that the “pencil” icon after the table caption provides a link to the raw data.)
{{User:McBayne/Template:Json2table|dataset=Chart Example Data}} produces
Default rendering of multilingual data
[edit]
This uses c:Data:Area of Glacier de la Plaine Morte by year.tab. Note that the table caption, column labels, and dates are all rendered in Swedish.
{{User:McBayne/Template:Json2table|dataset=Area of Glacier de la Plaine Morte by year.tab}} produces
| year | Area in km² |
|---|---|
| 1850 | 11.4 |
| 1973 | 9.1 |
| 1999 | 7.8 |
| 2023 | 6.78 |
Selecting columns and other customizations
[edit]
Using c:Data:Area of Glacier de la Plaine Morte by year.tab. Now the column labels and dates are rendered in Danish.
{{User:McBayne/Template:Json2table|dataset=Area of Glacier de la Plaine Morte by year.tab produces
|columns=a0/a1
|caption=false |row_header=false
|lang=de
|table_format=class="wikitable sortable"
|output=chart
|template=Area of Vadret da Tschierva by year.tab
|template_x=1
|chart_source=[[c:Data:Area of Glacier de la Plaine Morte by year.tab]]
|chart_y2=8,8,8,8
|chart_y2Title=Example_RefLine
|chart_xType=string}}
{{User:McBayne/Template:Json2table|dataset=Chart Example Data|output=chart|chart_xType=date|chart_type=area}} produces


