[pmwiki-users] thead tbody

John Rankin john.rankin at affinity.co.nz
Mon May 5 17:14:55 CDT 2008


>Date: Fri, 2 May 2008 11:29:30 -0500
>From: "Patrick R. Michaud" <pmichaud at pobox.com>
>Subject: Re: [pmwiki-users] thead tbody
>To: noskule <noskule at gmx.net>
>Cc: pmwiki-users at pmichaud.com
>Message-ID: <20080502162930.GC28129 at host.pmichaud.com>
>Content-Type: text/plain; charset=us-ascii
>
>On Fri, May 02, 2008 at 05:25:20PM +0200, noskule wrote:
>> hi list
>> Is there a way to get thead & tbody tags into pmwiki's table output? I 
>> did see pits 970, but that changes pmwiki.php. Anyone sees a way how to 
>> implement this?
>> thanks for any hints.
>
>For pages that want to do lots of extra tags, I generally recommend
>using the EnableHTML recipe and the <table>, <thead>, <tbody>,
>etc. tags directly.
>
>Pm
>
>Date: Fri, 02 May 2008 18:58:43 +0200
>From: noskule <noskule at gmx.net>
>Subject: Re: [pmwiki-users] thead tbody
>To: "Patrick R. Michaud" <pmichaud at pobox.com>
>Cc: pmwiki-users at pmichaud.com
>Message-ID: <481B4843.8020302 at gmx.net>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Patrick R. Michaud schrieb:
>> On Fri, May 02, 2008 at 05:25:20PM +0200, noskule wrote:
>>   
>>> hi list
>>> Is there a way to get thead & tbody tags into pmwiki's table output? I 
>>> did see pits 970, but that changes pmwiki.php. Anyone sees a way how to 
>>> implement this?
>>> thanks for any hints.
>>>     
>>
>> For pages that want to do lots of extra tags, I generally recommend
>> using the EnableHTML recipe and the <table>, <thead>, <tbody>,
>> etc. tags directly.
>>
>> Pm
>>   
>I enabled these allready for some special cases. But I have to implement 
>table sorting capability  for a webpage. I use jquery for that and the 
>plugin needs thead and tbody. The source are mostly pagelist output and 
>hand made tables. That's way html coding doesen't help much unless I 
>would recomend that the authors should use html tags what I thing 
>wouldn't be a good idea.
>I thougt of a markup that I could build, but not shure about the 
>starting point. 
>
>Is there a way to do that without interfering pmwiki table
>markup?
>
I did something similar in the past, to extend advanced
table markup so that it can produce <th> as well as <td>.

In your case, there appear to be a couple of challenges:

- ensuring the head is at the start of the table
- closing the head when you start the body
- closing the body when you end the table

"Choosing good markup is the hardest task" -- Pm

The "natural" markup might be:

Start a table with (:tablehead:) instead of (:table:)
and start the body with (:bodycellnr:)

Then the additional logic in the table processing function is:

- (:tablehead:) generates a table opening block of
  <table $tattr><thead><tr><td $attr> and a closing block
  of </td></tr></tbody></table>

- (:bodycellnr:) generates a row opening block of
  </td></tr></thead><tbody><tr><td $attr>

Then you'll need to redefine the table markup:

    Markup('table', '<block',
      '/^\\(:(table(?:head|end)?|cell|(?:body)?cellnr|div\\d*(?:end)?)(\\s.*?)?:\\)/ie',
      "CellsWithHeadAndBody('$1',PSS('$2'))");

Writing the CellsWithHeadAndBody function shouldn't be 
too difficult. You might find this PublishPDF recipe
helpful:
http://www.wikipublisher.org/wiki/index.php?n=Cookbook.AdvancedTableHeads

Have a look at the table.php script there.

The one obvious trap is if an author uses more than one
(:bodycellnr:) directive. However, since you say you will 
be using pagelist output, you can make sure it issues
just the one. I dare say it would be possible to add
a check to see whether <tbody> is open.

Hope this helps.
JR
-- 
John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
021 RANKIN
john.rankin at affinity.co.nz
www.affinity.co.nz





More information about the pmwiki-users mailing list