From 685730475317db0fcbdb486162b628434d39cbcf Mon Sep 17 00:00:00 2001 From: Daniel Thies Date: Thu, 7 Jul 2016 18:58:15 -0500 Subject: [PATCH] MDL-55007 filter_mathjaxloader: Wrap nolink around each expresssion --- filter/mathjaxloader/filter.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/filter/mathjaxloader/filter.php b/filter/mathjaxloader/filter.php index 3726c95dd45..88f22bfef26 100644 --- a/filter/mathjaxloader/filter.php +++ b/filter/mathjaxloader/filter.php @@ -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 '' . $text . ''; + if ($hasextra) { + $text = '' + $text + ''; + } else { + if ($hasinline) { + $text = preg_replace('/\\\\\\([\S\s]*?\\\\\\)/u', + '\0', $text); + } + if ($hasdisplay) { + $text = preg_replace('/\$\$[\S\s]*?\$\$|\\\\\\[[\S\s]*?\\\\\\]/u', + '\0', $text); + } + } + return '' . $text . ''; } return $text; }