Help:Table: Difference between revisions
Content deleted Content added
Largely based on http://test.wikipedia.org/wiki/Wiki_table_markup and http://test.wikipedia.org/wiki/Wiki_table_test |
m Reverted changes by 180.249.186.24 (talk) to last version by Pols12 Tag: Rollback |
||
(859 intermediate revisions by more than 100 users not shown) | |||
Line 1: | Line 1: | ||
{{MovedToMediaWiki}} |
|||
__NOTOC__ |
|||
This new table markup, developed by [[User: Magnus Manske| Magnus Manske]], replaces the <nowiki><table>, <tr>, <td>, <th>, and <caption></nowiki> HTML tags. |
|||
[[Category:Editor handbook{{#translation:}}]] |
|||
The tags below must start at the beginning of a new line (with one exception). The parameters are optional. |
|||
''See also'': [[Wiki markup tables]], [[WikiShouldOfferSimplifiedUseOfTables]] |
|||
=== Table === |
|||
A table is defined by |
|||
{| ''params'' |
|||
|} |
|||
which equals |
|||
<table ''params''> |
|||
</table> |
|||
=== TD === |
|||
Cells are generated either like this: |
|||
|cell1 |
|||
|cell2 |
|||
|cell3 |
|||
or like this: |
|||
|cell1||cell2||cell3 |
|||
which both equals |
|||
<td>cell1</td><td>cell2</td><td>cell3</td> |
|||
so "||" equals "newline"+"|" |
|||
Parameters in cells can be use like this: |
|||
|''params''|cell1 |
|||
which will result in |
|||
<td ''params''> |
|||
=== TH === |
|||
Functions the same way as TD, except "!" is used instead the opening "|". "!!" can be used instead of "||". Parameters still use "|", though! |
|||
=== TR === |
|||
<tr> tags will be generated automatically for the first row. To start a new row, use |
|||
|- |
|||
or |
|||
|-------------- |
|||
or |
|||
|------------------- |
|||
which all results in |
|||
<tr> |
|||
Parameters can be added like this: |
|||
|- ''params'' |
|||
or |
|||
|------- ''params'' |
|||
which results is |
|||
<tr ''params''> |
|||
Note: |
|||
* <tr> tags will be automatically opened at the first <td> equivalent |
|||
* <tr> tags will be automatically closed at <tr> and </table> equivalents |
|||
=== CAPTION === |
|||
A <caption> tag is created by |
|||
|+ Caption |
|||
which generates |
|||
<caption>Caption</caption> |
|||
You can also use parameters: |
|||
|+ ''params''|Caption |
|||
which will generate |
|||
<caption ''params''>Caption |
|||
==Examples== |
|||
=== Simple example === |
|||
{| |
|||
| Cell 1, row 1 |
|||
| Cell 2, row 1 |
|||
|- |
|||
| Cell 1, row 2 |
|||
| Cell 2, row 2 |
|||
|} |
|||
generates |
|||
{| |
|||
| Cell 1, row 1 |
|||
| Cell 2, row 1 |
|||
|- |
|||
| Cell 1, row 2 |
|||
| Cell 2, row 2 |
|||
|} |
|||
=== Advanced example === |
|||
{| 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 |
|||
|} |
|||
Note the floating table to the right. |
|||
{| 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 |
|||
|} |
|||
=== Nested table === |
|||
{| border=1 |
|||
| blabla |
|||
| |
|||
{| bgcolor=#ABCDEF border=2 |
|||
|nested |
|||
|- |
|||
|table |
|||
|} |
|||
|the original table again |
|||
|} |
|||
gives a nested table |
|||
{| border=1 |
|||
| blabla |
|||
| |
|||
{| bgcolor=#ABCDEF border=2 |
|||
|nested |
|||
|- |
|||
|table |
|||
|} |
|||
|the original table again |
|||
|} |
|||
=== Caption and multi-cell-lines === |
|||
{| border=1 align=right |
|||
|+ '''This is the caption.''' Example taken from Afghanistan table. |
|||
|[[Independence]]||[[August 19]], [[1919]] |
|||
|- |
|||
|[[Currency]]||[[Afghani]] |
|||
|- |
|||
|[[Time zone]]||[[UTC]]+4:30 |
|||
|- |
|||
|[[National anthem]]||[[Sououd-e-Melli]] |
|||
|- |
|||
|[[Top-level domain|Internet TLD]]||.AF |
|||
|} |
|||
<nowiki>{| border=1 align=right</nowiki> |
|||
<nowiki>|+ '''This is the caption.''' Example taken from Afghanistan table.</nowiki> |
|||
<nowiki>|[[Independence]]||[[August 19]], [[1919]]</nowiki> |
|||
<nowiki>|-</nowiki> |
|||
<nowiki>|[[Currency]]||[[Afghani]]</nowiki> |
|||
<nowiki>|-</nowiki> |
|||
<nowiki>|[[Time zone]]||[[UTC]]+4:30</nowiki> |
|||
<nowiki>|-</nowiki> |
|||
<nowiki>|[[National anthem]]||[[Sououd-e-Melli]]</nowiki> |
|||
<nowiki>|-</nowiki> |
|||
<nowiki>|[[Top-level domain|Internet TLD]]||.AF</nowiki> |
|||
<nowiki>|}</nowiki> |
|||
is shown on the right. |
|||
=== Header test === |
|||
{| border=1 |
|||
! Header1!! Header2 |
|||
|- |
|||
| Cell1|| Cell2 |
|||
|} |
|||
made by |
|||
{| border=1 |
|||
! Header1!! Header2 |
|||
|- |
|||
| Cell1|| Cell2 |
|||
|} |
|||
== TR test == |
|||
{| |
|||
| cell1 || cell2 |
|||
|- bgcolor=#abcdef |
|||
| cell3 || cell4 |
|||
|} |
|||
makes |
|||
{| |
|||
| cell1 || cell2 |
|||
|- bgcolor=#abcdef |
|||
| cell3 || cell4 |
|||
|} |
|||
=== Test for rows with mixed headers and body text === |
|||
{| border=1 cellspacing=0 |
|||
! |
|||
! col Header1 |
|||
! ch2 |
|||
|- |
|||
! row header 3 |
|||
| abc def ghi |
|||
| gchf ghh dfgh |
|||
|- |
|||
! RH 4 |
|||
| gfbb gbgbds |
|||
| dfgsdsdg |
|||
|} |
|||
'''makes:''' |
|||
{| border=1 cellspacing=0 |
|||
! |
|||
! col Header1 |
|||
! ch2 |
|||
|- |
|||
! row header 3 |
|||
| abc def ghi |
|||
| gchf ghh dfgh |
|||
|- |
|||
! RH 4 |
|||
| gfbb gbgbds |
|||
| dfgsdsdg |
|||
|} |
|||
'''but:''' |
|||
{| border=1 cellspacing=0 |
|||
! !! col Header1 !! ch2 |
|||
|- |
|||
! row header 3 || abc def ghi || gchf ghh dfgh |
|||
|- |
|||
! RH 4 || gfbb gbgbds || dfgsdsdg |
|||
|} |
|||
'''makes:''' |
|||
{| border=1 cellspacing=0 |
|||
! !! col Header1 !! ch2 |
|||
|- |
|||
! row header 3 || abc def ghi || gchf ghh dfgh |
|||
|- |
|||
! RH 4 || gfbb gbgbds || dfgsdsdg |
|||
|} |
Latest revision as of 05:19, 20 February 2023
This page has been moved to Help:Table on mediawiki.org.
Any modifications or additions to this page should be made on mediawiki.org instead. |