[pmwiki-users] Proposed markup for rowspan in simple tables

Peter Bowers pbowers at pobox.com
Mon Aug 25 09:35:57 CDT 2008


On Mon, Aug 25, 2008 at 12:23 PM, kirpi at kirpi.it <kirpi at kirpi.it> wrote:
>> Speaking of tables, I just had another thought regarding
>> the simple type of tables we create. The motivation here is
>> that in my experience, I often end up creating the small/simple
>> tables as follows:
>> [@
>> Column A    Column B     Column C
>> asdfas      asdfasdf     asdfasdf
>> asdfasdf    asdfasdfas   asdfasdf
>> asdf as     asf asfasd   asdfas asd
>> @]

Hmmm...  I agree putting multiple spaces between columns is a MUCH
easier way to create tables than putting the || in each time.  Maybe
an ROE pattern?

Enter this in your config.php:
$ROEPatterns['/TABLESTART(.*)TABLEEND/se'] =
     'preg_replace(array("/  +/", "/^/m"), array(" ||", "||"), "$1")';

Then any occurrence of 2 or more spaces will be replaced with a || and
there will be an additional || placed at the beginning of each line.

Enter this in your table:

===(snip)===
TABLESTART border=1
abc    def    hij
def    ghi    qsd
qwer   qwer   qwer
TABLEEND
===(snip)===

Your page will be modified to look like this:

===(snip)===
|| border=1
||abc ||def ||hij
||def ||ghi ||qsd
||qwer ||qwer ||qwer
===(snip)===

It's not quite the same as a markup, but if you like creating tables
by inserting multiple spaces this should save you some time...

(I never noticed that the || at the end of each line of the table is
optional.  I forgot to do a pattern for that and it displayed without
problems, so I've left the pattern out.  If someone knows a good
reason why that ending || is important let me know and I can add it in
easily enough...)

-Peter



More information about the pmwiki-users mailing list