Summary: Table directives have no equiv of < TH > tag
Created: 2005-09-20 08:16
Status: Closed - added for 2.2.11
Category: Feature
From: Collin
Priority: 55555444335
Version: 2.x
OS: Linux, apache 1.3.33, php 5.0.3

Description: While working with tables, I needed to be able to use multi-line preformatted text in a cell (to represent mathematical operations).

I switched to table directives markup, and have found that there does not seem to be a way to make a "table header" (ie in ordinary tables you'd do ||!Heading, but in table directives there's nothing, and ! does not work either)

And for that matter, I guess captions don't exist either.

I have 3 recipes that will provide solutions to this:

Currently ordinary tables have 3 capabilities that table directives do not have."<header>", "<caption>" and automatic zebra coloring of rows and columns.

PM said that table directive markup is an "aid to creating layouts". Table directives are for making tables. If it were meant to be only used as an "aid to creating layouts" then you should rename it to "(:layout" and eliminate table directives altogether. You do not want to include every feature of HTML, but headers are a feature of tables, not HTML.

GNUZoo August 20, 2006, at 01:54 AM CST

Technically this isn't a "bug"; table directive markup isn't really designed for building tables with headers and captions, it's more of an aid to creating layouts.

However, one can simulate the effect of a table heading cell with something like

    (:cell style='text-align:center; font-weight:bold;':)

We can also see about coming up with a markup for "table header" cells that generate <th> instead of <td> in the output; suggestions for a markup to do that are welcomed.


No, technically not a bug :). I guess 'emulating' a header is possible. Unfortunately it seems my css would over ride background colours though, as I use a background colour for table headers and I believe I have stipulated white for normal cell backgrounds. Of course this means no one can use any colour backgrounds in tables, an oversite I was considering rectifying.

Also, you mention that table directive markup is more for layout. I can't see that this is an argument for NOT having header and caption functionality in it. For the very reason that I chose to use table directives markup for my table: Ordinary table markup cannot handle newlines within a cell, while table directive markup can.

So my reasoning for including specific header cell markup would therefore be:

  1. Someone may want to force some strict css usage, and therefore it may not be possible to emulate headers.
  2. Table directive markup is preferable over ordinary table markup in the event of cells with newlines within (unless you want to modify ordinary table markup to work over multiple lines? ;). Table directives can be used as tables, not just page layout guides.

My suggestion is to use (:cellhead:) and (:cellheadnr:) to make the cell headers in the same manner as (:cell:) and (:cellnr:).

As for captions.. (:cellcap:) or (:tablecap:)?


I prefer the (:cellnr:) behavior, so I do not agree with (:row:). I do like the idea of (:headernr:), (:header:), and (:caption:)

-- BenWilson March 09, 2006, at 11:04 AM

I would like to see (:cellnr header:) and (:cell header:) as being the equivalent markup of ||!text....

--Peter Bowers March 09, 2008, at 08:21 AM

I started working on this and added some changes to SVN -- you can test the feature here and report about any problems, especially invalid HTML. --Petko February 07, 2010, at 01:26 PM