[pmwiki-users] nested-if in beta67

Patrick R. Michaud pmichaud at pobox.com
Sun Aug 10 11:12:11 CDT 2008


On Wed, Aug 06, 2008 at 09:42:24PM -0700, adam overton wrote:
> 
> ahhh. it appears that the newer version of nested if only accepts if- followed
> by a number, but not by a letter (the original nested-if does both). so:
> 
> doesn't work:
> (:ifM false:)testing2(:elseM:)(:ifG true:)G true(:ifGend:)(:ifMend:)
> 
> does work:
> (:if0 false:)testing2(:else0:)(:if1 true:)G true(:if1end:)(:if0end:)
> 
> 
> i've a bunch of code that currently uses letter-if's; does anyone know of an
> easy way to modify the new if-code in stdmarkup.php? i'm having trouble
> wrapping my brain around how to do that...

Try (in local/config.php):

  $CondTextPattern =   
    "/ \\(:if (\d*|[A-Z]) (?:end)? \\b[^\n]*?:\\)
       .*?
       (?: \\(: (?:if\\1|if\\1end) \\s* :\\)
       |   (?=\\(:(?:if\\1|if\\1end)\\b[^\n]*?:\\) | $)
       )
     /seix";

This allows either a sequence of digits or an uppercase letter to work
as an (:if:) identifier.

Pm



More information about the pmwiki-users mailing list