TeX filter getting a little over excited

Re: TeX filter getting a little over excited

by Gordon Bateson -
Number of replies: 1
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
For this particular case you could try the following modification:
  1. open "filter/tex/filter.php" with a text editor
  2. locate the following lines (around line 125):
    for ($i=0; $i<count($matches[0]); $i++) {
    $texexp = $matches[1][$i] . $matches[2][$i] . $matches[3][$i] . $matches[4][$i];
  3. change the above lines to the following:
    for ($i=0; $i<count($matches[0]); $i++) {
    $texexp = $matches[1][$i] . $matches[2][$i] . $matches[3][$i] . $matches[4][$i];
    if ($texexp=='ClueNum') continue;
  4. save the modified file
You could also modify the code in "filter/tex/filter.php" for a more general check around line 90. This will skip activation of the filter on Hot Potatoes quizzes completely.
  1. locate the following lines (around line 90):
    if (!preg_match('/<tex/i',$text) and !strstr($text,'$$') and !strstr($text,'\\[') and !preg_match('/\[tex/i',$text)) { //added one more tag (dlnsk)
    return $text;
    }
  2. change the above lines to the following:
    if (!preg_match('/<tex/i',$text) and !strstr($text,'$$') and !strstr($text,'\\[') and !preg_match('/\[tex/i',$text)) {
    return $text;
    }
    if (preg_match('/Created with (Mac )?Hot Potatoes/i', $text)) {
    return $text;
    }

    FYI the 'Created with Hot Potatoes' string appears near the top of all HP5 and HP6 quizzes
I haven't tested the above modifications, so handle with due caution smile

regards
Gordon
In reply to Gordon Bateson

Re: TeX filter getting a little over excited

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Gordon,
Thanks for your prompt reply. However, not being admin on my Moodle site I cannot envisage hacking the core Moodle file. What is really needed is for the TeX filter to come up with a working solution and commit it to CVS so that the correction gets into standard Moodle distributions. I have posted bug report MDL-7849 to this effect.
Thanks again,
Joseph