Recent changes Random page

Gaming
 
StarCraft Wiki
Super Smash Wiki
Halopedia
Diablo Wiki
FFXIclopedia
Grand Theft Wiki
See more...

Help:Table

From WoWWiki

Jump to: navigation, search
HELP CONTENTS · Getting Started · New to WoWWiki · Editing WoWWiki · Editing WoWWiki (advanced) · The WoWWiki Community · Additional Help
See Wikia Help for general Wikia- and wiki- related help. See WoWWiki:MediaWiki  Meta-Wiki Help for basic MediaWiki usage!

MediaWiki supports different types of table syntax:

  1. Limited HTML syntax
  2. Pipe syntax (which this article covers)

See the Wikipedia article on HTML elements for notes on traditional HTML. Note, however, that the thead, tbody, tfoot, and colgroup elements are currently not supported in MediaWiki.

The pipe syntax substitutes pipes (|) for HTML. The pipes must start at the beginning of a new line, except when separating optional parameters from content or when using || to separate cells on a single line.

Contents

Example table

{|
|-
! header 1
! header 2
! header 3
|-
| row 1, cell 1
| row 1, cell 2
| row 1, cell 3
|-
| row 2, cell 1
| row 2, cell 2
| row 2, cell 3
|}

Would look like this:

header 1 header 2 header 3
row 1, cell 1 row 1, cell 2 row 1, cell 3
row 2, cell 1 row 2, cell 2 row 2, cell 3


Tables

Use {| to open a table. This is equivalent to <table> in HTML. Likewise, |} closes a table and is equivalent to </table> in HTML.

Parameters (such as align, style, and other properties) can be assigned with by adding them after the opening brackets.

For example: {| class="tableExample" would align the table to the center of the page.

Rows

To start a new row, use |- which is equivalent to <tr> in HTML. It is not necessary to close a row (nor is there any syntax to do so); merely start a new row or end the table.

Parameters can be added in the same manner: |- class="tableExample" would align the content inside the row to the center of the row.

Cells

Cells (<td></td> in HTML) are generated in one of two ways.

On separate lines:

|cell1
|cell2
|cell3

Or all on one line:

|cell1||cell2||cell3

These are both equivalent to <td>cell1</td><td>cell2</td><td>cell3</td>.

Parameters in cells can be used like this:

|class="tableExample"|cell1
|class="tableExample"|cell2
|class="tableExample"|cell3

Or in one line:

|class="tableExample"|cell1||class="tableExample"|cell2||class="tableExample"|cell3

It is, again, not necessary or possible to close a cell, simply start a new row or close the table.

Headers

Headers (cells at the top of tables which indicate what the cells below contain) function the same way as cells, except ! is used instead of the opening |. Parameters still use "|", though. For example:

!class="tableExample2"|cell1

Headers are equivalent to <th></th> in HTML.

Captions

Captions are hardly ever used. However, should it be necessary to create one, it is possible in pipe syntax.

An HTML <caption> tag is created by |+ You can also use parameters. |+ class="tableExample"|Caption

Cosmetic formatting

When possible tables should use the WoWwiki style. To create such a table the first line should read:

{| class="darktable"

This makes the table match the style of WoWwiki, rather than generic HTML. (see example under "Sorting" below)

Sorting

Some wikis support automatic addition of sort buttons to column headers using special CSS classes on the table.

For example: {| class="sortable" would add sort buttons to column headers, and {| class="sortable darktable" is used in the following example:

Example Sortable Table
Alphabetical Numerical Reputation Surname
A 4 2 Revered Kir James T Kirk
C 3 3 Honored Rod Gene Roddenberry
B 2 4 FriendlyAnd John Anderson
D 1 1 Exalted Aze Bill Azeroth

Vic The Reputation column uses hidden, non-displaying numbers to determine sort order:

<span style="display:none">#</span>

Non-displaying letters can also be used to sort a list by surname if desired. For long list you should include at least the first few letters for subsorting names that start with the same letter.

<span style="display:none">Aze</span> Bill Azeroth

Striped tables

In long tables, or in tables with multi-line rows, it may be desirable to visually distinguish rows. This is accomplished by making every other row use a different background with class="alt" at the beginning of the desired rows, as follows:

|-class="alt"

While this can be used with sortable tables, the coloring stays with the original rows, and so my no longer alternate after sorting (try sorting example using the first column).

Example Striped Table
Alphabetical Numerical Reputation Surname
A 4 2 Revered Kirk
(James T.)
C 3 3 Honored Roddenberry
(Gene)
B 2 4 Friendly Anderson
(John)
D 1 1 Exalted Azeroth
(Bill)

External links

.