MDL-5507 filter_mathjaxloader: Add commeents for regexes

This commit is contained in:
Daniel Thies
2016-07-11 13:22:13 -05:00
parent 0b2b9e21dc
commit 09b3ec720f
+3
View File
@@ -164,13 +164,16 @@ class filter_mathjaxloader extends moodle_text_filter {
if ($hasinline || $hasdisplay || $hasextra) {
$PAGE->requires->yui_module('moodle-filter_mathjaxloader-loader', 'M.filter_mathjaxloader.typeset');
if ($hasextra) {
// If custom dilimeters are used, wrap whole text to prevent autolinking.
$text = '<span class="nolink">' + $text + '</span>';
} else {
if ($hasinline) {
// If the default inline TeX delimiters \( \) are present, wrap each pair in nolink.
$text = preg_replace('/\\\\\\([\S\s]*?\\\\\\)/u',
'<span class="nolink">\0</span>', $text);
}
if ($hasdisplay) {
// If default display TeX is used, wrap $$ $$ or \[ \] individually.
$text = preg_replace('/\$\$[\S\s]*?\$\$|\\\\\\[[\S\s]*?\\\\\\]/u',
'<span class="nolink">\0</span>', $text);
}