As of 1.2, Wikka introduces a flexible markup for data tables. Any kind of tables allowed by XHTML can be created using this markup, from the most basic examples (e.g. simple rows of cells) to complex tables with full support for accessibility options.

The most basic element of a table is a cell. Single cells can be created using the standard delimiter ||, e.g.:

||Hello||

Hello

Note that a cell must always be open and closed by delimiters.

Rows can be created by adding on the same line multiple cells:

||Cell 1||Cell 2||Cell 3||

Cell 1

Cell 2

Cell 3

Columns can be created by adding rows on separate lines:

||Cell 1||||Cell 2||||Cell 3||

Cell 1

Cell 2

Cell 3

By now you should be able to create simple tables with multiple rows and columns.

As soon as you create slightly more complex data tables, you will need to specify column and row headings. Headings are special cells that specify what kind of data rows and columns contain. The most basic way of creating a heading is by using |=| as a delimiter.

The following is an example of a simple table with column headings:

|=|Apples|=|Pears|=|||300Kg||480Kg||

Apples

Pears

300Kg

480Kg

Row headings are created in the same way. Since they are usually followed by normal cells, they must be terminated with the || standard delimiter if the next element in the row is a simple cell:

|=|Apples||300Kg|||=|Pears||480Kg||

Apples

300Kg

Pears

480Kg

You should be able by now to create simple tables with row and column headings:

We will describe later how to add accessibility parameters for row and column headings.

Usually tables are introduced with a caption that describes what the table contains. A caption element is introduced with a |?| delimiter and terminated with a standard delimiter ||.

|?|Fruit production in 2006|||=| |=|Apples|=|Pears|=||=|Mary||300Kg||320Kg|||=|John||400Kg||630Kg||

Fruit production in 2006

Apples

Pears

Mary

300Kg

320Kg

John

400Kg

630Kg

Spans are used to combine multiple cells or multiple headings
vertically or horizontally and are created using the followingattribute parameters:

||(span options)Element content||

A cell spanning multiple columns is generated by prefixing the cell content with a (x:n) parameter, where n is the number of columns to be spanned. The following example shows how to create a cell spanning two columns:

Spans can also be applied to rows. A cell spanning multiple rows is generated by prefixing the cell content with a (y:n) parameter, where n is the number of rows to be spanned. The following example shows how to create a cell spanning two rows:

|?|Embedding HTML within tables||||Here's some superscript: ""a<sup>2+1</sup>""||||And here's some subscript too: ""a<sub>2k</sub>""||||I love acronyms: ""<acronym title="What You See Is What You Get">WYSIWYG</acronym>""||

Embedding HTML within tables

Here's some superscript: a2+1

And here's some subscript too: a2k

I love acronyms: WYSIWYG

The table markup introduces a new style selector. CSS style options can be added to any element by enclosing them within single braces, right before the element content, e.g.:||{style options}Element content||

For example, to render a cell with red background and white text color, you can do the following:

Table-level attributes can be specified by adding at the beginning of the table the following element: |!| ||, which is used as a container for global table attributes. For example, you can specify global style options for a table by adding them to this element:

id attributes are used to refer to unique elements in a page and to provide an anchor for styling and linking. You can specify an id for any table element by using the (i:id) parameter.

For example, the following markup creates a table with the id "main_table" containing two cells with id's "cell_1" and "cell_2"

|!|(i:main_table)|||?|Using id to refer to table elements||||(i:cell_1)This cell can be referred to by using the ##cell_1## id||||(i:cell_2)This cell can be referred to by using the ##cell_2## id||

Using id to refer to table elements

This cell can be referred to by using the cell_1 id

This cell can be referred to by using the cell_2 id

Any table element can be given a title attribute to enhance its accessibility. Titles are typically displayed in graphical browsers by hovering over the corresponding element and are useful to display unobtrusive descriptions about specific elements. You can specify a title for any table element by using the (t:title) parameter.

The following example adds titles to several table elements (you can hover over the table to display them):

|!|(t:Comparative figures for fruit production in the last year){width: 350px}|||?|Fruit production in 2006|||=| |=|(t:yearly production of apples)Apples|=|(t:yearly production of pears)Pears|=||=|(t:Mary's contribution to 2006 production)Mary||(t:Mary's production of apples in 2006){text-align:center}300Kg||(t:Mary's production of pears in 2006){text-align:center}320Kg|||=|(t:John's contribution to 2006 production)John||(t:John's production of apples in 2006){text-align:center}400Kg||(t:John's production of pears in 2006){text-align:center}630Kg||

Fruit production in 2006

Apples

Pears

Mary

300Kg

320Kg

John

400Kg

630Kg

Tables can take an optional summary attribute to describe the purpose and/or structure of the table. The description provided by the summary attribute is particularly helpful to users of non-visual browsers. You can specify a summary by adding a (u:Summary) parameter in the table global attributes.

For example, the following line:|!|(u:This is a summary)||
will add to the table a summary attribute with the value This is a summary.

Rows in a table can be grouped in a table head, table body and table foot. This division enables browsers to support scrolling of table bodies independently of the table head and foot. When long tables are printed, the table head and foot information may be repeated on each page that contains table data. The table head and table foot should contain information about the table's columns. The table body should contain rows of table data.

Wikka allows you to create groups of rows with special markers:

The |[| marker groups the rows it precedes as a table head block;

The |]| marker groups the rows it precedes as a table foot block;

The |#| marker groups the rows it precedes as a table body;

The following example shows how to use these elements to create row groups. Note that Wikka uses different backgrounds to differentiate column headings in the table head and foot from row headings in the table body:

To be semantically correct and accessible to users with non-visual browsers, headings should contain scope attributes describing the cell range they refer to.

Column heading scopes can be specified using the (o:col) parameter in the corresponding column heading;

Row heading scopes can be specified using the (o:row) parameter in the corresponding row heading;

The following example shows how to correctly add column and row scopes to a table to make it accessible:

|!|(u:The number of employees and the foundation year of some imaginary companies.)|||?|Table 1: Company data|||[||||=|(o:col)Employees|=|(o:col)Founded|||#||=|(o:row)ACME Inc||1000||1947|||=|(o:row)XYZ Corp||2000||1973||