Mark top-level math element as having a texError when it is one (to make it easier to recognize)

This commit is contained in:
Davide P. Cervone 2011-05-01 18:44:03 -04:00
parent e23b8b4756
commit c23c21443e
8 changed files with 11 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1708,7 +1708,8 @@
postfilterHooks: MathJax.Callback.Hooks(true), postfilterHooks: MathJax.Callback.Hooks(true),
Translate: function (script) { Translate: function (script) {
var mml, math = script.innerHTML.replace(/^\s+/,"").replace(/\s+$/,""); var mml, isError = false;
var math = script.innerHTML.replace(/^\s+/,"").replace(/\s+$/,"");
var display = var display =
(script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null); (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null);
var data = {math:math, display:display, script:script}; var data = {math:math, display:display, script:script};
@ -1719,9 +1720,11 @@
} catch(err) { } catch(err) {
if (!err.texError) {throw err} if (!err.texError) {throw err}
mml = this.formatError(err,math,display,script); mml = this.formatError(err,math,display,script);
isError = true;
} }
if (mml.inferred) {mml = MML.apply(MathJax.ElementJax,mml.data)} else {mml = MML(mml)} if (mml.inferred) {mml = MML.apply(MathJax.ElementJax,mml.data)} else {mml = MML(mml)}
if (display) {mml.root.display = "block"} if (display) {mml.root.display = "block"}
if (isError) {mml.texError = true}
data.math = mml; this.postfilterHooks.Execute(data); data.math = mml; this.postfilterHooks.Execute(data);
return data.math; return data.math;
}, },