Hi David,
Unfortunately the TeX filter is overzealous and will convert a number of Javascript lines in Hot Potatoes HTML files to maths images.
For instance:
Temp = InputStuff.replace(/ \ [ ClueNum\]/g, ClueNum);
---> Temp = InputStuff.replace(/<a href=".../moodle/filter/tex/texdebug.php"><img class="texrender" border="0" title="ClueNum" alt="" src=".../moodle/filter/tex/pix.php/eeed6d5...48.gif" style="vertical-align:middle" /></a>/g, ClueNum);
This unwanted conversion (which results in the HP crossword not working properly) happens in the following conditions:
- the TeX filter has been enabled sitewide by Admin
- a teacher puts a direct link to an HTML Hot Potatoes file placed in the course files
It does not happen if you use the "normal" Moodle interface to point to your HP HTML file, i.e. Add an Actitivy / Hot Potatoes Quiz.
I have identified the culprit (in Moodle 1.6.3). In file \moodle\filter\tex\filter.php line 125:
preg_match_all('/<tex>(.+?)<\/tex>|\$\$(.+?)\$\$|\\\\ \ [ (.+?)\\\\\]|\\[tex\\](.+?)\\[\/tex\\]/is', $text, $matches);
The part in red in the preg_match_all regular expression is too "greedy" and it matches the various /\[ClueNum\], /\[strParams\], etc. Javascript bits which are to be found in the Crossword HP files.
Questions for TeX filter experts (and mathematicians):
- Is the part in red in the preg_match_all really useful in the TeX filter? Or could it be made less greedy and more to the point?
- When the TeX filter is enabled sitewide, could there be a way to prevent it from operating on any uploade HTML resource file, e.g. using a <noTex></noTex> tag similar to the <nolink></nolink> used to prevent dynamic glossary linking?
Thanks,
Joseph
EDIT.- After posting my message, just realized that the overzealous TeX filter is at work on this forum too, and changes my bits of Javascript into images!!! So I have introduced a few extra spaces in my quoted Javascript to prevent this...