[pmwiki-devel] Quick preg_replace question...

The Editor editor at fast.st
Fri Apr 27 10:56:12 CDT 2007


On 4/27/07, Neil Herber (nospam) <nospam at eton.ca> wrote:
> The Editor wrote:
> >> Anyway, it may be good before launching another advanced table recipe
> >> to discuss the markup, to see if it makes sense to others as well.

> Hi Dan
>
> I was initially confused by this markup because I thought t, r, and c
> stood for Top, Right, and Center. I far prefer the more wordy but
> completely clear notation used by SimplifiedAdvancedTableDirectives.

Well, it grows on you.  It also makes a lot of things simpler
codewise. And it's primarily a shortcut for me...

> If the tables are going to nest then some kind of enumeration would
> help, as in [table 3] ... [tableend 3]

They are nested based on the number of leading spaces (0, 1, or 2),
which is like an index for each table.  Looks nice on the page and
easy to code... However, mess up one space--and disaster. So maybe
this is a good suggestion... Maybe why Pm didn't implement...  I'll
think about it some and see if others say anything.

> I would also like to see the table elements arranged more-or-less as
> they would appear (neither recipe does this from what I can see). So:
>
> [table]
> [row] [cell one] [cell two]
> [row] ... etc.

Yes there have been time's I've wanted this also...  But I also like
being able to use it for multilines too...

However, now that you suggest it... I suppose the pattern could be
adjusted to make the \n optional in which case you would have either
option available to you (I'd have to go with the nesting rule of a
number inside somewhere...).  I'll still require [t] and [r] to be on
new lines (in the code that processes the tables)...

I'm out of time to test this now but will look into it...  Maybe:

'/([\n]{0,1})\[([trc]{1})(.*?)\]/e'

Thanks for the good idea!

Cheers,
Dan



More information about the pmwiki-devel mailing list