Summary: should table caption markup be visible in the stdmarkup file?
Created: 2004-09-26 01:08
Status: Closed - fixed for 2.0.devel10
Category: Feature
From: jr
Priority: 1
Version: 2.0dev8
OS: all

Description: Curently, pmwiki embeds treatment of table captions in the table row markup entry. It would be clearer to someone studying the stdmarkup.php file if there were a separate entry for table rows of the form '||!(.*?)!||'. Perhaps also add a comment about support for table headings using '||!'.

The main reason I went ahead and reused FormatTableRow() for captions was to enable captions to use left, right, and center alignment. Using a separate entry for processing captions is either redundant (a separate call to FormatTableRow() ) or loses that capability. It's reasonable to question if captions should provide alignment options. However, including comments about the available markups makes excellent sense. --Pm

One guessed that was the most likely reason. Lesson in sucking eggs follows:

  function SetTextAlignment($text) {
         $align = '';
         if $text starts and ends with a space
            $align = 'text-align: center;';
         else if $text starts with a space
            $align = 'text-align: right;'
         else if $text ends with a space
            $align = 'text-align: left;'
         return $align;

This preserves the default alignment, of course.

This useful function would then be available to future MarkupExtensions, for example (making this up as an illustration):

    =Box ! Box Caption Centred !Box paragraph text

might use a style sheet to produce a box around a paragraph of text, with a caption.

Just a thought jr