mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 12:19:46 -04:00
Cleanup and extra TeX punctuation
Former-commit-id: 5a50f5c57f835f912a046c10fab9afec3887d7c4 [formerly a900ed00b9d5df564f31e06c663b971c57efc6e5] Former-commit-id: b1bb8ba7740d2cbf6ce03107386b5c74d4fba4ad
This commit is contained in:
parent
7f769ff06e
commit
cf2ba65f5a
@ -1691,7 +1691,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
|
||||
//TESTING - find out whether document contains MathSVGs
|
||||
//Replace inline Math TeX with dummy images
|
||||
if (params.useMathJax) htmlArticle = htmlArticle.replace(/\$\$?((?:[^$<>]|<\s|\s>)+)\$\$?([\s<.,;:?!])/g, '<img alt="$1" class="mwe-math-fallback-image" />$2');
|
||||
if (params.useMathJax) htmlArticle = htmlArticle.replace(/\$\$?((?:[^$<>]|<\s|\s>)+)\$\$?([\s<.,;:?!'"])/g, '<img alt="$1" class="mwe-math-fallback-image" />$2');
|
||||
var containsMathSVG = /alt\s*=\s*['"][^'"]+['"][^>]+mwe-math-fallback-image|mwe-math-fallback-image[^>]+alt\s*=\s*['"][^'"]+['"]/i.test(htmlArticle);
|
||||
|
||||
//Preload stylesheets [kiwix-js @149]
|
||||
@ -1898,17 +1898,12 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
|
||||
$('#articleContent').contents().find('head').append("<base href='" + baseUrl + "'>");
|
||||
|
||||
//Load MathJax if required and if not already loaded
|
||||
//if (containsMathSVG || containsMathTeX) {
|
||||
if (containsMathSVG) {
|
||||
if (params.useMathJax && !window.frames[0].MathJax) {
|
||||
var doc = $("#articleContent").contents()[0];
|
||||
var script = doc.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.src = "/www/js/MathJax/MathJax.js?config=TeX-AMS_HTML-full";
|
||||
//if (containsMathTeX) script.innerHTML = "MathJax.Hub.Config({\n" +
|
||||
// "tex2jax: { inlineMath: [['$','$'], ['\\\\(','\\\\)']] }\n" +
|
||||
// "});\n" +
|
||||
// "MathJax.Hub.Queue(['Typeset', MathJax.Hub]);";
|
||||
doc.head.appendChild(script);
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ var versionDivs = document.getElementsByClassName('fileVersion');
|
||||
for (var i = 0; i < versionDivs.length; i++) {
|
||||
versionDivs[i].innerHTML = i ? params.fileVersion.replace(/\s+.+$/, "") : params['fileVersion'];
|
||||
}
|
||||
if (!params.showFileSelectors && params.packagedFile && params.storedFile && (params.storedFile != params.packagedFile)) {
|
||||
if (!params.showFileSelectors && params.packagedFile && params.storedFile && params.storedFile != params.packagedFile) {
|
||||
var currentArchive = document.getElementById('currentArchive');
|
||||
if (currentArchive) {
|
||||
currentArchive.innerHTML = "Currently loaded archive: <b>" + params.storedFile.replace(/\.zim$/i, "") + "</b>";
|
||||
|
Loading…
x
Reference in New Issue
Block a user