render-a11y-string.js (24029B)
1 (function webpackUniversalModuleDefinition(root, factory) { 2 if(typeof exports === 'object' && typeof module === 'object') 3 module.exports = factory(require("katex")); 4 else if(typeof define === 'function' && define.amd) 5 define(["katex"], factory); 6 else { 7 var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); 8 for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; 9 } 10 })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__974__) { 11 return /******/ (function() { // webpackBootstrap 12 /******/ "use strict"; 13 /******/ var __webpack_modules__ = ({ 14 15 /***/ 974: 16 /***/ (function(module) { 17 18 module.exports = __WEBPACK_EXTERNAL_MODULE__974__; 19 20 /***/ }) 21 22 /******/ }); 23 /************************************************************************/ 24 /******/ // The module cache 25 /******/ var __webpack_module_cache__ = {}; 26 /******/ 27 /******/ // The require function 28 /******/ function __webpack_require__(moduleId) { 29 /******/ // Check if module is in cache 30 /******/ if(__webpack_module_cache__[moduleId]) { 31 /******/ return __webpack_module_cache__[moduleId].exports; 32 /******/ } 33 /******/ // Create a new module (and put it into the cache) 34 /******/ var module = __webpack_module_cache__[moduleId] = { 35 /******/ // no module.id needed 36 /******/ // no module.loaded needed 37 /******/ exports: {} 38 /******/ }; 39 /******/ 40 /******/ // Execute the module function 41 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 42 /******/ 43 /******/ // Return the exports of the module 44 /******/ return module.exports; 45 /******/ } 46 /******/ 47 /************************************************************************/ 48 /******/ /* webpack/runtime/compat get default export */ 49 /******/ !function() { 50 /******/ // getDefaultExport function for compatibility with non-harmony modules 51 /******/ __webpack_require__.n = function(module) { 52 /******/ var getter = module && module.__esModule ? 53 /******/ function() { return module['default']; } : 54 /******/ function() { return module; }; 55 /******/ __webpack_require__.d(getter, { a: getter }); 56 /******/ return getter; 57 /******/ }; 58 /******/ }(); 59 /******/ 60 /******/ /* webpack/runtime/define property getters */ 61 /******/ !function() { 62 /******/ // define getter functions for harmony exports 63 /******/ __webpack_require__.d = function(exports, definition) { 64 /******/ for(var key in definition) { 65 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 66 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 67 /******/ } 68 /******/ } 69 /******/ }; 70 /******/ }(); 71 /******/ 72 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 73 /******/ !function() { 74 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 75 /******/ }(); 76 /******/ 77 /************************************************************************/ 78 var __webpack_exports__ = {}; 79 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 80 !function() { 81 /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(974); 82 /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); 83 /** 84 * renderA11yString returns a readable string. 85 * 86 * In some cases the string will have the proper semantic math 87 * meaning,: 88 * renderA11yString("\\frac{1}{2}"") 89 * -> "start fraction, 1, divided by, 2, end fraction" 90 * 91 * However, other cases do not: 92 * renderA11yString("f(x) = x^2") 93 * -> "f, left parenthesis, x, right parenthesis, equals, x, squared" 94 * 95 * The commas in the string aim to increase ease of understanding 96 * when read by a screenreader. 97 */ 98 // NOTE: since we're importing types here these files won't actually be 99 // included in the build. 100 // $FlowIgnore: we import the types directly anyways 101 102 var stringMap = { 103 "(": "left parenthesis", 104 ")": "right parenthesis", 105 "[": "open bracket", 106 "]": "close bracket", 107 "\\{": "left brace", 108 "\\}": "right brace", 109 "\\lvert": "open vertical bar", 110 "\\rvert": "close vertical bar", 111 "|": "vertical bar", 112 "\\uparrow": "up arrow", 113 "\\Uparrow": "up arrow", 114 "\\downarrow": "down arrow", 115 "\\Downarrow": "down arrow", 116 "\\updownarrow": "up down arrow", 117 "\\leftarrow": "left arrow", 118 "\\Leftarrow": "left arrow", 119 "\\rightarrow": "right arrow", 120 "\\Rightarrow": "right arrow", 121 "\\langle": "open angle", 122 "\\rangle": "close angle", 123 "\\lfloor": "open floor", 124 "\\rfloor": "close floor", 125 "\\int": "integral", 126 "\\intop": "integral", 127 "\\lim": "limit", 128 "\\ln": "natural log", 129 "\\log": "log", 130 "\\sin": "sine", 131 "\\cos": "cosine", 132 "\\tan": "tangent", 133 "\\cot": "cotangent", 134 "\\sum": "sum", 135 "/": "slash", 136 ",": "comma", 137 ".": "point", 138 "-": "negative", 139 "+": "plus", 140 "~": "tilde", 141 ":": "colon", 142 "?": "question mark", 143 "'": "apostrophe", 144 "\\%": "percent", 145 " ": "space", 146 "\\ ": "space", 147 "\\$": "dollar sign", 148 "\\angle": "angle", 149 "\\degree": "degree", 150 "\\circ": "circle", 151 "\\vec": "vector", 152 "\\triangle": "triangle", 153 "\\pi": "pi", 154 "\\prime": "prime", 155 "\\infty": "infinity", 156 "\\alpha": "alpha", 157 "\\beta": "beta", 158 "\\gamma": "gamma", 159 "\\omega": "omega", 160 "\\theta": "theta", 161 "\\sigma": "sigma", 162 "\\lambda": "lambda", 163 "\\tau": "tau", 164 "\\Delta": "delta", 165 "\\delta": "delta", 166 "\\mu": "mu", 167 "\\rho": "rho", 168 "\\nabla": "del", 169 "\\ell": "ell", 170 "\\ldots": "dots", 171 // TODO: add entries for all accents 172 "\\hat": "hat", 173 "\\acute": "acute" 174 }; 175 var powerMap = { 176 "prime": "prime", 177 "degree": "degrees", 178 "circle": "degrees", 179 "2": "squared", 180 "3": "cubed" 181 }; 182 var openMap = { 183 "|": "open vertical bar", 184 ".": "" 185 }; 186 var closeMap = { 187 "|": "close vertical bar", 188 ".": "" 189 }; 190 var binMap = { 191 "+": "plus", 192 "-": "minus", 193 "\\pm": "plus minus", 194 "\\cdot": "dot", 195 "*": "times", 196 "/": "divided by", 197 "\\times": "times", 198 "\\div": "divided by", 199 "\\circ": "circle", 200 "\\bullet": "bullet" 201 }; 202 var relMap = { 203 "=": "equals", 204 "\\approx": "approximately equals", 205 "≠": "does not equal", 206 "\\geq": "is greater than or equal to", 207 "\\ge": "is greater than or equal to", 208 "\\leq": "is less than or equal to", 209 "\\le": "is less than or equal to", 210 ">": "is greater than", 211 "<": "is less than", 212 "\\leftarrow": "left arrow", 213 "\\Leftarrow": "left arrow", 214 "\\rightarrow": "right arrow", 215 "\\Rightarrow": "right arrow", 216 ":": "colon" 217 }; 218 var accentUnderMap = { 219 "\\underleftarrow": "left arrow", 220 "\\underrightarrow": "right arrow", 221 "\\underleftrightarrow": "left-right arrow", 222 "\\undergroup": "group", 223 "\\underlinesegment": "line segment", 224 "\\utilde": "tilde" 225 }; 226 227 var buildString = function buildString(str, type, a11yStrings) { 228 if (!str) { 229 return; 230 } 231 232 var ret; 233 234 if (type === "open") { 235 ret = str in openMap ? openMap[str] : stringMap[str] || str; 236 } else if (type === "close") { 237 ret = str in closeMap ? closeMap[str] : stringMap[str] || str; 238 } else if (type === "bin") { 239 ret = binMap[str] || str; 240 } else if (type === "rel") { 241 ret = relMap[str] || str; 242 } else { 243 ret = stringMap[str] || str; 244 } // If the text to add is a number and there is already a string 245 // in the list and the last string is a number then we should 246 // combine them into a single number 247 248 249 if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string 250 // I think we might be able to drop the nested arrays, which would make 251 // this easier to type 252 // $FlowFixMe 253 /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) { 254 a11yStrings[a11yStrings.length - 1] += ret; 255 } else if (ret) { 256 a11yStrings.push(ret); 257 } 258 }; 259 260 var buildRegion = function buildRegion(a11yStrings, callback) { 261 var regionStrings = []; 262 a11yStrings.push(regionStrings); 263 callback(regionStrings); 264 }; 265 266 var handleObject = function handleObject(tree, a11yStrings, atomType) { 267 // Everything else is assumed to be an object... 268 switch (tree.type) { 269 case "accent": 270 { 271 buildRegion(a11yStrings, function (a11yStrings) { 272 buildA11yStrings(tree.base, a11yStrings, atomType); 273 a11yStrings.push("with"); 274 buildString(tree.label, "normal", a11yStrings); 275 a11yStrings.push("on top"); 276 }); 277 break; 278 } 279 280 case "accentUnder": 281 { 282 buildRegion(a11yStrings, function (a11yStrings) { 283 buildA11yStrings(tree.base, a11yStrings, atomType); 284 a11yStrings.push("with"); 285 buildString(accentUnderMap[tree.label], "normal", a11yStrings); 286 a11yStrings.push("underneath"); 287 }); 288 break; 289 } 290 291 case "accent-token": 292 { 293 // Used internally by accent symbols. 294 break; 295 } 296 297 case "atom": 298 { 299 var text = tree.text; 300 301 switch (tree.family) { 302 case "bin": 303 { 304 buildString(text, "bin", a11yStrings); 305 break; 306 } 307 308 case "close": 309 { 310 buildString(text, "close", a11yStrings); 311 break; 312 } 313 // TODO(kevinb): figure out what should be done for inner 314 315 case "inner": 316 { 317 buildString(tree.text, "inner", a11yStrings); 318 break; 319 } 320 321 case "open": 322 { 323 buildString(text, "open", a11yStrings); 324 break; 325 } 326 327 case "punct": 328 { 329 buildString(text, "punct", a11yStrings); 330 break; 331 } 332 333 case "rel": 334 { 335 buildString(text, "rel", a11yStrings); 336 break; 337 } 338 339 default: 340 { 341 tree.family; 342 throw new Error("\"" + tree.family + "\" is not a valid atom type"); 343 } 344 } 345 346 break; 347 } 348 349 case "color": 350 { 351 var color = tree.color.replace(/katex-/, ""); 352 buildRegion(a11yStrings, function (regionStrings) { 353 regionStrings.push("start color " + color); 354 buildA11yStrings(tree.body, regionStrings, atomType); 355 regionStrings.push("end color " + color); 356 }); 357 break; 358 } 359 360 case "color-token": 361 { 362 // Used by \color, \colorbox, and \fcolorbox but not directly rendered. 363 // It's a leaf node and has no children so just break. 364 break; 365 } 366 367 case "delimsizing": 368 { 369 if (tree.delim && tree.delim !== ".") { 370 buildString(tree.delim, "normal", a11yStrings); 371 } 372 373 break; 374 } 375 376 case "genfrac": 377 { 378 buildRegion(a11yStrings, function (regionStrings) { 379 // genfrac can have unbalanced delimiters 380 var leftDelim = tree.leftDelim, 381 rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption 382 // hasBarLine true -> fraction, false -> binomial 383 384 if (tree.hasBarLine) { 385 regionStrings.push("start fraction"); 386 leftDelim && buildString(leftDelim, "open", regionStrings); 387 buildA11yStrings(tree.numer, regionStrings, atomType); 388 regionStrings.push("divided by"); 389 buildA11yStrings(tree.denom, regionStrings, atomType); 390 rightDelim && buildString(rightDelim, "close", regionStrings); 391 regionStrings.push("end fraction"); 392 } else { 393 regionStrings.push("start binomial"); 394 leftDelim && buildString(leftDelim, "open", regionStrings); 395 buildA11yStrings(tree.numer, regionStrings, atomType); 396 regionStrings.push("over"); 397 buildA11yStrings(tree.denom, regionStrings, atomType); 398 rightDelim && buildString(rightDelim, "close", regionStrings); 399 regionStrings.push("end binomial"); 400 } 401 }); 402 break; 403 } 404 405 case "hbox": 406 { 407 buildA11yStrings(tree.body, a11yStrings, atomType); 408 break; 409 } 410 411 case "kern": 412 { 413 // No op: we don't attempt to present kerning information 414 // to the screen reader. 415 break; 416 } 417 418 case "leftright": 419 { 420 buildRegion(a11yStrings, function (regionStrings) { 421 buildString(tree.left, "open", regionStrings); 422 buildA11yStrings(tree.body, regionStrings, atomType); 423 buildString(tree.right, "close", regionStrings); 424 }); 425 break; 426 } 427 428 case "leftright-right": 429 { 430 // TODO: double check that this is a no-op 431 break; 432 } 433 434 case "lap": 435 { 436 buildA11yStrings(tree.body, a11yStrings, atomType); 437 break; 438 } 439 440 case "mathord": 441 { 442 buildString(tree.text, "normal", a11yStrings); 443 break; 444 } 445 446 case "op": 447 { 448 var body = tree.body, 449 name = tree.name; 450 451 if (body) { 452 buildA11yStrings(body, a11yStrings, atomType); 453 } else if (name) { 454 buildString(name, "normal", a11yStrings); 455 } 456 457 break; 458 } 459 460 case "op-token": 461 { 462 // Used internally by operator symbols. 463 buildString(tree.text, atomType, a11yStrings); 464 break; 465 } 466 467 case "ordgroup": 468 { 469 buildA11yStrings(tree.body, a11yStrings, atomType); 470 break; 471 } 472 473 case "overline": 474 { 475 buildRegion(a11yStrings, function (a11yStrings) { 476 a11yStrings.push("start overline"); 477 buildA11yStrings(tree.body, a11yStrings, atomType); 478 a11yStrings.push("end overline"); 479 }); 480 break; 481 } 482 483 case "phantom": 484 { 485 a11yStrings.push("empty space"); 486 break; 487 } 488 489 case "raisebox": 490 { 491 buildA11yStrings(tree.body, a11yStrings, atomType); 492 break; 493 } 494 495 case "rule": 496 { 497 a11yStrings.push("rectangle"); 498 break; 499 } 500 501 case "sizing": 502 { 503 buildA11yStrings(tree.body, a11yStrings, atomType); 504 break; 505 } 506 507 case "spacing": 508 { 509 a11yStrings.push("space"); 510 break; 511 } 512 513 case "styling": 514 { 515 // We ignore the styling and just pass through the contents 516 buildA11yStrings(tree.body, a11yStrings, atomType); 517 break; 518 } 519 520 case "sqrt": 521 { 522 buildRegion(a11yStrings, function (regionStrings) { 523 var body = tree.body, 524 index = tree.index; 525 526 if (index) { 527 var indexString = flatten(buildA11yStrings(index, [], atomType)).join(","); 528 529 if (indexString === "3") { 530 regionStrings.push("cube root of"); 531 buildA11yStrings(body, regionStrings, atomType); 532 regionStrings.push("end cube root"); 533 return; 534 } 535 536 regionStrings.push("root"); 537 regionStrings.push("start index"); 538 buildA11yStrings(index, regionStrings, atomType); 539 regionStrings.push("end index"); 540 return; 541 } 542 543 regionStrings.push("square root of"); 544 buildA11yStrings(body, regionStrings, atomType); 545 regionStrings.push("end square root"); 546 }); 547 break; 548 } 549 550 case "supsub": 551 { 552 var base = tree.base, 553 sub = tree.sub, 554 sup = tree.sup; 555 var isLog = false; 556 557 if (base) { 558 buildA11yStrings(base, a11yStrings, atomType); 559 isLog = base.type === "op" && base.name === "\\log"; 560 } 561 562 if (sub) { 563 var regionName = isLog ? "base" : "subscript"; 564 buildRegion(a11yStrings, function (regionStrings) { 565 regionStrings.push("start " + regionName); 566 buildA11yStrings(sub, regionStrings, atomType); 567 regionStrings.push("end " + regionName); 568 }); 569 } 570 571 if (sup) { 572 buildRegion(a11yStrings, function (regionStrings) { 573 var supString = flatten(buildA11yStrings(sup, [], atomType)).join(","); 574 575 if (supString in powerMap) { 576 regionStrings.push(powerMap[supString]); 577 return; 578 } 579 580 regionStrings.push("start superscript"); 581 buildA11yStrings(sup, regionStrings, atomType); 582 regionStrings.push("end superscript"); 583 }); 584 } 585 586 break; 587 } 588 589 case "text": 590 { 591 // TODO: handle other fonts 592 if (tree.font === "\\textbf") { 593 buildRegion(a11yStrings, function (regionStrings) { 594 regionStrings.push("start bold text"); 595 buildA11yStrings(tree.body, regionStrings, atomType); 596 regionStrings.push("end bold text"); 597 }); 598 break; 599 } 600 601 buildRegion(a11yStrings, function (regionStrings) { 602 regionStrings.push("start text"); 603 buildA11yStrings(tree.body, regionStrings, atomType); 604 regionStrings.push("end text"); 605 }); 606 break; 607 } 608 609 case "textord": 610 { 611 buildString(tree.text, atomType, a11yStrings); 612 break; 613 } 614 615 case "smash": 616 { 617 buildA11yStrings(tree.body, a11yStrings, atomType); 618 break; 619 } 620 621 case "enclose": 622 { 623 // TODO: create a map for these. 624 // TODO: differentiate between a body with a single atom, e.g. 625 // "cancel a" instead of "start cancel, a, end cancel" 626 if (/cancel/.test(tree.label)) { 627 buildRegion(a11yStrings, function (regionStrings) { 628 regionStrings.push("start cancel"); 629 buildA11yStrings(tree.body, regionStrings, atomType); 630 regionStrings.push("end cancel"); 631 }); 632 break; 633 } else if (/box/.test(tree.label)) { 634 buildRegion(a11yStrings, function (regionStrings) { 635 regionStrings.push("start box"); 636 buildA11yStrings(tree.body, regionStrings, atomType); 637 regionStrings.push("end box"); 638 }); 639 break; 640 } else if (/sout/.test(tree.label)) { 641 buildRegion(a11yStrings, function (regionStrings) { 642 regionStrings.push("start strikeout"); 643 buildA11yStrings(tree.body, regionStrings, atomType); 644 regionStrings.push("end strikeout"); 645 }); 646 break; 647 } else if (/phase/.test(tree.label)) { 648 buildRegion(a11yStrings, function (regionStrings) { 649 regionStrings.push("start phase angle"); 650 buildA11yStrings(tree.body, regionStrings, atomType); 651 regionStrings.push("end phase angle"); 652 }); 653 break; 654 } 655 656 throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet"); 657 } 658 659 case "vcenter": 660 { 661 buildA11yStrings(tree.body, a11yStrings, atomType); 662 break; 663 } 664 665 case "vphantom": 666 { 667 throw new Error("KaTeX-a11y: vphantom not implemented yet"); 668 } 669 670 case "hphantom": 671 { 672 throw new Error("KaTeX-a11y: hphantom not implemented yet"); 673 } 674 675 case "operatorname": 676 { 677 buildA11yStrings(tree.body, a11yStrings, atomType); 678 break; 679 } 680 681 case "array": 682 { 683 throw new Error("KaTeX-a11y: array not implemented yet"); 684 } 685 686 case "raw": 687 { 688 throw new Error("KaTeX-a11y: raw not implemented yet"); 689 } 690 691 case "size": 692 { 693 // Although there are nodes of type "size" in the parse tree, they have 694 // no semantic meaning and should be ignored. 695 break; 696 } 697 698 case "url": 699 { 700 throw new Error("KaTeX-a11y: url not implemented yet"); 701 } 702 703 case "tag": 704 { 705 throw new Error("KaTeX-a11y: tag not implemented yet"); 706 } 707 708 case "verb": 709 { 710 buildString("start verbatim", "normal", a11yStrings); 711 buildString(tree.body, "normal", a11yStrings); 712 buildString("end verbatim", "normal", a11yStrings); 713 break; 714 } 715 716 case "environment": 717 { 718 throw new Error("KaTeX-a11y: environment not implemented yet"); 719 } 720 721 case "horizBrace": 722 { 723 buildString("start " + tree.label.slice(1), "normal", a11yStrings); 724 buildA11yStrings(tree.base, a11yStrings, atomType); 725 buildString("end " + tree.label.slice(1), "normal", a11yStrings); 726 break; 727 } 728 729 case "infix": 730 { 731 // All infix nodes are replace with other nodes. 732 break; 733 } 734 735 case "includegraphics": 736 { 737 throw new Error("KaTeX-a11y: includegraphics not implemented yet"); 738 } 739 740 case "font": 741 { 742 // TODO: callout the start/end of specific fonts 743 // TODO: map \BBb{N} to "the naturals" or something like that 744 buildA11yStrings(tree.body, a11yStrings, atomType); 745 break; 746 } 747 748 case "href": 749 { 750 throw new Error("KaTeX-a11y: href not implemented yet"); 751 } 752 753 case "cr": 754 { 755 // This is used by environments. 756 throw new Error("KaTeX-a11y: cr not implemented yet"); 757 } 758 759 case "underline": 760 { 761 buildRegion(a11yStrings, function (a11yStrings) { 762 a11yStrings.push("start underline"); 763 buildA11yStrings(tree.body, a11yStrings, atomType); 764 a11yStrings.push("end underline"); 765 }); 766 break; 767 } 768 769 case "xArrow": 770 { 771 throw new Error("KaTeX-a11y: xArrow not implemented yet"); 772 } 773 774 case "cdlabel": 775 { 776 throw new Error("KaTeX-a11y: cdlabel not implemented yet"); 777 } 778 779 case "cdlabelparent": 780 { 781 throw new Error("KaTeX-a11y: cdlabelparent not implemented yet"); 782 } 783 784 case "mclass": 785 { 786 // \neq and \ne are macros so we let "htmlmathml" render the mathmal 787 // side of things and extract the text from that. 788 var _atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass 789 790 791 buildA11yStrings(tree.body, a11yStrings, _atomType); 792 break; 793 } 794 795 case "mathchoice": 796 { 797 // TODO: track which which style we're using, e.g. dispaly, text, etc. 798 // default to text style if even that may not be the correct style 799 buildA11yStrings(tree.text, a11yStrings, atomType); 800 break; 801 } 802 803 case "htmlmathml": 804 { 805 buildA11yStrings(tree.mathml, a11yStrings, atomType); 806 break; 807 } 808 809 case "middle": 810 { 811 buildString(tree.delim, atomType, a11yStrings); 812 break; 813 } 814 815 case "internal": 816 { 817 // internal nodes are never included in the parse tree 818 break; 819 } 820 821 case "html": 822 { 823 buildA11yStrings(tree.body, a11yStrings, atomType); 824 break; 825 } 826 827 default: 828 tree.type; 829 throw new Error("KaTeX a11y un-recognized type: " + tree.type); 830 } 831 }; 832 833 var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) { 834 if (a11yStrings === void 0) { 835 a11yStrings = []; 836 } 837 838 if (tree instanceof Array) { 839 for (var i = 0; i < tree.length; i++) { 840 buildA11yStrings(tree[i], a11yStrings, atomType); 841 } 842 } else { 843 handleObject(tree, a11yStrings, atomType); 844 } 845 846 return a11yStrings; 847 }; 848 849 var flatten = function flatten(array) { 850 var result = []; 851 array.forEach(function (item) { 852 if (item instanceof Array) { 853 result = result.concat(flatten(item)); 854 } else { 855 result.push(item); 856 } 857 }); 858 return result; 859 }; 860 861 var renderA11yString = function renderA11yString(text, settings) { 862 var tree = katex__WEBPACK_IMPORTED_MODULE_0___default().__parse(text, settings); 863 864 var a11yStrings = buildA11yStrings(tree, [], "normal"); 865 return flatten(a11yStrings).join(", "); 866 }; 867 868 /* harmony default export */ __webpack_exports__["default"] = (renderA11yString); 869 }(); 870 __webpack_exports__ = __webpack_exports__.default; 871 /******/ return __webpack_exports__; 872 /******/ })() 873 ; 874 });