@@ -150,33 +150,28 @@ class _KatexParser {
150
150
var index = 0 ;
151
151
while (index < spanClasses.length) {
152
152
final spanClass = spanClasses[index++ ];
153
- var classFound = false ;
154
-
155
153
switch (spanClass) {
156
154
case 'base' :
157
155
// .base { ... }
158
156
// Do nothing, it has properties that don't need special handling.
159
- classFound = true ;
157
+ break ;
160
158
161
159
case 'strut' :
162
160
// .strut { ... }
163
161
// Do nothing, it has properties that don't need special handling.
164
- classFound = true ;
162
+ break ;
165
163
166
164
case 'textbf' :
167
165
// .textbf { font-weight: bold; }
168
166
styles.fontWeight = KatexSpanFontWeight .bold;
169
- classFound = true ;
170
167
171
168
case 'textit' :
172
169
// .textit { font-style: italic; }
173
170
styles.fontStyle = KatexSpanFontStyle .italic;
174
- classFound = true ;
175
171
176
172
case 'textrm' :
177
173
// .textrm { font-family: KaTeX_Main; }
178
174
styles.fontFamily = 'KaTeX_Main' ;
179
- classFound = true ;
180
175
181
176
// case 'textsf':
182
177
// // .textsf { font-family: KaTeX_SansSerif; }
@@ -186,96 +181,81 @@ class _KatexParser {
186
181
case 'texttt' :
187
182
// .texttt { font-family: KaTeX_Typewriter; }
188
183
styles.fontFamily = 'KaTeX_Typewriter' ;
189
- classFound = true ;
190
184
191
185
case 'mathnormal' :
192
186
// .mathnormal { font-family: KaTeX_Math; font-style: italic; }
193
187
styles.fontFamily = 'KaTeX_Math' ;
194
188
styles.fontStyle = KatexSpanFontStyle .italic;
195
- classFound = true ;
196
189
197
190
case 'mathit' :
198
191
// .mathit { font-family: KaTeX_Main; font-style: italic; }
199
192
styles.fontFamily = 'KaTeX_Main' ;
200
193
styles.fontStyle = KatexSpanFontStyle .italic;
201
- classFound = true ;
202
194
203
195
case 'mathrm' :
204
196
// .mathrm { font-style: normal; }
205
197
styles.fontStyle = KatexSpanFontStyle .normal;
206
- classFound = true ;
207
198
208
199
case 'mathbf' :
209
200
// .mathbf { font-family: KaTeX_Main; font-weight: bold; }
210
201
styles.fontFamily = 'KaTeX_Main' ;
211
202
styles.fontWeight = KatexSpanFontWeight .bold;
212
- classFound = true ;
213
203
214
204
case 'boldsymbol' :
215
205
// .boldsymbol { font-family: KaTeX_Math; font-weight: bold; font-style: italic; }
216
206
styles.fontFamily = 'KaTeX_Math' ;
217
207
styles.fontWeight = KatexSpanFontWeight .bold;
218
208
styles.fontStyle = KatexSpanFontStyle .italic;
219
- classFound = true ;
220
209
221
210
case 'amsrm' :
222
211
// .amsrm { font-family: KaTeX_AMS; }
223
212
styles.fontFamily = 'KaTeX_AMS' ;
224
- classFound = true ;
225
213
226
214
case 'mathbb' :
227
215
case 'textbb' :
228
216
// .mathbb,
229
217
// .textbb { font-family: KaTeX_AMS; }
230
218
styles.fontFamily = 'KaTeX_AMS' ;
231
- classFound = true ;
232
219
233
220
case 'mathcal' :
234
221
// .mathcal { font-family: KaTeX_Caligraphic; }
235
222
styles.fontFamily = 'KaTeX_Caligraphic' ;
236
- classFound = true ;
237
223
238
224
case 'mathfrak' :
239
225
case 'textfrak' :
240
226
// .mathfrak,
241
227
// .textfrak { font-family: KaTeX_Fraktur; }
242
228
styles.fontFamily = 'KaTeX_Fraktur' ;
243
- classFound = true ;
244
229
245
230
case 'mathboldfrak' :
246
231
case 'textboldfrak' :
247
232
// .mathboldfrak,
248
233
// .textboldfrak { font-family: KaTeX_Fraktur; font-weight: bold; }
249
234
styles.fontFamily = 'KaTeX_Fraktur' ;
250
235
styles.fontWeight = KatexSpanFontWeight .bold;
251
- classFound = true ;
252
236
253
237
case 'mathtt' :
254
238
// .mathtt { font-family: KaTeX_Typewriter; }
255
239
styles.fontFamily = 'KaTeX_Typewriter' ;
256
- classFound = true ;
257
240
258
241
case 'mathscr' :
259
242
case 'textscr' :
260
243
// .mathscr,
261
244
// .textscr { font-family: KaTeX_Script; }
262
245
styles.fontFamily = 'KaTeX_Script' ;
263
- classFound = true ;
264
246
265
247
case 'mathsf' :
266
248
case 'textsf' :
267
249
// .mathsf,
268
250
// .textsf { font-family: KaTeX_SansSerif; }
269
251
styles.fontFamily = 'KaTeX_SansSerif' ;
270
- classFound = true ;
271
252
272
253
case 'mathboldsf' :
273
254
case 'textboldsf' :
274
255
// .mathboldsf,
275
256
// .textboldsf { font-family: KaTeX_SansSerif; font-weight: bold; }
276
257
styles.fontFamily = 'KaTeX_SansSerif' ;
277
258
styles.fontWeight = KatexSpanFontWeight .bold;
278
- classFound = true ;
279
259
280
260
case 'mathsfit' :
281
261
case 'mathitsf' :
@@ -285,13 +265,11 @@ class _KatexParser {
285
265
// .textitsf { font-family: KaTeX_SansSerif; font-style: italic; }
286
266
styles.fontFamily = 'KaTeX_SansSerif' ;
287
267
styles.fontStyle = KatexSpanFontStyle .italic;
288
- classFound = true ;
289
268
290
269
case 'mainrm' :
291
270
// .mainrm { font-family: KaTeX_Main; font-style: normal; }
292
271
styles.fontFamily = 'KaTeX_Main' ;
293
272
styles.fontStyle = KatexSpanFontStyle .normal;
294
- classFound = true ;
295
273
296
274
// TODO handle skipped class declarations between .mainrm and
297
275
// .sizing .
@@ -377,10 +355,11 @@ class _KatexParser {
377
355
case 'mopen' :
378
356
// Ignore these classes because they don't have a CSS definition
379
357
// in katex.scss, but we encounter them in the generated HTML.
380
- classFound = true ;
381
- }
358
+ break ;
382
359
383
- if (! classFound) _logError ('KaTeX: Unsupported CSS class: $spanClass ' );
360
+ default :
361
+ _logError ('KaTeX: Unsupported CSS class: $spanClass ' );
362
+ }
384
363
}
385
364
386
365
String ? text;
0 commit comments