[pmwiki-devel] having a single callback function for markups in php 5.5x compat issues
V.Krishn
vkrishn4 at gmail.com
Wed Apr 6 06:05:36 CDT 2016
Thanks.
Would try in some recipe else
this would be helpful when creating a new recipe.
> On 2016-04-02 10:41, V.Krishn wrote:
> > (:test param1 param2 param3:)
> > CODE:
> > Markup('test','directives','/\\(:test\\s(.*?):\\)/',"CallbackTest");
>
> ...
>
> > Wondering if were possible to produce:
> > Array
> > (
> >
> > [0] => (:test param1 param2 param3:)
> > [1] => test param1 param2 param3
> > [name] => test
> >
> > )
> > One benefit is I can write a single CallBack<fn> for all markups in
> > given
> > recipe.
>
> Place the directive name in () parentheses:
>
> '/\\(:(test)\\s(.*?):\\)/'
>
> This way you'll have the name as $m[1], and the arguments in $m[2]
> (which you can parse with ParseArgs). Then, you can have more than one
> directive name:
>
> '/\\(:(name1|name2|name999)\\s(.*?):\\)/'
>
> Petko
>
> P.S. The "\\s" assumes that the directives always have a space after the
> name: "(:name:)" will not be recognized. You may want to use a different
> pattern, something like:
>
> '/\\(:(name1|name2|name999)(\\s.*?)?:\\)/'
>
> the (\\s.*?)? part makes sure that if there are arguments, they will be
> preceded by a space; but there may not be arguments, then it will also
> work.
>
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
--
Regards.
V.Krishn
More information about the pmwiki-devel
mailing list