Skip to content

Commit c41a269

Browse files
committed
Add error messages for failed file loads (in case there are errors in extenion names, for example); Don't call resetEquationNumbers if AMSmath hasn't been loaded; Fix a problem with   in MathML for producing speech text; reomve mml from result if not needed after creating speech text.
1 parent 263a2a5 commit c41a269

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/mj-page.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ function ConfigureMathJax() {
209209
MathJax.Hub.Register.MessageHook("TeX Jax - parse error",function (message) {
210210
AddError("TeX parse error",message[1]);
211211
});
212+
MathJax.Hub.Register.MessageHook("file load error",function (message) {
213+
AddError("File load error",message[1]);
214+
});
212215

213216
//
214217
// Set the delays to 0 (we don't need to update the screen)
@@ -545,7 +548,7 @@ function ConfigureTypeset() {
545548
// Reset the MathJax counters for things
546549
//
547550
SVG.resetGlyphs(true);
548-
TEX.resetEquationNumbers();
551+
if (TEX.resetEquationNUmbers) TEX.resetEquationNumbers();
549552
MML.SUPER.ID = 0;
550553

551554
//
@@ -668,7 +671,8 @@ function AdjustMML() {
668671
for (var i = nodes.length-1; i >= 0; i--) {
669672
var math = nodes[i].getElementsByTagName("math")[0]
670673
nodes[i].parentNode.replaceChild(math,nodes[i]);
671-
if (data.speakText) math.setAttribute("alttext",speech.processExpression(math.outerHTML));
674+
var alttext = speech.processExpression(math.outerHTML.replace(/ /g,"\u00A0"));
675+
if (data.speakText) math.setAttribute("alttext",alttext);
672676
}
673677
}
674678
}

lib/mj-single.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ function ConfigureMathJax() {
210210
MathJax.Hub.Register.MessageHook("TeX Jax - parse error",function (message) {
211211
AddError("TeX parse error: "+message[1]);
212212
});
213+
MathJax.Hub.Register.MessageHook("file load error",function (message) {
214+
AddError("File load error: "+message[1]);
215+
});
213216

214217
//
215218
// Set the delays to 0 (we don't need to update the screen)
@@ -433,6 +436,8 @@ function GetSpeech(result) {
433436
jax.root.alttext = result.speakText;
434437
if (jax.root.attrNames) {jax.root.attrNames.push("alttext")}
435438
result.mml = jax.root.toMathML('',jax);
439+
} else {
440+
delete result.mml;
436441
}
437442
}
438443

@@ -613,7 +618,7 @@ function GetState(state) {
613618
state.defs = HTML.Element("defs");
614619
state.n = 0;
615620
}
616-
TEX.resetEquationNumbers();
621+
if (TEX.resetEquationNumbers) TEX.resetEquationNumbers();
617622
MML.SUPER.ID = ID = 0;
618623
}
619624
}

0 commit comments

Comments
 (0)