Simple Table markup for Wikka
Note
This feature is under development and can be tested using the SVN trunk version. Note that the syntax for tables is likely to change until a stable version is released. Please do not invest much time in creating (advanced) tablemarkup yet!Documentation
SVN
- To be included in 1.1.7.
- For the latest version, download the latest Wikka unstable version.
- For more information, see Ticket:230.
See also
I've hacked together a simple table markup for WikkaWiki; it is working it's way from a "layout" table markup to an accessible data table markup.
Currently it supports table header elements (<th>) and table data elements (<td>), cells spanning several columns and/or rows, table summary and caption, scope attributes for headers, table sections (<thead>, <tbody>, <tfoot>).
Basic Usage
Example:
||Row 1 Column 1||Row 1 Column 2||Row 1 Column 3||
||Row 2 Column 1||Row 2 Column 2||Row 2 Column 3||
The delimiter is two pipes (||).
- Use the delimiter to start a new table, row and/or cell.
- The current row is ended with a delimiter at the end of a line.
- The table is ended by starting the next line with anything else than a new delimiter after ending a row.
"Advanced" Usage
Example:
|?This is a token summary, must be first line in table markup. PS is between single pipes!|
|!|The Caption||
|#h|
|=|First Column|=|Second Column||
|#b|
||First datacell||Second Datacell||
|2|A datacell spanning two columns||
|,2|A datacell spanning two rows||A cell on the right||
||Another cell on the right (due to previous rowspan'd cell)||
|#f|
|=|First Column|=|Second Column||
Enhanced features are enabled by putting modifiers between the pipes.
- A header cell is started with a equals sign (|=|).
- A cell span is started with numbers seperated by a comma. (|2| = colspan="2", |2,2| = col+rowspan ="2" each, |,2| = rowspan="2" only).
- An optional caption for the table can be put behind a exclamation mark'ed delimiter (|!|) and a normal delimiter. Needs to be alone on the line!
- A summary (for accessability) can be given in a delimiter started by a question mark (|?Summary|). Needs to be alone on the line, and first in the markup!
- Optional row and col scope attributes for headers can be added as |=r| and |=c|.
- Optional thead, tbody and tfoot sections are generated by adding on a separate line |#h|, |#b|, |#f|
- Each row must (still) be ended by a basic (or any, actually) delimiter.
Known Issues
Ending the table with a || delimiter without a newline adds another cell/column. (ie: if there is no more content after the table, or if there is a space after the delimiter).
Wanted
I want input on bugs/issues - and on wanted functionality / suggestion on the markup.
TODO
- better delimiters? Please advice.
- header cells Done.
- col/rowspan Done.
- caption Done.
- summary Done.
- th scope attribute Done.
- thead/tbody/tfoot Done.
CategoryUserContributions
Cheers
Thanks!
Additionally - I suspect the planned changes to the formatter/formatters will destroy this "hack". I'll have a better look at it ... soon... ;)
DarTar: I'll probably manage to churn out a modification to SimpleTables that support table headers and col-/rowspaces within the next week (or two) - without changing the use of the basic table markup provided now.
The other issue with he 'patch' utility is that the file being modified has to be reasonably close to the one you make the 'diff' file from .... In the case of this application, time has gone on since the last release ... you modified your files, Joe modified his differently, I went in a whole 'nother direction ... increasing the 'fuzzify' value only gets one so far at times ...
|=| => <th>
|=c| => <th scope="col">
|=r| => <th scope="row">
How does that sound? Adding support for thead/tbody/tfoot keeping an intuitive markup seems more complicated...
OTOH thead/tfoot/tbody should be easy(er) to program, given practical delimiters.
I suggest (to start) that a tag on a line of it's own starts a new row group(?):
|#h| => <thead>
|#f| => <tfoot>
|#b| => <tbody>
|!|The Caption||
|#h|
|=|Name|=|Title||
|#f|
|=|Name|=|Title||
|#b|
||Jane Doe||Director of Missing Persons||
||John Doe||Secretary of Missing Persons||
I like the proposed markup!
I still wonder if it would be possible for a simple table to automatically generate <thead>+<tbody> (forget about tfoot in that case), provided the table starts with a row (or rows) of only header cells; or generate a <tbody> only if there aren't any header rows (there could be a column, of course) - this if the specific markup hasn't been provided by the user, of course.
colgroup and col woudl be nice - any suggestions for markup?
I really like the way this is heading, with a clean, extensible marlkup to create accessible data tables! Great work, Tormod!
th - td - td - td
th - td - td - td
with no look-ahead the best guess here is to make the first row a thead.
As for the abbr attribute, maybe we could use round brackets?
|=c(Bananas)|Yellow oblong fruits||=c(Apples)|Round green fruits||
If in the case of 'th - td - td - td' you cannot detect that it's not a whole row of th cells, then indeed you cannot automatically generate a <thead>.
Let's stick with the markup solution for now - that should at least be possible.
(As long as we have a good markup, a late formatter might be able to generate more automatically - but that would depend on a comlpete overhaul of the formatter.)
- header cells should be able to get an id (actually this true for each table markup element)
- data cells should also be able to get a headers attribute (to refer to a list of header cell ids)
- there's also the axis attribute (categorization); applies to both header and data cells
Markup ideas anyone?
How to combine in a sensible way the |=|, |=r|, |=c| markup for headers with the |n|, |,n| markup for spans?
Maybe just:
|=2| //header spanning two columns with no scope
|=,2| //header spanning two rows with no scope
|=c2| //header spanning two columns with 'col' scope
|=r,3| //header spanning two rows with 'row' scope
is that intuitive/robust enough? Looking at these examples, I'm wondering whether the "," is a good option for distinguishing span values.
|=R|
|=C|
or maybe:
|=rg|
|=cg|
A simple solution would be to use round brackets, following the convention used for codeblocks:
%%(php;15;filename) %%
If the order is not enough to determine what parameter a value refers to, then maybe we should add explicit "parameter: value" statements:
|=r(id: main;abbr: Head)|This is a header||(headers: main;id: mycell) Here goes some cell content||
But I wonder how many users (who know XHTML) will use this markup instead of ""embedding a table as HTML"". See also the relevant discussion at: http://wikkawiki.org/WikkaExtensibleMarkup
For grouping, we could stick to the |#x| convention (already in use to groupe rows), and have:
|#h| => thead
|#b| => tbody
|#f| => tfoot
|#c| => col
|#g| => colgroup
For further accessibility attributes, instead of using the full attribute name (as suggested in my previous comment), we could use only a single letter to identify the attribute, for instance:
a => abbreviation
i => id
h => headers
etc.
Some examples:
|(i:d35)|data|| => data cell with id "d35"
|=(i:fruit)|header|| => header cell with id "d35"
|=(a:Apples)|Round Green Fruits|| => header with abbreviation
|(h:fruit, quantity)|data|| => data cell referring to headers with id "fruit" and "quantity".
|=(i:fruit;a:Apples)|Round Green Fruits|| => header with abbreviation "Apples" and id "fruit"
To keep things even more consistent, we might even move the scope and span attributes *inside* the brackets.
|=(c)|header|| => header with col scope
|=(r)|header|| => header with row scope
|=(rg)|header|| => header with rowgroup scope
|=(cg)|header|| => header with colgroup scope
|=(c)|header|| => header with col scope
|=(cg2)|header|| =>header spanning two columns with 'colgroup' scope
|=(rg,2)|header|| => header spanning two rows with 'row' scope
To conclude, a final nice example:
|=(rg,2;a:Apples;i:id)|Round Green Fruits||
which should be, by now, self-explanatory :D
Tormod, nightmares?
Long time since anyone wrote anything here so... I really need this table markup now! :)
So, what's the status? Is it mature enough to use or are there any bugs? If so, is someone working on them?
I am currently using v1.1.6.2, can I take this table formatter code and implement it in that version now?
Thanks!
Andreas