Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b54aeb5
)
MDL-5507 filter_mathjaxloader: Add commeents for regexes
author
Daniel Thies
<dthies@ccal.edu>
Mon, 11 Jul 2016 18:20:41 +0000
(13:20 -0500)
committer
Daniel Thies
<dthies@ccal.edu>
Mon, 11 Jul 2016 18:20:41 +0000
(13:20 -0500)
filter/mathjaxloader/filter.php
patch
|
blob
|
blame
|
history
diff --git
a/filter/mathjaxloader/filter.php
b/filter/mathjaxloader/filter.php
index
88f22bf
..
c5428c8
100644
(file)
--- a/
filter/mathjaxloader/filter.php
+++ b/
filter/mathjaxloader/filter.php
@@
-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 ($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) {
$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) {
$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);
}
$text = preg_replace('/\$\$[\S\s]*?\$\$|\\\\\\[[\S\s]*?\\\\\\]/u',
'<span class="nolink">\0</span>', $text);
}