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

Ashish Myles marcianx at gmail.com
Fri Nov 19 22:52:43 CST 2010


Hi,

I am a newcomer to PmWiki and I totally love how easy it is to make
plugins. I created a recipe to use MathJax for math and I noticed an
issue with the plugin that also affects the jsMath plugin which I have
been using so far. I wanted to resolve this issue before posting the
recipe.

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').'\$\$}')");

However, in some cases, some curly braces get parsed. The following
line works fine and gets copied over to the HTML without further
processing
     {$$ (a){}{ } $$}
In other words, if I view the source, I see
     {$$ (a){}{ } $$}
as I am supposed to.

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

Moreover, PmWiki likes to convert "{a}" to "a" with a macron above it,
which converts
    {$$ \frac{a}{b} $$}
    {$$ {a} $$}
    {$$ ({a}) $$}
to the following HTML code
    {$$ &#257; $$}
    {$$ (&#257;) $$}
    {$$ \frac&#257;{b} $$}

I tried disabling all the other plugins in my configuration files and
the behavior was unchanged.  Looking around the PmWiki site, I don't
see what triggers this conversion.

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.

Ashish



More information about the pmwiki-users mailing list