Merge branch 'issue117' into 1.1a-candidate
This commit is contained in:
commit
17d6686c92
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
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function(){var b="1.1";var a=MathJax.ElementJax.mml;a.mbase.Augment({toMathML:function(k){var g=(this.inferred&&this.parent.inferRow);if(k==null){k=""}var e=this.type,d=this.MathMLattributes();if(e==="mspace"){return k+"<"+e+d+" />"}var j=[];var h=(this.isToken?"":k+(g?"":" "));for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){j.push(this.data[f].toMathML(h))}else{if(!this.isToken){j.push(h+"<mrow />")}}}if(this.isToken){return k+"<"+e+d+">"+j.join("")+"</"+e+">"}if(g){return j.join("\n")}if(j.length===0||(j.length===1&&j[0]==="")){return k+"<"+e+d+" />"}return k+"<"+e+d+">\n"+j.join("\n")+"\n"+k+"</"+e+">"},MathMLattributes:function(){var j=[],g=this.defaults;var c=this.copyAttributes,l=this.skipAttributes;if(this.type==="math"){j.push('xmlns="http://www.w3.org/1998/Math/MathML"')}if(this.type==="mstyle"){g=a.math.prototype.defaults}for(var d in g){if(!l[d]&&g.hasOwnProperty(d)){var e=(d==="open"||d==="close");if(this[d]!=null&&(e||this[d]!==g[d])){var k=this[d];delete this[d];if(e||this.Get(d)!==k){j.push(d+'="'+this.quoteHTML(k)+'"')}this[d]=k}}}for(var h=0,f=c.length;h<f;h++){if(this[c[h]]!=null){j.push(c[h]+'="'+this.quoteHTML(this[c[h]])+'"')}}if(j.length){return" "+j.join(" ")}else{return""}},copyAttributes:["fontfamily","fontsize","fontweight","fontstyle","color","background","id","class","href","style"],skipAttributes:{texClass:1,useHeight:1,texprimestyle:1},quoteHTML:function(e){e=String(e).split("");for(var f=0,d=e.length;f<d;f++){var h=e[f].charCodeAt(0);if(h<32||h>126){e[f]="&#x"+h.toString(16).toUpperCase()+";"}else{var g={"&":"&","<":"<",">":">",'"':"""}[e[f]];if(g){e[f]=g}}}return e.join("")}});a.msubsup.Augment({toMathML:function(h){var e=this.type;if(this.data[this.sup]==null){e="msub"}if(this.data[this.sub]==null){e="msup"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.munderover.Augment({toMathML:function(h){var e=this.type;if(this.data[this.under]==null){e="mover"}if(this.data[this.over]==null){e="munder"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.TeXAtom.Augment({toMathML:function(c){return c+"<mrow>\n"+this.data[0].toMathML(c+" ")+"\n"+c+"</mrow>"}});a.chars.Augment({toMathML:function(c){return(c||"")+this.quoteHTML(this.toString())}});a.entity.Augment({toMathML:function(c){return(c||"")+"&"+this.data[0]+";<!-- "+this.toString()+" -->"}});MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function(){a.TeXmathchoice.Augment({toMathML:function(c){return this.Core().toMathML(c)}})});MathJax.Hub.Startup.signal.Post("toMathML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js");
|
||||
MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function(){var b="1.1";var a=MathJax.ElementJax.mml;a.mbase.Augment({toMathML:function(k){var g=(this.inferred&&this.parent.inferRow);if(k==null){k=""}var e=this.type,d=this.MathMLattributes();if(e==="mspace"){return k+"<"+e+d+" />"}var j=[];var h=(this.isToken?"":k+(g?"":" "));for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){j.push(this.data[f].toMathML(h))}else{if(!this.isToken){j.push(h+"<mrow />")}}}if(this.isToken){return k+"<"+e+d+">"+j.join("")+"</"+e+">"}if(g){return j.join("\n")}if(j.length===0||(j.length===1&&j[0]==="")){return k+"<"+e+d+" />"}return k+"<"+e+d+">\n"+j.join("\n")+"\n"+k+"</"+e+">"},MathMLattributes:function(){var j=[],g=this.defaults;var c=this.copyAttributes,l=this.skipAttributes;if(this.type==="math"){j.push('xmlns="http://www.w3.org/1998/Math/MathML"')}if(this.type==="mstyle"){g=a.math.prototype.defaults}for(var d in g){if(!l[d]&&g.hasOwnProperty(d)){var e=(d==="open"||d==="close");if(this[d]!=null&&(e||this[d]!==g[d])){var k=this[d];delete this[d];if(e||this.Get(d)!==k){j.push(d+'="'+this.quoteHTML(k)+'"')}this[d]=k}}}for(var h=0,f=c.length;h<f;h++){if(this[c[h]]!=null){j.push(c[h]+'="'+this.quoteHTML(this[c[h]])+'"')}}if(j.length){return" "+j.join(" ")}else{return""}},copyAttributes:["fontfamily","fontsize","fontweight","fontstyle","color","background","id","class","href","style"],skipAttributes:{texClass:1,useHeight:1,texprimestyle:1},quoteHTML:function(e){e=String(e).split("");for(var f=0,d=e.length;f<d;f++){var h=e[f].charCodeAt(0);if(h<32||h>126){e[f]="&#x"+h.toString(16).toUpperCase()+";"}else{var g={"&":"&","<":"<",">":">",'"':"""}[e[f]];if(g){e[f]=g}}}return e.join("")}});a.msubsup.Augment({toMathML:function(h){var e=this.type;if(this.data[this.sup]==null){e="msub"}if(this.data[this.sub]==null){e="msup"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.munderover.Augment({toMathML:function(h){var e=this.type;if(this.data[this.under]==null){e="mover"}if(this.data[this.over]==null){e="munder"}var d=this.MathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.TeXAtom.Augment({toMathML:function(c){return c+"<mrow>\n"+this.data[0].toMathML(c+" ")+"\n"+c+"</mrow>"}});a.chars.Augment({toMathML:function(c){return(c||"")+this.quoteHTML(this.toString())}});a.entity.Augment({toMathML:function(c){return(c||"")+"&"+this.data[0]+";<!-- "+this.toString()+" -->"}});a.xml.Augment({toMathML:function(c){return(c||"")+this.toString()}});MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function(){a.TeXmathchoice.Augment({toMathML:function(c){return this.Core().toMathML(c)}})});MathJax.Hub.Startup.signal.Post("toMathML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
16
jax/output/HTML-CSS/autoload/annotation-xml.js
Normal file
16
jax/output/HTML-CSS/autoload/annotation-xml.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* /MathJax/jax/output/HTML-CSS/autoload/annotation-xml.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var c="1.1";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a["annotation-xml"].Augment({toHTML:function(f){f=this.HTMLhandleSize(this.HTMLcreateSpan(f));var g=this.Get("encoding");for(var e=0,d=this.data.length;e<d;e++){this.data[e].toHTML(f,g)}this.HTMLhandleSpace(f);this.HTMLhandleColor(f);return f},HTMLgetScale:function(){return this.SUPER(arguments).HTMLgetScale.call(this)*(100/b.scale)}});a.xml.Augment({toHTML:function(f,g){for(var e=0,d=this.data.length;e<d;e++){f.appendChild(this.data[e].cloneNode(true))}f.bbox.w=b.getW(f);f.bbox.rw=f.bbox.w;var h=b.getHD(f);f.bbox.h=h.h;f.bbox.d=h.d}});MathJax.Hub.Startup.signal.Post("HTML-CSS annotation-xml Ready");MathJax.Ajax.loadComplete(b.autoloadDir+"/annotation-xml.js")});
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -132,6 +132,10 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
|
|||
toMathML: function (space) {return (space||"") + "&"+this.data[0]+";<!-- "+this.toString()+" -->"}
|
||||
});
|
||||
|
||||
MML.xml.Augment({
|
||||
toMathML: function (space) {return (space||"") + this.toString()}
|
||||
});
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function () {
|
||||
MML.TeXmathchoice.Augment({
|
||||
toMathML: function (space) {return this.Core().toMathML(space)}
|
||||
|
|
|
@ -1175,6 +1175,22 @@ MathJax.ElementJax.mml.Augment({
|
|||
}
|
||||
});
|
||||
|
||||
MML.xml = MML.mbase.Subclass({
|
||||
type: "xml",
|
||||
Init: function () {
|
||||
this.div = document.createElement("div");
|
||||
return this.SUPER(arguments).Init.apply(this,arguments);
|
||||
},
|
||||
Append: function () {
|
||||
for (var i = 0, m = arguments.length; i < m; i++) {
|
||||
this.data.push(arguments[i]);
|
||||
this.div.appendChild(document.importNode(arguments[i],true));
|
||||
}
|
||||
},
|
||||
value: function () {return this.div},
|
||||
toString: function () {return this.div.innerHTML}
|
||||
});
|
||||
|
||||
MML.TeXAtom = MML.mbase.Subclass({
|
||||
type: "texatom",
|
||||
inferRow: TRUE,
|
||||
|
|
|
@ -82,6 +82,8 @@
|
|||
} else if (child.nodeValue.match(/\S/)) {
|
||||
MATHML.Error("Unexpected text node: '"+child.nodeValue+"'");
|
||||
}
|
||||
} else if (mml.type === "annotation-xml") {
|
||||
mml.Append(MML.xml(child));
|
||||
} else {
|
||||
var cmml = this.MakeMML(child); mml.Append(cmml);
|
||||
if (cmml.mmlSelfClosing && cmml.data.length)
|
||||
|
|
58
unpacked/jax/output/HTML-CSS/autoload/annotation-xml.js
Normal file
58
unpacked/jax/output/HTML-CSS/autoload/annotation-xml.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*************************************************************
|
||||
*
|
||||
* MathJax/jax/output/HTML-CSS/autoload/annotation-xm;l.js
|
||||
*
|
||||
* Implements the HTML-CSS output for <annotation-xml> elements.
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2011 Design Science, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||
var VERSION = "1.1";
|
||||
var MML = MathJax.ElementJax.mml,
|
||||
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
|
||||
|
||||
MML["annotation-xml"].Augment({
|
||||
toHTML: function (span) {
|
||||
span = this.HTMLhandleSize(this.HTMLcreateSpan(span));
|
||||
var encoding = this.Get("encoding");
|
||||
for (var i = 0, m = this.data.length; i < m; i++)
|
||||
{this.data[i].toHTML(span,encoding)}
|
||||
this.HTMLhandleSpace(span);
|
||||
this.HTMLhandleColor(span);
|
||||
return span;
|
||||
},
|
||||
HTMLgetScale: function () {
|
||||
return this.SUPER(arguments).HTMLgetScale.call(this) * (100/HTMLCSS.scale)
|
||||
}
|
||||
});
|
||||
|
||||
MML.xml.Augment({
|
||||
toHTML: function (span,encoding) {
|
||||
for (var i = 0, m = this.data.length; i < m; i++)
|
||||
{span.appendChild(this.data[i].cloneNode(true))}
|
||||
span.bbox.w = HTMLCSS.getW(span); span.bbox.rw = span.bbox.w;
|
||||
var HD = HTMLCSS.getHD(span);
|
||||
span.bbox.h = HD.h; span.bbox.d = HD.d;
|
||||
}
|
||||
});
|
||||
|
||||
MathJax.Hub.Startup.signal.Post("HTML-CSS annotation-xml Ready");
|
||||
MathJax.Ajax.loadComplete(HTMLCSS.autoloadDir+"/annotation-xml.js");
|
||||
|
||||
});
|
||||
|
|
@ -487,12 +487,12 @@
|
|||
this.HDMspan.className = "MathJax"; this.HDMspan.id = "MathJax_getScales";
|
||||
this.HDMimg.style.width = "60em";
|
||||
var em = this.outerEm = this.HDMspan.offsetWidth/60;
|
||||
var scale = Math.floor(Math.max(this.config.minScaleAdjust/100,(ex/this.TeX.x_height)/em) * this.config.scale);
|
||||
span.style.fontSize = this.HDMspan.style.fontSize = scale+"%";
|
||||
this.scale = Math.floor(Math.max(this.config.minScaleAdjust/100,(ex/this.TeX.x_height)/em) * this.config.scale);
|
||||
span.style.fontSize = this.HDMspan.style.fontSize = this.scale+"%";
|
||||
this.em = MML.mbase.prototype.em = this.HDMspan.offsetWidth/60;
|
||||
if (this.operaFontSizeBug && em === this.em && scale !== 100) {
|
||||
if (this.operaFontSizeBug && em === this.em && this.scale !== 100) {
|
||||
// Opera 10.61 doesn't seem to process the fontSize setting above, so adjust manually
|
||||
this.em = MML.mbase.prototype.em = em * scale/100;
|
||||
this.em = MML.mbase.prototype.em = em * this.scale/100;
|
||||
}
|
||||
span.parentNode.removeChild(this.HDMspan);
|
||||
this.msieMarginScale = this.getMarginScale(span);
|
||||
|
@ -2033,7 +2033,9 @@
|
|||
MML.mmultiscripts.Augment({toHTML: MML.mbase.HTMLautoload});
|
||||
|
||||
MML.mtable.Augment({toHTML: MML.mbase.HTMLautoload});
|
||||
|
||||
|
||||
MML["annotation-xml"].Augment({toHTML: MML.mbase.HTMLautoload});
|
||||
|
||||
MML.math.Augment({
|
||||
toHTML: function (span,node) {
|
||||
var alttext = this.Get("alttext"); if (alttext) {node.setAttribute("aria-label",alttext)}
|
||||
|
|
|
@ -442,6 +442,16 @@
|
|||
parent.appendChild(document.createTextNode(this.toString()));
|
||||
}
|
||||
});
|
||||
|
||||
MML.xml.Augment({
|
||||
//
|
||||
// Insert the XML verbatim
|
||||
//
|
||||
toNativeMML: function (parent) {
|
||||
for (var i = 0, m = this.data.length; i < m; i++)
|
||||
{parent.appendChild(this.data[i].cloneNode(true))}
|
||||
}
|
||||
});
|
||||
|
||||
HUB.Register.StartupHook("TeX mathchoice Ready",function () {
|
||||
MML.TeXmathchoice.Augment({
|
||||
|
|
Loading…
Reference in New Issue
Block a user