jekyll-theme-hydejack 9.0.4 → 9.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (243) hide show
  1. checksums.yaml +4 -4
  2. data/_config.yml +5 -4
  3. data/_includes/body/breadcrumbs.html +19 -0
  4. data/_includes/body/footer.html +1 -1
  5. data/_includes/body/index.html +3 -2
  6. data/_includes/body/main.html +1 -0
  7. data/_includes/body/nav.html +3 -3
  8. data/_includes/body/scripts.html +2 -2
  9. data/_includes/body/sidebar.html +1 -1
  10. data/_includes/components/dingbat.html +13 -0
  11. data/_includes/components/post.html +35 -9
  12. data/_includes/components/tag-list.html +24 -24
  13. data/_includes/head/index.html +1 -1
  14. data/_includes/head/links-static.html +7 -4
  15. data/_includes/head/meta-static.html +1 -1
  16. data/_includes/head/scripts.html +7 -2
  17. data/_includes/head/styles-inline.html +4 -2
  18. data/_includes/head/styles-no-inline.html +4 -2
  19. data/_includes/header.txt +1 -1
  20. data/_includes/scripts.html +33 -0
  21. data/_includes/scripts/load-js.min.js +1 -1
  22. data/_includes/scripts/nomodule.min.js +1 -1
  23. data/_includes/smart-url +10 -1
  24. data/_includes/styles/page-style.scss +1 -0
  25. data/_includes/styles/style.scss +1 -0
  26. data/_includes/styles/variables.scss +4 -2
  27. data/_includes/templates/animation.html +1 -0
  28. data/_includes/templates/index.html +20 -2
  29. data/_layouts/about.html +4 -1
  30. data/_layouts/base.html +3 -12
  31. data/_layouts/compress.html +1 -1
  32. data/_layouts/page.html +4 -2
  33. data/_layouts/plain.html +29 -0
  34. data/_layouts/post.html +6 -1
  35. data/_sass/_mixins.scss +26 -3
  36. data/_sass/_tippy.scss +41 -0
  37. data/_sass/html.scss +1 -7
  38. data/_sass/hydejack/__inline__/_base.scss +23 -1
  39. data/_sass/hydejack/__inline__/_content.scss +5 -1
  40. data/_sass/hydejack/__inline__/_sidebar.scss +18 -4
  41. data/_sass/hydejack/__inline__/_toc.scss +9 -5
  42. data/_sass/hydejack/__inline__/_utilities.scss +25 -0
  43. data/_sass/hydejack/__link__/_base.scss +1 -1
  44. data/_sass/hydejack/__link__/_break-layout.scss +8 -1
  45. data/_sass/hydejack/__link__/_images.scss +1 -1
  46. data/_sass/hydejack/__link__/_sidebar.scss +15 -5
  47. data/_sass/hydejack/__link__/_toc.scss +4 -4
  48. data/_sass/hydejack/__link__/_utilities.scss +25 -0
  49. data/_sass/hydejack/_base.pre.scss +23 -1
  50. data/_sass/hydejack/_break-layout.pre.scss +8 -1
  51. data/_sass/hydejack/_content.pre.scss +5 -1
  52. data/_sass/hydejack/_images.pre.scss +1 -1
  53. data/_sass/hydejack/_sidebar.pre.scss +29 -5
  54. data/_sass/hydejack/_toc.pre.scss +12 -6
  55. data/_sass/hydejack/_utilities.pre.scss +25 -0
  56. data/_sass/pooleparty/__inline__/_base.scss +2 -0
  57. data/_sass/pooleparty/__inline__/_code.scss +1 -1
  58. data/_sass/pooleparty/__inline__/_message.scss +1 -1
  59. data/_sass/pooleparty/__inline__/_posts.scss +19 -3
  60. data/_sass/pooleparty/__inline__/_type.scss +4 -2
  61. data/_sass/pooleparty/__link__/_code.scss +138 -27
  62. data/_sass/pooleparty/__link__/_footnotes.scss +2 -1
  63. data/_sass/pooleparty/__link__/_posts.scss +12 -0
  64. data/_sass/pooleparty/__link__/_read-more.scss +1 -0
  65. data/_sass/pooleparty/__link__/_table.scss +30 -36
  66. data/_sass/pooleparty/__link__/_type.scss +4 -2
  67. data/_sass/pooleparty/_base.pre.scss +2 -0
  68. data/_sass/pooleparty/_code.pre.scss +138 -27
  69. data/_sass/pooleparty/_footnotes.pre.scss +2 -1
  70. data/_sass/pooleparty/_message.pre.scss +1 -1
  71. data/_sass/pooleparty/_posts.pre.scss +31 -3
  72. data/_sass/pooleparty/_read-more.pre.scss +1 -0
  73. data/_sass/pooleparty/_table.pre.scss +30 -36
  74. data/_sass/pooleparty/_type.pre.scss +6 -4
  75. data/_sass/tippyjs/_mixins.scss +25 -0
  76. data/_sass/tippyjs/_vars.scss +6 -0
  77. data/_sass/tippyjs/animations/fade.scss +8 -0
  78. data/_sass/tippyjs/index.scss +90 -0
  79. data/assets/bower.json +2 -1
  80. data/assets/bower_components/MathJax/.bower.json +5 -5
  81. data/assets/bower_components/MathJax/es5/a11y/assistive-mml.js +1 -1
  82. data/assets/bower_components/MathJax/es5/a11y/complexity.js +1 -1
  83. data/assets/bower_components/MathJax/es5/a11y/explorer.js +1 -1
  84. data/assets/bower_components/MathJax/es5/a11y/semantic-enrich.js +1 -1
  85. data/assets/bower_components/MathJax/es5/adaptors/liteDOM.js +1 -1
  86. data/assets/bower_components/MathJax/es5/core.js +1 -1
  87. data/assets/bower_components/MathJax/es5/input/asciimath.js +1 -1
  88. data/assets/bower_components/MathJax/es5/input/mml.js +1 -1
  89. data/assets/bower_components/MathJax/es5/input/mml/entities.js +1 -1
  90. data/assets/bower_components/MathJax/es5/input/tex-base.js +1 -1
  91. data/assets/bower_components/MathJax/es5/input/tex-full.js +1 -1
  92. data/assets/bower_components/MathJax/es5/input/tex.js +1 -1
  93. data/assets/bower_components/MathJax/es5/input/tex/extensions/action.js +1 -1
  94. data/assets/bower_components/MathJax/es5/input/tex/extensions/all-packages.js +1 -1
  95. data/assets/bower_components/MathJax/es5/input/tex/extensions/ams.js +1 -1
  96. data/assets/bower_components/MathJax/es5/input/tex/extensions/amscd.js +1 -1
  97. data/assets/bower_components/MathJax/es5/input/tex/extensions/autoload.js +1 -1
  98. data/assets/bower_components/MathJax/es5/input/tex/extensions/bbox.js +1 -1
  99. data/assets/bower_components/MathJax/es5/input/tex/extensions/boldsymbol.js +1 -1
  100. data/assets/bower_components/MathJax/es5/input/tex/extensions/braket.js +1 -1
  101. data/assets/bower_components/MathJax/es5/input/tex/extensions/bussproofs.js +1 -1
  102. data/assets/bower_components/MathJax/es5/input/tex/extensions/cancel.js +1 -1
  103. data/assets/bower_components/MathJax/es5/input/tex/extensions/color.js +1 -1
  104. data/assets/bower_components/MathJax/es5/input/tex/extensions/colorV2.js +1 -1
  105. data/assets/bower_components/MathJax/es5/input/tex/extensions/configMacros.js +1 -1
  106. data/assets/bower_components/MathJax/es5/input/tex/extensions/enclose.js +1 -1
  107. data/assets/bower_components/MathJax/es5/input/tex/extensions/extpfeil.js +1 -1
  108. data/assets/bower_components/MathJax/es5/input/tex/extensions/html.js +1 -1
  109. data/assets/bower_components/MathJax/es5/input/tex/extensions/mhchem.js +1 -1
  110. data/assets/bower_components/MathJax/es5/input/tex/extensions/newcommand.js +1 -1
  111. data/assets/bower_components/MathJax/es5/input/tex/extensions/noerrors.js +1 -1
  112. data/assets/bower_components/MathJax/es5/input/tex/extensions/noundefined.js +1 -1
  113. data/assets/bower_components/MathJax/es5/input/tex/extensions/physics.js +1 -1
  114. data/assets/bower_components/MathJax/es5/input/tex/extensions/require.js +1 -1
  115. data/assets/bower_components/MathJax/es5/input/tex/extensions/tagFormat.js +1 -1
  116. data/assets/bower_components/MathJax/es5/input/tex/extensions/textmacros.js +1 -0
  117. data/assets/bower_components/MathJax/es5/input/tex/extensions/unicode.js +1 -1
  118. data/assets/bower_components/MathJax/es5/input/tex/extensions/verb.js +1 -1
  119. data/assets/bower_components/MathJax/es5/latest.js +1 -1
  120. data/assets/bower_components/MathJax/es5/loader.js +1 -1
  121. data/assets/bower_components/MathJax/es5/mml-chtml.js +1 -1
  122. data/assets/bower_components/MathJax/es5/mml-svg.js +1 -1
  123. data/assets/bower_components/MathJax/es5/node-main.js +1 -1
  124. data/assets/bower_components/MathJax/es5/output/chtml.js +1 -1
  125. data/assets/bower_components/MathJax/es5/output/chtml/fonts/tex.js +1 -1
  126. data/assets/bower_components/MathJax/es5/output/svg.js +1 -1
  127. data/assets/bower_components/MathJax/es5/output/svg/fonts/tex.js +1 -1
  128. data/assets/bower_components/MathJax/es5/sre/mathmaps/de.js +104 -0
  129. data/assets/bower_components/MathJax/es5/sre/mathmaps/en.js +11 -5
  130. data/assets/bower_components/MathJax/es5/sre/mathmaps/es.js +1 -1
  131. data/assets/bower_components/MathJax/es5/sre/mathmaps/mathmaps_ie.js +117 -9
  132. data/assets/bower_components/MathJax/es5/sre/mathmaps/nemeth.js +3 -3
  133. data/assets/bower_components/MathJax/es5/sre/sre-node.js +11 -0
  134. data/assets/bower_components/MathJax/es5/sre/sre_browser.js +1110 -1186
  135. data/assets/bower_components/MathJax/es5/startup.js +1 -1
  136. data/assets/bower_components/MathJax/es5/tex-chtml-full.js +1 -1
  137. data/assets/bower_components/MathJax/es5/tex-chtml.js +1 -1
  138. data/assets/bower_components/MathJax/es5/tex-mml-chtml.js +1 -1
  139. data/assets/bower_components/MathJax/es5/tex-mml-svg.js +1 -1
  140. data/assets/bower_components/MathJax/es5/tex-svg-full.js +1 -1
  141. data/assets/bower_components/MathJax/es5/tex-svg.js +1 -1
  142. data/assets/bower_components/MathJax/es5/ui/menu.js +1 -1
  143. data/assets/bower_components/MathJax/es5/ui/safe.js +1 -0
  144. data/assets/bower_components/MathJax/package.json +3 -3
  145. data/assets/bower_components/katex/.bower.json +7 -6
  146. data/assets/bower_components/katex/dist/contrib/render-a11y-string.js +858 -0
  147. data/assets/bower_components/katex/dist/contrib/render-a11y-string.min.js +1 -0
  148. data/assets/bower_components/katex/dist/contrib/render-a11y-string.mjs +741 -0
  149. data/assets/bower_components/katex/dist/katex.css +1 -10
  150. data/assets/bower_components/katex/dist/katex.js +1228 -612
  151. data/assets/bower_components/katex/dist/katex.min.css +1 -1
  152. data/assets/bower_components/katex/dist/katex.min.js +1 -1
  153. data/assets/bower_components/katex/dist/katex.mjs +1270 -591
  154. data/assets/bower_components/katex/docs/cli.md.template +21 -0
  155. data/assets/bower_components/katex/flow-typed/npm/jest_v24.x.x.js +1201 -0
  156. data/assets/bower_components/katex/yarn.lock +233 -172
  157. data/assets/css/{hydejack-9.0.4.css → hydejack-9.1.4.css} +0 -0
  158. data/assets/icomoon/fonts/icomoon.eot +0 -0
  159. data/assets/icomoon/fonts/icomoon.svg +6 -3
  160. data/assets/icomoon/fonts/icomoon.ttf +0 -0
  161. data/assets/icomoon/fonts/icomoon.woff +0 -0
  162. data/assets/icomoon/selection.json +1 -1
  163. data/assets/icomoon/style.css +17 -8
  164. data/assets/icons/icon-128x128.png +0 -0
  165. data/assets/icons/icon-144x144.png +0 -0
  166. data/assets/icons/icon-152x152.png +0 -0
  167. data/assets/icons/icon-192x192.png +0 -0
  168. data/assets/icons/icon-384x384.png +0 -0
  169. data/assets/icons/icon-512x512.png +0 -0
  170. data/assets/icons/icon-96x96.png +0 -0
  171. data/assets/img/logo.png +0 -0
  172. data/assets/img/sidebar-bg.jpg +0 -0
  173. data/assets/img/swipe.svg +1 -22
  174. data/assets/js/LEGACY-clap-button-hydejack-9.1.4.js +14 -0
  175. data/assets/js/LEGACY-drawer-hydejack-9.1.4.js +14 -0
  176. data/assets/js/{LEGACY-fetch-hydejack-9.0.4.js → LEGACY-fetch-hydejack-9.1.4.js} +2 -2
  177. data/assets/js/LEGACY-hydejack-9.1.4.js +27 -0
  178. data/assets/js/LEGACY-navbar-hydejack-9.1.4.js +14 -0
  179. data/assets/js/LEGACY-push-state-hydejack-9.1.4.js +14 -0
  180. data/assets/js/LEGACY-resize-observer-hydejack-9.1.4.js +14 -0
  181. data/assets/js/{LEGACY-shadydom-hydejack-9.0.4.js → LEGACY-shadydom-hydejack-9.1.4.js} +2 -2
  182. data/assets/js/LEGACY-vendors~clap-button-hydejack-9.1.4.js +14 -0
  183. data/assets/js/LEGACY-vendors~drawer-hydejack-9.1.4.js +48 -0
  184. data/assets/js/LEGACY-vendors~drawer~push-state-hydejack-9.1.4.js +214 -0
  185. data/assets/js/LEGACY-vendors~fetch-hydejack-9.1.4.js +14 -0
  186. data/assets/js/LEGACY-vendors~intersection-observer-hydejack-9.1.4.js +14 -0
  187. data/assets/js/LEGACY-vendors~push-state-hydejack-9.1.4.js +34 -0
  188. data/assets/js/LEGACY-vendors~shadydom-hydejack-9.1.4.js +155 -0
  189. data/assets/js/{LEGACY-vendors~webanimations-hydejack-9.0.4.js → LEGACY-vendors~webanimations-hydejack-9.1.4.js} +2 -2
  190. data/assets/js/{LEGACY-vendors~webcomponents-hydejack-9.0.4.js → LEGACY-vendors~webcomponents-hydejack-9.1.4.js} +4 -4
  191. data/assets/js/{LEGACY-webcomponents-hydejack-9.0.4.js → LEGACY-webcomponents-hydejack-9.1.4.js} +2 -2
  192. data/assets/js/clap-button-hydejack-9.1.4.js +14 -0
  193. data/assets/js/drawer-hydejack-9.1.4.js +14 -0
  194. data/assets/js/{shadydom-hydejack-9.0.4.js → fetch-hydejack-9.1.4.js} +2 -2
  195. data/assets/js/hydejack-9.1.4.js +28 -0
  196. data/assets/js/navbar-hydejack-9.1.4.js +14 -0
  197. data/assets/js/push-state-hydejack-9.1.4.js +14 -0
  198. data/assets/js/resize-observer-hydejack-9.1.4.js +14 -0
  199. data/assets/js/{fetch-hydejack-9.0.4.js → shadydom-hydejack-9.1.4.js} +2 -2
  200. data/assets/js/vendors~clap-button-hydejack-9.1.4.js +14 -0
  201. data/assets/js/vendors~drawer-hydejack-9.1.4.js +48 -0
  202. data/assets/js/vendors~drawer~push-state-hydejack-9.1.4.js +163 -0
  203. data/assets/js/vendors~fetch-hydejack-9.1.4.js +14 -0
  204. data/assets/js/vendors~intersection-observer-hydejack-9.1.4.js +14 -0
  205. data/assets/js/vendors~push-state-hydejack-9.1.4.js +34 -0
  206. data/assets/js/vendors~shadydom-hydejack-9.1.4.js +146 -0
  207. data/assets/js/{vendors~webanimations-hydejack-9.0.4.js → vendors~webanimations-hydejack-9.1.4.js} +2 -2
  208. data/assets/js/{webcomponents-hydejack-9.0.4.js → webcomponents-hydejack-9.1.4.js} +2 -2
  209. data/assets/site.webmanifest +1 -1
  210. data/assets/version.json +2 -2
  211. metadata +59 -47
  212. data/_includes/templates/back.html +0 -6
  213. data/_includes/templates/forward.html +0 -6
  214. data/assets/js/LEGACY-drawer-hydejack-9.0.4.js +0 -14
  215. data/assets/js/LEGACY-hydejack-9.0.4.js +0 -28
  216. data/assets/js/LEGACY-navbar-hydejack-9.0.4.js +0 -14
  217. data/assets/js/LEGACY-push-state-hydejack-9.0.4.js +0 -14
  218. data/assets/js/LEGACY-resize-observer-hydejack-9.0.4.js +0 -14
  219. data/assets/js/LEGACY-search-hydejack-9.0.4.js +0 -14
  220. data/assets/js/LEGACY-toc-hydejack-9.0.4.js +0 -14
  221. data/assets/js/LEGACY-vendors~drawer-hydejack-9.0.4.js +0 -47
  222. data/assets/js/LEGACY-vendors~drawer~push-state-hydejack-9.0.4.js +0 -215
  223. data/assets/js/LEGACY-vendors~drawer~push-state~search-hydejack-9.0.4.js +0 -151
  224. data/assets/js/LEGACY-vendors~fetch-hydejack-9.0.4.js +0 -14
  225. data/assets/js/LEGACY-vendors~intersection-observer-hydejack-9.0.4.js +0 -14
  226. data/assets/js/LEGACY-vendors~push-state-hydejack-9.0.4.js +0 -33
  227. data/assets/js/LEGACY-vendors~search-hydejack-9.0.4.js +0 -40
  228. data/assets/js/LEGACY-vendors~shadydom-hydejack-9.0.4.js +0 -155
  229. data/assets/js/drawer-hydejack-9.0.4.js +0 -14
  230. data/assets/js/hydejack-9.0.4.js +0 -28
  231. data/assets/js/navbar-hydejack-9.0.4.js +0 -14
  232. data/assets/js/push-state-hydejack-9.0.4.js +0 -14
  233. data/assets/js/resize-observer-hydejack-9.0.4.js +0 -14
  234. data/assets/js/search-hydejack-9.0.4.js +0 -14
  235. data/assets/js/toc-hydejack-9.0.4.js +0 -14
  236. data/assets/js/vendors~drawer-hydejack-9.0.4.js +0 -47
  237. data/assets/js/vendors~drawer~push-state-hydejack-9.0.4.js +0 -163
  238. data/assets/js/vendors~drawer~push-state~search-hydejack-9.0.4.js +0 -124
  239. data/assets/js/vendors~fetch-hydejack-9.0.4.js +0 -14
  240. data/assets/js/vendors~intersection-observer-hydejack-9.0.4.js +0 -14
  241. data/assets/js/vendors~push-state-hydejack-9.0.4.js +0 -33
  242. data/assets/js/vendors~search-hydejack-9.0.4.js +0 -40
  243. data/assets/js/vendors~shadydom-hydejack-9.0.4.js +0 -146
