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

Peter Bowers pbowers at pobox.com
Mon Aug 25 09:56:06 CDT 2008


On Mon, Aug 25, 2008 at 4:35 PM, Peter Bowers <pbowers at pobox.com> wrote:
> (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...)

After I sent this I realized it's going to be really hard to change
your last column into a right-aligned or center-aligned table without
that ending ||.  Thus a new ROE pattern, slightly more complicated...

===(snip)===
$ROEPatterns["/TABLESTART([^\n]*)\n(.*)\n\s*TABLEEND/se"] = '"||
$1\n".preg_replace(array("/  +/", "/^/m", "/$/m"), array(" ||", "||",
" ||"), "$2")';
===(snip)===

It works in my ultra-simple test.  This:

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

will be modified to look like this:

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

If you find something more complicated it should (reasonably) be doing
that it's not doing let me know...  Obviously this is NOT a substitute
for a markup, but just a way to save work while creating tables...

IF this solution is acceptable (i.e., use the same markup but allow
for other types of table text to be converted into this markup) then
this idea could be fairly trivially expanded using a function that
would parse the (:simpletable ...:) options, do the conversion, and
replace the text right back into the text being edited...

-Peter



More information about the pmwiki-users mailing list