@umoteam/editor-external 9.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.js +3 -3
- package/edgeone.json +4 -0
- package/libs/katex/README.md +3 -3
- package/libs/katex/contrib/auto-render.js +29 -65
- package/libs/katex/contrib/auto-render.min.js +1 -1
- package/libs/katex/contrib/auto-render.mjs +34 -68
- package/libs/katex/contrib/copy-tex.js +23 -37
- package/libs/katex/contrib/copy-tex.min.js +1 -1
- package/libs/katex/contrib/copy-tex.mjs +20 -40
- package/libs/katex/contrib/mathtex-script-type.js +4 -10
- package/libs/katex/contrib/mathtex-script-type.min.js +1 -1
- package/libs/katex/contrib/mathtex-script-type.mjs +0 -3
- package/libs/katex/contrib/mhchem.js +59 -310
- package/libs/katex/contrib/mhchem.min.js +1 -1
- package/libs/katex/contrib/mhchem.mjs +62 -307
- package/libs/katex/contrib/render-a11y-string.js +17 -119
- package/libs/katex/contrib/render-a11y-string.min.js +1 -1
- package/libs/katex/contrib/render-a11y-string.mjs +55 -157
- package/libs/katex/katex-swap.css +1237 -0
- package/libs/katex/katex-swap.min.css +1 -0
- package/libs/katex/katex.css +32 -4
- package/libs/katex/katex.js +4987 -6215
- package/libs/katex/katex.min.css +1 -1
- package/libs/katex/katex.min.js +1 -1
- package/libs/katex/katex.mjs +4562 -6559
- package/libs/mermaid/mermaid.min.js +3022 -0
- package/libs/plyr/plyr.css +1 -0
- package/libs/plyr/plyr.js +8803 -0
- package/libs/plyr/plyr.min.js +2 -0
- package/libs/plyr/plyr.min.js.map +1 -0
- package/libs/plyr/plyr.min.mjs +1 -0
- package/libs/plyr/plyr.min.mjs.map +1 -0
- package/libs/plyr/plyr.mjs +8795 -0
- package/libs/plyr/plyr.polyfilled.js +9296 -0
- package/libs/plyr/plyr.polyfilled.min.js +2 -0
- package/libs/plyr/plyr.polyfilled.min.js.map +1 -0
- package/libs/plyr/plyr.polyfilled.min.mjs +1 -0
- package/libs/plyr/plyr.polyfilled.min.mjs.map +1 -0
- package/libs/plyr/plyr.polyfilled.mjs +9288 -0
- package/libs/plyr/plyr.svg +1 -0
- package/package.json +15 -16
- package/libs/imgly/background-removal-data/12086412521285f855c2921ae13d3370ab243c9a250ebe340430075780f4624b +0 -0
- package/libs/imgly/background-removal-data/26a663c5a768f39155009f52e0f66815f36983ae275eec676365f7d09ef97edd +0 -0
- package/libs/imgly/background-removal-data/378cd0ab154b324c0b1fe3136a605a8618865d4ce38824a30c938cc1e6312ce4 +0 -0
- package/libs/imgly/background-removal-data/391ce9664d3a506e4333adb82581fc2dc6fbef0354f497ab417c050cb6eba6c4 +0 -0
- package/libs/imgly/background-removal-data/417316220b16ddd1c2a4730a315206ec0405aac7b64a878bdbe514e687b07b6f +0 -0
- package/libs/imgly/background-removal-data/7b64520a3747dd5dcf6ac48f612504bb3b1e273a08b42b5a7efd614b9e4a397c +0 -0
- package/libs/imgly/background-removal-data/7b95dd2733643f999b985105afb755122ca36de12decadc7855ebfbdab6920e6 +0 -0
- package/libs/imgly/background-removal-data/8b993f75a6dc28aab79d1f216e62b59aaa6b3a15e62159bcad4a2ac197c4db0a +0 -0
- package/libs/imgly/background-removal-data/90741e8ae8b47de7666ae4163ba26087500d534973a853bbd02cea715f24b5ee +0 -0
- package/libs/imgly/background-removal-data/9f0512f9be98be0f44ad2f9ec9fe706ae626f2037aca910df6d1396a06a30d41 +0 -0
- package/libs/imgly/background-removal-data/a2a1f2d68cd58b5a6262755e434dee496fc0f27c0ba8fcbb5d57c56ffa1bb15f +0 -0
- package/libs/imgly/background-removal-data/a984abd436e7a8119dc170730260a37436ce0d0542984b71c5a1a386777ab7fd +0 -0
- package/libs/imgly/background-removal-data/af8fb2b72ffb03ed999778c4de73fd4ade196890be6e0253230b198dd11e9db0 +0 -0
- package/libs/imgly/background-removal-data/b53229786ebfbaabcfec4955c248135ba47a13972bf700116a2ff85b86507d2e +0 -0
- package/libs/imgly/background-removal-data/bbf8e366b8f11bb64e60c8532fc2ffed21535fa1cf981464ac45485972107855 +0 -0
- package/libs/imgly/background-removal-data/c1eba9d5d2ee58ba832bf98b50624ea8813f2279505643401c23674c6b326d0b +0 -0
- package/libs/imgly/background-removal-data/c9f954707cb992edf62319d9aed365b4fc9ec3f08693a020db30040c0f953198 +0 -0
- package/libs/imgly/background-removal-data/cad6b95099faeba3ea1299d717990453208cc075b53332db9123a4e2bdaf160c +0 -0
- package/libs/imgly/background-removal-data/dd4fad06953738263bc4d5f94974376467fc74081cba665cef18af8223894ed4 +0 -0
- package/libs/imgly/background-removal-data/e9445ca5ac21e04579658183cd886440f3524caafe6a8947dd20a73b34fba5b0 +0 -0
- package/libs/imgly/background-removal-data/ea46f83f60203065638f183fc8a5446dfc28a163d7ba1922fc3bc6cf40347fa2 +0 -0
- package/libs/imgly/background-removal-data/ef7fb517ae63534f48efa657702b3821fb5d59e4fd372016793edc0389341cc0 +0 -0
- package/libs/imgly/background-removal-data/f69890cf74d0a687904dd088c0aaadce598c8bc217366ebee6993eadd4d56208 +0 -0
- package/libs/imgly/background-removal-data/f6e7e01556358ed875f260bdfb22fb6f7213ac6fd4098ed72c0e7af081f0c23c +0 -0
- package/libs/imgly/background-removal-data/fa3e4102c796fb6d1dab5417c5c0b4b5d219e6b9624d045d7361a033e7db183f +0 -0
- package/libs/imgly/background-removal-data/resources.json +0 -462
- package/libs/mammoth/mammoth.browser.min.js +0 -21
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
|
|
8
8
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
9
|
}
|
|
10
|
-
})((typeof self !== 'undefined' ? self : this), function(
|
|
10
|
+
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__757__) {
|
|
11
11
|
return /******/ (function() { // webpackBootstrap
|
|
12
12
|
/******/ "use strict";
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
15
|
-
/***/
|
|
15
|
+
/***/ 757:
|
|
16
16
|
/***/ (function(module) {
|
|
17
17
|
|
|
18
|
-
module.exports =
|
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__757__;
|
|
19
19
|
|
|
20
20
|
/***/ })
|
|
21
21
|
|
|
@@ -77,9 +77,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__771__;
|
|
|
77
77
|
/******/
|
|
78
78
|
/************************************************************************/
|
|
79
79
|
var __webpack_exports__ = {};
|
|
80
|
-
|
|
81
|
-
!function() {
|
|
82
|
-
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(771);
|
|
80
|
+
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(757);
|
|
83
81
|
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
|
|
84
82
|
/**
|
|
85
83
|
* renderA11yString returns a readable string.
|
|
@@ -96,9 +94,10 @@ var __webpack_exports__ = {};
|
|
|
96
94
|
* The commas in the string aim to increase ease of understanding
|
|
97
95
|
* when read by a screenreader.
|
|
98
96
|
*/
|
|
97
|
+
|
|
99
98
|
// NOTE: since we're importing types here these files won't actually be
|
|
100
99
|
// included in the build.
|
|
101
|
-
|
|
100
|
+
|
|
102
101
|
|
|
103
102
|
const stringMap = {
|
|
104
103
|
"(": "left parenthesis",
|
|
@@ -224,14 +223,11 @@ const accentUnderMap = {
|
|
|
224
223
|
"\\underlinesegment": "line segment",
|
|
225
224
|
"\\utilde": "tilde"
|
|
226
225
|
};
|
|
227
|
-
|
|
228
226
|
const buildString = (str, type, a11yStrings) => {
|
|
229
227
|
if (!str) {
|
|
230
228
|
return;
|
|
231
229
|
}
|
|
232
|
-
|
|
233
230
|
let ret;
|
|
234
|
-
|
|
235
231
|
if (type === "open") {
|
|
236
232
|
ret = str in openMap ? openMap[str] : stringMap[str] || str;
|
|
237
233
|
} else if (type === "close") {
|
|
@@ -242,28 +238,23 @@ const buildString = (str, type, a11yStrings) => {
|
|
|
242
238
|
ret = relMap[str] || str;
|
|
243
239
|
} else {
|
|
244
240
|
ret = stringMap[str] || str;
|
|
245
|
-
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// If the text to add is a number and there is already a string
|
|
246
244
|
// in the list and the last string is a number then we should
|
|
247
245
|
// combine them into a single number
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string
|
|
251
|
-
// I think we might be able to drop the nested arrays, which would make
|
|
252
|
-
// this easier to type
|
|
253
|
-
// $FlowFixMe
|
|
254
|
-
/^\d+$/.test(a11yStrings[a11yStrings.length - 1])) {
|
|
246
|
+
const last = a11yStrings[a11yStrings.length - 1];
|
|
247
|
+
if (/^\d+$/.test(ret) && a11yStrings.length > 0 && typeof last === "string" && /^\d+$/.test(last)) {
|
|
255
248
|
a11yStrings[a11yStrings.length - 1] += ret;
|
|
256
249
|
} else if (ret) {
|
|
257
250
|
a11yStrings.push(ret);
|
|
258
251
|
}
|
|
259
252
|
};
|
|
260
|
-
|
|
261
253
|
const buildRegion = (a11yStrings, callback) => {
|
|
262
254
|
const regionStrings = [];
|
|
263
255
|
a11yStrings.push(regionStrings);
|
|
264
256
|
callback(regionStrings);
|
|
265
257
|
};
|
|
266
|
-
|
|
267
258
|
const handleObject = (tree, a11yStrings, atomType) => {
|
|
268
259
|
// Everything else is assumed to be an object...
|
|
269
260
|
switch (tree.type) {
|
|
@@ -277,7 +268,6 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
277
268
|
});
|
|
278
269
|
break;
|
|
279
270
|
}
|
|
280
|
-
|
|
281
271
|
case "accentUnder":
|
|
282
272
|
{
|
|
283
273
|
buildRegion(a11yStrings, a11yStrings => {
|
|
@@ -288,67 +278,56 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
288
278
|
});
|
|
289
279
|
break;
|
|
290
280
|
}
|
|
291
|
-
|
|
292
281
|
case "accent-token":
|
|
293
282
|
{
|
|
294
283
|
// Used internally by accent symbols.
|
|
295
284
|
break;
|
|
296
285
|
}
|
|
297
|
-
|
|
298
286
|
case "atom":
|
|
299
287
|
{
|
|
300
288
|
const {
|
|
301
289
|
text
|
|
302
290
|
} = tree;
|
|
303
|
-
|
|
304
291
|
switch (tree.family) {
|
|
305
292
|
case "bin":
|
|
306
293
|
{
|
|
307
294
|
buildString(text, "bin", a11yStrings);
|
|
308
295
|
break;
|
|
309
296
|
}
|
|
310
|
-
|
|
311
297
|
case "close":
|
|
312
298
|
{
|
|
313
299
|
buildString(text, "close", a11yStrings);
|
|
314
300
|
break;
|
|
315
301
|
}
|
|
316
302
|
// TODO(kevinb): figure out what should be done for inner
|
|
317
|
-
|
|
318
303
|
case "inner":
|
|
319
304
|
{
|
|
320
305
|
buildString(tree.text, "inner", a11yStrings);
|
|
321
306
|
break;
|
|
322
307
|
}
|
|
323
|
-
|
|
324
308
|
case "open":
|
|
325
309
|
{
|
|
326
310
|
buildString(text, "open", a11yStrings);
|
|
327
311
|
break;
|
|
328
312
|
}
|
|
329
|
-
|
|
330
313
|
case "punct":
|
|
331
314
|
{
|
|
332
315
|
buildString(text, "punct", a11yStrings);
|
|
333
316
|
break;
|
|
334
317
|
}
|
|
335
|
-
|
|
336
318
|
case "rel":
|
|
337
319
|
{
|
|
338
320
|
buildString(text, "rel", a11yStrings);
|
|
339
321
|
break;
|
|
340
322
|
}
|
|
341
|
-
|
|
342
323
|
default:
|
|
343
324
|
{
|
|
344
325
|
tree.family;
|
|
345
326
|
throw new Error("\"" + tree.family + "\" is not a valid atom type");
|
|
346
327
|
}
|
|
347
328
|
}
|
|
348
|
-
|
|
349
329
|
break;
|
|
350
330
|
}
|
|
351
|
-
|
|
352
331
|
case "color":
|
|
353
332
|
{
|
|
354
333
|
const color = tree.color.replace(/katex-/, "");
|
|
@@ -359,23 +338,19 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
359
338
|
});
|
|
360
339
|
break;
|
|
361
340
|
}
|
|
362
|
-
|
|
363
341
|
case "color-token":
|
|
364
342
|
{
|
|
365
343
|
// Used by \color, \colorbox, and \fcolorbox but not directly rendered.
|
|
366
344
|
// It's a leaf node and has no children so just break.
|
|
367
345
|
break;
|
|
368
346
|
}
|
|
369
|
-
|
|
370
347
|
case "delimsizing":
|
|
371
348
|
{
|
|
372
349
|
if (tree.delim && tree.delim !== ".") {
|
|
373
350
|
buildString(tree.delim, "normal", a11yStrings);
|
|
374
351
|
}
|
|
375
|
-
|
|
376
352
|
break;
|
|
377
353
|
}
|
|
378
|
-
|
|
379
354
|
case "genfrac":
|
|
380
355
|
{
|
|
381
356
|
buildRegion(a11yStrings, regionStrings => {
|
|
@@ -383,9 +358,10 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
383
358
|
const {
|
|
384
359
|
leftDelim,
|
|
385
360
|
rightDelim
|
|
386
|
-
} = tree;
|
|
387
|
-
// hasBarLine true -> fraction, false -> binomial
|
|
361
|
+
} = tree;
|
|
388
362
|
|
|
363
|
+
// NOTE: Not sure if this is a safe assumption
|
|
364
|
+
// hasBarLine true -> fraction, false -> binomial
|
|
389
365
|
if (tree.hasBarLine) {
|
|
390
366
|
regionStrings.push("start fraction");
|
|
391
367
|
leftDelim && buildString(leftDelim, "open", regionStrings);
|
|
@@ -406,20 +382,17 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
406
382
|
});
|
|
407
383
|
break;
|
|
408
384
|
}
|
|
409
|
-
|
|
410
385
|
case "hbox":
|
|
411
386
|
{
|
|
412
387
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
413
388
|
break;
|
|
414
389
|
}
|
|
415
|
-
|
|
416
390
|
case "kern":
|
|
417
391
|
{
|
|
418
392
|
// No op: we don't attempt to present kerning information
|
|
419
393
|
// to the screen reader.
|
|
420
394
|
break;
|
|
421
395
|
}
|
|
422
|
-
|
|
423
396
|
case "leftright":
|
|
424
397
|
{
|
|
425
398
|
buildRegion(a11yStrings, regionStrings => {
|
|
@@ -429,54 +402,45 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
429
402
|
});
|
|
430
403
|
break;
|
|
431
404
|
}
|
|
432
|
-
|
|
433
405
|
case "leftright-right":
|
|
434
406
|
{
|
|
435
407
|
// TODO: double check that this is a no-op
|
|
436
408
|
break;
|
|
437
409
|
}
|
|
438
|
-
|
|
439
410
|
case "lap":
|
|
440
411
|
{
|
|
441
412
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
442
413
|
break;
|
|
443
414
|
}
|
|
444
|
-
|
|
445
415
|
case "mathord":
|
|
446
416
|
{
|
|
447
417
|
buildString(tree.text, "normal", a11yStrings);
|
|
448
418
|
break;
|
|
449
419
|
}
|
|
450
|
-
|
|
451
420
|
case "op":
|
|
452
421
|
{
|
|
453
422
|
const {
|
|
454
423
|
body,
|
|
455
424
|
name
|
|
456
425
|
} = tree;
|
|
457
|
-
|
|
458
426
|
if (body) {
|
|
459
427
|
buildA11yStrings(body, a11yStrings, atomType);
|
|
460
428
|
} else if (name) {
|
|
461
429
|
buildString(name, "normal", a11yStrings);
|
|
462
430
|
}
|
|
463
|
-
|
|
464
431
|
break;
|
|
465
432
|
}
|
|
466
|
-
|
|
467
433
|
case "op-token":
|
|
468
434
|
{
|
|
469
435
|
// Used internally by operator symbols.
|
|
470
436
|
buildString(tree.text, atomType, a11yStrings);
|
|
471
437
|
break;
|
|
472
438
|
}
|
|
473
|
-
|
|
474
439
|
case "ordgroup":
|
|
475
440
|
{
|
|
476
441
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
477
442
|
break;
|
|
478
443
|
}
|
|
479
|
-
|
|
480
444
|
case "overline":
|
|
481
445
|
{
|
|
482
446
|
buildRegion(a11yStrings, function (a11yStrings) {
|
|
@@ -486,50 +450,42 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
486
450
|
});
|
|
487
451
|
break;
|
|
488
452
|
}
|
|
489
|
-
|
|
490
453
|
case "pmb":
|
|
491
454
|
{
|
|
492
455
|
a11yStrings.push("bold");
|
|
493
456
|
break;
|
|
494
457
|
}
|
|
495
|
-
|
|
496
458
|
case "phantom":
|
|
497
459
|
{
|
|
498
460
|
a11yStrings.push("empty space");
|
|
499
461
|
break;
|
|
500
462
|
}
|
|
501
|
-
|
|
502
463
|
case "raisebox":
|
|
503
464
|
{
|
|
504
465
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
505
466
|
break;
|
|
506
467
|
}
|
|
507
|
-
|
|
508
468
|
case "rule":
|
|
509
469
|
{
|
|
510
470
|
a11yStrings.push("rectangle");
|
|
511
471
|
break;
|
|
512
472
|
}
|
|
513
|
-
|
|
514
473
|
case "sizing":
|
|
515
474
|
{
|
|
516
475
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
517
476
|
break;
|
|
518
477
|
}
|
|
519
|
-
|
|
520
478
|
case "spacing":
|
|
521
479
|
{
|
|
522
480
|
a11yStrings.push("space");
|
|
523
481
|
break;
|
|
524
482
|
}
|
|
525
|
-
|
|
526
483
|
case "styling":
|
|
527
484
|
{
|
|
528
485
|
// We ignore the styling and just pass through the contents
|
|
529
486
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
530
487
|
break;
|
|
531
488
|
}
|
|
532
|
-
|
|
533
489
|
case "sqrt":
|
|
534
490
|
{
|
|
535
491
|
buildRegion(a11yStrings, regionStrings => {
|
|
@@ -537,31 +493,26 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
537
493
|
body,
|
|
538
494
|
index
|
|
539
495
|
} = tree;
|
|
540
|
-
|
|
541
496
|
if (index) {
|
|
542
497
|
const indexString = flatten(buildA11yStrings(index, [], atomType)).join(",");
|
|
543
|
-
|
|
544
498
|
if (indexString === "3") {
|
|
545
499
|
regionStrings.push("cube root of");
|
|
546
500
|
buildA11yStrings(body, regionStrings, atomType);
|
|
547
501
|
regionStrings.push("end cube root");
|
|
548
502
|
return;
|
|
549
503
|
}
|
|
550
|
-
|
|
551
504
|
regionStrings.push("root");
|
|
552
505
|
regionStrings.push("start index");
|
|
553
506
|
buildA11yStrings(index, regionStrings, atomType);
|
|
554
507
|
regionStrings.push("end index");
|
|
555
508
|
return;
|
|
556
509
|
}
|
|
557
|
-
|
|
558
510
|
regionStrings.push("square root of");
|
|
559
511
|
buildA11yStrings(body, regionStrings, atomType);
|
|
560
512
|
regionStrings.push("end square root");
|
|
561
513
|
});
|
|
562
514
|
break;
|
|
563
515
|
}
|
|
564
|
-
|
|
565
516
|
case "supsub":
|
|
566
517
|
{
|
|
567
518
|
const {
|
|
@@ -570,12 +521,10 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
570
521
|
sup
|
|
571
522
|
} = tree;
|
|
572
523
|
let isLog = false;
|
|
573
|
-
|
|
574
524
|
if (base) {
|
|
575
525
|
buildA11yStrings(base, a11yStrings, atomType);
|
|
576
526
|
isLog = base.type === "op" && base.name === "\\log";
|
|
577
527
|
}
|
|
578
|
-
|
|
579
528
|
if (sub) {
|
|
580
529
|
const regionName = isLog ? "base" : "subscript";
|
|
581
530
|
buildRegion(a11yStrings, function (regionStrings) {
|
|
@@ -584,25 +533,20 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
584
533
|
regionStrings.push("end " + regionName);
|
|
585
534
|
});
|
|
586
535
|
}
|
|
587
|
-
|
|
588
536
|
if (sup) {
|
|
589
537
|
buildRegion(a11yStrings, function (regionStrings) {
|
|
590
538
|
const supString = flatten(buildA11yStrings(sup, [], atomType)).join(",");
|
|
591
|
-
|
|
592
539
|
if (supString in powerMap) {
|
|
593
540
|
regionStrings.push(powerMap[supString]);
|
|
594
541
|
return;
|
|
595
542
|
}
|
|
596
|
-
|
|
597
543
|
regionStrings.push("start superscript");
|
|
598
544
|
buildA11yStrings(sup, regionStrings, atomType);
|
|
599
545
|
regionStrings.push("end superscript");
|
|
600
546
|
});
|
|
601
547
|
}
|
|
602
|
-
|
|
603
548
|
break;
|
|
604
549
|
}
|
|
605
|
-
|
|
606
550
|
case "text":
|
|
607
551
|
{
|
|
608
552
|
// TODO: handle other fonts
|
|
@@ -614,7 +558,6 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
614
558
|
});
|
|
615
559
|
break;
|
|
616
560
|
}
|
|
617
|
-
|
|
618
561
|
buildRegion(a11yStrings, function (regionStrings) {
|
|
619
562
|
regionStrings.push("start text");
|
|
620
563
|
buildA11yStrings(tree.body, regionStrings, atomType);
|
|
@@ -622,19 +565,16 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
622
565
|
});
|
|
623
566
|
break;
|
|
624
567
|
}
|
|
625
|
-
|
|
626
568
|
case "textord":
|
|
627
569
|
{
|
|
628
570
|
buildString(tree.text, atomType, a11yStrings);
|
|
629
571
|
break;
|
|
630
572
|
}
|
|
631
|
-
|
|
632
573
|
case "smash":
|
|
633
574
|
{
|
|
634
575
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
635
576
|
break;
|
|
636
577
|
}
|
|
637
|
-
|
|
638
578
|
case "enclose":
|
|
639
579
|
{
|
|
640
580
|
// TODO: create a map for these.
|
|
@@ -669,59 +609,44 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
669
609
|
});
|
|
670
610
|
break;
|
|
671
611
|
}
|
|
672
|
-
|
|
673
612
|
throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet");
|
|
674
613
|
}
|
|
675
|
-
|
|
676
614
|
case "vcenter":
|
|
677
615
|
{
|
|
678
616
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
679
617
|
break;
|
|
680
618
|
}
|
|
681
|
-
|
|
682
619
|
case "vphantom":
|
|
683
620
|
{
|
|
684
621
|
throw new Error("KaTeX-a11y: vphantom not implemented yet");
|
|
685
622
|
}
|
|
686
|
-
|
|
687
|
-
case "hphantom":
|
|
688
|
-
{
|
|
689
|
-
throw new Error("KaTeX-a11y: hphantom not implemented yet");
|
|
690
|
-
}
|
|
691
|
-
|
|
692
623
|
case "operatorname":
|
|
693
624
|
{
|
|
694
625
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
695
626
|
break;
|
|
696
627
|
}
|
|
697
|
-
|
|
698
628
|
case "array":
|
|
699
629
|
{
|
|
700
630
|
throw new Error("KaTeX-a11y: array not implemented yet");
|
|
701
631
|
}
|
|
702
|
-
|
|
703
632
|
case "raw":
|
|
704
633
|
{
|
|
705
634
|
throw new Error("KaTeX-a11y: raw not implemented yet");
|
|
706
635
|
}
|
|
707
|
-
|
|
708
636
|
case "size":
|
|
709
637
|
{
|
|
710
638
|
// Although there are nodes of type "size" in the parse tree, they have
|
|
711
639
|
// no semantic meaning and should be ignored.
|
|
712
640
|
break;
|
|
713
641
|
}
|
|
714
|
-
|
|
715
642
|
case "url":
|
|
716
643
|
{
|
|
717
644
|
throw new Error("KaTeX-a11y: url not implemented yet");
|
|
718
645
|
}
|
|
719
|
-
|
|
720
646
|
case "tag":
|
|
721
647
|
{
|
|
722
648
|
throw new Error("KaTeX-a11y: tag not implemented yet");
|
|
723
649
|
}
|
|
724
|
-
|
|
725
650
|
case "verb":
|
|
726
651
|
{
|
|
727
652
|
buildString("start verbatim", "normal", a11yStrings);
|
|
@@ -729,12 +654,10 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
729
654
|
buildString("end verbatim", "normal", a11yStrings);
|
|
730
655
|
break;
|
|
731
656
|
}
|
|
732
|
-
|
|
733
657
|
case "environment":
|
|
734
658
|
{
|
|
735
659
|
throw new Error("KaTeX-a11y: environment not implemented yet");
|
|
736
660
|
}
|
|
737
|
-
|
|
738
661
|
case "horizBrace":
|
|
739
662
|
{
|
|
740
663
|
buildString("start " + tree.label.slice(1), "normal", a11yStrings);
|
|
@@ -742,18 +665,15 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
742
665
|
buildString("end " + tree.label.slice(1), "normal", a11yStrings);
|
|
743
666
|
break;
|
|
744
667
|
}
|
|
745
|
-
|
|
746
668
|
case "infix":
|
|
747
669
|
{
|
|
748
670
|
// All infix nodes are replace with other nodes.
|
|
749
671
|
break;
|
|
750
672
|
}
|
|
751
|
-
|
|
752
673
|
case "includegraphics":
|
|
753
674
|
{
|
|
754
675
|
throw new Error("KaTeX-a11y: includegraphics not implemented yet");
|
|
755
676
|
}
|
|
756
|
-
|
|
757
677
|
case "font":
|
|
758
678
|
{
|
|
759
679
|
// TODO: callout the start/end of specific fonts
|
|
@@ -761,18 +681,15 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
761
681
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
762
682
|
break;
|
|
763
683
|
}
|
|
764
|
-
|
|
765
684
|
case "href":
|
|
766
685
|
{
|
|
767
686
|
throw new Error("KaTeX-a11y: href not implemented yet");
|
|
768
687
|
}
|
|
769
|
-
|
|
770
688
|
case "cr":
|
|
771
689
|
{
|
|
772
690
|
// This is used by environments.
|
|
773
691
|
throw new Error("KaTeX-a11y: cr not implemented yet");
|
|
774
692
|
}
|
|
775
|
-
|
|
776
693
|
case "underline":
|
|
777
694
|
{
|
|
778
695
|
buildRegion(a11yStrings, function (a11yStrings) {
|
|
@@ -782,32 +699,27 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
782
699
|
});
|
|
783
700
|
break;
|
|
784
701
|
}
|
|
785
|
-
|
|
786
702
|
case "xArrow":
|
|
787
703
|
{
|
|
788
704
|
throw new Error("KaTeX-a11y: xArrow not implemented yet");
|
|
789
705
|
}
|
|
790
|
-
|
|
791
706
|
case "cdlabel":
|
|
792
707
|
{
|
|
793
708
|
throw new Error("KaTeX-a11y: cdlabel not implemented yet");
|
|
794
709
|
}
|
|
795
|
-
|
|
796
710
|
case "cdlabelparent":
|
|
797
711
|
{
|
|
798
712
|
throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");
|
|
799
713
|
}
|
|
800
|
-
|
|
801
714
|
case "mclass":
|
|
802
715
|
{
|
|
803
716
|
// \neq and \ne are macros so we let "htmlmathml" render the mathmal
|
|
804
717
|
// side of things and extract the text from that.
|
|
805
|
-
const atomType = tree.mclass.slice(1);
|
|
806
|
-
|
|
718
|
+
const atomType = tree.mclass.slice(1);
|
|
719
|
+
// TODO(ts): drop the leading "m" from the values in mclass
|
|
807
720
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
808
721
|
break;
|
|
809
722
|
}
|
|
810
|
-
|
|
811
723
|
case "mathchoice":
|
|
812
724
|
{
|
|
813
725
|
// TODO: track which style we're using, e.g. display, text, etc.
|
|
@@ -815,42 +727,34 @@ const handleObject = (tree, a11yStrings, atomType) => {
|
|
|
815
727
|
buildA11yStrings(tree.text, a11yStrings, atomType);
|
|
816
728
|
break;
|
|
817
729
|
}
|
|
818
|
-
|
|
819
730
|
case "htmlmathml":
|
|
820
731
|
{
|
|
821
732
|
buildA11yStrings(tree.mathml, a11yStrings, atomType);
|
|
822
733
|
break;
|
|
823
734
|
}
|
|
824
|
-
|
|
825
735
|
case "middle":
|
|
826
736
|
{
|
|
827
737
|
buildString(tree.delim, atomType, a11yStrings);
|
|
828
738
|
break;
|
|
829
739
|
}
|
|
830
|
-
|
|
831
740
|
case "internal":
|
|
832
741
|
{
|
|
833
742
|
// internal nodes are never included in the parse tree
|
|
834
743
|
break;
|
|
835
744
|
}
|
|
836
|
-
|
|
837
745
|
case "html":
|
|
838
746
|
{
|
|
839
747
|
buildA11yStrings(tree.body, a11yStrings, atomType);
|
|
840
748
|
break;
|
|
841
749
|
}
|
|
842
|
-
|
|
843
750
|
default:
|
|
844
|
-
tree.type;
|
|
845
751
|
throw new Error("KaTeX a11y un-recognized type: " + tree.type);
|
|
846
752
|
}
|
|
847
753
|
};
|
|
848
|
-
|
|
849
754
|
const buildA11yStrings = function (tree, a11yStrings, atomType) {
|
|
850
755
|
if (a11yStrings === void 0) {
|
|
851
756
|
a11yStrings = [];
|
|
852
757
|
}
|
|
853
|
-
|
|
854
758
|
if (tree instanceof Array) {
|
|
855
759
|
for (let i = 0; i < tree.length; i++) {
|
|
856
760
|
buildA11yStrings(tree[i], a11yStrings, atomType);
|
|
@@ -858,14 +762,12 @@ const buildA11yStrings = function (tree, a11yStrings, atomType) {
|
|
|
858
762
|
} else {
|
|
859
763
|
handleObject(tree, a11yStrings, atomType);
|
|
860
764
|
}
|
|
861
|
-
|
|
862
765
|
return a11yStrings;
|
|
863
766
|
};
|
|
864
|
-
|
|
865
767
|
const flatten = function (array) {
|
|
866
768
|
let result = [];
|
|
867
769
|
array.forEach(function (item) {
|
|
868
|
-
if (item
|
|
770
|
+
if (Array.isArray(item)) {
|
|
869
771
|
result = result.concat(flatten(item));
|
|
870
772
|
} else {
|
|
871
773
|
result.push(item);
|
|
@@ -873,16 +775,12 @@ const flatten = function (array) {
|
|
|
873
775
|
});
|
|
874
776
|
return result;
|
|
875
777
|
};
|
|
876
|
-
|
|
877
778
|
const renderA11yString = function (text, settings) {
|
|
878
779
|
const tree = katex__WEBPACK_IMPORTED_MODULE_0___default().__parse(text, settings);
|
|
879
|
-
|
|
880
780
|
const a11yStrings = buildA11yStrings(tree, [], "normal");
|
|
881
781
|
return flatten(a11yStrings).join(", ");
|
|
882
782
|
};
|
|
883
|
-
|
|
884
783
|
/* harmony default export */ __webpack_exports__["default"] = (renderA11yString);
|
|
885
|
-
}();
|
|
886
784
|
__webpack_exports__ = __webpack_exports__["default"];
|
|
887
785
|
/******/ return __webpack_exports__;
|
|
888
786
|
/******/ })()
|