Extended Table Action Documentation
This is the documentation page for a proposed extended table action. The code is available on the TableAction page. The development of this action has been discontinued since the implementation of a new table markup in the main development line.
Documentation
Short description
Turns a simple list of cell contents into a (data) table.Parameters
name | type | required? | default | description |
---|---|---|---|---|
delimiter | char | optional | semicolon (;) | delimiter that will be used to separate cells; must be a single character. |
delim | char | optional | ; | synonym of delimiter |
caption | string | optional | none | table caption |
columns | integer | optional | 1 | number of columns the table is to have. |
cols | integer | optional | 1 | synonym of columns |
border | integer | optional | 1 | borderwidth of table. |
cellpadding | integer | optional | 3 | padding within cells in pixels. |
cellspacing | integer | optional | 1 | space between cells in pixels. |
style | string | optional | none | in-line style for the table. |
class | string | optional | none | alternative for style: use the class to style with the stylesheet. |
summary | string | optional | none | summary of what the table contains. |
cells | string | required | content of the table with cells separated by the (defined) delimiter. |
Long description
Wikka markup within cells is interpreted but HTML markup for cell contents is not possible.There is only one required paramater: cells; if this is missing an error message will be displayed, along with the original action markup.
It is possible to define cell contents across multiple lines; surrounding whitespace is trimmed before generating output, embedded whitespace (including newlines) is retained.
Cell contents must be separated by a delimiter character; by default this is a semicolon, but if this would conflict with cell contents, a delimiter can be defined with the delimiter (or delim) parameter. Superfluous delimiters at the start and end of the cells parameter are discarded, so it's possible to write each cell row on a separate line, and end each cell with the delimiter: this makes it relatively easy to maintain table contents.
A caption can be defined, as well as a summary.
There is limited support for table headers (th cells): if cell content is embedded in sets of 2 to 5 '=' characters (as in heading markup) these will be discarded and a header cell (th) will be generated instead of a data cell (td). Row groups (thead, tfoot, tbody) are NOT supported.
The result is valid (data) table markup although accessibility will be limited.
Author
JavaWomanExamples
- Simple table with "forced" empty cell (###):
{{table columns="3" cells="a;b;c;1;###;3"}}
- Using delimiter '+' instead of ';' because a cell contains a semicolon; and Wikka heading markup being turned into table header cells:
{{table columns="3" cellpadding="1" delim="+" cells="==a==+b+c+==1==+2;3;4;5+6"}}
- Header cells created with Wikka heading markup, and Wikka markup (italic, bold and centered) within table cells:
{{table columns="3" cellpadding="2" cells="==a==;==b==;==c==;//1//;**2**;@@3@@"}}
- Error message created when required parameter cells is missing:
{{table cols="5" caption="invalid table action"}}
- Action across multiple lines, with also newlines separating table rows within the cells parameter; surrounding (extra) delimiters are automatically discarded so each table row, including the last, can be terminated with the (defined) delimiter. Note that the last table row starts with two (implicit) empty cells while the content for the last cell contains a new line (rendered as intended):
{{table cols="3" cellpadding="10" delimiter="\"
cells="\\\\==a==\==b==\==c==\
//1//\**2**\@@3@@\
\\//last
cell//\\"
}}
CategoryDevelopment
Did you maybe copy from the source of this page? The examples are setup to be shown in the rendered page, so they contain <br /> to force line breaks; if you copy from the rendered page you will get the newlines (as intended) without the <br /> (which should not be there).
If that doesn't solve it, can you explain exactly where/when that error message appears?
{{table cols="3" cellpadding="10" delimiter="\"
cells="\\\\==a==\==b==\==c==\
//1//\**2**\@@3@@\
\\//last cell//\\"
}}
So, no, no html/forced line breaks in there, and this is what I get:
"Unknown action; the action name must not contain special characters." I'm running on 1.1.6.0, so that's not the pbl. :(
Goto http://wikka.jsnx.com/TableAction to patch for the multiline action/parameter first!
Otherwise, the parser can't handle multiline action like the latest example. : )
Thanks for catching that - I just realized this page didn't make it clear it's documenting a *proposed* extended table action. I've corrected that now.
If the parameter is not set or is set to zero the table will be displayed as usual, if it's set to 1 the first row will be rendered as a table header (th).
You can see it in action at wiki.smallpiece.info/SandBox
Looks promising. Maybe you want to share the code here on this wiki, so that other interested users can use it, too?
I set up a page on my wiki with the mod.
wiki.smallpiece.info/WikkaTable
Look at inline commenst. I'm planning to add some explanation but now I'm really too busy. :-)
I looked at your page and it's a really good idea. (Even though the "improved" Table action is just a kluge to tide us over until we have an actual "table markup).
One problem though: the page is decared to be covered by the Creative Commons license; unfortunately that is incompatible with the GPL license that Wikka is released under.
So we could just "ignore" your code (and maybe make our own change) - or you could maybe change your page and release your modification under GPL (or LGPL)... or - as was suggested - you could post your mod (code and explanation) on this site and allow it to be included (literally or with modifications).
Should I insert my code in the table action development page?