Welcome to Mediawiki, with yet another way to express formulas unlike anything else you've ever seen....
I am working on a parser for mediawiki pages, and I am trying to deal with transcluding, and all the cool expressions and conditions that can be embedded in templates. My project is written in Java, so I got a copy of JEP, added it to my project, add a call to parse the #expr "12-(((0.5-(8))round 0)mod 12)" and wound up with NaN as an answer. Darn.
So I was reading the docs on the Help:Calculation page, learning about things like round being an infix operator, the trunc operator as a prefix operator, etc. I wondered if any of these unique ways to express these things were because of mediaWiki being written in PHP, but found PHP does things like round and trunc in its expressions in the usual functional call way.
So it appears that medawiki has just decided to go out and create Yet Another Math Language incompatible with all the other math expression parsers.... Sigh....
Does anyone know of a java project that can parse mediawiki expressions, or do I have to roll my own?
Thanks....
References:
- Posted to the calculation discussion page
- Calculation help
- Source for mediawiki expression parser: http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ParserFunctions/Expr.php
- Open source wiki engines in java - Jamwiki implements mediawiki functionality - http://jamwiki.org