@@ -654,12 +654,15 @@ var AMsymbols = [
654
654
{ input :"vec" , tag :"mover" , output :"\u2192" , tex :null , ttype :UNARY , acc :true } ,
655
655
{ input :"dot" , tag :"mover" , output :"." , tex :null , ttype :UNARY , acc :true } ,
656
656
{ input :"ddot" , tag :"mover" , output :".." , tex :null , ttype :UNARY , acc :true } ,
657
+ { input :"overarc" , tag :"mover" , output :"\u23DC" , tex :"overparen" , ttype :UNARY , acc :true } ,
657
658
{ input :"ul" , tag :"munder" , output :"\u0332" , tex :"underline" , ttype :UNARY , acc :true } ,
658
659
{ input :"ubrace" , tag :"munder" , output :"\u23DF" , tex :"underbrace" , ttype :UNARYUNDEROVER , acc :true } ,
659
660
{ input :"obrace" , tag :"mover" , output :"\u23DE" , tex :"overbrace" , ttype :UNARYUNDEROVER , acc :true } ,
660
661
{ input :"text" , tag :"mtext" , output :"text" , tex :null , ttype :TEXT } ,
661
662
{ input :"mbox" , tag :"mtext" , output :"mbox" , tex :null , ttype :TEXT } ,
662
663
{ input :"color" , tag :"mstyle" , ttype :BINARY } ,
664
+ { input :"id" , tag :"mrow" , ttype :BINARY } ,
665
+ { input :"class" , tag :"mrow" , ttype :BINARY } ,
663
666
{ input :"cancel" , tag :"menclose" , output :"cancel" , tex :null , ttype :UNARY } ,
664
667
AMquote ,
665
668
{ input :"bb" , tag :"mstyle" , atname :"mathvariant" , atval :"bold" , output :"bb" , tex :null , ttype :UNARY } ,
@@ -908,11 +911,11 @@ function AMparseSexpr(str) { //parses str and returns [node,tailstr]
908
911
} else if ( typeof symbol . acc == "boolean" && symbol . acc ) { // accent
909
912
node = createMmlNode ( symbol . tag , result [ 0 ] ) ;
910
913
var accnode = createMmlNode ( "mo" , document . createTextNode ( symbol . output ) ) ;
911
- if ( symbol . input == "vec" && (
912
- ( result [ 0 ] . nodeName == "mrow" && result [ 0 ] . childNodes . length == 1
913
- && result [ 0 ] . firstChild . firstChild . nodeValue !== null
914
+ if ( symbol . input == "vec" && (
915
+ ( result [ 0 ] . nodeName == "mrow" && result [ 0 ] . childNodes . length == 1
916
+ && result [ 0 ] . firstChild . firstChild . nodeValue !== null
914
917
&& result [ 0 ] . firstChild . firstChild . nodeValue . length == 1 ) ||
915
- ( result [ 0 ] . firstChild . nodeValue !== null
918
+ ( result [ 0 ] . firstChild . nodeValue !== null
916
919
&& result [ 0 ] . firstChild . nodeValue . length == 1 ) ) ) {
917
920
accnode . setAttribute ( "stretchy" , false ) ;
918
921
}
@@ -953,14 +956,22 @@ function AMparseSexpr(str) { //parses str and returns [node,tailstr]
953
956
if ( result2 [ 0 ] == null ) return [ createMmlNode ( "mo" ,
954
957
document . createTextNode ( symbol . input ) ) , str ] ;
955
958
AMremoveBrackets ( result2 [ 0 ] ) ;
956
- if ( symbol . input == "color" ) {
957
- if ( str . charAt ( 0 ) == "{" ) i = str . indexOf ( "}" ) ;
958
- else if ( str . charAt ( 0 ) == "(" ) i = str . indexOf ( ")" ) ;
959
- else if ( str . charAt ( 0 ) == "[" ) i = str . indexOf ( "]" ) ;
960
- st = str . slice ( 1 , i ) ;
961
- node = createMmlNode ( symbol . tag , result2 [ 0 ] ) ;
962
- node . setAttribute ( "mathcolor" , st ) ;
963
- return [ node , result2 [ 1 ] ] ;
959
+ if ( [ 'color' , 'class' , 'id' ] . indexOf ( symbol . input ) >= 0 ) {
960
+
961
+ // Get the second argument
962
+ if ( str . charAt ( 0 ) == "{" ) i = str . indexOf ( "}" ) ;
963
+ else if ( str . charAt ( 0 ) == "(" ) i = str . indexOf ( ")" ) ;
964
+ else if ( str . charAt ( 0 ) == "[" ) i = str . indexOf ( "]" ) ;
965
+ st = str . slice ( 1 , i ) ;
966
+
967
+ // Make a mathml node
968
+ node = createMmlNode ( symbol . tag , result2 [ 0 ] ) ;
969
+
970
+ // Set the correct attribute
971
+ if ( symbol . input === "color" ) node . setAttribute ( "mathcolor" , st )
972
+ else if ( symbol . input === "class" ) node . setAttribute ( "class" , st )
973
+ else if ( symbol . input === "id" ) node . setAttribute ( "id" , st )
974
+ return [ node , result2 [ 1 ] ] ;
964
975
}
965
976
if ( symbol . input == "root" || symbol . output == "stackrel" )
966
977
newFrag . appendChild ( result2 [ 0 ] ) ;
0 commit comments