Merge branch 'issue814' into v2.4-beta. Issue #814.

This commit is contained in:
Davide P. Cervone 2014-05-29 11:56:07 -04:00
commit a314139f59
3 changed files with 17 additions and 5 deletions

View File

@ -1276,6 +1276,7 @@ junk = null;
ASCIIMATH.Augment({
sourceMenuTitle: /*_(MathMenu)*/ ["AsciiMathInput","AsciiMath Input"],
annotationEncoding: "text/x-asciimath",
prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing AsciiMath
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing AsciiMath

View File

@ -2061,6 +2061,7 @@
},
sourceMenuTitle: /*_(MathMenu)*/ ["TeXCommands","TeX Commands"],
annotationEncoding: "application/x-tex",
prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing TeX
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing TeX
@ -2087,7 +2088,6 @@
this.prefilterHooks.Execute(data); math = data.math;
try {
mml = TEX.Parse(math).mml();
// mml = MML.semantics(mml,MML.annotation(math).With({encoding:"application/x-tex"}));
} catch(err) {
if (!err.texError) {throw err}
mml = this.formatError(err,math,display,script);

View File

@ -300,7 +300,7 @@
//
// Convert to MathML (if restarted, remove any partial math)
//
try {math.toNativeMML(mspan)} catch (err) {
try {math.toNativeMML(mspan,jax)} catch (err) {
if (err.restart) {while (mspan.firstChild) {mspan.removeChild(mspan.firstChild)}}
throw err;
}
@ -916,8 +916,9 @@
}
MML.math.Augment({
toNativeMML: function (parent) {
var tag = this.NativeMMLelement(this.type), math = tag, jax;
toNativeMML: function (parent,jax) {
var tag = this.NativeMMLelement(this.type), math = tag;
var annotate = (jax ? MathJax.InputJax[jax.inputJax].annotationEncoding : null);
var i, m;
nMML.adjustWidths = [];
//
@ -931,6 +932,17 @@
//
if (nMML.widthBug) {tag = tag.appendChild(this.NativeMMLelement("mrow"))}
//
// Addannotation if the input jax provides an annotation encoding
//
if (annotate) {
tag = tag.appendChild(this.NativeMMLelement("semantics"))
tag.appendChild(this.NativeMMLelement("mrow"));
var annotation = tag.appendChild(this.NativeMMLelement("annotation"));
annotation.appendChild(document.createTextNode(jax.originalText));
annotation.setAttribute("encoding",annotate);
tag = tag.firstChild; // mrow
}
//
// Add the children
//
for (i = 0, m = this.data.length; i < m; i++) {
@ -976,7 +988,6 @@
//
// Save size for later when we check if Web fonts have arrived
//
jax = HUB.getJaxFor(parent);
if (jax) {jax.NativeMML.scrollWidth = math.firstChild.scrollWidth}
}
if (nMML.adjustWidths.length) {