[pmwiki-users] On the order of Markup

Peter Kay pkay42 at gmail.com
Wed May 3 15:09:11 CDT 2017

I was thinking about that, trying to find ways to rewrite Markup_e so
that it just works.  But there are other approaches:

Markup('include', '>if',
  function ($m) use ($pagename) { return PRR(IncludeText($pagename, $m[1]));});

A lot of Markup_e involves needing $pagename; I would propose having
MarkupToHTML call the function with both the match and $pagename:

Markup('include', '>if',
  function ($m, $pagename) { return PRR(IncludeText($pagename, $m[1]));});

the "use ()" syntax will probably allow us to rewrite Markup_e in a
way that - while perhaps slower - is seamless.  Consider the following


function get_f($m) {
  return function () use ($m) { echo $m;};



We should be able to do something similar with an eval() thrown in there.


On Wed, May 3, 2017 at 1:48 PM, Petko Yotov <5ko at 5ko.fr> wrote:
> On 2017-05-03 19:19, Peter Kay wrote:
>> One other problem I recently stumbled on is that the MarkupRules only
>> allow one instance of a given pattern.
>> So for example if you want to process '/XXX/' twice (for whatever
>> reason), you can't - only one copy goes in.
> If you want to process '/XXX/' twice (for whatever reason), there are dozens
> of ways to write the same pattern:
>   '/[X]XX/'
>   '/X[X]X/'
>   '/XX[X]/'
>   '/(X)XX/'
>   '/(XX)X/'
>   '/(?:XX)X/'
>   '/XXX{1}/'
>   '/X{1}XX{1}/'
> etc., etc., etc.
>> I'd rather build the rules using the markup name, so as long
>> as the names are different, they'll both run.
> The next version of PHP, 7.2, will deprecate the function create_function().
> We will have to rewrite the core markup engine, markup rules and the
> processing of various $*Patterns (future PmWiki versions may have to drop
> support for PHP 5.2 and older).
> So indeed, it may be possible to find a way to build the rules using the
> markup name, and even pass the name to the processing function so a single
> function can do multiple rules.
> As always, if implemented, such a feature will have to *not* break the
> existing markup rules that work today for PHP 5.3-7.1.
> Petko
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users

More information about the pmwiki-users mailing list