Upgrade Katex to v0.16.10
This commit is contained in:
84
paige/node_modules/katex/dist/contrib/auto-render.js
generated
vendored
84
paige/node_modules/katex/dist/contrib/auto-render.js
generated
vendored
@@ -90,15 +90,15 @@ var external_katex_ = __webpack_require__(771);
|
||||
var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
|
||||
;// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
|
||||
/* eslint no-constant-condition:0 */
|
||||
var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
|
||||
const findEndOfMath = function (delimiter, text, startIndex) {
|
||||
// Adapted from
|
||||
// https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
|
||||
var index = startIndex;
|
||||
var braceLevel = 0;
|
||||
var delimLength = delimiter.length;
|
||||
let index = startIndex;
|
||||
let braceLevel = 0;
|
||||
const delimLength = delimiter.length;
|
||||
|
||||
while (index < text.length) {
|
||||
var character = text[index];
|
||||
const character = text[index];
|
||||
|
||||
if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
|
||||
return index;
|
||||
@@ -116,18 +116,16 @@ var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
|
||||
return -1;
|
||||
};
|
||||
|
||||
var escapeRegex = function escapeRegex(string) {
|
||||
const escapeRegex = function (string) {
|
||||
return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
||||
};
|
||||
|
||||
var amsRegex = /^\\begin{/;
|
||||
const amsRegex = /^\\begin{/;
|
||||
|
||||
var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
|
||||
var index;
|
||||
var data = [];
|
||||
var regexLeft = new RegExp("(" + delimiters.map(function (x) {
|
||||
return escapeRegex(x.left);
|
||||
}).join("|") + ")");
|
||||
const splitAtDelimiters = function (text, delimiters) {
|
||||
let index;
|
||||
const data = [];
|
||||
const regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");
|
||||
|
||||
while (true) {
|
||||
index = text.search(regexLeft);
|
||||
@@ -145,21 +143,19 @@ var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
|
||||
} // ... so this always succeeds:
|
||||
|
||||
|
||||
var i = delimiters.findIndex(function (delim) {
|
||||
return text.startsWith(delim.left);
|
||||
});
|
||||
const i = delimiters.findIndex(delim => text.startsWith(delim.left));
|
||||
index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
|
||||
|
||||
if (index === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
var rawData = text.slice(0, index + delimiters[i].right.length);
|
||||
var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
|
||||
const rawData = text.slice(0, index + delimiters[i].right.length);
|
||||
const math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
|
||||
data.push({
|
||||
type: "math",
|
||||
data: math,
|
||||
rawData: rawData,
|
||||
rawData,
|
||||
display: delimiters[i].display
|
||||
});
|
||||
text = text.slice(index + delimiters[i].right.length);
|
||||
@@ -184,8 +180,8 @@ var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
|
||||
* API, we should copy it before mutating.
|
||||
*/
|
||||
|
||||
var renderMathInText = function renderMathInText(text, optionsCopy) {
|
||||
var data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
|
||||
const renderMathInText = function (text, optionsCopy) {
|
||||
const data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
|
||||
|
||||
if (data.length === 1 && data[0].type === 'text') {
|
||||
// There is no formula in the text.
|
||||
@@ -194,14 +190,14 @@ var renderMathInText = function renderMathInText(text, optionsCopy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var fragment = document.createDocumentFragment();
|
||||
const fragment = document.createDocumentFragment();
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].type === "text") {
|
||||
fragment.appendChild(document.createTextNode(data[i].data));
|
||||
} else {
|
||||
var span = document.createElement("span");
|
||||
var math = data[i].data; // Override any display mode defined in the settings with that
|
||||
const span = document.createElement("span");
|
||||
let math = data[i].data; // Override any display mode defined in the settings with that
|
||||
// defined by the text itself
|
||||
|
||||
optionsCopy.displayMode = data[i].display;
|
||||
@@ -229,18 +225,18 @@ var renderMathInText = function renderMathInText(text, optionsCopy) {
|
||||
return fragment;
|
||||
};
|
||||
|
||||
var renderElem = function renderElem(elem, optionsCopy) {
|
||||
for (var i = 0; i < elem.childNodes.length; i++) {
|
||||
var childNode = elem.childNodes[i];
|
||||
const renderElem = function (elem, optionsCopy) {
|
||||
for (let i = 0; i < elem.childNodes.length; i++) {
|
||||
const childNode = elem.childNodes[i];
|
||||
|
||||
if (childNode.nodeType === 3) {
|
||||
// Text node
|
||||
// Concatenate all sibling text nodes.
|
||||
// Webkit browsers split very large text nodes into smaller ones,
|
||||
// so the delimiters may be split across different nodes.
|
||||
var textContentConcat = childNode.textContent;
|
||||
var sibling = childNode.nextSibling;
|
||||
var nSiblings = 0;
|
||||
let textContentConcat = childNode.textContent;
|
||||
let sibling = childNode.nextSibling;
|
||||
let nSiblings = 0;
|
||||
|
||||
while (sibling && sibling.nodeType === Node.TEXT_NODE) {
|
||||
textContentConcat += sibling.textContent;
|
||||
@@ -248,11 +244,11 @@ var renderElem = function renderElem(elem, optionsCopy) {
|
||||
nSiblings++;
|
||||
}
|
||||
|
||||
var frag = renderMathInText(textContentConcat, optionsCopy);
|
||||
const frag = renderMathInText(textContentConcat, optionsCopy);
|
||||
|
||||
if (frag) {
|
||||
// Remove extra text nodes
|
||||
for (var j = 0; j < nSiblings; j++) {
|
||||
for (let j = 0; j < nSiblings; j++) {
|
||||
childNode.nextSibling.remove();
|
||||
}
|
||||
|
||||
@@ -264,30 +260,26 @@ var renderElem = function renderElem(elem, optionsCopy) {
|
||||
i += nSiblings;
|
||||
}
|
||||
} else if (childNode.nodeType === 1) {
|
||||
(function () {
|
||||
// Element node
|
||||
var className = ' ' + childNode.className + ' ';
|
||||
var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) {
|
||||
return className.indexOf(' ' + x + ' ') === -1;
|
||||
});
|
||||
// Element node
|
||||
const className = ' ' + childNode.className + ' ';
|
||||
const shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1);
|
||||
|
||||
if (shouldRender) {
|
||||
renderElem(childNode, optionsCopy);
|
||||
}
|
||||
})();
|
||||
if (shouldRender) {
|
||||
renderElem(childNode, optionsCopy);
|
||||
}
|
||||
} // Otherwise, it's something else, and ignore it.
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var renderMathInElement = function renderMathInElement(elem, options) {
|
||||
const renderMathInElement = function (elem, options) {
|
||||
if (!elem) {
|
||||
throw new Error("No element provided to render");
|
||||
}
|
||||
|
||||
var optionsCopy = {}; // Object.assign(optionsCopy, option)
|
||||
const optionsCopy = {}; // Object.assign(optionsCopy, option)
|
||||
|
||||
for (var option in options) {
|
||||
for (const option in options) {
|
||||
if (options.hasOwnProperty(option)) {
|
||||
optionsCopy[option] = options[option];
|
||||
}
|
||||
|
||||
2
paige/node_modules/katex/dist/contrib/auto-render.min.js
generated
vendored
2
paige/node_modules/katex/dist/contrib/auto-render.min.js
generated
vendored
@@ -1 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var i={};return function(){n.d(i,{default:function(){return s}});var e=n(771),t=n.n(e),r=function(e,t,r){for(var n=r,i=0,a=e.length;n<t.length;){var o=t[n];if(i<=0&&t.slice(n,n+a)===e)return n;"\\"===o?n++:"{"===o?i++:"}"===o&&i--,n++}return-1},a=/^\\begin{/,o=function(e,t){for(var n,i=[],o=new RegExp("("+t.map((function(e){return e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")})).join("|")+")");-1!==(n=e.search(o));){n>0&&(i.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));var l=t.findIndex((function(t){return e.startsWith(t.left)}));if(-1===(n=r(t[l].right,e,t[l].left.length)))break;var d=e.slice(0,n+t[l].right.length),s=a.test(d)?d:e.slice(t[l].left.length,n);i.push({type:"math",data:s,rawData:d,display:t[l].display}),e=e.slice(n+t[l].right.length)}return""!==e&&i.push({type:"text",data:e}),i},l=function(e,r){var n=o(e,r.delimiters);if(1===n.length&&"text"===n[0].type)return null;for(var i=document.createDocumentFragment(),a=0;a<n.length;a++)if("text"===n[a].type)i.appendChild(document.createTextNode(n[a].data));else{var l=document.createElement("span"),d=n[a].data;r.displayMode=n[a].display;try{r.preProcess&&(d=r.preProcess(d)),t().render(d,l,r)}catch(e){if(!(e instanceof t().ParseError))throw e;r.errorCallback("KaTeX auto-render: Failed to parse `"+n[a].data+"` with ",e),i.appendChild(document.createTextNode(n[a].rawData));continue}i.appendChild(l)}return i},d=function e(t,r){for(var n=0;n<t.childNodes.length;n++){var i=t.childNodes[n];if(3===i.nodeType){for(var a=i.textContent,o=i.nextSibling,d=0;o&&o.nodeType===Node.TEXT_NODE;)a+=o.textContent,o=o.nextSibling,d++;var s=l(a,r);if(s){for(var f=0;f<d;f++)i.nextSibling.remove();n+=s.childNodes.length-1,t.replaceChild(s,i)}else n+=d}else 1===i.nodeType&&function(){var t=" "+i.className+" ";-1===r.ignoredTags.indexOf(i.nodeName.toLowerCase())&&r.ignoredClasses.every((function(e){return-1===t.indexOf(" "+e+" ")}))&&e(i,r)}()}},s=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},d(e,r)}}(),i=i.default}()}));
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};return function(){r.d(o,{default:function(){return d}});var e=r(771),t=r.n(e);const n=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},i=/^\\begin{/;var a=function(e,t){let r;const o=[],a=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;r=e.search(a),-1!==r;){r>0&&(o.push({type:"text",data:e.slice(0,r)}),e=e.slice(r));const a=t.findIndex((t=>e.startsWith(t.left)));if(r=n(t[a].right,e,t[a].left.length),-1===r)break;const l=e.slice(0,r+t[a].right.length),s=i.test(l)?l:e.slice(t[a].left.length,r);o.push({type:"math",data:s,rawData:l,display:t[a].display}),e=e.slice(r+t[a].right.length)}return""!==e&&o.push({type:"text",data:e}),o};const l=function(e,n){const r=a(e,n.delimiters);if(1===r.length&&"text"===r[0].type)return null;const o=document.createDocumentFragment();for(let e=0;e<r.length;e++)if("text"===r[e].type)o.appendChild(document.createTextNode(r[e].data));else{const i=document.createElement("span");let a=r[e].data;n.displayMode=r[e].display;try{n.preProcess&&(a=n.preProcess(a)),t().render(a,i,n)}catch(i){if(!(i instanceof t().ParseError))throw i;n.errorCallback("KaTeX auto-render: Failed to parse `"+r[e].data+"` with ",i),o.appendChild(document.createTextNode(r[e].rawData));continue}o.appendChild(i)}return o},s=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const s=l(o,t);if(s){for(let e=0;e<a;e++)r.nextSibling.remove();n+=s.childNodes.length-1,e.replaceChild(s,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";-1===t.ignoredTags.indexOf(r.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&s(r,t)}}};var d=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},s(e,n)}}(),o=o.default}()}));
|
||||
51
paige/node_modules/katex/dist/contrib/copy-tex.js
generated
vendored
51
paige/node_modules/katex/dist/contrib/copy-tex.js
generated
vendored
@@ -14,7 +14,7 @@ var __webpack_exports__ = {};
|
||||
|
||||
;// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js
|
||||
// Set these to how you want inline and display math to be delimited.
|
||||
var defaultCopyDelimiters = {
|
||||
const defaultCopyDelimiters = {
|
||||
inline: ['$', '$'],
|
||||
// alternative: ['\(', '\)']
|
||||
display: ['$$', '$$'] // alternative: ['\[', '\]']
|
||||
@@ -30,10 +30,10 @@ function katexReplaceWithTex(fragment, copyDelimiters) {
|
||||
|
||||
// Remove .katex-html blocks that are preceded by .katex-mathml blocks
|
||||
// (which will get replaced below).
|
||||
var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
|
||||
const katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
|
||||
|
||||
for (var i = 0; i < katexHtml.length; i++) {
|
||||
var element = katexHtml[i];
|
||||
for (let i = 0; i < katexHtml.length; i++) {
|
||||
const element = katexHtml[i];
|
||||
|
||||
if (element.remove) {
|
||||
element.remove();
|
||||
@@ -44,18 +44,17 @@ function katexReplaceWithTex(fragment, copyDelimiters) {
|
||||
// descendant, with inline delimiters.
|
||||
|
||||
|
||||
var katexMathml = fragment.querySelectorAll('.katex-mathml');
|
||||
const katexMathml = fragment.querySelectorAll('.katex-mathml');
|
||||
|
||||
for (var _i = 0; _i < katexMathml.length; _i++) {
|
||||
var _element = katexMathml[_i];
|
||||
|
||||
var texSource = _element.querySelector('annotation');
|
||||
for (let i = 0; i < katexMathml.length; i++) {
|
||||
const element = katexMathml[i];
|
||||
const texSource = element.querySelector('annotation');
|
||||
|
||||
if (texSource) {
|
||||
if (_element.replaceWith) {
|
||||
_element.replaceWith(texSource);
|
||||
} else if (_element.parentNode) {
|
||||
_element.parentNode.replaceChild(texSource, _element);
|
||||
if (element.replaceWith) {
|
||||
element.replaceWith(texSource);
|
||||
} else if (element.parentNode) {
|
||||
element.parentNode.replaceChild(texSource, element);
|
||||
}
|
||||
|
||||
texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1];
|
||||
@@ -63,11 +62,11 @@ function katexReplaceWithTex(fragment, copyDelimiters) {
|
||||
} // Switch display math to display delimiters.
|
||||
|
||||
|
||||
var displays = fragment.querySelectorAll('.katex-display annotation');
|
||||
const displays = fragment.querySelectorAll('.katex-display annotation');
|
||||
|
||||
for (var _i2 = 0; _i2 < displays.length; _i2++) {
|
||||
var _element2 = displays[_i2];
|
||||
_element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
|
||||
for (let i = 0; i < displays.length; i++) {
|
||||
const element = displays[i];
|
||||
element.innerHTML = copyDelimiters.display[0] + element.innerHTML.substr(copyDelimiters.inline[0].length, element.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
|
||||
}
|
||||
|
||||
return fragment;
|
||||
@@ -79,43 +78,41 @@ function katexReplaceWithTex(fragment, copyDelimiters) {
|
||||
function closestKatex(node) {
|
||||
// If node is a Text Node, for example, go up to containing Element,
|
||||
// where we can apply the `closest` method.
|
||||
var element = node instanceof Element ? node : node.parentElement;
|
||||
const element = node instanceof Element ? node : node.parentElement;
|
||||
return element && element.closest('.katex');
|
||||
} // Global copy handler to modify behavior on/within .katex elements.
|
||||
|
||||
|
||||
document.addEventListener('copy', function (event) {
|
||||
var selection = window.getSelection();
|
||||
const selection = window.getSelection();
|
||||
|
||||
if (selection.isCollapsed || !event.clipboardData) {
|
||||
return; // default action OK if selection is empty or unchangeable
|
||||
}
|
||||
|
||||
var clipboardData = event.clipboardData;
|
||||
var range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
|
||||
const clipboardData = event.clipboardData;
|
||||
const range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
|
||||
|
||||
var startKatex = closestKatex(range.startContainer);
|
||||
const startKatex = closestKatex(range.startContainer);
|
||||
|
||||
if (startKatex) {
|
||||
range.setStartBefore(startKatex);
|
||||
} // Similarly, when end point is within a formula, expand to entire formula.
|
||||
|
||||
|
||||
var endKatex = closestKatex(range.endContainer);
|
||||
const endKatex = closestKatex(range.endContainer);
|
||||
|
||||
if (endKatex) {
|
||||
range.setEndAfter(endKatex);
|
||||
}
|
||||
|
||||
var fragment = range.cloneContents();
|
||||
const fragment = range.cloneContents();
|
||||
|
||||
if (!fragment.querySelector('.katex-mathml')) {
|
||||
return; // default action OK if no .katex-mathml elements
|
||||
}
|
||||
|
||||
var htmlContents = Array.prototype.map.call(fragment.childNodes, function (el) {
|
||||
return el instanceof Text ? el.textContent : el.outerHTML;
|
||||
}).join(''); // Preserve usual HTML copy/paste behavior.
|
||||
const htmlContents = Array.prototype.map.call(fragment.childNodes, el => el instanceof Text ? el.textContent : el.outerHTML).join(''); // Preserve usual HTML copy/paste behavior.
|
||||
|
||||
clipboardData.setData('text/html', htmlContents); // Rewrite plain-text version.
|
||||
|
||||
|
||||
2
paige/node_modules/katex/dist/contrib/copy-tex.min.js
generated
vendored
2
paige/node_modules/katex/dist/contrib/copy-tex.min.js
generated
vendored
@@ -1 +1 @@
|
||||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={},t={inline:["$","$"],display:["$$","$$"]};var n=function(e,n){void 0===n&&(n=t);for(var r=e.querySelectorAll(".katex-mathml + .katex-html"),a=0;a<r.length;a++){var o=r[a];o.remove?o.remove():o.parentNode&&o.parentNode.removeChild(o)}for(var i=e.querySelectorAll(".katex-mathml"),l=0;l<i.length;l++){var f=i[l],c=f.querySelector("annotation");c&&(f.replaceWith?f.replaceWith(c):f.parentNode&&f.parentNode.replaceChild(c,f),c.innerHTML=n.inline[0]+c.innerHTML+n.inline[1])}for(var d=e.querySelectorAll(".katex-display annotation"),s=0;s<d.length;s++){var p=d[s];p.innerHTML=n.display[0]+p.innerHTML.substr(n.inline[0].length,p.innerHTML.length-n.inline[0].length-n.inline[1].length)+n.display[1]}return e};function r(e){var t=e instanceof Element?e:e.parentElement;return t&&t.closest(".katex")}return document.addEventListener("copy",(function(e){var t=window.getSelection();if(!t.isCollapsed&&e.clipboardData){var a=e.clipboardData,o=t.getRangeAt(0),i=r(o.startContainer);i&&o.setStartBefore(i);var l=r(o.endContainer);l&&o.setEndAfter(l);var f=o.cloneContents();if(f.querySelector(".katex-mathml")){var c=Array.prototype.map.call(f.childNodes,(function(e){return e instanceof Text?e.textContent:e.outerHTML})).join("");a.setData("text/html",c),a.setData("text/plain",n(f).textContent),e.preventDefault()}}})),e=e.default}()}));
|
||||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={};const t={inline:["$","$"],display:["$$","$$"]};var n=function(e,n){void 0===n&&(n=t);const o=e.querySelectorAll(".katex-mathml + .katex-html");for(let e=0;e<o.length;e++){const t=o[e];t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)}const r=e.querySelectorAll(".katex-mathml");for(let e=0;e<r.length;e++){const t=r[e],o=t.querySelector("annotation");o&&(t.replaceWith?t.replaceWith(o):t.parentNode&&t.parentNode.replaceChild(o,t),o.innerHTML=n.inline[0]+o.innerHTML+n.inline[1])}const l=e.querySelectorAll(".katex-display annotation");for(let e=0;e<l.length;e++){const t=l[e];t.innerHTML=n.display[0]+t.innerHTML.substr(n.inline[0].length,t.innerHTML.length-n.inline[0].length-n.inline[1].length)+n.display[1]}return e};function o(e){const t=e instanceof Element?e:e.parentElement;return t&&t.closest(".katex")}return document.addEventListener("copy",(function(e){const t=window.getSelection();if(t.isCollapsed||!e.clipboardData)return;const r=e.clipboardData,l=t.getRangeAt(0),i=o(l.startContainer);i&&l.setStartBefore(i);const a=o(l.endContainer);a&&l.setEndAfter(a);const s=l.cloneContents();if(!s.querySelector(".katex-mathml"))return;const c=Array.prototype.map.call(s.childNodes,(e=>e instanceof Text?e.textContent:e.outerHTML)).join("");r.setData("text/html",c),r.setData("text/plain",n(s).textContent),e.preventDefault()})),e=e.default}()}));
|
||||
6
paige/node_modules/katex/dist/contrib/mathtex-script-type.js
generated
vendored
6
paige/node_modules/katex/dist/contrib/mathtex-script-type.js
generated
vendored
@@ -82,15 +82,15 @@ var __webpack_exports__ = {};
|
||||
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(771);
|
||||
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
|
||||
|
||||
var scripts = document.body.getElementsByTagName("script");
|
||||
let scripts = document.body.getElementsByTagName("script");
|
||||
scripts = Array.prototype.slice.call(scripts);
|
||||
scripts.forEach(function (script) {
|
||||
if (!script.type || !script.type.match(/math\/tex/i)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
|
||||
var katexElement = document.createElement(display ? "div" : "span");
|
||||
const display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
|
||||
const katexElement = document.createElement(display ? "div" : "span");
|
||||
katexElement.setAttribute("class", display ? "equation" : "inline-equation");
|
||||
|
||||
try {
|
||||
|
||||
2
paige/node_modules/katex/dist/contrib/mathtex-script-type.min.js
generated
vendored
2
paige/node_modules/katex/dist/contrib/mathtex-script-type.min.js
generated
vendored
@@ -1 +1 @@
|
||||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var r="object"==typeof exports?t(require("katex")):t(e.katex);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o,i,a,u={};return o=n(771),i=n.n(o),a=document.body.getElementsByTagName("script"),(a=Array.prototype.slice.call(a)).forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;var t=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(t?"div":"span");r.setAttribute("class",t?"equation":"inline-equation");try{i().render(e.text,r,{displayMode:t})}catch(t){r.textContent=e.text}e.parentNode.replaceChild(r,e)})),u=u.default}()}));
|
||||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var n="object"==typeof exports?t(require("katex")):t(e.katex);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};return function(){var e=r(771),t=r.n(e);let n=document.body.getElementsByTagName("script");n=Array.prototype.slice.call(n),n.forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;const n=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(n?"div":"span");r.setAttribute("class",n?"equation":"inline-equation");try{t().render(e.text,r,{displayMode:n})}catch(t){r.textContent=e.text}e.parentNode.replaceChild(r,e)}))}(),o=o.default}()}));
|
||||
232
paige/node_modules/katex/dist/contrib/mhchem.js
generated
vendored
232
paige/node_modules/katex/dist/contrib/mhchem.js
generated
vendored
@@ -151,7 +151,7 @@ katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\tripledash", "{\\v
|
||||
// It takes the argument to \ce or \pu and returns the corresponding TeX string.
|
||||
//
|
||||
|
||||
var chemParse = function chemParse(tokens, stateMachine) {
|
||||
var chemParse = function (tokens, stateMachine) {
|
||||
// Recreate the argument string from KaTeX's array of tokens.
|
||||
var str = "";
|
||||
var expectedLoc = tokens.length && tokens[tokens.length - 1].loc.start;
|
||||
@@ -183,7 +183,7 @@ var mhchemParser = {
|
||||
// Call like
|
||||
// go("H2O");
|
||||
//
|
||||
go: function go(input, stateMachine) {
|
||||
go: function (input, stateMachine) {
|
||||
if (!input) {
|
||||
return [];
|
||||
}
|
||||
@@ -315,7 +315,7 @@ var mhchemParser = {
|
||||
}
|
||||
}
|
||||
},
|
||||
concatArray: function concatArray(a, b) {
|
||||
concatArray: function (a, b) {
|
||||
if (b) {
|
||||
if (Array.isArray(b)) {
|
||||
for (var iB = 0; iB < b.length; iB++) {
|
||||
@@ -351,7 +351,7 @@ var mhchemParser = {
|
||||
'digits': /^[0-9]+/,
|
||||
'-9.,9': /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,
|
||||
'-9.,9 no missing 0': /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
|
||||
'(-)(9.,9)(e)(99)': function e99(input) {
|
||||
'(-)(9.,9)(e)(99)': function (input) {
|
||||
var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);
|
||||
|
||||
if (m && m[0]) {
|
||||
@@ -363,7 +363,7 @@ var mhchemParser = {
|
||||
|
||||
return null;
|
||||
},
|
||||
'(-)(9)^(-9)': function _(input) {
|
||||
'(-)(9)^(-9)': function (input) {
|
||||
var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
|
||||
|
||||
if (m && m[0]) {
|
||||
@@ -375,7 +375,7 @@ var mhchemParser = {
|
||||
|
||||
return null;
|
||||
},
|
||||
'state of aggregation $': function stateOfAggregation$(input) {
|
||||
'state of aggregation $': function (input) {
|
||||
// ... or crystal system
|
||||
var a = mhchemParser.patterns.findObserveGroups(input, "", /^\([a-z]{1,3}(?=[\),])/, ")", ""); // (aq), (aq,$\infty$), (aq, sat)
|
||||
|
||||
@@ -404,51 +404,51 @@ var mhchemParser = {
|
||||
'. ': /^([.\u22C5\u00B7\u2022])\s*/,
|
||||
'...': /^\.\.\.(?=$|[^.])/,
|
||||
'* ': /^([*])\s*/,
|
||||
'^{(...)}': function _(input) {
|
||||
'^{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "^{", "", "", "}");
|
||||
},
|
||||
'^($...$)': function $$(input) {
|
||||
'^($...$)': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "^", "$", "$", "");
|
||||
},
|
||||
'^a': /^\^([0-9]+|[^\\_])/,
|
||||
'^\\x{}{}': function x(input) {
|
||||
'^\\x{}{}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
|
||||
},
|
||||
'^\\x{}': function x(input) {
|
||||
'^\\x{}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", "");
|
||||
},
|
||||
'^\\x': /^\^(\\[a-zA-Z]+)\s*/,
|
||||
'^(-1)': /^\^(-?\d+)/,
|
||||
'\'': /^'/,
|
||||
'_{(...)}': function _(input) {
|
||||
'_{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "_{", "", "", "}");
|
||||
},
|
||||
'_($...$)': function _$$(input) {
|
||||
'_($...$)': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "_", "$", "$", "");
|
||||
},
|
||||
'_9': /^_([+\-]?[0-9]+|[^\\])/,
|
||||
'_\\x{}{}': function _X(input) {
|
||||
'_\\x{}{}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
|
||||
},
|
||||
'_\\x{}': function _X(input) {
|
||||
'_\\x{}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", "");
|
||||
},
|
||||
'_\\x': /^_(\\[a-zA-Z]+)\s*/,
|
||||
'^_': /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,
|
||||
'{}': /^\{\}/,
|
||||
'{...}': function _(input) {
|
||||
'{...}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "", "{", "}", "");
|
||||
},
|
||||
'{(...)}': function _(input) {
|
||||
'{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "{", "", "", "}");
|
||||
},
|
||||
'$...$': function $$(input) {
|
||||
'$...$': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "", "$", "$", "");
|
||||
},
|
||||
'${(...)}$': function $$(input) {
|
||||
'${(...)}$': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "${", "", "", "}$");
|
||||
},
|
||||
'$(...)$': function $$(input) {
|
||||
'$(...)$': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "$", "", "", "$");
|
||||
},
|
||||
'=<>': /^[=<>]/,
|
||||
@@ -462,21 +462,21 @@ var mhchemParser = {
|
||||
'pm-operator': /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,
|
||||
'operator': /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,
|
||||
'arrowUpDown': /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,
|
||||
'\\bond{(...)}': function bond(input) {
|
||||
'\\bond{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\bond{", "", "", "}");
|
||||
},
|
||||
'->': /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,
|
||||
'CMT': /^[CMT](?=\[)/,
|
||||
'[(...)]': function _(input) {
|
||||
'[(...)]': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "[", "", "", "]");
|
||||
},
|
||||
'1st-level escape': /^(&|\\\\|\\hline)\s*/,
|
||||
'\\,': /^(?:\\[,\ ;:])/,
|
||||
// \\x - but output no space before
|
||||
'\\x{}{}': function x(input) {
|
||||
'\\x{}{}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
|
||||
},
|
||||
'\\x{}': function x(input) {
|
||||
'\\x{}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "");
|
||||
},
|
||||
'\\ca': /^\\ca(?:\s+|(?![a-zA-Z]))/,
|
||||
@@ -484,28 +484,28 @@ var mhchemParser = {
|
||||
'orbital': /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,
|
||||
// only those with numbers in front, because the others will be formatted correctly anyway
|
||||
'others': /^[\/~|]/,
|
||||
'\\frac{(...)}': function frac(input) {
|
||||
'\\frac{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\frac{", "", "", "}", "{", "", "", "}");
|
||||
},
|
||||
'\\overset{(...)}': function overset(input) {
|
||||
'\\overset{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\overset{", "", "", "}", "{", "", "", "}");
|
||||
},
|
||||
"\\underset{(...)}": function underset(input) {
|
||||
'\\underset{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\underset{", "", "", "}", "{", "", "", "}");
|
||||
},
|
||||
"\\underbrace{(...)}": function underbrace(input) {
|
||||
'\\underbrace{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\underbrace{", "", "", "}_", "{", "", "", "}");
|
||||
},
|
||||
'\\color{(...)}0': function color0(input) {
|
||||
'\\color{(...)}0': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}");
|
||||
},
|
||||
'\\color{(...)}{(...)}1': function color1(input) {
|
||||
'\\color{(...)}{(...)}1': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}", "{", "", "", "}");
|
||||
},
|
||||
'\\color(...){(...)}2': function color2(input) {
|
||||
'\\color(...){(...)}2': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}");
|
||||
},
|
||||
'\\ce{(...)}': function ce(input) {
|
||||
'\\ce{(...)}': function (input) {
|
||||
return mhchemParser.patterns.findObserveGroups(input, "\\ce{", "", "", "}");
|
||||
},
|
||||
'oxidation$': /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
|
||||
@@ -513,7 +513,7 @@ var mhchemParser = {
|
||||
// 0 could be oxidation or charge
|
||||
'roman numeral': /^[IVX]+/,
|
||||
'1/2$': /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
|
||||
'amount': function amount(input) {
|
||||
'amount': function (input) {
|
||||
var match; // e.g. 2, 0.5, 1/2, -2, n/2, +; $a$ could be added later in parsing
|
||||
|
||||
match = input.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);
|
||||
@@ -541,11 +541,11 @@ var mhchemParser = {
|
||||
|
||||
return null;
|
||||
},
|
||||
'amount2': function amount2(input) {
|
||||
'amount2': function (input) {
|
||||
return this['amount'](input);
|
||||
},
|
||||
'(KV letters),': /^(?:[A-Z][a-z]{0,2}|i)(?=,)/,
|
||||
'formula$': function formula$(input) {
|
||||
'formula$': function (input) {
|
||||
if (input.match(/^\([a-z]+\)$/)) {
|
||||
return null;
|
||||
} // state of aggregation = no formula
|
||||
@@ -567,9 +567,9 @@ var mhchemParser = {
|
||||
'//': /^\s*(\/\/)\s*/,
|
||||
'*': /^\s*[*.]\s*/
|
||||
},
|
||||
findObserveGroups: function findObserveGroups(input, begExcl, begIncl, endIncl, endExcl, beg2Excl, beg2Incl, end2Incl, end2Excl, combine) {
|
||||
findObserveGroups: function (input, begExcl, begIncl, endIncl, endExcl, beg2Excl, beg2Incl, end2Incl, end2Excl, combine) {
|
||||
/** @type {{(input: string, pattern: string | RegExp): string | string[] | null;}} */
|
||||
var _match = function _match(input, pattern) {
|
||||
var _match = function (input, pattern) {
|
||||
if (typeof pattern === "string") {
|
||||
if (input.indexOf(pattern) !== 0) {
|
||||
return null;
|
||||
@@ -589,7 +589,7 @@ var mhchemParser = {
|
||||
/** @type {{(input: string, i: number, endChars: string | RegExp): {endMatchBegin: number, endMatchEnd: number} | null;}} */
|
||||
|
||||
|
||||
var _findObserveGroups = function _findObserveGroups(input, i, endChars) {
|
||||
var _findObserveGroups = function (input, i, endChars) {
|
||||
var braces = 0;
|
||||
|
||||
while (i < input.length) {
|
||||
@@ -669,7 +669,7 @@ var mhchemParser = {
|
||||
// e.g. match("a", input) will look for the regexp called "a" and see if it matches
|
||||
// returns null or {match_:"a", remainder:"bc"}
|
||||
//
|
||||
match_: function match_(m, input) {
|
||||
match_: function (m, input) {
|
||||
var pattern = mhchemParser.patterns.patterns[m];
|
||||
|
||||
if (pattern === undefined) {
|
||||
@@ -705,88 +705,88 @@ var mhchemParser = {
|
||||
// Generic state machine actions
|
||||
//
|
||||
actions: {
|
||||
'a=': function a(buffer, m) {
|
||||
'a=': function (buffer, m) {
|
||||
buffer.a = (buffer.a || "") + m;
|
||||
},
|
||||
'b=': function b(buffer, m) {
|
||||
'b=': function (buffer, m) {
|
||||
buffer.b = (buffer.b || "") + m;
|
||||
},
|
||||
'p=': function p(buffer, m) {
|
||||
'p=': function (buffer, m) {
|
||||
buffer.p = (buffer.p || "") + m;
|
||||
},
|
||||
'o=': function o(buffer, m) {
|
||||
'o=': function (buffer, m) {
|
||||
buffer.o = (buffer.o || "") + m;
|
||||
},
|
||||
'q=': function q(buffer, m) {
|
||||
'q=': function (buffer, m) {
|
||||
buffer.q = (buffer.q || "") + m;
|
||||
},
|
||||
'd=': function d(buffer, m) {
|
||||
'd=': function (buffer, m) {
|
||||
buffer.d = (buffer.d || "") + m;
|
||||
},
|
||||
'rm=': function rm(buffer, m) {
|
||||
'rm=': function (buffer, m) {
|
||||
buffer.rm = (buffer.rm || "") + m;
|
||||
},
|
||||
'text=': function text(buffer, m) {
|
||||
'text=': function (buffer, m) {
|
||||
buffer.text_ = (buffer.text_ || "") + m;
|
||||
},
|
||||
'insert': function insert(buffer, m, a) {
|
||||
'insert': function (buffer, m, a) {
|
||||
return {
|
||||
type_: a
|
||||
};
|
||||
},
|
||||
'insert+p1': function insertP1(buffer, m, a) {
|
||||
'insert+p1': function (buffer, m, a) {
|
||||
return {
|
||||
type_: a,
|
||||
p1: m
|
||||
};
|
||||
},
|
||||
'insert+p1+p2': function insertP1P2(buffer, m, a) {
|
||||
'insert+p1+p2': function (buffer, m, a) {
|
||||
return {
|
||||
type_: a,
|
||||
p1: m[0],
|
||||
p2: m[1]
|
||||
};
|
||||
},
|
||||
'copy': function copy(buffer, m) {
|
||||
'copy': function (buffer, m) {
|
||||
return m;
|
||||
},
|
||||
'rm': function rm(buffer, m) {
|
||||
'rm': function (buffer, m) {
|
||||
return {
|
||||
type_: 'rm',
|
||||
p1: m || ""
|
||||
};
|
||||
},
|
||||
'text': function text(buffer, m) {
|
||||
'text': function (buffer, m) {
|
||||
return mhchemParser.go(m, 'text');
|
||||
},
|
||||
'{text}': function text(buffer, m) {
|
||||
'{text}': function (buffer, m) {
|
||||
var ret = ["{"];
|
||||
mhchemParser.concatArray(ret, mhchemParser.go(m, 'text'));
|
||||
ret.push("}");
|
||||
return ret;
|
||||
},
|
||||
'tex-math': function texMath(buffer, m) {
|
||||
'tex-math': function (buffer, m) {
|
||||
return mhchemParser.go(m, 'tex-math');
|
||||
},
|
||||
'tex-math tight': function texMathTight(buffer, m) {
|
||||
'tex-math tight': function (buffer, m) {
|
||||
return mhchemParser.go(m, 'tex-math tight');
|
||||
},
|
||||
'bond': function bond(buffer, m, k) {
|
||||
'bond': function (buffer, m, k) {
|
||||
return {
|
||||
type_: 'bond',
|
||||
kind_: k || m
|
||||
};
|
||||
},
|
||||
'color0-output': function color0Output(buffer, m) {
|
||||
'color0-output': function (buffer, m) {
|
||||
return {
|
||||
type_: 'color0',
|
||||
color: m[0]
|
||||
};
|
||||
},
|
||||
'ce': function ce(buffer, m) {
|
||||
'ce': function (buffer, m) {
|
||||
return mhchemParser.go(m);
|
||||
},
|
||||
'1/2': function _(buffer, m) {
|
||||
'1/2': function (buffer, m) {
|
||||
/** @type {ParserOutput[]} */
|
||||
var ret = [];
|
||||
|
||||
@@ -813,7 +813,7 @@ var mhchemParser = {
|
||||
|
||||
return ret;
|
||||
},
|
||||
'9,9': function _(buffer, m) {
|
||||
'9,9': function (buffer, m) {
|
||||
return mhchemParser.go(m, '9,9');
|
||||
}
|
||||
},
|
||||
@@ -822,7 +822,7 @@ var mhchemParser = {
|
||||
// convert { 'letter': { 'state': { action_: 'output' } } } to { 'state' => [ { pattern: 'letter', task: { action_: [{type_: 'output'}] } } ] }
|
||||
// with expansion of 'a|b' to 'a' and 'b' (at 2 places)
|
||||
//
|
||||
createTransitions: function createTransitions(o) {
|
||||
createTransitions: function (o) {
|
||||
var pattern, state;
|
||||
/** @type {string[]} */
|
||||
|
||||
@@ -1458,7 +1458,7 @@ mhchemParser.stateMachines = {
|
||||
nextState: '3'
|
||||
}
|
||||
},
|
||||
"\\underset{(...)}": {
|
||||
'\\underset{(...)}': {
|
||||
'*': {
|
||||
action_: [{
|
||||
type_: 'output',
|
||||
@@ -1467,7 +1467,7 @@ mhchemParser.stateMachines = {
|
||||
nextState: '3'
|
||||
}
|
||||
},
|
||||
"\\underbrace{(...)}": {
|
||||
'\\underbrace{(...)}': {
|
||||
'*': {
|
||||
action_: [{
|
||||
type_: 'output',
|
||||
@@ -1553,7 +1553,7 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'o after d': function oAfterD(buffer, m) {
|
||||
'o after d': function (buffer, m) {
|
||||
var ret;
|
||||
|
||||
if ((buffer.d || "").match(/^[0-9]+$/)) {
|
||||
@@ -1568,11 +1568,11 @@ mhchemParser.stateMachines = {
|
||||
mhchemParser.actions['o='](buffer, m);
|
||||
return ret;
|
||||
},
|
||||
'd= kv': function dKv(buffer, m) {
|
||||
'd= kv': function (buffer, m) {
|
||||
buffer.d = m;
|
||||
buffer.dType = 'kv';
|
||||
},
|
||||
'charge or bond': function chargeOrBond(buffer, m) {
|
||||
'charge or bond': function (buffer, m) {
|
||||
if (buffer['beginsWithBond']) {
|
||||
/** @type {ParserOutput[]} */
|
||||
var ret = [];
|
||||
@@ -1583,7 +1583,7 @@ mhchemParser.stateMachines = {
|
||||
buffer.d = m;
|
||||
}
|
||||
},
|
||||
'- after o/d': function afterOD(buffer, m, isAfterD) {
|
||||
'- after o/d': function (buffer, m, isAfterD) {
|
||||
var c1 = mhchemParser.patterns.match_('orbital', buffer.o || "");
|
||||
var c2 = mhchemParser.patterns.match_('one lowercase greek letter $', buffer.o || "");
|
||||
var c3 = mhchemParser.patterns.match_('one lowercase latin letter $', buffer.o || "");
|
||||
@@ -1617,35 +1617,35 @@ mhchemParser.stateMachines = {
|
||||
|
||||
return ret;
|
||||
},
|
||||
'a to o': function aToO(buffer) {
|
||||
'a to o': function (buffer) {
|
||||
buffer.o = buffer.a;
|
||||
buffer.a = undefined;
|
||||
},
|
||||
'sb=true': function sbTrue(buffer) {
|
||||
'sb=true': function (buffer) {
|
||||
buffer.sb = true;
|
||||
},
|
||||
'sb=false': function sbFalse(buffer) {
|
||||
'sb=false': function (buffer) {
|
||||
buffer.sb = false;
|
||||
},
|
||||
'beginsWithBond=true': function beginsWithBondTrue(buffer) {
|
||||
'beginsWithBond=true': function (buffer) {
|
||||
buffer['beginsWithBond'] = true;
|
||||
},
|
||||
'beginsWithBond=false': function beginsWithBondFalse(buffer) {
|
||||
'beginsWithBond=false': function (buffer) {
|
||||
buffer['beginsWithBond'] = false;
|
||||
},
|
||||
'parenthesisLevel++': function parenthesisLevel(buffer) {
|
||||
'parenthesisLevel++': function (buffer) {
|
||||
buffer['parenthesisLevel']++;
|
||||
},
|
||||
'parenthesisLevel--': function parenthesisLevel(buffer) {
|
||||
'parenthesisLevel--': function (buffer) {
|
||||
buffer['parenthesisLevel']--;
|
||||
},
|
||||
'state of aggregation': function stateOfAggregation(buffer, m) {
|
||||
'state of aggregation': function (buffer, m) {
|
||||
return {
|
||||
type_: 'state of aggregation',
|
||||
p1: mhchemParser.go(m, 'o')
|
||||
};
|
||||
},
|
||||
'comma': function comma(buffer, m) {
|
||||
'comma': function (buffer, m) {
|
||||
var a = m.replace(/\s*$/, '');
|
||||
var withSpace = a !== m;
|
||||
|
||||
@@ -1661,7 +1661,7 @@ mhchemParser.stateMachines = {
|
||||
};
|
||||
}
|
||||
},
|
||||
'output': function output(buffer, m, entityFollows) {
|
||||
'output': function (buffer, m, entityFollows) {
|
||||
// entityFollows:
|
||||
// undefined = if we have nothing else to output, also ignore the just read space (buffer.sb)
|
||||
// 1 = an entity follows, never omit the space if there was one just read before (can only apply to state 1)
|
||||
@@ -1756,63 +1756,63 @@ mhchemParser.stateMachines = {
|
||||
|
||||
return ret;
|
||||
},
|
||||
'oxidation-output': function oxidationOutput(buffer, m) {
|
||||
'oxidation-output': function (buffer, m) {
|
||||
var ret = ["{"];
|
||||
mhchemParser.concatArray(ret, mhchemParser.go(m, 'oxidation'));
|
||||
ret.push("}");
|
||||
return ret;
|
||||
},
|
||||
'frac-output': function fracOutput(buffer, m) {
|
||||
'frac-output': function (buffer, m) {
|
||||
return {
|
||||
type_: 'frac-ce',
|
||||
p1: mhchemParser.go(m[0]),
|
||||
p2: mhchemParser.go(m[1])
|
||||
};
|
||||
},
|
||||
'overset-output': function oversetOutput(buffer, m) {
|
||||
'overset-output': function (buffer, m) {
|
||||
return {
|
||||
type_: 'overset',
|
||||
p1: mhchemParser.go(m[0]),
|
||||
p2: mhchemParser.go(m[1])
|
||||
};
|
||||
},
|
||||
'underset-output': function undersetOutput(buffer, m) {
|
||||
'underset-output': function (buffer, m) {
|
||||
return {
|
||||
type_: 'underset',
|
||||
p1: mhchemParser.go(m[0]),
|
||||
p2: mhchemParser.go(m[1])
|
||||
};
|
||||
},
|
||||
'underbrace-output': function underbraceOutput(buffer, m) {
|
||||
'underbrace-output': function (buffer, m) {
|
||||
return {
|
||||
type_: 'underbrace',
|
||||
p1: mhchemParser.go(m[0]),
|
||||
p2: mhchemParser.go(m[1])
|
||||
};
|
||||
},
|
||||
'color-output': function colorOutput(buffer, m) {
|
||||
'color-output': function (buffer, m) {
|
||||
return {
|
||||
type_: 'color',
|
||||
color1: m[0],
|
||||
color2: mhchemParser.go(m[1])
|
||||
};
|
||||
},
|
||||
'r=': function r(buffer, m) {
|
||||
'r=': function (buffer, m) {
|
||||
buffer.r = m;
|
||||
},
|
||||
'rdt=': function rdt(buffer, m) {
|
||||
'rdt=': function (buffer, m) {
|
||||
buffer.rdt = m;
|
||||
},
|
||||
'rd=': function rd(buffer, m) {
|
||||
'rd=': function (buffer, m) {
|
||||
buffer.rd = m;
|
||||
},
|
||||
'rqt=': function rqt(buffer, m) {
|
||||
'rqt=': function (buffer, m) {
|
||||
buffer.rqt = m;
|
||||
},
|
||||
'rq=': function rq(buffer, m) {
|
||||
'rq=': function (buffer, m) {
|
||||
buffer.rq = m;
|
||||
},
|
||||
'operator': function operator(buffer, m, p1) {
|
||||
'operator': function (buffer, m, p1) {
|
||||
return {
|
||||
type_: 'operator',
|
||||
kind_: p1 || m
|
||||
@@ -1944,7 +1944,7 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'output': function output(buffer) {
|
||||
'output': function (buffer) {
|
||||
if (buffer.text_) {
|
||||
/** @type {ParserOutput} */
|
||||
var ret = {
|
||||
@@ -2060,13 +2060,13 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'state of aggregation': function stateOfAggregation(buffer, m) {
|
||||
'state of aggregation': function (buffer, m) {
|
||||
return {
|
||||
type_: 'state of aggregation subscript',
|
||||
p1: mhchemParser.go(m, 'o')
|
||||
};
|
||||
},
|
||||
'color-output': function colorOutput(buffer, m) {
|
||||
'color-output': function (buffer, m) {
|
||||
return {
|
||||
type_: 'color',
|
||||
color1: m[0],
|
||||
@@ -2174,7 +2174,7 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'color-output': function colorOutput(buffer, m) {
|
||||
'color-output': function (buffer, m) {
|
||||
return {
|
||||
type_: 'color',
|
||||
color1: m[0],
|
||||
@@ -2205,7 +2205,7 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'roman-numeral': function romanNumeral(buffer, m) {
|
||||
'roman-numeral': function (buffer, m) {
|
||||
return {
|
||||
type_: 'roman numeral',
|
||||
p1: m || ""
|
||||
@@ -2237,7 +2237,7 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'output': function output(buffer) {
|
||||
'output': function (buffer) {
|
||||
if (buffer.o) {
|
||||
/** @type {ParserOutput} */
|
||||
var ret = {
|
||||
@@ -2283,10 +2283,10 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'tight operator': function tightOperator(buffer, m) {
|
||||
'tight operator': function (buffer, m) {
|
||||
buffer.o = (buffer.o || "") + "{" + m + "}";
|
||||
},
|
||||
'output': function output(buffer) {
|
||||
'output': function (buffer) {
|
||||
if (buffer.o) {
|
||||
/** @type {ParserOutput} */
|
||||
var ret = {
|
||||
@@ -2320,7 +2320,7 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'comma': function comma() {
|
||||
'comma': function () {
|
||||
return {
|
||||
type_: 'commaDecimal'
|
||||
};
|
||||
@@ -2407,7 +2407,7 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'enumber': function enumber(buffer, m) {
|
||||
'enumber': function (buffer, m) {
|
||||
/** @type {ParserOutput[]} */
|
||||
var ret = [];
|
||||
|
||||
@@ -2451,7 +2451,7 @@ mhchemParser.stateMachines = {
|
||||
|
||||
return ret;
|
||||
},
|
||||
'number^': function number(buffer, m) {
|
||||
'number^': function (buffer, m) {
|
||||
/** @type {ParserOutput[]} */
|
||||
var ret = [];
|
||||
|
||||
@@ -2465,18 +2465,18 @@ mhchemParser.stateMachines = {
|
||||
ret.push("^{" + m[2] + "}");
|
||||
return ret;
|
||||
},
|
||||
'operator': function operator(buffer, m, p1) {
|
||||
'operator': function (buffer, m, p1) {
|
||||
return {
|
||||
type_: 'operator',
|
||||
kind_: p1 || m
|
||||
};
|
||||
},
|
||||
'space': function space() {
|
||||
'space': function () {
|
||||
return {
|
||||
type_: 'pu-space-1'
|
||||
};
|
||||
},
|
||||
'output': function output(buffer) {
|
||||
'output': function (buffer) {
|
||||
/** @type {ParserOutput | ParserOutput[]} */
|
||||
var ret;
|
||||
var md = mhchemParser.patterns.match_('{(...)}', buffer.d || "");
|
||||
@@ -2586,20 +2586,20 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'cdot': function cdot() {
|
||||
'cdot': function () {
|
||||
return {
|
||||
type_: 'tight cdot'
|
||||
};
|
||||
},
|
||||
'^(-1)': function _(buffer, m) {
|
||||
'^(-1)': function (buffer, m) {
|
||||
buffer.rm += "^{" + m + "}";
|
||||
},
|
||||
'space': function space() {
|
||||
'space': function () {
|
||||
return {
|
||||
type_: 'pu-space-2'
|
||||
};
|
||||
},
|
||||
'output': function output(buffer) {
|
||||
'output': function (buffer) {
|
||||
/** @type {ParserOutput | ParserOutput[]} */
|
||||
var ret = [];
|
||||
|
||||
@@ -2653,12 +2653,12 @@ mhchemParser.stateMachines = {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
'comma': function comma() {
|
||||
'comma': function () {
|
||||
return {
|
||||
type_: 'commaDecimal'
|
||||
};
|
||||
},
|
||||
'output-0': function output0(buffer) {
|
||||
'output-0': function (buffer) {
|
||||
/** @type {ParserOutput[]} */
|
||||
var ret = [];
|
||||
buffer.text_ = buffer.text_ || "";
|
||||
@@ -2689,7 +2689,7 @@ mhchemParser.stateMachines = {
|
||||
|
||||
return ret;
|
||||
},
|
||||
'output-o': function outputO(buffer) {
|
||||
'output-o': function (buffer) {
|
||||
/** @type {ParserOutput[]} */
|
||||
var ret = [];
|
||||
buffer.text_ = buffer.text_ || "";
|
||||
@@ -2725,7 +2725,7 @@ mhchemParser.stateMachines = {
|
||||
/** @type {Texify} */
|
||||
|
||||
var texify = {
|
||||
go: function go(input, isInner) {
|
||||
go: function (input, isInner) {
|
||||
// (recursive, max 4 levels)
|
||||
if (!input) {
|
||||
return "";
|
||||
@@ -2754,14 +2754,14 @@ var texify = {
|
||||
|
||||
return res;
|
||||
},
|
||||
_goInner: function _goInner(input) {
|
||||
_goInner: function (input) {
|
||||
if (!input) {
|
||||
return input;
|
||||
}
|
||||
|
||||
return texify.go(input, true);
|
||||
},
|
||||
_go2: function _go2(buf) {
|
||||
_go2: function (buf) {
|
||||
/** @type {undefined | string} */
|
||||
var res;
|
||||
|
||||
@@ -3052,7 +3052,7 @@ var texify = {
|
||||
assertString(res);
|
||||
return res;
|
||||
},
|
||||
_getArrow: function _getArrow(a) {
|
||||
_getArrow: function (a) {
|
||||
switch (a) {
|
||||
case "->":
|
||||
return "rightarrow";
|
||||
@@ -3089,7 +3089,7 @@ var texify = {
|
||||
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
||||
}
|
||||
},
|
||||
_getBond: function _getBond(a) {
|
||||
_getBond: function (a) {
|
||||
switch (a) {
|
||||
case "-":
|
||||
return "{-}";
|
||||
@@ -3147,7 +3147,7 @@ var texify = {
|
||||
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
||||
}
|
||||
},
|
||||
_getOperator: function _getOperator(a) {
|
||||
_getOperator: function (a) {
|
||||
switch (a) {
|
||||
case "+":
|
||||
return " {}+{} ";
|
||||
|
||||
95
paige/node_modules/katex/dist/contrib/render-a11y-string.js
generated
vendored
95
paige/node_modules/katex/dist/contrib/render-a11y-string.js
generated
vendored
@@ -100,7 +100,7 @@ var __webpack_exports__ = {};
|
||||
// included in the build.
|
||||
// $FlowIgnore: we import the types directly anyways
|
||||
|
||||
var stringMap = {
|
||||
const stringMap = {
|
||||
"(": "left parenthesis",
|
||||
")": "right parenthesis",
|
||||
"[": "open bracket",
|
||||
@@ -173,22 +173,22 @@ var stringMap = {
|
||||
"\\hat": "hat",
|
||||
"\\acute": "acute"
|
||||
};
|
||||
var powerMap = {
|
||||
const powerMap = {
|
||||
"prime": "prime",
|
||||
"degree": "degrees",
|
||||
"circle": "degrees",
|
||||
"2": "squared",
|
||||
"3": "cubed"
|
||||
};
|
||||
var openMap = {
|
||||
const openMap = {
|
||||
"|": "open vertical bar",
|
||||
".": ""
|
||||
};
|
||||
var closeMap = {
|
||||
const closeMap = {
|
||||
"|": "close vertical bar",
|
||||
".": ""
|
||||
};
|
||||
var binMap = {
|
||||
const binMap = {
|
||||
"+": "plus",
|
||||
"-": "minus",
|
||||
"\\pm": "plus minus",
|
||||
@@ -200,7 +200,7 @@ var binMap = {
|
||||
"\\circ": "circle",
|
||||
"\\bullet": "bullet"
|
||||
};
|
||||
var relMap = {
|
||||
const relMap = {
|
||||
"=": "equals",
|
||||
"\\approx": "approximately equals",
|
||||
"≠": "does not equal",
|
||||
@@ -216,7 +216,7 @@ var relMap = {
|
||||
"\\Rightarrow": "right arrow",
|
||||
":": "colon"
|
||||
};
|
||||
var accentUnderMap = {
|
||||
const accentUnderMap = {
|
||||
"\\underleftarrow": "left arrow",
|
||||
"\\underrightarrow": "right arrow",
|
||||
"\\underleftrightarrow": "left-right arrow",
|
||||
@@ -225,12 +225,12 @@ var accentUnderMap = {
|
||||
"\\utilde": "tilde"
|
||||
};
|
||||
|
||||
var buildString = function buildString(str, type, a11yStrings) {
|
||||
const buildString = (str, type, a11yStrings) => {
|
||||
if (!str) {
|
||||
return;
|
||||
}
|
||||
|
||||
var ret;
|
||||
let ret;
|
||||
|
||||
if (type === "open") {
|
||||
ret = str in openMap ? openMap[str] : stringMap[str] || str;
|
||||
@@ -258,18 +258,18 @@ var buildString = function buildString(str, type, a11yStrings) {
|
||||
}
|
||||
};
|
||||
|
||||
var buildRegion = function buildRegion(a11yStrings, callback) {
|
||||
var regionStrings = [];
|
||||
const buildRegion = (a11yStrings, callback) => {
|
||||
const regionStrings = [];
|
||||
a11yStrings.push(regionStrings);
|
||||
callback(regionStrings);
|
||||
};
|
||||
|
||||
var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
const handleObject = (tree, a11yStrings, atomType) => {
|
||||
// Everything else is assumed to be an object...
|
||||
switch (tree.type) {
|
||||
case "accent":
|
||||
{
|
||||
buildRegion(a11yStrings, function (a11yStrings) {
|
||||
buildRegion(a11yStrings, a11yStrings => {
|
||||
buildA11yStrings(tree.base, a11yStrings, atomType);
|
||||
a11yStrings.push("with");
|
||||
buildString(tree.label, "normal", a11yStrings);
|
||||
@@ -280,7 +280,7 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
case "accentUnder":
|
||||
{
|
||||
buildRegion(a11yStrings, function (a11yStrings) {
|
||||
buildRegion(a11yStrings, a11yStrings => {
|
||||
buildA11yStrings(tree.base, a11yStrings, atomType);
|
||||
a11yStrings.push("with");
|
||||
buildString(accentUnderMap[tree.label], "normal", a11yStrings);
|
||||
@@ -297,7 +297,9 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
case "atom":
|
||||
{
|
||||
var text = tree.text;
|
||||
const {
|
||||
text
|
||||
} = tree;
|
||||
|
||||
switch (tree.family) {
|
||||
case "bin":
|
||||
@@ -349,8 +351,8 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
case "color":
|
||||
{
|
||||
var color = tree.color.replace(/katex-/, "");
|
||||
buildRegion(a11yStrings, function (regionStrings) {
|
||||
const color = tree.color.replace(/katex-/, "");
|
||||
buildRegion(a11yStrings, regionStrings => {
|
||||
regionStrings.push("start color " + color);
|
||||
buildA11yStrings(tree.body, regionStrings, atomType);
|
||||
regionStrings.push("end color " + color);
|
||||
@@ -376,10 +378,12 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
case "genfrac":
|
||||
{
|
||||
buildRegion(a11yStrings, function (regionStrings) {
|
||||
buildRegion(a11yStrings, regionStrings => {
|
||||
// genfrac can have unbalanced delimiters
|
||||
var leftDelim = tree.leftDelim,
|
||||
rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption
|
||||
const {
|
||||
leftDelim,
|
||||
rightDelim
|
||||
} = tree; // NOTE: Not sure if this is a safe assumption
|
||||
// hasBarLine true -> fraction, false -> binomial
|
||||
|
||||
if (tree.hasBarLine) {
|
||||
@@ -418,7 +422,7 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
case "leftright":
|
||||
{
|
||||
buildRegion(a11yStrings, function (regionStrings) {
|
||||
buildRegion(a11yStrings, regionStrings => {
|
||||
buildString(tree.left, "open", regionStrings);
|
||||
buildA11yStrings(tree.body, regionStrings, atomType);
|
||||
buildString(tree.right, "close", regionStrings);
|
||||
@@ -446,8 +450,10 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
case "op":
|
||||
{
|
||||
var body = tree.body,
|
||||
name = tree.name;
|
||||
const {
|
||||
body,
|
||||
name
|
||||
} = tree;
|
||||
|
||||
if (body) {
|
||||
buildA11yStrings(body, a11yStrings, atomType);
|
||||
@@ -526,12 +532,14 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
case "sqrt":
|
||||
{
|
||||
buildRegion(a11yStrings, function (regionStrings) {
|
||||
var body = tree.body,
|
||||
index = tree.index;
|
||||
buildRegion(a11yStrings, regionStrings => {
|
||||
const {
|
||||
body,
|
||||
index
|
||||
} = tree;
|
||||
|
||||
if (index) {
|
||||
var indexString = flatten(buildA11yStrings(index, [], atomType)).join(",");
|
||||
const indexString = flatten(buildA11yStrings(index, [], atomType)).join(",");
|
||||
|
||||
if (indexString === "3") {
|
||||
regionStrings.push("cube root of");
|
||||
@@ -556,10 +564,12 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
case "supsub":
|
||||
{
|
||||
var base = tree.base,
|
||||
sub = tree.sub,
|
||||
sup = tree.sup;
|
||||
var isLog = false;
|
||||
const {
|
||||
base,
|
||||
sub,
|
||||
sup
|
||||
} = tree;
|
||||
let isLog = false;
|
||||
|
||||
if (base) {
|
||||
buildA11yStrings(base, a11yStrings, atomType);
|
||||
@@ -567,7 +577,7 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
}
|
||||
|
||||
if (sub) {
|
||||
var regionName = isLog ? "base" : "subscript";
|
||||
const regionName = isLog ? "base" : "subscript";
|
||||
buildRegion(a11yStrings, function (regionStrings) {
|
||||
regionStrings.push("start " + regionName);
|
||||
buildA11yStrings(sub, regionStrings, atomType);
|
||||
@@ -577,7 +587,7 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
|
||||
if (sup) {
|
||||
buildRegion(a11yStrings, function (regionStrings) {
|
||||
var supString = flatten(buildA11yStrings(sup, [], atomType)).join(",");
|
||||
const supString = flatten(buildA11yStrings(sup, [], atomType)).join(",");
|
||||
|
||||
if (supString in powerMap) {
|
||||
regionStrings.push(powerMap[supString]);
|
||||
@@ -792,10 +802,9 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
{
|
||||
// \neq and \ne are macros so we let "htmlmathml" render the mathmal
|
||||
// side of things and extract the text from that.
|
||||
var _atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass
|
||||
const atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass
|
||||
|
||||
|
||||
buildA11yStrings(tree.body, a11yStrings, _atomType);
|
||||
buildA11yStrings(tree.body, a11yStrings, atomType);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -837,13 +846,13 @@ var handleObject = function handleObject(tree, a11yStrings, atomType) {
|
||||
}
|
||||
};
|
||||
|
||||
var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) {
|
||||
const buildA11yStrings = function (tree, a11yStrings, atomType) {
|
||||
if (a11yStrings === void 0) {
|
||||
a11yStrings = [];
|
||||
}
|
||||
|
||||
if (tree instanceof Array) {
|
||||
for (var i = 0; i < tree.length; i++) {
|
||||
for (let i = 0; i < tree.length; i++) {
|
||||
buildA11yStrings(tree[i], a11yStrings, atomType);
|
||||
}
|
||||
} else {
|
||||
@@ -853,8 +862,8 @@ var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) {
|
||||
return a11yStrings;
|
||||
};
|
||||
|
||||
var flatten = function flatten(array) {
|
||||
var result = [];
|
||||
const flatten = function (array) {
|
||||
let result = [];
|
||||
array.forEach(function (item) {
|
||||
if (item instanceof Array) {
|
||||
result = result.concat(flatten(item));
|
||||
@@ -865,10 +874,10 @@ var flatten = function flatten(array) {
|
||||
return result;
|
||||
};
|
||||
|
||||
var renderA11yString = function renderA11yString(text, settings) {
|
||||
var tree = katex__WEBPACK_IMPORTED_MODULE_0___default().__parse(text, settings);
|
||||
const renderA11yString = function (text, settings) {
|
||||
const tree = katex__WEBPACK_IMPORTED_MODULE_0___default().__parse(text, settings);
|
||||
|
||||
var a11yStrings = buildA11yStrings(tree, [], "normal");
|
||||
const a11yStrings = buildA11yStrings(tree, [], "normal");
|
||||
return flatten(a11yStrings).join(", ");
|
||||
};
|
||||
|
||||
|
||||
2
paige/node_modules/katex/dist/contrib/render-a11y-string.min.js
generated
vendored
2
paige/node_modules/katex/dist/contrib/render-a11y-string.min.js
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user