Skip to content

Commit 64cbe85

Browse files
committed
katex [nfc]: Small further simplifications in CSS-class logic
1 parent 1f7cdd5 commit 64cbe85

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/model/katex.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@ class _KatexParser {
300300
case 'delimsizing':
301301
// .delimsizing { ... }
302302
if (index + 1 > spanClasses.length) throw KatexHtmlParseError();
303-
final nextClass = spanClasses[index++];
304-
switch (nextClass) {
303+
switch (spanClasses[index++]) {
305304
case 'size1':
306305
styles.fontFamily = 'KaTeX_Size1';
307306
case 'size2':
@@ -313,24 +312,25 @@ class _KatexParser {
313312

314313
case 'mult':
315314
// TODO handle nested spans with `.delim-size{1,4}` class.
316-
break;
317-
}
315+
throw KatexHtmlParseError();
318316

319-
if (styles.fontFamily == null) throw KatexHtmlParseError();
317+
default:
318+
throw KatexHtmlParseError();
319+
}
320320

321321
// TODO handle .nulldelimiter and .delimcenter .
322322

323323
case 'op-symbol':
324324
// .op-symbol { ... }
325325
if (index + 1 > spanClasses.length) throw KatexHtmlParseError();
326-
final nextClass = spanClasses[index++];
327-
switch (nextClass) {
326+
switch (spanClasses[index++]) {
328327
case 'small-op':
329328
styles.fontFamily = 'KaTeX_Size1';
330329
case 'large-op':
331330
styles.fontFamily = 'KaTeX_Size2';
331+
default:
332+
throw KatexHtmlParseError();
332333
}
333-
if (styles.fontFamily == null) throw KatexHtmlParseError();
334334

335335
// TODO handle more classes from katex.scss
336336

0 commit comments

Comments
 (0)