@@ -0,0 +1 @@
1
+ !function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],r);else{var t="object"==typeof exports?r(require("katex")):r(e.katex);for(var a in t)("object"==typeof exports?exports:e)[a]=t[a]}}("undefined"!=typeof self?self:this,function(e){return function(e){var r={};function t(a){if(r[a])return r[a].exports;var o=r[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,a){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:a})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(t.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(a,o,function(r){return e[r]}.bind(null,o));return a},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=1)}([function(r,t){r.exports=e},function(e,r,t){"use strict";t.r(r);var a=t(0),o=t.n(a),n={"(":"left parenthesis",")":"right parenthesis","[":"open bracket","]":"close bracket","\\{":"left brace","\\}":"right brace","\\lvert":"open vertical bar","\\rvert":"close vertical bar","|":"vertical bar","\\uparrow":"up arrow","\\Uparrow":"up arrow","\\downarrow":"down arrow","\\Downarrow":"down arrow","\\updownarrow":"up down arrow","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow","\\langle":"open angle","\\rangle":"close angle","\\lfloor":"open floor","\\rfloor":"close floor","\\int":"integral","\\intop":"integral","\\lim":"limit","\\ln":"natural log","\\log":"log","\\sin":"sine","\\cos":"cosine","\\tan":"tangent","\\cot":"cotangent","\\sum":"sum","/":"slash",",":"comma",".":"point","-":"negative","+":"plus","~":"tilde",":":"colon","?":"question mark","'":"apostrophe","\\%":"percent"," ":"space","\\ ":"space","\\$":"dollar sign","\\angle":"angle","\\degree":"degree","\\circ":"circle","\\vec":"vector","\\triangle":"triangle","\\pi":"pi","\\prime":"prime","\\infty":"infinity","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\omega":"omega","\\theta":"theta","\\sigma":"sigma","\\lambda":"lambda","\\tau":"tau","\\Delta":"delta","\\delta":"delta","\\mu":"mu","\\rho":"rho","\\nabla":"del","\\ell":"ell","\\ldots":"dots","\\hat":"hat","\\acute":"acute"},s={prime:"prime",degree:"degrees",circle:"degrees",2:"squared",3:"cubed"},i={"|":"open vertical bar",".":""},l={"|":"close vertical bar",".":""},c={"+":"plus","-":"minus","\\pm":"plus minus","\\cdot":"dot","*":"times","/":"divided by","\\times":"times","\\div":"divided by","\\circ":"circle","\\bullet":"bullet"},u={"=":"equals","\\approx":"approximately equals","\u2260":"does not equal","\\geq":"is greater than or equal to","\\ge":"is greater than or equal to","\\leq":"is less than or equal to","\\le":"is less than or equal to",">":"is greater than","<":"is less than","\\leftarrow":"left arrow","\\Leftarrow":"left arrow","\\rightarrow":"right arrow","\\Rightarrow":"right arrow",":":"colon"},p={"\\underleftarrow":"left arrow","\\underrightarrow":"right arrow","\\underleftrightarrow":"left-right arrow","\\undergroup":"group","\\underlinesegment":"line segment","\\utilde":"tilde"},d=function(e,r,t){var a;e&&(/^\d+$/.test(a="open"===r?e in i?i[e]:n[e]||e:"close"===r?e in l?l[e]:n[e]||e:"bin"===r?c[e]||e:"rel"===r?u[e]||e:n[e]||e)&&t.length>0&&/^\d+$/.test(t[t.length-1])?t[t.length-1]+=a:a&&t.push(a))},b=function(e,r){var t=[];e.push(t),r(t)},h=function(e,r,t){switch(e.type){case"accent":b(r,function(r){f(e.base,r,t),r.push("with"),d(e.label,"normal",r),r.push("on top")});break;case"accentUnder":b(r,function(r){f(e.base,r,t),r.push("with"),d(p[e.label],"normal",r),r.push("underneath")});break;case"accent-token":break;case"atom":var a=e.text;switch(e.family){case"bin":d(a,"bin",r);break;case"close":d(a,"close",r);break;case"inner":d(e.text,"inner",r);break;case"open":d(a,"open",r);break;case"punct":d(a,"punct",r);break;case"rel":d(a,"rel",r);break;default:throw e.family,new Error('"'+e.family+'" is not a valid atom type')}break;case"color":var o=e.color.replace(/katex-/,"");b(r,function(r){r.push("start color "+o),f(e.body,r,t),r.push("end color "+o)});break;case"color-token":break;case"delimsizing":e.delim&&"."!==e.delim&&d(e.delim,"normal",r);break;case"genfrac":b(r,function(r){var a=e.leftDelim,o=e.rightDelim;e.hasBarLine?(r.push("start fraction"),a&&d(a,"open",r),f(e.numer,r,t),r.push("divided by"),f(e.denom,r,t),o&&d(o,"close",r),r.push("end fraction")):(r.push("start binomial"),a&&d(a,"open",r),f(e.numer,r,t),r.push("over"),f(e.denom,r,t),o&&d(o,"close",r),r.push("end binomial"))});break;case"kern":break;case"leftright":b(r,function(r){d(e.left,"open",r),f(e.body,r,t),d(e.right,"close",r)});break;case"leftright-right":break;case"lap":f(e.body,r,t);break;case"mathord":d(e.text,"normal",r);break;case"op":var n=e.body,i=e.name;n?f(n,r,t):i&&d(i,"normal",r);break;case"op-token":d(e.text,t,r);break;case"ordgroup":f(e.body,r,t);break;case"overline":b(r,function(r){r.push("start overline"),f(e.body,r,t),r.push("end overline")});break;case"phantom":r.push("empty space");break;case"raisebox":f(e.body,r,t);break;case"rule":r.push("rectangle");break;case"sizing":f(e.body,r,t);break;case"spacing":r.push("space");break;case"styling":f(e.body,r,t);break;case"sqrt":b(r,function(r){var a=e.body,o=e.index;if(o)return"3"===m(f(o,[],t)).join(",")?(r.push("cube root of"),f(a,r,t),void r.push("end cube root")):(r.push("root"),r.push("start index"),f(o,r,t),void r.push("end index"));r.push("square root of"),f(a,r,t),r.push("end square root")});break;case"supsub":var l=e.base,c=e.sub,u=e.sup,h=!1;if(l&&(f(l,r,t),h="op"===l.type&&"\\log"===l.name),c){var y=h?"base":"subscript";b(r,function(e){e.push("start "+y),f(c,e,t),e.push("end "+y)})}u&&b(r,function(e){var r=m(f(u,[],t)).join(",");r in s?e.push(s[r]):(e.push("start superscript"),f(u,e,t),e.push("end superscript"))});break;case"text":if("\\textbf"===e.font){b(r,function(r){r.push("start bold text"),f(e.body,r,t),r.push("end bold text")});break}b(r,function(r){r.push("start text"),f(e.body,r,t),r.push("end text")});break;case"textord":d(e.text,t,r);break;case"smash":f(e.body,r,t);break;case"enclose":if(/cancel/.test(e.label)){b(r,function(r){r.push("start cancel"),f(e.body,r,t),r.push("end cancel")});break}if(/box/.test(e.label)){b(r,function(r){r.push("start box"),f(e.body,r,t),r.push("end box")});break}if(/sout/.test(e.label)){b(r,function(r){r.push("start strikeout"),f(e.body,r,t),r.push("end strikeout")});break}throw new Error("KaTeX-a11y: enclose node with "+e.label+" not supported yet");case"vphantom":throw new Error("KaTeX-a11y: vphantom not implemented yet");case"hphantom":throw new Error("KaTeX-a11y: hphantom not implemented yet");case"operatorname":f(e.body,r,t);break;case"array":throw new Error("KaTeX-a11y: array not implemented yet");case"raw":throw new Error("KaTeX-a11y: raw not implemented yet");case"size":break;case"url":throw new Error("KaTeX-a11y: url not implemented yet");case"tag":throw new Error("KaTeX-a11y: tag not implemented yet");case"verb":d("start verbatim","normal",r),d(e.body,"normal",r),d("end verbatim","normal",r);break;case"environment":throw new Error("KaTeX-a11y: environment not implemented yet");case"horizBrace":d("start "+e.label.slice(1),"normal",r),f(e.base,r,t),d("end "+e.label.slice(1),"normal",r);break;case"infix":break;case"includegraphics":throw new Error("KaTeX-a11y: includegraphics not implemented yet");case"font":f(e.body,r,t);break;case"href":throw new Error("KaTeX-a11y: href not implemented yet");case"cr":throw new Error("KaTeX-a11y: cr not implemented yet");case"underline":b(r,function(r){r.push("start underline"),f(e.body,r,t),r.push("end underline")});break;case"xArrow":throw new Error("KaTeX-a11y: xArrow not implemented yet");case"mclass":var g=e.mclass.slice(1);f(e.body,r,g);break;case"mathchoice":f(e.text,r,t);break;case"htmlmathml":f(e.mathml,r,t);break;case"middle":d(e.delim,t,r);break;default:throw e.type,new Error("KaTeX a11y un-recognized type: "+e.type)}},f=function e(r,t,a){if(void 0===t&&(t=[]),r instanceof Array)for(var o=0;o<r.length;o++)e(r[o],t,a);else h(r,t,a);return t},m=function e(r){var t=[];return r.forEach(function(r){r instanceof Array?t=t.concat(e(r)):t.push(r)}),t};r.default=function(e,r){var t=o.a.__parse(e,r),a=f(t,[],"normal");return m(a).join(", ")}}]).default});
@@ -0,0 +1,741 @@
1
+ import katex from '../katex.mjs';
2
+
3
+ /**
4
+ * renderA11yString returns a readable string.
5
+ *
6
+ * In some cases the string will have the proper semantic math
7
+ * meaning,:
8
+ * renderA11yString("\\frac{1}{2}"")
9
+ * -> "start fraction, 1, divided by, 2, end fraction"
10
+ *
11
+ * However, other cases do not:
12
+ * renderA11yString("f(x) = x^2")
13
+ * -> "f, left parenthesis, x, right parenthesis, equals, x, squared"
14
+ *
15
+ * The commas in the string aim to increase ease of understanding
16
+ * when read by a screenreader.
17
+ */
18
+ const stringMap = {
19
+ "(": "left parenthesis",
20
+ ")": "right parenthesis",
21
+ "[": "open bracket",
22
+ "]": "close bracket",
23
+ "\\{": "left brace",
24
+ "\\}": "right brace",
25
+ "\\lvert": "open vertical bar",
26
+ "\\rvert": "close vertical bar",
27
+ "|": "vertical bar",
28
+ "\\uparrow": "up arrow",
29
+ "\\Uparrow": "up arrow",
30
+ "\\downarrow": "down arrow",
31
+ "\\Downarrow": "down arrow",
32
+ "\\updownarrow": "up down arrow",
33
+ "\\leftarrow": "left arrow",
34
+ "\\Leftarrow": "left arrow",
35
+ "\\rightarrow": "right arrow",
36
+ "\\Rightarrow": "right arrow",
37
+ "\\langle": "open angle",
38
+ "\\rangle": "close angle",
39
+ "\\lfloor": "open floor",
40
+ "\\rfloor": "close floor",
41
+ "\\int": "integral",
42
+ "\\intop": "integral",
43
+ "\\lim": "limit",
44
+ "\\ln": "natural log",
45
+ "\\log": "log",
46
+ "\\sin": "sine",
47
+ "\\cos": "cosine",
48
+ "\\tan": "tangent",
49
+ "\\cot": "cotangent",
50
+ "\\sum": "sum",
51
+ "/": "slash",
52
+ ",": "comma",
53
+ ".": "point",
54
+ "-": "negative",
55
+ "+": "plus",
56
+ "~": "tilde",
57
+ ":": "colon",
58
+ "?": "question mark",
59
+ "'": "apostrophe",
60
+ "\\%": "percent",
61
+ " ": "space",
62
+ "\\ ": "space",
63
+ "\\$": "dollar sign",
64
+ "\\angle": "angle",
65
+ "\\degree": "degree",
66
+ "\\circ": "circle",
67
+ "\\vec": "vector",
68
+ "\\triangle": "triangle",
69
+ "\\pi": "pi",
70
+ "\\prime": "prime",
71
+ "\\infty": "infinity",
72
+ "\\alpha": "alpha",
73
+ "\\beta": "beta",
74
+ "\\gamma": "gamma",
75
+ "\\omega": "omega",
76
+ "\\theta": "theta",
77
+ "\\sigma": "sigma",
78
+ "\\lambda": "lambda",
79
+ "\\tau": "tau",
80
+ "\\Delta": "delta",
81
+ "\\delta": "delta",
82
+ "\\mu": "mu",
83
+ "\\rho": "rho",
84
+ "\\nabla": "del",
85
+ "\\ell": "ell",
86
+ "\\ldots": "dots",
87
+ // TODO: add entries for all accents
88
+ "\\hat": "hat",
89
+ "\\acute": "acute"
90
+ };
91
+ const powerMap = {
92
+ "prime": "prime",
93
+ "degree": "degrees",
94
+ "circle": "degrees",
95
+ "2": "squared",
96
+ "3": "cubed"
97
+ };
98
+ const openMap = {
99
+ "|": "open vertical bar",
100
+ ".": ""
101
+ };
102
+ const closeMap = {
103
+ "|": "close vertical bar",
104
+ ".": ""
105
+ };
106
+ const binMap = {
107
+ "+": "plus",
108
+ "-": "minus",
109
+ "\\pm": "plus minus",
110
+ "\\cdot": "dot",
111
+ "*": "times",
112
+ "/": "divided by",
113
+ "\\times": "times",
114
+ "\\div": "divided by",
115
+ "\\circ": "circle",
116
+ "\\bullet": "bullet"
117
+ };
118
+ const relMap = {
119
+ "=": "equals",
120
+ "\\approx": "approximately equals",
121
+ "≠": "does not equal",
122
+ "\\geq": "is greater than or equal to",
123
+ "\\ge": "is greater than or equal to",
124
+ "\\leq": "is less than or equal to",
125
+ "\\le": "is less than or equal to",
126
+ ">": "is greater than",
127
+ "<": "is less than",
128
+ "\\leftarrow": "left arrow",
129
+ "\\Leftarrow": "left arrow",
130
+ "\\rightarrow": "right arrow",
131
+ "\\Rightarrow": "right arrow",
132
+ ":": "colon"
133
+ };
134
+ const accentUnderMap = {
135
+ "\\underleftarrow": "left arrow",
136
+ "\\underrightarrow": "right arrow",
137
+ "\\underleftrightarrow": "left-right arrow",
138
+ "\\undergroup": "group",
139
+ "\\underlinesegment": "line segment",
140
+ "\\utilde": "tilde"
141
+ };
142
+
143
+ const buildString = (str, type, a11yStrings) => {
144
+ if (!str) {
145
+ return;
146
+ }
147
+
148
+ let ret;
149
+
150
+ if (type === "open") {
151
+ ret = str in openMap ? openMap[str] : stringMap[str] || str;
152
+ } else if (type === "close") {
153
+ ret = str in closeMap ? closeMap[str] : stringMap[str] || str;
154
+ } else if (type === "bin") {
155
+ ret = binMap[str] || str;
156
+ } else if (type === "rel") {
157
+ ret = relMap[str] || str;
158
+ } else {
159
+ ret = stringMap[str] || str;
160
+ } // If the text to add is a number and there is already a string
161
+ // in the list and the last string is a number then we should
162
+ // combine them into a single number
163
+
164
+
165
+ if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string
166
+ // I think we might be able to drop the nested arrays, which would make
167
+ // this easier to type - $FlowFixMe
168
+ /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) {
169
+ a11yStrings[a11yStrings.length - 1] += ret;
170
+ } else if (ret) {
171
+ a11yStrings.push(ret);
172
+ }
173
+ };
174
+
175
+ const buildRegion = (a11yStrings, callback) => {
176
+ const regionStrings = [];
177
+ a11yStrings.push(regionStrings);
178
+ callback(regionStrings);
179
+ };
180
+
181
+ const handleObject = (tree, a11yStrings, atomType) => {
182
+ // Everything else is assumed to be an object...
183
+ switch (tree.type) {
184
+ case "accent":
185
+ {
186
+ buildRegion(a11yStrings, a11yStrings => {
187
+ buildA11yStrings(tree.base, a11yStrings, atomType);
188
+ a11yStrings.push("with");
189
+ buildString(tree.label, "normal", a11yStrings);
190
+ a11yStrings.push("on top");
191
+ });
192
+ break;
193
+ }
194
+
195
+ case "accentUnder":
196
+ {
197
+ buildRegion(a11yStrings, a11yStrings => {
198
+ buildA11yStrings(tree.base, a11yStrings, atomType);
199
+ a11yStrings.push("with");
200
+ buildString(accentUnderMap[tree.label], "normal", a11yStrings);
201
+ a11yStrings.push("underneath");
202
+ });
203
+ break;
204
+ }
205
+
206
+ case "accent-token":
207
+ {
208
+ // Used internally by accent symbols.
209
+ break;
210
+ }
211
+
212
+ case "atom":
213
+ {
214
+ const text = tree.text;
215
+
216
+ switch (tree.family) {
217
+ case "bin":
218
+ {
219
+ buildString(text, "bin", a11yStrings);
220
+ break;
221
+ }
222
+
223
+ case "close":
224
+ {
225
+ buildString(text, "close", a11yStrings);
226
+ break;
227
+ }
228
+ // TODO(kevinb): figure out what should be done for inner
229
+
230
+ case "inner":
231
+ {
232
+ buildString(tree.text, "inner", a11yStrings);
233
+ break;
234
+ }
235
+
236
+ case "open":
237
+ {
238
+ buildString(text, "open", a11yStrings);
239
+ break;
240
+ }
241
+
242
+ case "punct":
243
+ {
244
+ buildString(text, "punct", a11yStrings);
245
+ break;
246
+ }
247
+
248
+ case "rel":
249
+ {
250
+ buildString(text, "rel", a11yStrings);
251
+ break;
252
+ }
253
+
254
+ default:
255
+ {
256
+ tree.family;
257
+ throw new Error(`"${tree.family}" is not a valid atom type`);
258
+ }
259
+ }
260
+
261
+ break;
262
+ }
263
+
264
+ case "color":
265
+ {
266
+ const color = tree.color.replace(/katex-/, "");
267
+ buildRegion(a11yStrings, regionStrings => {
268
+ regionStrings.push("start color " + color);
269
+ buildA11yStrings(tree.body, regionStrings, atomType);
270
+ regionStrings.push("end color " + color);
271
+ });
272
+ break;
273
+ }
274
+
275
+ case "color-token":
276
+ {
277
+ // Used by \color, \colorbox, and \fcolorbox but not directly rendered.
278
+ // It's a leaf node and has no children so just break.
279
+ break;
280
+ }
281
+
282
+ case "delimsizing":
283
+ {
284
+ if (tree.delim && tree.delim !== ".") {
285
+ buildString(tree.delim, "normal", a11yStrings);
286
+ }
287
+
288
+ break;
289
+ }
290
+
291
+ case "genfrac":
292
+ {
293
+ buildRegion(a11yStrings, regionStrings => {
294
+ // genfrac can have unbalanced delimiters
295
+ const leftDelim = tree.leftDelim,
296
+ rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption
297
+ // hasBarLine true -> fraction, false -> binomial
298
+
299
+ if (tree.hasBarLine) {
300
+ regionStrings.push("start fraction");
301
+ leftDelim && buildString(leftDelim, "open", regionStrings);
302
+ buildA11yStrings(tree.numer, regionStrings, atomType);
303
+ regionStrings.push("divided by");
304
+ buildA11yStrings(tree.denom, regionStrings, atomType);
305
+ rightDelim && buildString(rightDelim, "close", regionStrings);
306
+ regionStrings.push("end fraction");
307
+ } else {
308
+ regionStrings.push("start binomial");
309
+ leftDelim && buildString(leftDelim, "open", regionStrings);
310
+ buildA11yStrings(tree.numer, regionStrings, atomType);
311
+ regionStrings.push("over");
312
+ buildA11yStrings(tree.denom, regionStrings, atomType);
313
+ rightDelim && buildString(rightDelim, "close", regionStrings);
314
+ regionStrings.push("end binomial");
315
+ }
316
+ });
317
+ break;
318
+ }
319
+
320
+ case "kern":
321
+ {
322
+ // No op: we don't attempt to present kerning information
323
+ // to the screen reader.
324
+ break;
325
+ }
326
+
327
+ case "leftright":
328
+ {
329
+ buildRegion(a11yStrings, regionStrings => {
330
+ buildString(tree.left, "open", regionStrings);
331
+ buildA11yStrings(tree.body, regionStrings, atomType);
332
+ buildString(tree.right, "close", regionStrings);
333
+ });
334
+ break;
335
+ }
336
+
337
+ case "leftright-right":
338
+ {
339
+ // TODO: double check that this is a no-op
340
+ break;
341
+ }
342
+
343
+ case "lap":
344
+ {
345
+ buildA11yStrings(tree.body, a11yStrings, atomType);
346
+ break;
347
+ }
348
+
349
+ case "mathord":
350
+ {
351
+ buildString(tree.text, "normal", a11yStrings);
352
+ break;
353
+ }
354
+
355
+ case "op":
356
+ {
357
+ const body = tree.body,
358
+ name = tree.name;
359
+
360
+ if (body) {
361
+ buildA11yStrings(body, a11yStrings, atomType);
362
+ } else if (name) {
363
+ buildString(name, "normal", a11yStrings);
364
+ }
365
+
366
+ break;
367
+ }
368
+
369
+ case "op-token":
370
+ {
371
+ // Used internally by operator symbols.
372
+ buildString(tree.text, atomType, a11yStrings);
373
+ break;
374
+ }
375
+
376
+ case "ordgroup":
377
+ {
378
+ buildA11yStrings(tree.body, a11yStrings, atomType);
379
+ break;
380
+ }
381
+
382
+ case "overline":
383
+ {
384
+ buildRegion(a11yStrings, function (a11yStrings) {
385
+ a11yStrings.push("start overline");
386
+ buildA11yStrings(tree.body, a11yStrings, atomType);
387
+ a11yStrings.push("end overline");
388
+ });
389
+ break;
390
+ }
391
+
392
+ case "phantom":
393
+ {
394
+ a11yStrings.push("empty space");
395
+ break;
396
+ }
397
+
398
+ case "raisebox":
399
+ {
400
+ buildA11yStrings(tree.body, a11yStrings, atomType);
401
+ break;
402
+ }
403
+
404
+ case "rule":
405
+ {
406
+ a11yStrings.push("rectangle");
407
+ break;
408
+ }
409
+
410
+ case "sizing":
411
+ {
412
+ buildA11yStrings(tree.body, a11yStrings, atomType);
413
+ break;
414
+ }
415
+
416
+ case "spacing":
417
+ {
418
+ a11yStrings.push("space");
419
+ break;
420
+ }
421
+
422
+ case "styling":
423
+ {
424
+ // We ignore the styling and just pass through the contents
425
+ buildA11yStrings(tree.body, a11yStrings, atomType);
426
+ break;
427
+ }
428
+
429
+ case "sqrt":
430
+ {
431
+ buildRegion(a11yStrings, regionStrings => {
432
+ const body = tree.body,
433
+ index = tree.index;
434
+
435
+ if (index) {
436
+ const indexString = flatten(buildA11yStrings(index, [], atomType)).join(",");
437
+
438
+ if (indexString === "3") {
439
+ regionStrings.push("cube root of");
440
+ buildA11yStrings(body, regionStrings, atomType);
441
+ regionStrings.push("end cube root");
442
+ return;
443
+ }
444
+
445
+ regionStrings.push("root");
446
+ regionStrings.push("start index");
447
+ buildA11yStrings(index, regionStrings, atomType);
448
+ regionStrings.push("end index");
449
+ return;
450
+ }
451
+
452
+ regionStrings.push("square root of");
453
+ buildA11yStrings(body, regionStrings, atomType);
454
+ regionStrings.push("end square root");
455
+ });
456
+ break;
457
+ }
458
+
459
+ case "supsub":
460
+ {
461
+ const base = tree.base,
462
+ sub = tree.sub,
463
+ sup = tree.sup;
464
+ let isLog = false;
465
+
466
+ if (base) {
467
+ buildA11yStrings(base, a11yStrings, atomType);
468
+ isLog = base.type === "op" && base.name === "\\log";
469
+ }
470
+
471
+ if (sub) {
472
+ const regionName = isLog ? "base" : "subscript";
473
+ buildRegion(a11yStrings, function (regionStrings) {
474
+ regionStrings.push(`start ${regionName}`);
475
+ buildA11yStrings(sub, regionStrings, atomType);
476
+ regionStrings.push(`end ${regionName}`);
477
+ });
478
+ }
479
+
480
+ if (sup) {
481
+ buildRegion(a11yStrings, function (regionStrings) {
482
+ const supString = flatten(buildA11yStrings(sup, [], atomType)).join(",");
483
+
484
+ if (supString in powerMap) {
485
+ regionStrings.push(powerMap[supString]);
486
+ return;
487
+ }
488
+
489
+ regionStrings.push("start superscript");
490
+ buildA11yStrings(sup, regionStrings, atomType);
491
+ regionStrings.push("end superscript");
492
+ });
493
+ }
494
+
495
+ break;
496
+ }
497
+
498
+ case "text":
499
+ {
500
+ // TODO: handle other fonts
501
+ if (tree.font === "\\textbf") {
502
+ buildRegion(a11yStrings, function (regionStrings) {
503
+ regionStrings.push("start bold text");
504
+ buildA11yStrings(tree.body, regionStrings, atomType);
505
+ regionStrings.push("end bold text");
506
+ });
507
+ break;
508
+ }
509
+
510
+ buildRegion(a11yStrings, function (regionStrings) {
511
+ regionStrings.push("start text");
512
+ buildA11yStrings(tree.body, regionStrings, atomType);
513
+ regionStrings.push("end text");
514
+ });
515
+ break;
516
+ }
517
+
518
+ case "textord":
519
+ {
520
+ buildString(tree.text, atomType, a11yStrings);
521
+ break;
522
+ }
523
+
524
+ case "smash":
525
+ {
526
+ buildA11yStrings(tree.body, a11yStrings, atomType);
527
+ break;
528
+ }
529
+
530
+ case "enclose":
531
+ {
532
+ // TODO: create a map for these.
533
+ // TODO: differentiate between a body with a single atom, e.g.
534
+ // "cancel a" instead of "start cancel, a, end cancel"
535
+ if (/cancel/.test(tree.label)) {
536
+ buildRegion(a11yStrings, function (regionStrings) {
537
+ regionStrings.push("start cancel");
538
+ buildA11yStrings(tree.body, regionStrings, atomType);
539
+ regionStrings.push("end cancel");
540
+ });
541
+ break;
542
+ } else if (/box/.test(tree.label)) {
543
+ buildRegion(a11yStrings, function (regionStrings) {
544
+ regionStrings.push("start box");
545
+ buildA11yStrings(tree.body, regionStrings, atomType);
546
+ regionStrings.push("end box");
547
+ });
548
+ break;
549
+ } else if (/sout/.test(tree.label)) {
550
+ buildRegion(a11yStrings, function (regionStrings) {
551
+ regionStrings.push("start strikeout");
552
+ buildA11yStrings(tree.body, regionStrings, atomType);
553
+ regionStrings.push("end strikeout");
554
+ });
555
+ break;
556
+ }
557
+
558
+ throw new Error(`KaTeX-a11y: enclose node with ${tree.label} not supported yet`);
559
+ }
560
+
561
+ case "vphantom":
562
+ {
563
+ throw new Error("KaTeX-a11y: vphantom not implemented yet");
564
+ }
565
+
566
+ case "hphantom":
567
+ {
568
+ throw new Error("KaTeX-a11y: hphantom not implemented yet");
569
+ }
570
+
571
+ case "operatorname":
572
+ {
573
+ buildA11yStrings(tree.body, a11yStrings, atomType);
574
+ break;
575
+ }
576
+
577
+ case "array":
578
+ {
579
+ throw new Error("KaTeX-a11y: array not implemented yet");
580
+ }
581
+
582
+ case "raw":
583
+ {
584
+ throw new Error("KaTeX-a11y: raw not implemented yet");
585
+ }
586
+
587
+ case "size":
588
+ {
589
+ // Although there are nodes of type "size" in the parse tree, they have
590
+ // no semantic meaning and should be ignored.
591
+ break;
592
+ }
593
+
594
+ case "url":
595
+ {
596
+ throw new Error("KaTeX-a11y: url not implemented yet");
597
+ }
598
+
599
+ case "tag":
600
+ {
601
+ throw new Error("KaTeX-a11y: tag not implemented yet");
602
+ }
603
+
604
+ case "verb":
605
+ {
606
+ buildString(`start verbatim`, "normal", a11yStrings);
607
+ buildString(tree.body, "normal", a11yStrings);
608
+ buildString(`end verbatim`, "normal", a11yStrings);
609
+ break;
610
+ }
611
+
612
+ case "environment":
613
+ {
614
+ throw new Error("KaTeX-a11y: environment not implemented yet");
615
+ }
616
+
617
+ case "horizBrace":
618
+ {
619
+ buildString(`start ${tree.label.slice(1)}`, "normal", a11yStrings);
620
+ buildA11yStrings(tree.base, a11yStrings, atomType);
621
+ buildString(`end ${tree.label.slice(1)}`, "normal", a11yStrings);
622
+ break;
623
+ }
624
+
625
+ case "infix":
626
+ {
627
+ // All infix nodes are replace with other nodes.
628
+ break;
629
+ }
630
+
631
+ case "includegraphics":
632
+ {
633
+ throw new Error("KaTeX-a11y: includegraphics not implemented yet");
634
+ }
635
+
636
+ case "font":
637
+ {
638
+ // TODO: callout the start/end of specific fonts
639
+ // TODO: map \BBb{N} to "the naturals" or something like that
640
+ buildA11yStrings(tree.body, a11yStrings, atomType);
641
+ break;
642
+ }
643
+
644
+ case "href":
645
+ {
646
+ throw new Error("KaTeX-a11y: href not implemented yet");
647
+ }
648
+
649
+ case "cr":
650
+ {
651
+ // This is used by environments.
652
+ throw new Error("KaTeX-a11y: cr not implemented yet");
653
+ }
654
+
655
+ case "underline":
656
+ {
657
+ buildRegion(a11yStrings, function (a11yStrings) {
658
+ a11yStrings.push("start underline");
659
+ buildA11yStrings(tree.body, a11yStrings, atomType);
660
+ a11yStrings.push("end underline");
661
+ });
662
+ break;
663
+ }
664
+
665
+ case "xArrow":
666
+ {
667
+ throw new Error("KaTeX-a11y: xArrow not implemented yet");
668
+ }
669
+
670
+ case "mclass":
671
+ {
672
+ // \neq and \ne are macros so we let "htmlmathml" render the mathmal
673
+ // side of things and extract the text from that.
674
+ const atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass
675
+
676
+ buildA11yStrings(tree.body, a11yStrings, atomType);
677
+ break;
678
+ }
679
+
680
+ case "mathchoice":
681
+ {
682
+ // TODO: track which which style we're using, e.g. dispaly, text, etc.
683
+ // default to text style if even that may not be the correct style
684
+ buildA11yStrings(tree.text, a11yStrings, atomType);
685
+ break;
686
+ }
687
+
688
+ case "htmlmathml":
689
+ {
690
+ buildA11yStrings(tree.mathml, a11yStrings, atomType);
691
+ break;
692
+ }
693
+
694
+ case "middle":
695
+ {
696
+ buildString(tree.delim, atomType, a11yStrings);
697
+ break;
698
+ }
699
+
700
+ default:
701
+ tree.type;
702
+ throw new Error("KaTeX a11y un-recognized type: " + tree.type);
703
+ }
704
+ };
705
+
706
+ const buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) {
707
+ if (a11yStrings === void 0) {
708
+ a11yStrings = [];
709
+ }
710
+
711
+ if (tree instanceof Array) {
712
+ for (let i = 0; i < tree.length; i++) {
713
+ buildA11yStrings(tree[i], a11yStrings, atomType);
714
+ }
715
+ } else {
716
+ handleObject(tree, a11yStrings, atomType);
717
+ }
718
+
719
+ return a11yStrings;
720
+ };
721
+
722
+ const flatten = function flatten(array) {
723
+ let result = [];
724
+ array.forEach(function (item) {
725
+ if (item instanceof Array) {
726
+ result = result.concat(flatten(item));
727
+ } else {
728
+ result.push(item);
729
+ }
730
+ });
731
+ return result;
732
+ };
733
+
734
+ const renderA11yString = function renderA11yString(text, settings) {
735
+ const tree = katex.__parse(text, settings);
736
+
737
+ const a11yStrings = buildA11yStrings(tree, [], "normal");
738
+ return flatten(a11yStrings).join(", ");
739
+ };
740
+
741
+ export default renderA11yString;