Skip to content
Snippets Groups Projects
Commit a55291e2 authored by Elke Kreim's avatar Elke Kreim
Browse files

Fix remote url for MathJax

Use local MathJax configured in filter_mathjaxloader
parent d742b5d2
No related branches found
No related tags found
No related merge requests found
...@@ -189,9 +189,28 @@ function stack_cors_link(string $filename): string { ...@@ -189,9 +189,28 @@ function stack_cors_link(string $filename): string {
* Gets the URL used for MathJax, might be VLE local. * Gets the URL used for MathJax, might be VLE local.
*/ */
function stack_get_mathjax_url(): string { function stack_get_mathjax_url(): string {
// TODO: figure out how to support VLE local with CORS. // HSH patch - 2024.05.31: Elke Kreim - elke.kreim@hs-hannover.de
// include fix https://github.com/maths/moodle-qtype_stack/pull/1194/files
// to use local installation of MathHax configured in plugin filter_mathjaxloader
$mathjaxconfigurl = get_config('filter_mathjaxloader', 'httpsurl');
if ($mathjaxconfigurl) {
$questionpos = strpos($mathjaxconfigurl, '?');
if ($questionpos !== false) {
$querystring = substr($mathjaxconfigurl, $questionpos + 1);
$urlstring = substr($mathjaxconfigurl, 0, $questionpos);
parse_str($querystring, $queryparams);
$queryparams = array_merge(['config' => 'TeX-AMS-MML_HTMLorMML'], $queryparams);
$querystring = http_build_query($queryparams, null, '&', PHP_QUERY_RFC3986);
$url = $urlstring . '?' . $querystring;
} else {
$url = $mathjaxconfigurl . '?config=TeX-AMS-MML_HTMLorMML';
}
return $url;
} else {
return 'https://cdn.jsdelivr.net/npm/mathjax@2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; return 'https://cdn.jsdelivr.net/npm/mathjax@2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
} }
}
/* /*
* Gets the url for MathJax 3. * Gets the url for MathJax 3.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment