[pmwiki-devel] TRUE and FALSE in conditionals

Patrick R. Michaud pmichaud at pobox.com
Wed Mar 14 07:29:22 CDT 2007


On Wed, Mar 14, 2007 at 10:06:37AM +0100, Jiri Hladůvka / OBUTEX wrote:
> As the side effect of testing empty string I discovered a wheel.
> One has to realize that PmWiki "true" and "false" are not constants or 
> variables
> and when used in the conditional they are considered as tested texts.
> e.g.
> (:if equal ( equal A B ) false :)
> ...

I don't think this is testing what you think it's testing.
The "equal" condition simply parses the parameter string into
arguments, and then checks to see that its first two arguments
are equal.  Thus,

    (:if equal ( equal A B ) false :)

is the same as writing

    (:if equal "(" "equal" :)

and this will always evaluate to false.

> They can be used only in the form
> (:if true:)      -      always include text
> and
> (:if false:)      -      always exclude text (same as a comment)

They can also be used with extended conditionals, as in

    (:if expr equal A B && true :)

but you're correct that in this case "true" is acting as the
name of a conditional test, and not as a value to be evaluated.

Pm



More information about the pmwiki-devel mailing list