Help:  Contents | Getting Started | New to BRWiki | Editing BRWiki | Editing BRWiki (advanced) | Communication and Community | Additional Help
The help pages are currently being redesigned so they are more helpful. If you have any comments or are interested in helping out, please see the help team.

 This article or section needs to be cleaned up to a higher standard of quality.
style="Template:stub explanationcss;" |
This may include editing to correct spelling and grammar, rewriting sections to ensure they are clear and concise, and wikifying.

MediaWiki supports different types of table syntax:
  1. XHTML
  2. HTML and wiki <td> syntax
  3. pipe-syntax

All three are supported by MediaWiki and create valid HTML output.
See also HTML element#Tables. Note however that the thead, tbody, tfoot, and colgroup elements are currently not supported in MediaWiki.

[top]Overview















Comparison of table syntax'''
 XHTML HTML & Wiki-td Wiki-pipe
Table
<table></table>
<table></table>
class="bbcode_container" |
Code:
[noparse]{| params 
|}[/noparse]
Caption
<caption></caption>
<caption></caption>
|+ caption
Row
<tr></tr>
<tr>
|- params
Data cell

<td>cell1</td>

<td>cell2</td>

<td>cell1

<td>cell2

class="bbcode_container" |
Code:
[noparse]| cell1
| cell2[/noparse]
Data cell
<td>cell1</td> <td>cell2</td> <td>cell3</td>
<td>cell1 <td>cell2 <td>cell3
|cell1||cell2||cell3
Header cell
<th></th>
<th>
! heading
Sample table










1 2
3 4

class="bbcode_container" |
Code:
[noparse]
<table>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</table>
[/noparse]
class="bbcode_container" |
Code:
[noparse]
<table>
<tr>
<td> 1 <td> 2
<tr>
<td> 3 <td> 4
</table>
[/noparse]
class="bbcode_container" |
Code:
[noparse]
{|
| 1 || 2
|-
| 3 || 4
|}[/noparse]
Sample table














1 2
3 4
5 6

class="bbcode_container" |
Code:
[noparse]
<table>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
</table>
[/noparse]
class="bbcode_container" |
Code:
[noparse]
<table>
<tr>
<td> 1 <td> 2
<tr>
<td> 3 <td> 4
<tr>
<td> 5 <td> 6
</table>
[/noparse]
class="bbcode_container" |
Code:
[noparse]
{|
| 1 || 2
|-
| 3 || 4
|-
| 5 || 6
|}[/noparse]
Pros
  • Can be previewed/debugged with any XHTML editor
  • Can be formatted for easier reading
  • Well-known

  • Can be previewed/debugged with any HTML editor
  • Can be formatted for easier reading
  • Well-known
  • Takes less space than XHTML

  • Easy to write
  • Easy to read
  • Takes little space

Cons
  • Tedious
  • Takes a lot of space
  • Difficult to read quickly

  • Confusing, especially for people with little HTML experience
  • Poorly formed
  • Poorly delimited
  • Generally odd looking

  • Unfamiliar syntax
  • Rigid structure
  • Cannot be indented

 XHTML HTML & Wiki-td Wiki-pipe

[top]Guide to the pipe syntax

The pipe syntax, developed by Magnus Manske, substitutes pipes (|) for HTML. There is an on-line script which converts html tables to pipe syntax tables.
The pipes must start at the beginning of a new line, except when separating parameters from content or when using || to separate cells on a single line. The parameters are optional.

[top]Tables

A table is defined by

{| ''params''
|}

which equals

<table ''params''>Insert non-formatted text here
</table>
Careful: You must include the space between

[top]Rows

tags will be generated automatically for the first row. To start a new row, use
so "||" equals "newline" + "|"
Parameters in cells can be used like this:

You can also use parameters:
cell1cell2cell3
or like this:
cell1cell2cell3
which both equal
cell1cell2cell3cell1cell2cell3
which will result in
params>

[top]Headers

Functions the same way as TD, except "!" is used instead of the opening "|". "!!" can be used instead of "||". Parameters still use "|", though! Example:
params!cell1

[top]Captions

A
tag is created byCaption
which generates
Caption

[top]Simple example

class="bbcode_container" |
Code:
 
{|
| Cell 1, row 1
| Cell 2, row 1
|-
| Cell 1, row 2
| Cell 2, row 2
|}
generates
Cell 1, row 1Cell 2, row 1
Cell 1, row 2Cell 2, row 2

[top]Advanced example

class="bbcode_container" |
Code:
{| align=right border=1
| Cell 1, row 1
|rowspan=2| Cell 2, row 1 (and 2)
| Cell 3, row 1
|-
| Cell 1, row 2
| Cell 3, row 2
|}
Cell 1, row 1Cell 2, row 1 (and 2)Cell 3, row 1
Cell 1, row 2Cell 3, row 2
Note the floating table to the right.

[top]Nested table

class="bbcode_container" |
Code:
{| border=1
| &alpha;
|
{| bgcolor=#ABCDEF border=2
|nested
|-
|table
|}
|the original table again
|}
gives a nested table
α
nested
table
the original table again
Nested tables have to start on a new line.

[top]Text next to a table

You can use various codes to float the table to the left or the right of text. Traditional HTML uses align=left or align=right. You can also use style="float: left;" or style="float:right;". However, be careful when using this in tandem with preformatted text. It may overlap the table because it does not wrap.
An example of what not to do:

Multiplication table
×123
1123
2246
3369
44812
551015
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur velit pede, imperdiet id, pellentesque ut, aliquam sed, nunc. Duis condimentum bibendum felis. Aliquam sed leo. Nunc volutpat volutpat massa. Curabitur luctus mauris eget urna. Donec dictum. Fusce a turpis. Nullam sodales fringilla neque. Aenean nibh. Donec viverra purus et est. Integer at enim molestie nulla fringilla imperdiet. Nam dictum rutrum eros. Sed ut diam. Etiam et elit. Praesent ut tellus. Nullam vel sem.
Sed luctus arcu nec nulla. Sed dictum rhoncus leo. Praesent fringilla, nunc ut hendrerit tempus, nibh sem venenatis sapien, vitae tempor lorem turpis eu justo. Vestibulum a nibh. Sed interdum. Suspendisse potenti. Fusce a nibh. Aenean sed urna nec tellus porta hendrerit. Vestibulum felis velit, scelerisque non, pellentesque sed, ultricies vitae, nulla. Etiam vel ligula. In hac habitasse platea dictumst. Aliquam id ante vitae nulla dictum laoreet. Aliquam erat volutpat.
Pellentesque felis. Nullam nec dui. Sed odio. Curabitur bibendum elementum metus. Donec luctus velit vel lectus. In vel justo vel velit fringilla porttitor. Nullam sagittis. Suspendisse blandit nibh nec mauris. Praesent nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vivamus bibendum leo quis neque. Vivamus consectetuer ligula at dui. Mauris iaculis sollicitudin nunc.

To prevent this, use {{clr}} to clear both sides, {{clrr}} to clear the right, or {{clrl}} to clear the left. This will place all following text (include more tables) after any floated elements:

Multiplication table
×123
1123
2246
3369
44812
551015
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur velit pede, imperdiet id, pellentesque ut, aliquam sed, nunc. Duis condimentum bibendum felis. Aliquam sed leo. Nunc volutpat volutpat massa. Curabitur luctus mauris eget urna. Donec dictum. Fusce a turpis. Nullam sodales fringilla neque. Aenean nibh. Donec viverra purus et est. Integer at enim molestie nulla fringilla imperdiet. Nam dictum rutrum eros. Sed ut diam. Etiam et elit. Praesent ut tellus. Nullam vel sem. {{clrr}}


Sed luctus arcu nec nulla. Sed dictum rhoncus leo. Praesent fringilla, nunc ut hendrerit tempus, nibh sem venenatis sapien, vitae tempor lorem turpis eu justo. Vestibulum a nibh. Sed interdum. Suspendisse potenti. Fusce a nibh. Aenean sed urna nec tellus porta hendrerit. Vestibulum felis velit, scelerisque non, pellentesque sed, ultricies vitae, nulla. Etiam vel ligula. In hac habitasse platea dictumst. Aliquam id ante vitae nulla dictum laoreet. Aliquam erat volutpat.
Pellentesque felis. Nullam nec dui. Sed odio. Curabitur bibendum elementum metus. Donec luctus velit vel lectus. In vel justo vel velit fringilla porttitor. Nullam sagittis. Suspendisse blandit nibh nec mauris. Praesent nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vivamus bibendum leo quis neque. Vivamus consectetuer ligula at dui. Mauris iaculis sollicitudin nunc.

[top]Decimal point alignment

A method to get columns of numbers aligned at the decimal point is as follows:
class="bbcode_container" |
Code:
<blockquote>
{| cellpadding=0 cellspacing=0
|align=right| 432 || . || 1
|-
|align=right| 43 || . || 21
|-
|align=right| 4 || . || 321
|}
</blockquote>
gives

432.1
43.21
4.321

In simple cases one can dispense with the table feature and simply start the lines with a space, and put spaces to position the numbers:
432.1
43.21
4.321

[top]External links


Tags for this Page

Similar Pages

  1. Monster Table
    By Arjan in forum Template
    Comments: 0
    Last Post: 05-17-2007, 10:27 AM
  2. Creature Table/Data
    By Arjan in forum Template
    Comments: 0
    Last Post: 05-15-2007, 11:50 AM
  3. Creature Table
    By Arjan in forum Template
    Comments: 0
    Last Post: 05-15-2007, 11:09 AM
  4. Domain/Table
    By Arjan in forum Main
    Comments: 0
    Last Post: 04-09-2007, 09:43 PM

Bookmarks

Posting Permissions

Posting Permissions
  • You may not create new articles
  • You may not edit articles
  • You may not protect articles
  • You may not post comments
  • You may not post attachments
  • You may not edit your comments
BIRTHRIGHT, DUNGEONS & DRAGONS, D&D, the BIRTHRIGHT logo, and the D&D logo are trademarks owned by Wizards of the Coast, Inc., a subsidiary of Hasbro, Inc., and are used by permission. ©2002-2010 Wizards of the Coast, Inc.