[pmwiki-users] ZAP conditional syntax
The Editor
editor at fast.st
Thu Mar 8 15:47:37 CST 2007
On 3/8/07, Hladůvka Jiří <mail at revida.sk> wrote:
> Ben Stallings napsal(a):
> > Dan wrote,
> >
> > (:zap condition="condition" fields="field1,field2" true="value1,value2"
> > false="value3,value4":)
> > ...
> Looks good - I vote for this.
>
> Jiri
Can't really do that without creating a new markup which I would
rather avoid. According to my markup definition, it has to look like
(:zap if*="text...":).
Here's the best in my view so far:
(:zap if="condition ? field1=value1, field2=value2 : field1=value3 ,
field2=value4":)
With these related options:
(:zap if="condition ? field1=value1` field2=value2 : field1=value3 `
field2=value4":)
Replaces , with ` which is almost never used to help avoid accidental
bugs from user input.
(:zap if="condition ? field1=value1, field2=value2 (false)
field1=value3 , field2=value4":)
Another indicator beside : for what to do when the condition fails...
Other options include
! or :: or || (!), etc... Again, the more common the delimiter, the
more likely your conditional will be compromised...
Hmmm, I was thinking I might be able to escape any delimiters used,
and then return them just before the actions are triggered but don't
see how that would work. Perhaps I could convert them then for if's
and validates, and then reconvert them back later. That could make
this a bit more ironclad, meaning I could focus more on syntax... :)
So should we go with option 1?
Cheers,
Dan
More information about the pmwiki-users
mailing list