User:Zocky/Table syntax

A simple syntax for simple tables

Here goes:

1) If a line starts and ends with a pipe, it's a table row. Cells are separated by pipes

 |a1|b1|c1|
 |a2|b2|c2|

displays

a1

b1

c1

a2

b2

c2

2) empty lines separate tables

 |a1|b1|c1|

 |a2|b2|c2|

displays

a1

b1

c1

a2

b2

c2


3) If a cell ends with more than one pipe, it's a column span:

 |a1||c1|
 |a2|b2|c2|
 |a3|b3||
 |a4| |c4|

displays

a1

c1

a2

b2

c2

a3

b3

a4

 

c4


4) If a line starts with more than one pipe, it's continuing rowspans from above:

 |a1|b1|c1|
 |||c2|
 ||b3|c3|
 |||c4|

displays

a1

b1

c1

c2

b3

c3

c4

5) treat

 |a1
 ||b1
 |||c1|d1|e1|

same as

|a1|b1|c1|d1|e1|


This means that

 |mammalia
 ||carnivora
 |||canis
 ||||dog|house|woofs|
 ||||wolf|woods|yelps|
 |||felis
 ||||cat|house|meows|
 ||||lynx|woods|hisses|
 ||rodenta
 |||ratus
 ||||brown rat|sewer|squeaks|
 ||||black rat|middle ages|plagues|

produces

mammalia carnivora canis dog house woofs
wolf woods yelps
felis cat house meows
lynx woods hisses
rodenta ratus brown rat sewer squeaks
black rat middle ages plagues

5) Headings are allowed, and are treated as header cells:

 |==Nowheria==||
 |===Capital===|Backendsville|
 |===Surface area===|small|
 |===People===|many|

displays

Nowheria

Capital

Backendsville

Surface area

Small

People

Many

Caveat

  • Only one paragraph per cell.
  • Row spans can be specified only for leftmost cells in the table

I don't think either is very important - most tables don't need multiple paragraphs per cell and row spans are much more useful on the left side than anywhere else. If any of it is needed, there's < table > to fall back on.


Things to consider:

  • Use spacing to specify alignment.
 |left | center | right|
  • Caption row, including alignment for the table.
maybe make it should look like section titles?
  |=caption=|
  |a1|b1|c1|
  |a2|b2|c2|

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.