Skip to content

Commit eb61c8b

Browse files
committed
Merge branch 'fix-html' into develop
2 parents b85343a + a55da39 commit eb61c8b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

unpacked/extensions/TeX/unicode.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
8989
{HD = HD.replace(/ /g,"").split(/,/); font = this.GetBrackets(name)}
9090
else {font = HD; HD = null}
9191
}
92-
var n = this.trimSpaces(this.GetArgument(name)),
93-
N = parseInt(n.match(/^x/) ? "0"+n : n);
92+
var n = this.trimSpaces(this.GetArgument(name)).replace(/^0x/,"x");
93+
if (!n.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/)) {
94+
TEX.Error(["BadUnicode","Argument to \\unicode must be a number"]);
95+
}
96+
var N = parseInt(n.match(/^x/) ? "0"+n : n);
9497
if (!UNICODE[N]) {UNICODE[N] = [800,200,font,N]}
9598
else if (!font) {font = UNICODE[N][2]}
9699
if (HD) {
@@ -101,7 +104,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
101104
if (font) {
102105
UNICODE[N][2] = def.fontfamily = font.replace(/"/g,"'");
103106
if (variant) {
104-
if (variant.match(/bold/)) {def.fontweight = "bold"}
107+
if (variant.match(/bold/)) {def.fontweight = "bold"}
105108
if (variant.match(/italic|-mathit/)) {def.fontstyle = "italic"}
106109
}
107110
} else if (variant) {def.mathvariant = variant}

unpacked/extensions/toMathML.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
8686
if (this.mathvariant && this.toMathMLvariants[this.mathvariant])
8787
{CLASS.push("MJX"+this.mathvariant)}
8888
if (this.variantForm) {CLASS.push("MJX-variant")}
89-
if (CLASS.length) {attr.unshift('class="'+CLASS.join(" ")+'"')}
89+
if (CLASS.length) {attr.unshift('class="'+this.toMathMLquote(CLASS.join(" "))+'"')}
9090
},
9191
toMathMLattribute: function (value) {
9292
if (typeof(value) === "string" &&
@@ -165,7 +165,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
165165
var xmlEscapedTex = jax.originalText.replace(/[&<>]/g, function(item) {
166166
return { '>': '&gt;', '<': '&lt;','&': '&amp;' }[item]
167167
});
168-
data.push(space+' <annotation encoding="'+annotation+'">'+xmlEscapedTex+"</annotation>");
168+
data.push(space+' <annotation encoding="'+this.toMathMLquote(annotation)+'">'+xmlEscapedTex+"</annotation>");
169169
data.push(space+" </semantics>");
170170
}
171171
return space+"<"+tag+attr+">\n"+data.join("\n")+"\n"+space+"</"+tag+">";
@@ -221,7 +221,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
221221
});
222222

223223
MML.entity.Augment({
224-
toMathML: function (space) {return (space||"") + "&"+this.data[0]+";<!-- "+this.toString()+" -->"}
224+
toMathML: function (space) {return (space||"") + "&"+this.toMathMLquote(this.data[0])+";<!-- "+this.toString()+" -->"}
225225
});
226226

227227
MML.xml.Augment({

0 commit comments

Comments
 (0)