[pmwiki-users] Wikipaths (was: PData support for pagelisting images)

Dominique Faure dominique.faure at gmail.com
Fri Sep 8 01:43:23 CDT 2006


On 9/8/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Fri, Sep 08, 2006 at 04:57:45AM +0530, V.Krishn wrote:
> > On Friday 08 September 2006 03:57, Patrick R. Michaud wrote:
> > > So, the regexp to find and replace this becomes something like:
> > >
> > >     preg_replace('/\\{(\\(\\w[^)]+\\)*)([^}]*)\\}/e',
> > >                  "ApplyFunctions(PSS('$1'), PSS('$2'))", $x, $match)
> >
> > not quite sure, should it be
> >  preg_replace('/\\{(\\(\\w[^)]+\\))*([^}]*)\\}/e',
> > //-----------------check n no of func------------
> >                  "ApplyFunctions(PSS('$1'), PSS('$2'))", $x, $match)
>
> Oh, we were both almost there.  It really needs to be:
>
>     preg_replace('/\\{((?:\\(\\w[^)]+\\))*)([^}]*)\\}/e',
>
> The point is to get all of the (...) functions into $1.
>
[Sorry, to come back so lately, I had a time zone vs slumber issue :-)]

IMHO, we need to separate function calls from their arguments, dealing with:

{(func) args} instead of {(func args) another_form_of_arg}

in order to allow inner arguments being function call results (or at
least variable values) as in:

{(substr) 1 '{$vote}' '*****'}

which should replace a voting indice from 0 to 5 by an equivalent line
of stars (not really the best sample I may provide, but it's the first
that come to mind).

The real challenge is to handle (real) expressions like:

{(f) arg1 {(g) arg2} {(h) {(k) arg3}}}

> With all of those parentheses in there, perhaps it really is LISP!  :-)
>
Or is it PmWiki new functional SCHEME ?

May the FORTH be with us,
Dom




More information about the pmwiki-users mailing list