[pmwiki-users] New Functional Syntax

Patrick R. Michaud pmichaud at pobox.com
Fri Sep 8 16:27:41 CDT 2006


On Fri, Sep 08, 2006 at 05:10:10PM -0400, Stirling Westrup wrote:
> I've just been thinking about the idea thats being kicked around here of
> adding a function syntax to variable displays. Something like:
> 
>   {(function1 args)(function2 args)$Name}
> 
> has been proposed. This works fine when the required result is based
> upon a single instance of a single variable. How would we code the
> equivalent of:
> 
>   instring($Name,1,pos($Name,'-'))

I don't have any plans to get that advanced.  If someone needs
that capability, it should be written as a special-purpose function
in PHP, not as a combination of things to be applied in wiki markup.

> As well, earlier today I was thinking it would be very nice to be able
> to do this:
> 
>   rege_replace($Name,/^(.*-)([^0-9]+)$/,concat($1,format("%02d",inc($2))))
> 
> To perform an evaluated regular-expression replace to change
> 'Chapter-01' into 'Chapter-02'. Methinks we're now on a very slippery
> slope indeed!

Yes, a very slippery slope, and I'm going to be trying extra hard
not to head down it.  Only those things that I can see an immediate
use for in pmwiki.org or lots of sites will go in the core; 
everything else is a recipe.

Pm




More information about the pmwiki-users mailing list