Re: [pmwiki-users] Keep() not preventing further parsing?
On Sat, Nov 20, 2010 at 12:09 PM, Petko Yotov <5...@5ko.fr> wrote: > 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 '[='. > Thank you Petko! The Markup() lines above had been copy-paste-modified from jsMath, which is where I got the 'directives' from; it also seemed appropriate at the time, being before the 'inline's. I went for '>[=' as you suggested, and it worked like a charm! Thanks! Ashish ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Keep() not preventing further parsing?
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 it. > 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 http://www.pmwiki.org/wiki/Cookbook/PublishPDF 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=]$$} Thanks, Petko ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
[pmwiki-users] Keep() not preventing further parsing?
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 {$$ ā $$} {$$ (ā) $$} {$$ \fracā{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 ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users