I have just written an extension that uses Steven Chan's PHP scripts (http://www.jcphysics.com/ASCIIMath/) to convert a relatively simple markup language into MathML. The only problem now is that it needs to be presented as XML - currently the output is just displaying as simple text. I remember reading something about mediawiki and XML format, but can't find it again. Is there any simple way of making mediawiki display MathML, or would it need a major rewriting of mediawiki?
I am new to this, but there is some guidance on setting up something for PmWiki using javascript at the following http://www.pmwiki.org/wiki/Cookbook/ASCIIMath. I don't know how it would apply to mediawiki.
Andrew Mole wrote:
I have just written an extension that uses Steven Chan's PHP scripts (http://www.jcphysics.com/ASCIIMath/) to convert a relatively simple markup language into MathML. The only problem now is that it needs to be presented as XML - currently the output is just displaying as simple text. I remember reading something about mediawiki and XML format, but can't find it again. Is there any simple way of making mediawiki display MathML, or would it need a major rewriting of mediawiki?
You can tell MediaWiki to declare its output to be of type application/xhtml+xml, which will let Mozilla/Firefox interpret eg MathML inline:
$wgMimeType = "application/xhtml+xml";
However there are two basic problems with this: 1) Internet Explorer and some other browsers won't display such pages at all. 2) If there are any XML well-formedness errors in output, Mozilla and other compliant browsers will refuse to display the page.
As for 1), this may or may not matter to you.
As for 2), we try to ensure that MediaWiki outputs valid, well-formed XHTML 1.0 Transitional. However there are not guarantees, in particular with rendering of wikitext there may be odd nesting or improperly closed tags at times. If you enable postprocessing with HTML Tidy, this will probably in most cases fix such errors.
Tidy is controlled by the $wgUseTidy setting; see DefaultSettings.php for other settings which may affect it as well. Tidy comes with most Linux distributions and ports collections, or can be gotten from http://tidy.sourceforge.net/
MediaWiki can shell out to the 'tidy' command-line program, or use the PHP extension wrapping libtidy (but be aware there is a serious memory corruption bug with the current release of the PHP tidy extension, see http://pecl.php.net/bugs/bug.php?id=4202 )
-- brion vibber (brion @ pobox.com)
I am wondering whether there may be another alternative using the javascript version of the ASCIIMathML converter (at least for mediawiki installations other than the central Wikimedia ones).
If it were possible (and I can't quite see how to do it) to place the following line into the <head> section:
<script type="text/javascript" src="/some_path/ASCIIMathML.js"></script>
such that Peter Jipsen's script is accessible (http://www1.chapman.edu/~jipsen/mathml/asciimath.html), then ASCIIMathML notation would be available to browsers that were set up for it (Netscape/Mozilla/Firefox and IE6+MathPlayer). For other browsers, they would get the following message on top:
To view the ASCIIMathML notation use Internet Explorer 6+MathPlayer or Netscape/Mozilla/Firefox
I realize that this may not be an elegant option for Wikimedia projects, but if I wanted to implement this on my local installation, where would I put the javascript line above (or is it prevented by security measures)?
On 8/19/05, Andrew Mole andrew.mole@gmail.com wrote:
I am wondering whether there may be another alternative using the javascript version of the ASCIIMathML converter (at least for mediawiki installations other than the central Wikimedia ones).
If it were possible (and I can't quite see how to do it) to place the following line into the <head> section:
<script type="text/javascript" src="/some_path/ASCIIMathML.js"></script>
such that Peter Jipsen's script is accessible (http://www1.chapman.edu/~jipsen/mathml/asciimath.html), then ASCIIMathML notation would be available to browsers that were set up for it (Netscape/Mozilla/Firefox and IE6+MathPlayer). For other browsers, they would get the following message on top:
To view the ASCIIMathML notation use Internet Explorer 6+MathPlayer or Netscape/Mozilla/Firefox
I realize that this may not be an elegant option for Wikimedia projects, but if I wanted to implement this on my local installation, where would I put the javascript line above (or is it prevented by security measures)?
Find the file for the skin you're using - for MonoBook (the default) it's skins/MonoBook.php. That file outputs the HTML page. Add the line wherever it needs to go.
However, Monobook uses some clever CSS that will get messed up by the message at the top of the page. Best to configure the JavaScript not to print that message at all.
-- Josh
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org