@@ -93,7 +93,7 @@ MathParserResult? parseMath(dom.Element element, { required bool block }) {
9393 final parser = _KatexParser ();
9494 try {
9595 nodes = parser.parseKatexHtml (katexHtmlElement);
96- } on KatexHtmlParseError catch (e, st) {
96+ } on _KatexHtmlParseError catch (e, st) {
9797 assert (debugLog ('$e \n $st ' ));
9898 }
9999
@@ -122,7 +122,7 @@ class _KatexParser {
122122 var resultSpans = QueueList <KatexNode >();
123123 for (final node in nodes.reversed) {
124124 if (node is ! dom.Element || node.localName != 'span' ) {
125- throw KatexHtmlParseError ();
125+ throw _KatexHtmlParseError ();
126126 }
127127
128128 final span = _parseSpan (node);
@@ -163,23 +163,23 @@ class _KatexParser {
163163 if (element.className.startsWith ('strut' )) {
164164 if (element.className == 'strut' && element.nodes.isEmpty) {
165165 final styles = _parseSpanInlineStyles (element);
166- if (styles == null ) throw KatexHtmlParseError ();
166+ if (styles == null ) throw _KatexHtmlParseError ();
167167
168168 final heightEm = styles.heightEm;
169- if (heightEm == null ) throw KatexHtmlParseError ();
169+ if (heightEm == null ) throw _KatexHtmlParseError ();
170170 final verticalAlignEm = styles.verticalAlignEm;
171171
172172 // Ensure only `height` and `vertical-align` inline styles are present.
173173 if (styles.filter (heightEm: false , verticalAlignEm: false ) !=
174174 KatexSpanStyles ()) {
175- throw KatexHtmlParseError ();
175+ throw _KatexHtmlParseError ();
176176 }
177177
178178 return KatexStrutNode (
179179 heightEm: heightEm,
180180 verticalAlignEm: verticalAlignEm);
181181 } else {
182- throw KatexHtmlParseError ();
182+ throw _KatexHtmlParseError ();
183183 }
184184 }
185185
@@ -189,10 +189,10 @@ class _KatexParser {
189189 className: 'vlist-t' || 'vlist-t vlist-t2' ,
190190 nodes: [...],
191191 ) && final vlistT) {
192- if (vlistT.attributes.containsKey ('style' )) throw KatexHtmlParseError ();
192+ if (vlistT.attributes.containsKey ('style' )) throw _KatexHtmlParseError ();
193193
194194 final hasTwoVlistR = vlistT.className == 'vlist-t vlist-t2' ;
195- if (! hasTwoVlistR && vlistT.nodes.length != 1 ) throw KatexHtmlParseError ();
195+ if (! hasTwoVlistR && vlistT.nodes.length != 1 ) throw _KatexHtmlParseError ();
196196
197197 if (hasTwoVlistR) {
198198 if (vlistT.nodes case [
@@ -205,14 +205,14 @@ class _KatexParser {
205205 ]) {
206206 // Do nothing.
207207 } else {
208- throw KatexHtmlParseError ();
208+ throw _KatexHtmlParseError ();
209209 }
210210 }
211211
212212 if (vlistT.nodes.first
213213 case dom.Element (localName: 'span' , className: 'vlist-r' ) &&
214214 final vlistR) {
215- if (vlistR.attributes.containsKey ('style' )) throw KatexHtmlParseError ();
215+ if (vlistR.attributes.containsKey ('style' )) throw _KatexHtmlParseError ();
216216
217217 if (vlistR.nodes.first
218218 case dom.Element (localName: 'span' , className: 'vlist' ) &&
@@ -245,7 +245,7 @@ class _KatexParser {
245245 final marginRightEm = styles.marginRightEm;
246246 final marginLeftEm = styles.marginLeftEm;
247247 if (marginRightEm != null && marginRightEm.isNegative) {
248- throw KatexHtmlParseError ();
248+ throw _KatexHtmlParseError ();
249249 }
250250 if (marginLeftEm != null && marginLeftEm.isNegative) {
251251 innerSpanNode = KatexSpanNode (
@@ -263,7 +263,7 @@ class _KatexParser {
263263 debugHtmlNode: kDebugMode ? innerSpan : null ,
264264 node: innerSpanNode));
265265 } else {
266- throw KatexHtmlParseError ();
266+ throw _KatexHtmlParseError ();
267267 }
268268 }
269269
@@ -272,13 +272,13 @@ class _KatexParser {
272272 debugHtmlNode: kDebugMode ? vlistT : null ,
273273 );
274274 } else {
275- throw KatexHtmlParseError ();
275+ throw _KatexHtmlParseError ();
276276 }
277277 } else {
278- throw KatexHtmlParseError ();
278+ throw _KatexHtmlParseError ();
279279 }
280280 } else {
281- throw KatexHtmlParseError ();
281+ throw _KatexHtmlParseError ();
282282 }
283283 }
284284
@@ -288,7 +288,7 @@ class _KatexParser {
288288 if (inlineStyles != null ) {
289289 // We expect `vertical-align` inline style to be only present on a
290290 // `strut` span, for which we emit `KatexStrutNode` separately.
291- if (inlineStyles.verticalAlignEm != null ) throw KatexHtmlParseError ();
291+ if (inlineStyles.verticalAlignEm != null ) throw _KatexHtmlParseError ();
292292 }
293293
294294 // Aggregate the CSS styles that apply, in the same order as the CSS
@@ -320,7 +320,7 @@ class _KatexParser {
320320 // .strut { ... }
321321 // We expect the 'strut' class to be the only class in a span,
322322 // in which case we handle it separately and emit `KatexStrutNode`.
323- throw KatexHtmlParseError ();
323+ throw _KatexHtmlParseError ();
324324
325325 case 'textbf' :
326326 // .textbf { font-weight: bold; }
@@ -454,48 +454,48 @@ class _KatexParser {
454454 case 'fontsize-ensurer' :
455455 // .sizing,
456456 // .fontsize-ensurer { ... }
457- if (index + 2 > spanClasses.length) throw KatexHtmlParseError ();
457+ if (index + 2 > spanClasses.length) throw _KatexHtmlParseError ();
458458 final resetSizeClass = spanClasses[index++ ];
459459 final sizeClass = spanClasses[index++ ];
460460
461461 final resetSizeClassSuffix = _resetSizeClassRegExp.firstMatch (resetSizeClass)? .group (1 );
462- if (resetSizeClassSuffix == null ) throw KatexHtmlParseError ();
462+ if (resetSizeClassSuffix == null ) throw _KatexHtmlParseError ();
463463 final sizeClassSuffix = _sizeClassRegExp.firstMatch (sizeClass)? .group (1 );
464- if (sizeClassSuffix == null ) throw KatexHtmlParseError ();
464+ if (sizeClassSuffix == null ) throw _KatexHtmlParseError ();
465465
466466 const sizes = < double > [0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1 , 1.2 , 1.44 , 1.728 , 2.074 , 2.488 ];
467467
468468 final resetSizeIdx = int .parse (resetSizeClassSuffix, radix: 10 );
469469 final sizeIdx = int .parse (sizeClassSuffix, radix: 10 );
470470
471471 // These indexes start at 1.
472- if (resetSizeIdx > sizes.length) throw KatexHtmlParseError ();
473- if (sizeIdx > sizes.length) throw KatexHtmlParseError ();
472+ if (resetSizeIdx > sizes.length) throw _KatexHtmlParseError ();
473+ if (sizeIdx > sizes.length) throw _KatexHtmlParseError ();
474474 fontSizeEm = sizes[sizeIdx - 1 ] / sizes[resetSizeIdx - 1 ];
475475
476476 case 'delimsizing' :
477477 // .delimsizing { ... }
478- if (index + 1 > spanClasses.length) throw KatexHtmlParseError ();
478+ if (index + 1 > spanClasses.length) throw _KatexHtmlParseError ();
479479 fontFamily = switch (spanClasses[index++ ]) {
480480 'size1' => 'KaTeX_Size1' ,
481481 'size2' => 'KaTeX_Size2' ,
482482 'size3' => 'KaTeX_Size3' ,
483483 'size4' => 'KaTeX_Size4' ,
484484 'mult' =>
485485 // TODO handle nested spans with `.delim-size{1,4}` class.
486- throw KatexHtmlParseError (),
487- _ => throw KatexHtmlParseError (),
486+ throw _KatexHtmlParseError (),
487+ _ => throw _KatexHtmlParseError (),
488488 };
489489
490490 // TODO handle .nulldelimiter and .delimcenter .
491491
492492 case 'op-symbol' :
493493 // .op-symbol { ... }
494- if (index + 1 > spanClasses.length) throw KatexHtmlParseError ();
494+ if (index + 1 > spanClasses.length) throw _KatexHtmlParseError ();
495495 fontFamily = switch (spanClasses[index++ ]) {
496496 'small-op' => 'KaTeX_Size1' ,
497497 'large-op' => 'KaTeX_Size2' ,
498- _ => throw KatexHtmlParseError (),
498+ _ => throw _KatexHtmlParseError (),
499499 };
500500
501501 // TODO handle more classes from katex.scss
@@ -536,7 +536,7 @@ class _KatexParser {
536536 } else {
537537 spans = _parseChildSpans (element.nodes);
538538 }
539- if (text == null && spans == null ) throw KatexHtmlParseError ();
539+ if (text == null && spans == null ) throw _KatexHtmlParseError ();
540540
541541 return KatexSpanNode (
542542 styles: inlineStyles != null
@@ -593,7 +593,7 @@ class _KatexParser {
593593 ' ${expression .toDebugString ()}' ));
594594 _hasError = true ;
595595 } else {
596- throw KatexHtmlParseError ();
596+ throw _KatexHtmlParseError ();
597597 }
598598 }
599599
@@ -605,7 +605,7 @@ class _KatexParser {
605605 marginLeftEm: marginLeftEm,
606606 );
607607 } else {
608- throw KatexHtmlParseError ();
608+ throw _KatexHtmlParseError ();
609609 }
610610 }
611611 return null ;
@@ -753,9 +753,9 @@ class KatexSpanStyles {
753753 }
754754}
755755
756- class KatexHtmlParseError extends Error {
756+ class _KatexHtmlParseError extends Error {
757757 final String ? message;
758- KatexHtmlParseError ([this .message]);
758+ _KatexHtmlParseError ([this .message]);
759759
760760 @override
761761 String toString () {
0 commit comments