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