I want to add support for TeX mode to Wikipedia script.
I wrote a program which takes TeX code on stdin, validates and standarizes it (so that "x+y" and "x + y" don't have to be generated twice), and even has some extensions ("%" -> "%"), checks if given image already exists, and if i doesn't, passes it to latex, dvips and convert to get nice antialiased png file.
How to integrate it with Wikipedia script ?
Wikipedia script when rendering should find all <math>.*</math> in markup, call this program (which is very fast if images are already rendered) and get info provided by it to render a page. I'm not even sure what should that program return.
There are 3 possibilities: * illegal markup - <tt>Illegal markup: ^$%^*^%$%(^$%(^$^$%^$</tt> * markup validated ok, latex runs corectly - <img href="/path/345456986858674.png"> * markup validated ok, latex failed - ???
The last case shouldn't happen too often, but if we always wait for latex to finish, that will unnecesarily increase latency.
I'm also thinking that some similar solution should be added for chemical reactions.
Any opinions ?