Make content-mathml extension use proper form for <mn>-n</mn>. Issue #989.

This commit is contained in:
Davide P. Cervone 2016-06-18 09:23:48 -04:00
parent 3d36b7a4ba
commit e7446074c0

View File

@ -190,7 +190,18 @@ MathJax.Extension["MathML/content-mathml"] = (function(HUB) {
*/
appendToken: function(parentNode,name,textContent) {
var element = CToP.createElement(name);
element.appendChild(document.createTextNode(textContent));
if (name === 'mn' && textContent.substr(0,1) === "-") {
//
// use <mrow><mo>&#x2212;</mo><mn>n</mn></mrow> instead of <mn>-n</mn>
//
element.appendChild(document.createTextNode(textContent.substr(1)));
var mrow = CToP.createElement('mrow');
CToP.appendToken(mrow,'mo','\u2212');
mrow.appendChild(element);
element = mrow;
} else {
element.appendChild(document.createTextNode(textContent));
}
parentNode.appendChild(element);
return element;
},