[[/MathML HOWTO]] - step by step instructions for adding MathML support to MoinMoin (one of several possible ways, other ways are discussed below) If you use MathML in your wiki, you may use "MathMlSupport/HelpOnMathematicalFormulas" as help page in your wiki. * Note: this wiki instance (the one you are reading right now) doesn't have any MathML patches installed therefore the examples on the above pages will not show up as MathML. But they will if copied to an instance with the patch. A problem of the method described in the above howto: when trying to write a help page for this syntax, constructs enclosed in { { { } } } still get rendered as math. This is because the math delimiter as used in the wiki syntax and delimiter defined in the java script are the same. Maybe we should change the delimiter in the script to something long and improbable like $ASCIIMathML$ and make the wiki parser transform $$ to $ASCIIMathML$. But this will worsen the readability for people whose browser doesn't render MathML. Another option is to write the two $ signs in help pages with a space betweed them, just the way it's done on all the moin help pages for other constructs like { { { } } } Supporting MathML will allow MoinMoin to compete with other wikis that have texvc (a Latex-lexer that allows safe Latex execution for math-related symbols) or allow native MathML input. I suggest to bundle [[http://www1.chapman.edu/~jipsen/mathml/asciimath.html|ASCIImath]] and change its default-pattern of {{{`markup`}}} to something that does not trigger our parser and is shorter than four characters. * UPDATE (2006-09-05): Integration of asciimatml into moinmoin has been done by [[http://www.knowledgeforge.net/project/sciki/|sciki (scientfic wiki) project]]. The actual code is available in their subversion repository which is web browseable here: http://project.knowledgeforge.net/sciki/svn/ and here are [[http://project.knowledgeforge.net/sciki/svn/trunk/INSTALL.txt|installation instructions]]. . Have you thought about porting it to 1.5 and registering on the particular CategoryMarket pages? . There is nothing to do for 1.5. I tried with moin-1.5.4 and it just works :-) . Nice to know, that should be mentioned in the README - and it could be listed on the market pages. . (RufusPollock: author of the sciki code) Thanks for that information about compatibility with 1.5 which I've added to the README.txt. What Category do you think this should go in (ParserMarket perhaps?) UPDATE: The latest version of ASCIIMathML doesn't need the modification in {{{}}} tag. Adding the following to wikiconfig.py seems to be enough, no need to modify wikiutil.py. {{{ html_head=''' ''' }}} Older version of ASCIIMathML works by including this in the header: {{{ your title... }}} In order to install it, you can add the following line to you wikiconfig.py: {{{ html_head=''' ''' }}} Download ASCIIMathML.js: download [[http://www1.chapman.edu/~jipsen/mathml/asciimathdownload/|ASCIIMathML.js]] and put it somewhere readable. For example {{{ cp ASCIIMathML.js yourhtdocs/ and don't forget to specify the location of the javascript as well. In this case, it should be src="/ASCIIMathML.js". }}} Edit wikiutil.py: {{{ Line ~ 1078: output.append(""" - + Line ~ 1165: - output.append('\n\n' % ''.join(bodyattr)) + output.append('\n\n' % ''.join(bodyattr)) }}} Usage {{{{ {{{`a+b`}}} }}}} == Patch for shorter markup == Note: it's a rather not elegant patch With it the usage will be {{{ $$a+b$$ }}} Normal words description: It makes the wiki parser recognise {{{ $$anything$$ }}} in the wiki markup and replace it with {{{ `anything` }}} in the HTML output. After doing the previous edit parser.py {{{ Line ~ 83: before the line (?P[<>&]) """ % { add the line: (?P\$\$.*?\$\$) Line ~ 887: before the def scan(self, scan_re, line): add: def _asciimath_repl(self, word): """Handle math in $$ $$ for AsciiMathML.""" return self.formatter.text('`'+ word[2:-2] +'`') }}} ---- Why don't we just change two lines in ASCIIMathML.js? Change the 17 and 18th lines to this and you'd get the functionality of the patch above without changing the parser: {{{ var AMdelimiter1 = "$$", AMescape1 = "\\\\\\$$"; // can use other characters var AMdelimiter2 = "$$", AMescape2 = "\\\\\\$$", AMdelimiter2regexp = "\\$$"; }}} . Oops, I was wrong. You did have to include the patch and the lines above. My mistake. Now I have to do Wiki:WikiPenance. --Wiki:AnonymousCoward = ToDo = There was a question on the mailing list what will happen with this. I personally don't use any math markup, so just some random thoughts that can be improved by someone really using this stuff: * we shouldn't change the tag and head contents of ANY page, so there needs to be some mechanism to do this only for pages using asciimath * ''is it not possible to use a #pragma for this?'' * the $$ method doesn't look that bad, so if nobody has a better idea, we could go that way * we can't use a moin parser plugin because this is also used inline, right? * We have macros for that * ''I think both (inline and block) should be supported. Maybe the $$ solution '''and''' the parser?'' * we can't just define the body onload js function as this might be used by other stuff * But the JS can be loaded later. So macro/parser could just output a ` ''' '/moin_static184'}}} Am I doing something wrong ? -- [[]] <> * Okay problem solved (thanks to moins chat support by 'thesheep': {{{ html_head=''' ''' }}} -- [[zelhar]] <> * '''Update for Moin192:''' I tried to apply the instructions on [[moinmo.in/MathMlSupport/MathML%20HOWTO]] but for the parser configurations it doesn't work and in fact I get an error and moin cannot run when I edit the parser according to the instructions. Any idea what can be done. Especially I think editing the parser file isn't very elegant a solution and it would be better to add a module instead... -- [[zelhar]] <> <> * Correction: I applied the parser changed as recommended on [[moinmo.in/MathMlSupport/MathML%20HOWTO]] and it works but with bugs. For example an expression of the type: `$$kappa^[> == wiki.py missing == * I try to follow this guide to enable MathMLSupport (MoinMoin 1.8, DesktopEdition): http://moinmo.in/MathMlSupport/MathML%20HOWTO. * I'm told to "edit the file parser.py under MoinMoin directory" * This file does not exist at all. What to do? -- Pida 2008-12-31 = mathtrans parser = You could also use the [[http://hg.moinmo.in/moin/extensions/file/tip/data/plugin/parser/text_x_mathtran.py|mathtrans parser]]. This uses the action cache for already converted formulars. The devolping process isn't finished yet but it can be used already. * Thank you, but is there any information on the use of this parser? I tried (blanks inserted to prevent this page from being formatted) * # f o r m a t text_x_mathtran at the beginning of the page => The whole page is a code block * { { { # ! text_x_mathtran at the beginning of a code block => The formula is not being formatted * This style: t e x : \sum_0^n 2^{-n} * e.g. {{{{{ {{{#!mathtran \sum_0^n 2^{-n} }}} }}}}} gives {{attachment:mathtran_example.png}} = moin2 inline mathml/svg patch = [[attachment:moin2-mathml.diff]] Maybe someone with a clue about mathml, its entities, xml, etc. could have a look at this patch. Also general feedback wanted. Is "inlining" mathml into html5 the way to go? Browser support aside from FF4? == Known issues == * "inline" mathml support requires Firefox 4.0 (use e.g. beta3 or a current nightly build) or another browser with similar capabilities * details there: http://hacks.mozilla.org/2010/05/firefox-4-the-html5-parser-inline-svg-speed-and-more/ * mathml entities don't work, don't know why * the mathmlentities.py is maybe incomplete, need a better one (but first make it work) == How to use == * create a plain text item * edit mimetype metadata so it is "text/mathml" * paste some mathml into the editor textarea * save * if you have some appropriate browser, you should see it rendered now