File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,11 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
89
89
{ HD = HD . replace ( / / g, "" ) . split ( / , / ) ; font = this . GetBrackets ( name ) }
90
90
else { font = HD ; HD = null }
91
91
}
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 ( / ^ 0 x / , "x" ) ;
93
+ if ( ! n . match ( / ^ ( x [ 0 - 9 A - F a - 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 ) ;
94
97
if ( ! UNICODE [ N ] ) { UNICODE [ N ] = [ 800 , 200 , font , N ] }
95
98
else if ( ! font ) { font = UNICODE [ N ] [ 2 ] }
96
99
if ( HD ) {
@@ -101,7 +104,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
101
104
if ( font ) {
102
105
UNICODE [ N ] [ 2 ] = def . fontfamily = font . replace ( / " / g, "'" ) ;
103
106
if ( variant ) {
104
- if ( variant . match ( / b o l d / ) ) { def . fontweight = "bold" }
107
+ if ( variant . match ( / b o l d / ) ) { def . fontweight = "bold" }
105
108
if ( variant . match ( / i t a l i c | - m a t h i t / ) ) { def . fontstyle = "italic" }
106
109
}
107
110
} else if ( variant ) { def . mathvariant = variant }
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
86
86
if ( this . mathvariant && this . toMathMLvariants [ this . mathvariant ] )
87
87
{ CLASS . push ( "MJX" + this . mathvariant ) }
88
88
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 ( " " ) ) + '"' ) }
90
90
} ,
91
91
toMathMLattribute : function ( value ) {
92
92
if ( typeof ( value ) === "string" &&
@@ -165,7 +165,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
165
165
var xmlEscapedTex = jax . originalText . replace ( / [ & < > ] / g, function ( item ) {
166
166
return { '>' : '>' , '<' : '<' , '&' : '&' } [ item ]
167
167
} ) ;
168
- data . push ( space + ' <annotation encoding="' + annotation + '">' + xmlEscapedTex + "</annotation>" ) ;
168
+ data . push ( space + ' <annotation encoding="' + this . toMathMLquote ( annotation ) + '">' + xmlEscapedTex + "</annotation>" ) ;
169
169
data . push ( space + " </semantics>" ) ;
170
170
}
171
171
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 () {
221
221
} ) ;
222
222
223
223
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 ( ) + " -->" }
225
225
} ) ;
226
226
227
227
MML . xml . Augment ( {
You can’t perform that action at this time.
0 commit comments