[pmwiki-users] ZAP conditional syntax

Ben Stallings ben at interdependentweb.com
Thu Mar 8 11:22:26 CST 2007


Dan wrote,
> I wanted to ask a quick question to see if anyone has
> any suggestions for syntax of the zap conditional processing (and form
> validation also).

I would really like to see the ||s gone from ZAP's conditional syntax, 
unless they mean "or".  Or a table boundary.  Likewise the |s unless 
they indicate labels.

I had previously suggested using standard ?: syntax, like so:

(:zap field="condition ? true value : false value":)

with spaces surrounding the ? and : to distinguish them from punctuation.

But now that you're talking about assigning multiple fields on a single 
condition, I suggest something more like

(:zap if="condition ? field1=value1, field2=value2 : field1=value3 
field2=value4":)

or even

(:zap condition="condition" fields="field1,field2" true="value1,value2" 
false="value3,value4":)

In any case I think it's important to keep the meanings of punctuation 
clear in users' heads: = means assignment, comma separates items in a 
list, || means or (or a table boundary), and | means a label.

(And then there's what :) means to 99% of the Internet-using public. 
Some of my users insist on calling PmWiki directives "smileys."  Maybe 
we should call them that, too.)

The ?: syntax is common among dozens of programming languages, and it 
can be distinguished from punctuation just by putting a space before 
each symbol.  So I would much rather see that standard adopted by ZAP 
than yet another quirky system I'll have to look up in the documentation 
every time I want to use it.

Thanks for asking for feedback, Dan!  --Ben



More information about the pmwiki-users mailing list