mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-5507 filter_mathjaxloader: Add commeents for regexes
This commit is contained in:
parent
b54aeb5f83
commit
fa3f814792
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user