[pmwiki-users] Nested Blocks (tables, divs, etc)

Patrick R. Michaud pmichaud at pobox.com
Tue Feb 24 11:29:28 CST 2009


On Fri, Feb 20, 2009 at 04:39:50PM +0000, Ed W wrote:
> Hi, I am looking through the code in stdmarkup.php, in particular the 
> Cells function and wondering why we don't offer (automatic) nested 
> tables/divs, etc?

The reason PmWiki works the way it does is that I didn't want
to require (:...end:) tags on every construct, especially for
non-nested constructs.  For example, if we had automatically nested
tables/divs, then what is now

    (:div:)
    first division
    (:div:)
    second division
    (:div:)
    third division
    (:divend:)

would end up being

    (:div:)
    first division
    (:divend:)
    (:div:)
    second division
    (:divend:)
    (:div:)
    third division
    (:divend:)

It gets even worse for things like nested (:if:) constructs
and the like:

    (:if ... :)
       (:if2 ... :)
       (:if2 ... :)
    (:if ... :)
       (:if2 ... :)
    (:ifend:)

becomes

    (:if ... :)
       (:if ... :)
       (:ifend:)
       (:if ... :)
       (:ifend:)
    (:ifend:)
    (:if ... :)
       (:if ... :)
       (:ifend:)
    (:ifend:)

Since the non-nested cases are far more common than the nested ones,
I've optimized the markup for that.

> This doesn't seem to change or break anything obvious.  We could nest 
> divs before, now we can just do it without having to manually number them. 

Changing this in the core would break a _lot_ of stuff, as evidenced
by the examples above.

Pm



More information about the pmwiki-users mailing list