@@ -654,12 +654,15 @@ var AMsymbols = [
654654{ input :"vec" , tag :"mover" , output :"\u2192" , tex :null , ttype :UNARY , acc :true } ,
655655{ input :"dot" , tag :"mover" , output :"." , tex :null , ttype :UNARY , acc :true } ,
656656{ input :"ddot" , tag :"mover" , output :".." , tex :null , ttype :UNARY , acc :true } ,
657+ { input :"overarc" , tag :"mover" , output :"\u23DC" , tex :"overparen" , ttype :UNARY , acc :true } ,
657658{ input :"ul" , tag :"munder" , output :"\u0332" , tex :"underline" , ttype :UNARY , acc :true } ,
658659{ input :"ubrace" , tag :"munder" , output :"\u23DF" , tex :"underbrace" , ttype :UNARYUNDEROVER , acc :true } ,
659660{ input :"obrace" , tag :"mover" , output :"\u23DE" , tex :"overbrace" , ttype :UNARYUNDEROVER , acc :true } ,
660661{ input :"text" , tag :"mtext" , output :"text" , tex :null , ttype :TEXT } ,
661662{ input :"mbox" , tag :"mtext" , output :"mbox" , tex :null , ttype :TEXT } ,
662663{ input :"color" , tag :"mstyle" , ttype :BINARY } ,
664+ { input :"id" , tag :"mrow" , ttype :BINARY } ,
665+ { input :"class" , tag :"mrow" , ttype :BINARY } ,
663666{ input :"cancel" , tag :"menclose" , output :"cancel" , tex :null , ttype :UNARY } ,
664667AMquote ,
665668{ 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]
908911 } else if ( typeof symbol . acc == "boolean" && symbol . acc ) { // accent
909912 node = createMmlNode ( symbol . tag , result [ 0 ] ) ;
910913 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
914917 && result [ 0 ] . firstChild . firstChild . nodeValue . length == 1 ) ||
915- ( result [ 0 ] . firstChild . nodeValue !== null
918+ ( result [ 0 ] . firstChild . nodeValue !== null
916919 && result [ 0 ] . firstChild . nodeValue . length == 1 ) ) ) {
917920 accnode . setAttribute ( "stretchy" , false ) ;
918921 }
@@ -953,14 +956,22 @@ function AMparseSexpr(str) { //parses str and returns [node,tailstr]
953956 if ( result2 [ 0 ] == null ) return [ createMmlNode ( "mo" ,
954957 document . createTextNode ( symbol . input ) ) , str ] ;
955958 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 ] ] ;
964975 }
965976 if ( symbol . input == "root" || symbol . output == "stackrel" )
966977 newFrag . appendChild ( result2 [ 0 ] ) ;
0 commit comments