[pmwiki-users] Markup Extension writing - DFaure

Petko Yotov 5ko at 5ko.fr
Tue Feb 10 05:18:03 PST 2026


On 10/02/2026 13:18, Hans Bracker wrote:
> Is there another way than rewriting recipes?

I don't know.

MarkupExprPlus seems to disable the core markup expressions and add its 
own full replacement.

It processes not only add/sub/mul/div but all core markup expressions, 
and any custom ones you may add.

See if the problem appears with the latest version of MX+, and maybe 
DFaure can reply better than me.

Petko

-- 
If you upgrade :  https://www.pmwiki.org/Upgrades

On 10/02/2026 13:18, Hans Bracker wrote:
> Yes, sum does work. The MarkupExprPlus recipe definitions of add, sub,
> mul and div don't work with 'strcount'. I can fix it and get the
> value, not the token,  by adding a line of code to top of the
> function, like this, calling MarkupRestore():
> 
> function MEP_nums($params) {
>   $params = trim(MarkupRestore($params));
>   $params = preg_split('/\\s+/', $params);
>   $args = array();
>   foreach ($params as $p) {
>     list($d) = sscanf($p, "%g");
>     if (is_numeric($d)) $args[] = $d;
>   }
>   return $args;
> }
> 
> Is there another way than rewriting recipes?
> 
> Hans
> 
> 
> On 10/02/2026 10:44, Petko Yotov wrote:
>> This seems to work for me.
>> 
>> I tried your code, and the {(sum)} expression on the Cookbook, with 
>> this markup:
>> 
>>   {(sum (strcount are PmWiki.BasicEditing) -6)}
>> 
>> The string "are" appears 16 times in my BasicEditing.
>> 
>> The result is correctly 16 - 6 = 10.
>> 
>> Definition:
>> $MarkupExpr['sum'] = 'array_sum($args)';
>> $MarkupExpr['strcount'] as below.
>> 
>> Petko



More information about the pmwiki-users mailing list