incubator-jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Lerch <>
Subject JSPWiki + MathML
Date Tue, 23 Mar 2010 14:56:26 GMT
Hi folks,

I recently did a little hack with JSPWiki 2.8.3 which I thought 
(encouraged by Janne) may be of interest.

My goal was to find a quick and easy way to turn a wiki into a 
mathematics notebook.
As it turned out it was even much easier with JSPWiki then I had expected.

What I did was:

1. I changed the ContentType in Wiki.jsp to "application/xhtml+xml" from 

2. I wrapped the StringWriter in class XHTMLRenderer

///-StringWriter out = new StringWriter();
Writer out = new AMathFilterWriter(new StringWriter()); ///+

with my FilterWriter, which in essence scans the Stream for a pair of 
backticks, where it expects an ascii math expression which it can 
translate into full-blown MathML 2.0 on-the-fly. The resulting MathML 
fragment will then get inserted directly into the page download. 
Mozilla, as you may be aware, can display this stuff without any add-on.

With these 2 little changes I already can do some very exciting things 
(see attached).

Of course that's a terrible hack, and the are certainly better ways of 
doing the same.

However, what I'm asking you to consider for v3.0 is to decide if you 
can switch to ContentType "application/xhtml+xml" in the core. This 
could be a basis to add this and other XML applications (like svg or 
rdf) to JSPWiki with ease. Of course there is some work to do to escape 
the then toxic user input like <, & and > (I think JDOM can do that) and 
sanitize some of the JavaScript directly embedded in jsp (I realized 
later on that there is some XML-incompatible stuff in there too, like 
"&&" etc.).

Please let me know what you think.


  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message