[pmwiki-users] Keep() not preventing further parsing?

Petko Yotov 5ko at 5ko.fr
Sat Nov 20 11:09:45 CST 2010

On Saturday 20 November 2010 05:52:43 Ashish Myles wrote:
> Even though the MathJax javascript plugin does all the parsing itself,
> I have to make sure that none of the content between the {$ ... $} and
> {$$ ... $$} delimiters gets modified. So I used the following two
> lines:
> Markup('{$', 'directives', '/\\{\\$(.*?)\\$\\}/e',
> "Keep('{\$'.PSS('$1').'\$}')");
> Markup('{$$', '<{$', '/\\{\\$\\$(.*?)\\$\$\\}/e',
> "Keep('{\$\$'.PSS('$1').'\$\$}')");

Hello. Don't use 'directives', it is too late and some wiki markup was already 
processed at this point. You should try and use '_begin', or '>[=', or 
'<$[phrase]', that is, just after the "escaped text" is processed with '[='.

You can see the markup order if you add to config.php 
  $EnableDiag = 1;

and then open a page http://yourwiki/pmwiki.php?action=ruleset .

> But if I try:
>     {$$ {(a)} $$}
>     {$$ \frac{(a)}{(b)} $$}
> then the curly braces are removed in the final HTML output

That's because {(...)} is considered a MarkupExpression and is already done 
when 'directives' are processed. Using an earlier 'when' parameter should fix 

> Moreover, PmWiki likes to convert "{a}" to "a" with a macron above it,

This is not something from PmWiki, it is very likely due to a cookbook recipe,

  http://www.pmwiki.org/wiki/Cookbook/MarkupExtensions or

Anyways, fixing the "when" parameter should fix this too.

> Note that one doesn't actually need MathJax to test the cases above.
> Just put the two Markup() lines above in your local config file and
> look at the resulting HTML.

Right, you probably could just [=escape=] the MathJax code, like:

 {$$[=here is my MathJax code=]$$}


More information about the pmwiki-users mailing list