@@ -115,6 +115,51 @@ String _parseMathRecursive(dom.Node node, String parsed) {
115115 }
116116 parsed = '$parsed & ' ;
117117 }
118+ if (node.localName == "mmultiscripts" ) {
119+ String base = _parseMathRecursive (nodeList[0 ], "" );
120+ String preSubScripts = "" ;
121+ String preSuperScripts = "" ;
122+ String postSubScripts = "" ;
123+ String postSuperScripts = "" ;
124+ bool isPostScripts = true ;
125+ bool isSubScripts = true ;
126+ for (var element in nodeList.skip (1 )) {
127+ if (element.localName == "mprescripts" ) {
128+ isPostScripts = false ;
129+ isSubScripts = true ;
130+ continue ;
131+ }
132+
133+ if (isPostScripts) {
134+ if (isSubScripts) {
135+ postSubScripts = _parseMathRecursive (element, postSubScripts);
136+ } else {
137+ postSuperScripts = _parseMathRecursive (element, postSuperScripts);
138+ }
139+ } else {
140+ if (isSubScripts) {
141+ preSubScripts = _parseMathRecursive (element, preSubScripts);
142+ } else {
143+ preSuperScripts = _parseMathRecursive (element, preSuperScripts);
144+ }
145+ }
146+ isSubScripts = ! isSubScripts;
147+ }
148+ if (preSubScripts.isNotEmpty) {
149+ preSubScripts = "_$preSubScripts " ;
150+ }
151+ if (preSuperScripts.isNotEmpty) {
152+ preSuperScripts = "^$preSuperScripts " ;
153+ }
154+ if (postSubScripts.isNotEmpty) {
155+ postSubScripts = "_$postSubScripts " ;
156+ }
157+ if (postSuperScripts.isNotEmpty) {
158+ postSuperScripts = "^$postSuperScripts " ;
159+ }
160+ parsed =
161+ "$parsed {}$preSubScripts $preSuperScripts $base $postSubScripts $postSuperScripts " ;
162+ }
118163 }
119164 return parsed;
120165}
0 commit comments