[Pmwiki-users] Some thoughts on delete and tables

Patrick R. Michaud pmichaud at pobox.com
Tue Apr 29 14:50:41 CDT 2003

On Tue, 29 Apr 2003, Janice Heinold wrote:

> There is an alternative table syntax using double brackets. I'm not sure if
> it's documented (yet), but it gives you more control.

It's not documented yet-- I had originally intended for it to be
documented in the AdvancedTables page, but that page is getting a bit
long.  Here's a start of a description (and anyone who wants to fix up the
tables documentation on pmichaud.com -- please feel free to do so).

There are four tags for large-scale table processing.  All must be
at the beginning of a line to have any effect.

[[table (attr...)]] 
    ends any previous table (equivalent to [[tableend]]),
    and generates a new HTML <table> tag with the attributes given by attr.
[[cell (attr...)]]
    closes the previous table cell, if any, and generates a new cell
    with the attributes given by attr.  In HTML, this creates a new
    "<td attr>" tag (and possibly <table>, <tr>, and </td> tags if they 
    are needed to produce a valid HTML table).
[[cellnr (attr..)]]
    closes the previous table cell, if any, and generates a new cell
    at the beginning of the next row.  In HTML, this creates a 
    "<tr><td attr>" tag, and possibly <table>, </td>, and </tr> tags if 
    they are needed for valid HTML.
    closes the previous table cell and closes off any table.  Generates
    </td>, </tr>, and </table> tags as needed.

For the table, cell, and cellnr tags the author can specify any attributes
that would be valid in the HTML <table> or <td> tags.  Thus you can specify
rowspan, colspan, etc. arguments to build arbitrary tables.  However, 
it's not possible to nest a [[table]] inside of a [[cell]] or [[cellnr]] --
the next paragraph explains why.

Many are likely to ask why I didn't just use the standard HTML
table markup (<table>, <tr>, <td>, <th>) instead of creating my own,
and allowing nested tables as a result.  There are two answers:  first,
the HTML table markup is very ugly for naive authors (see PmWiki.Audiences 
and PmWiki.PmWikiPhilosophy #2), and second, it'd be very easy for authors
to create tables that are incorrect HTML and that display incorrectly
(or  not at all) on some browsers.  Even seasoned web professionals sometimes
get the table markup wrong, so it's a bit unrealistic to expect the
average author to always get it right, or to be able to read arbitrary
HTML table markup that someone else has created.

I didn't want to write the code needed to make PmWiki understand and
fix arbitrary table markup, so I created the simplified version above.  
Still, this version is able to handle most table requirements (with the 
possible exception of nested tables).

And, this is not to say that nested HTML tables are impossible in PmWiki
--they just can't be easily created by wiki authors using the default wiki 
markup.  A site administrator can of course create header/footer HTML code 
that makes use of nested tables.

So, that's the summary of [[table]], [[cell]], etc.


More information about the pmwiki-users mailing list