As an alternative, I understand that Jon Papaioannou has provided a new API in Moodle for user preferences. Could this be used to switch filters on or off at the user's discretion?
Another unresolved issue is how to hook up the MathML filter with admin/cron.php to clean up unused gif files in the cache produced by the filter. The filter runs touch() on any gif file which is displayed through the filter. This means that any cached gif image which is more than a week or two old is probably stale and can be discarded.
For filters I'm imagining there would be a GUI on the user profile page, but there's a bit to do first, namely something that dynamically adjusts to available filters, and secondly a GUI for the admin to decide what the user is allowed to switch on and off.
This can eventually be done by analyzing the name and version of the browser contained in the HTTP_USER_AGENT environment variable, but the ideal solution is that in the http protocol, there be a standard variable indicating whether the browser accepts MathML.
One approach I found by googling is to modify apache itself, but Gustav Delius and Mad Alex have already patched moodle to do that
http://cvs.sourceforge.net/viewcvs.py/moodle/moodle/lib/weblib.php?rev=1.193
(search for mathml)
(it simply allows mathml to be integrated into HTML) which can also be done (less elegantly) by patching apache itself:
http://golem.ph.utexas.edu/~distler/blog/archives/000167.html
http://seventeen.mit.edu/blog/platin/archives/000025.html
here is an idea: BROWSER strings are modifiable:
While we wait for the coding of preferences, we could
search for the string "mathml" in a browser string and anyone who wants pure MATHML just needs to add the keyword "mathml" to their BROWSER strings (easy to do in firebird, at least)
advantage over preferences: this would be a per-browser solution whereas preferences would assume the student sticks to the same browser throughout the entire course
<?php
if (!(strpos($HTTP_USER_AGENT,'mathml') === false)) {
// skip the mathml filter
} else {
// process with the mathml filter;
}
?>
It's so braindead ... I don't understand why these browser people have made compliance such a rigid requirement. I do understand the reasons for encouraging compliance, but to simply give up displaying an entire page just when a few characters are not-compliant is, in my opinion, a backward step for humanity. The computers are supposed to be working for us, remember? I would rather see computers becoming more fuzzy and forgiving of human-made data.
</latenightrant>
Not directed at you, Zig, at all, your post just released some pent up frustration. I'll go to bed now.
In view of this you might find the following snippet of an email exchange amusing. (Jacques Distler administers the string theory blog from which that largish sample MathML example on my site was taken):
On Feb 4, 2004, at 8:09 PM, Zbigniew Fiedorowicz wrote:
There is a bug in your itexToMML plugin. It produces the malformed
character entity &#xi; instead of ξ For an example of this
see http://golem.ph.utexas.edu/string/archives/000275.html
No it doesn't.
The W3C Validator says that page is valid XHTML+MathML.
Listing the file, I see only ξ, not &#xi;.
It renders correctly in Mozilla.
Now, I will admit that when I do a "view source" in Mozilla, I see &#xi;.
I don't know *why* Mozilla is doing that. But it ain't true.
In fact, there are no instances of &#xi; on either blog hosted here at golem.
Jacques
One approach I found by googling is to modify apache itself, but Gustav Delius and Mad Alex have already patched moodle to do that
http://cvs.sourceforge.net/viewcvs.py/moodle/moodle/lib/weblib.php?rev=1.193
(search for mathml)
While Gustav/Alex's patch does address the <xml> header issue, it doesn't address the xhtml-conformance issue. I believe their patch works only with pages produced by their special locally-hacked version of the Moodle quiz module, which interfaces with their external AIM software. [Correct me if I'm wrong Gustav.]