Jump to content

Wiki table markup discussion history: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
m class
Redirected page to Help:Table
Tag: New redirect
 
(69 intermediate revisions by 48 users not shown)
Line 1: Line 1:
#REDIRECT [[Help:Table]]
Wiki markup for tables. Holy grail of wiki...

Table markup needs to be
* easy to read in raw form (current HTML is terrible here)
* flexible to provide borders, colours etc (although maybe pages like the Elements are using those simply because it's possible -- would we miss whistles and bells?)

== Half-HTML proposal ==
lacking a better name... (by [[User:Magnus Manske|Magnus Manske]])

:{| initiates a table, |} ends it
:{|F starts a table, with formatting "F"
:| starts a table cell with no extra formatting
:|F| starts a table cell with formatting "F"
:|- starts a new row

=== Simple example ===
:{|
:| Cell 1, row 1
:| Cell 2, row 1
:|-
:| Cell 1, row 2
:| Cell 2, row 2
:|}

=== Mor comlex example ===
:{| align=right width=100
:| Cell 1, row 1
:|colspan=2| Cell 2, row 1 (and 2)
:| Cell 3, row 1
:|-
:| Cell 1, row 2
:|
:| Cell 3, row 2
:|}

=== Advantages ===
* Full HTML capabilities, if needed
* Simple syntax for simple tables
* Allows for nested tables
* Could use pre-defined table types via "class=xxx"

== List-style proposal ==
Example:
<pre>
[[Table:president]]
||
| Name
| Bill Clinton
||
| Musical instrument
| saxophone
||
</pre>

The table is made up of two parts:
* Firstly, a header block. Syntax and tokens to be determined: the use of <nowiki>[[</nowiki> above is just an example. The header block defines the ''style'' of the table. This may be complex and hard to read, and could be one of:
** CSS
** something CSS-ish and Wiki-ish
** keywords which identify build-in styles
* Secondly, the actual data. Note that "table headers" in the sense of "special rows or columns which define the meaning of the data" are just specially-formatted rows or columns. It's up to the header block to define some sort of highlighting.

Instead of one raw line per table line, chop the table up with one line per cell. This could be an optional feature.

<pre>
||
| row one, cell 1
| row one, cell 2
||
| row two, cell 1
| row two, cell 2
||
</pre>

Basically, "|" marks the start of a cell. "||" marks the start of a row. Presumably, one could indicate a skipped cell with

<pre>
| full cell
|
| we've skipped one
</pre>

Now the twist: '''this can work in either direction''', eg:

<pre>
||
| column one, cell 1
| column one, cell 2
||
| column two, cell 1
| column two, cell 2
||
</pre>

For some tables, this might be a clearer way of reading raw format.

The header block would need to define:
* whether row or column direction
* internal borders
* main border
* colours

This could be some form of CSS or hideous markup codes, or it could point to styles elsewhere. The examples below are inspired by the [[math: syntax, but it's just off the top of my head.

The point is that no matter how ugly the table head block is, it's ONE line of yuck that can be skipped over by someone who is interested in the '''data''' of the table.

<pre>
[[table: column; border:black]]
||
| first cell
...etc
</pre>

Preset styles might be easier. These could themselves define row / column behaviour. For example, for the information on element pages, phoneme pages and US president pages. Something like the Periodic Table might have to remain in HTML -- but it doesn't need to be updated often. An advantage of using presets would be instant uniformity across similar pages.

<pre>
[[table:element]]
[[table:phoneme]]
[[table:president]]
and some general styles:
[[table:row_border]]
[[table:column_border]]
[[table:row_lines]]
[[table:column_lines]]
[[table:row_grid]]
[[table:column_grid]]
</pre>




-- [[user:Tarquin|Tarquin]]


== Extended PikiePikie syntax ==

This syntax is designed to allow nested tables, and a limited set of table attributes. The most important differences with the PikiePikie syntax are:
# [| and |] start and end a table rule, not a table
# | is used to separate columns
# after [| and | you can have attributes such "al=r" (align = "right").

Simple examples:

[| a simple table | with two columns |]

[{ first header | second header }]
[| a table | with 2 columns |]
[| and 2 | rows |]
[! and a caption !]

[| a table with a single line and |]
[|
[| a nested table | with two columns |]
[| and two | rows |]
|]

A more elaborate example (The Owl table):
<nowiki>
{{bd=1,cs=0,al=r,cp=2}}
[|{{al=c,bc=pink}} ''Owls''' |]
[| [[image:Northern_Spotted_Owl.USFWS-thumb.jpg]] |]
[|{{al=c}} Northern spotted owl |]
[|{{al=c,bc=pink}} '''[[Scientific classification]]''' |]
[|{{al=c}}
[| [[Kingdom (biology)|Kingdom]]: | [[Animalia]] |]
[| [[Phylum]]: | [[Chordata]] |]
[| [[Class (biology)|Class]]: | [[Aves]] |]
[| [[Order (biology)|Order]]: | '''Strigiformes''' |]
|]
[|{{al=c,bc=pink}} '''[[family (biology)|Families]]''' |]
[|
[| [[Barn owl|Tytonidae]] - Barn owls |]
[| [[Typical owl|Strigidae]] - Typical owls |]
|]
</nowiki>


=== Basic principles===

* [| ... | ... | ... |] indicates a table row
* [{ ... | ... | ... }] indicates a table header
* [! ...... !] indicates a table caption
* {{%arg%}} after | defines attributes for following cell
* {{%arg%}} after [ defines attributes of table rule
* {{%arg%}} after other than | or [ defines attributes for the following table
* consecutive rows belong always to the same table, table ends when there is no immediate next row

=== Allowed Arguments ===

* table:
** al=align, bc=background-color, bd=border, wd=width,
** cp=cellpadding, cs=cellspacing
* table rule:
** al=align, bc=background-color, va=valign
* table cell:
** al=align, bc=background-color, cs=col-span, rs=rowspan,
** va=valign, wd=width

=== FAQ ===

==== Comparison to the first proposal ====

The syntax can be used similar to Tarquin's proposal. You would get something like the following:

[|
| row one, cell 1
| row one, cell 2
|]
[|
| row two, cell 1
| row two, cell 2
|]

==== Why only these arguments? ====

These are the ones that were used in the complex tables I saw. Other might be added though, although we should limit it to only those with simple arguments to avoid parsing problems.

-- Jan Hidders


----------------------------

Some existing schemes below.

== MoinMoin Syntax ==
Seen on Meatball's patch of UseModWiki too

<pre>
|| Heading 1 \
|| Heading 2 \
|| Heading 3 \
||
|| I went to the barber today and he gave me a shave and a haircut. \
|| 7 \
|| No bullet lists, though. :( \
||
|| New row \
|||| LinkPattern in a cell that spans two columns. \
||
</pre>

== Wookee syntax ==
Seen on the Unreal Wiki

simple table:
<pre>
| bAlwaysRelevant | Notoriously overconfident.
| bHidden | Lacks self assurance.</pre>


complex table:
<pre>
|||^ <wiki>=== A complex table ===</wiki> |
|^ '''First''' |^ '''Second''' |^ '''Third''' |
| upper left | upper middle | right side |
|> right aligned |^ centered |< left aligned |
|||^ bottom row spans three columns |
</pre>

On wikitech-l-mailinglist, Jocelyn Giraud also mentioned
http://phpwiki.sf.net/phpwiki, which seems to have this
''Wookee syntax'' implemented. Also a disadvantage is
mentioned: phpwiki's table don't have is "align='right'"
on the whole table.


== PikiePikie syntax ==

[2|| This is a table with a single cell on the first line ||
|| two cells || on this line ||
|| two cells on || this line too ||
|||> and one centred cell on this line |]

This would become:

<table border="2" cellspacing="0" cellpadding="3"><tr><td colspan="2">This is a table with a single cell on the first line</td></tr><tr><td>two cells</td><td>on this line</td></tr><tr><td>two cells on</td><td>this line too</td></tr><tr><td colspan="2" align="center">and one centred cell on this line</td></tr></table>

For more examples see: http://pikie.darktech.org/cgi/pikie?TableSyntax


=== Basic principles ===
* [| starts a table and |] ends it
* || indicates new column
* ||\n|| indicates new table rule

=== Advantages ===
* Allows nested tables and cells with more than 1 line but keeps visual format for simple tables

Latest revision as of 02:17, 31 May 2023

Redirect to: