www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a314139f597a98f1857ec627e08697e665e820d4
parent 54007abc60ab8d6d945404c3e1d5e859f669cd93
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Thu, 29 May 2014 11:56:07 -0400

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

Diffstat:
Munpacked/jax/input/AsciiMath/jax.js | 1+
Munpacked/jax/input/TeX/jax.js | 2+-
Munpacked/jax/output/NativeMML/jax.js | 19+++++++++++++++----
3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/unpacked/jax/input/AsciiMath/jax.js b/unpacked/jax/input/AsciiMath/jax.js @@ -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 diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.js @@ -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); diff --git a/unpacked/jax/output/NativeMML/jax.js b/unpacked/jax/output/NativeMML/jax.js @@ -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) {