MDL-55007 filter_mathjaxloader: Wrap nolink around each expresssion

This commit is contained in:
Daniel Thies
2016-07-07 20:22:56 -05:00
parent eb36cfcbb6
commit 6857304753
+13 -1
View File
@@ -163,7 +163,19 @@ class filter_mathjaxloader extends moodle_text_filter {
}
if ($hasinline || $hasdisplay || $hasextra) {
$PAGE->requires->yui_module('moodle-filter_mathjaxloader-loader', 'M.filter_mathjaxloader.typeset');
return '<span class="nolink"><span class="filter_mathjaxloader_equation">' . $text . '</span></span>';
if ($hasextra) {
$text = '<span class="nolink">' + $text + '</span>';
} else {
if ($hasinline) {
$text = preg_replace('/\\\\\\([\S\s]*?\\\\\\)/u',
'<span class="nolink">\0</span>', $text);
}
if ($hasdisplay) {
$text = preg_replace('/\$\$[\S\s]*?\$\$|\\\\\\[[\S\s]*?\\\\\\]/u',
'<span class="nolink">\0</span>', $text);
}
}
return '<span class="filter_mathjaxloader_equation">' . $text . '</span>';
}
return $text;
}