Extension:SimpleTable

From mediawiki.org
MediaWiki extensions manual
SimpleTable
Release status: unstable
Implementation Tag
Description Converts tab- (or comma-) separated data into a Wiki table.
Author(s) JohanTheGhost
Maintainer(s) Vicarage
MediaWiki 1.35+
License No license specified
Download

The SimpleTable extension allows tabular data to be easily cut-and-pasted into a Wiki; for example, this allows a CSV export from Excel to be pasted in without having to manually edit it into Wiki table syntax. It's really crude, and doesn't allow any kind of clever formatting; for example, there is no way to set row and cell parameters, including row and cell spanning.

Usage[edit]

All you need to do is prepare your data in rows, with fields separated by tab characters. (Excel's "Save as" → "Text (Tab delimited)" function saves data in this format.) Place the data inside <tab>...</tab> tags, and set any table parameters inside the opening <tab> tag:

<tab border=1>
Field 1→Field 2→Field 3
Field 4→Field 5→Field 6
Field 7→Field 8→Field 9
</tab>

(where represents a tab character) produces the corresponding table. Most table parameters should work; for example, if your wiki has the wikitable CSS class defined, then this markup should work:

<tab class=wikitable>
. . .

Parameter: sep[edit]

You can use a different separator, using the sep parameter.

Values[edit]

sep can be one of:

tab
a tab
space
a space
spaces
one or more spaces and/or tabs
comma
a comma
bar
a vertical bar (|)
semicolon
a semicolon

Parameter: head[edit]

You can also specify that either the top row or the left column should be formatted as a heading, using the head parameter.

Values[edit]

head can be one of:

top
make the top row a heading
left
make the left column a heading
topleft
do both

Oddly Top headings are done by default if head is omitted, use 'head=' to remove them

Example[edit]

<tab class=wikitable sep=comma head=top>
Head 1,Head 2,Head 3
Field 4,Field 5,Field 6
Field 7,Field 8,Field 9
</tab>

produces a table with a heading row and two data rows, all having three columns.

Installation[edit]

  • Download, unzip and place the file(s) in a directory called SimpleTable in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'SimpleTable' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.