[pmwiki-users] {(...)} markup recipe available

Patrick R. Michaud pmichaud at pobox.com
Wed Apr 11 14:24:38 CDT 2007


On Wed, Apr 11, 2007 at 02:17:30PM -0500, Ben Stallings wrote:
> Patrick R. Michaud wrote:
> >It may need some serious tweaking, because {(...)} always
> >expects the operation to be at the front, while {( ? : )} seems
> >to have its operators in the middle.  If I were doing this
> >from scratch, I would probably write it as:
> >
> >  {(if cond true false)}
> 
> That's so similar to (:if cond:)true(:else:)false(:endif:) that I don't 
> think it needs a separate markup... provided that {()} functions can be 
> used inside of (:if:) conditionals, which I haven't tested yet.

Yes, they can.  Or if for some reason they can't, then they're supposed
to be usable inside of (:if:).

> But... it seems to me that the purpose of {()} markup is to make PHP 
> functions available inside PmWiki, which is basically the same as what I 
> was doing with {( ? : )} ...

I'm sure you realize this already, but it also makes it possible to
call custom functions, and it restricts the types of functions that
can be called to a "safe" set.

> ... anything before the ? is actually evaluated 
> as a PHP expression (Danger, Will Robinson!) so *any function at all* 
> can go in there without needing to be defined separately in PmWiki.
> 
> That's probably more power than we want people to have.  

Yes, danger-danger-danger, especially if there's any form of open
editing on the site.  You probably don't want people executing 
PHP's "unlink" function.  :-)  That's why I much prefer the restricted 
form that {(...)} is currently using.

Thanks again!

Pm



More information about the pmwiki-users mailing list