@umoteam/editor-external 9.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.js +3 -3
- package/edgeone.json +4 -0
- package/libs/katex/README.md +3 -3
- package/libs/katex/contrib/auto-render.js +29 -65
- package/libs/katex/contrib/auto-render.min.js +1 -1
- package/libs/katex/contrib/auto-render.mjs +34 -68
- package/libs/katex/contrib/copy-tex.js +23 -37
- package/libs/katex/contrib/copy-tex.min.js +1 -1
- package/libs/katex/contrib/copy-tex.mjs +20 -40
- package/libs/katex/contrib/mathtex-script-type.js +4 -10
- package/libs/katex/contrib/mathtex-script-type.min.js +1 -1
- package/libs/katex/contrib/mathtex-script-type.mjs +0 -3
- package/libs/katex/contrib/mhchem.js +59 -310
- package/libs/katex/contrib/mhchem.min.js +1 -1
- package/libs/katex/contrib/mhchem.mjs +62 -307
- package/libs/katex/contrib/render-a11y-string.js +17 -119
- package/libs/katex/contrib/render-a11y-string.min.js +1 -1
- package/libs/katex/contrib/render-a11y-string.mjs +55 -157
- package/libs/katex/katex-swap.css +1237 -0
- package/libs/katex/katex-swap.min.css +1 -0
- package/libs/katex/katex.css +32 -4
- package/libs/katex/katex.js +4987 -6215
- package/libs/katex/katex.min.css +1 -1
- package/libs/katex/katex.min.js +1 -1
- package/libs/katex/katex.mjs +4562 -6559
- package/libs/mermaid/mermaid.min.js +3022 -0
- package/libs/plyr/plyr.css +1 -0
- package/libs/plyr/plyr.js +8803 -0
- package/libs/plyr/plyr.min.js +2 -0
- package/libs/plyr/plyr.min.js.map +1 -0
- package/libs/plyr/plyr.min.mjs +1 -0
- package/libs/plyr/plyr.min.mjs.map +1 -0
- package/libs/plyr/plyr.mjs +8795 -0
- package/libs/plyr/plyr.polyfilled.js +9296 -0
- package/libs/plyr/plyr.polyfilled.min.js +2 -0
- package/libs/plyr/plyr.polyfilled.min.js.map +1 -0
- package/libs/plyr/plyr.polyfilled.min.mjs +1 -0
- package/libs/plyr/plyr.polyfilled.min.mjs.map +1 -0
- package/libs/plyr/plyr.polyfilled.mjs +9288 -0
- package/libs/plyr/plyr.svg +1 -0
- package/package.json +15 -16
- package/libs/imgly/background-removal-data/12086412521285f855c2921ae13d3370ab243c9a250ebe340430075780f4624b +0 -0
- package/libs/imgly/background-removal-data/26a663c5a768f39155009f52e0f66815f36983ae275eec676365f7d09ef97edd +0 -0
- package/libs/imgly/background-removal-data/378cd0ab154b324c0b1fe3136a605a8618865d4ce38824a30c938cc1e6312ce4 +0 -0
- package/libs/imgly/background-removal-data/391ce9664d3a506e4333adb82581fc2dc6fbef0354f497ab417c050cb6eba6c4 +0 -0
- package/libs/imgly/background-removal-data/417316220b16ddd1c2a4730a315206ec0405aac7b64a878bdbe514e687b07b6f +0 -0
- package/libs/imgly/background-removal-data/7b64520a3747dd5dcf6ac48f612504bb3b1e273a08b42b5a7efd614b9e4a397c +0 -0
- package/libs/imgly/background-removal-data/7b95dd2733643f999b985105afb755122ca36de12decadc7855ebfbdab6920e6 +0 -0
- package/libs/imgly/background-removal-data/8b993f75a6dc28aab79d1f216e62b59aaa6b3a15e62159bcad4a2ac197c4db0a +0 -0
- package/libs/imgly/background-removal-data/90741e8ae8b47de7666ae4163ba26087500d534973a853bbd02cea715f24b5ee +0 -0
- package/libs/imgly/background-removal-data/9f0512f9be98be0f44ad2f9ec9fe706ae626f2037aca910df6d1396a06a30d41 +0 -0
- package/libs/imgly/background-removal-data/a2a1f2d68cd58b5a6262755e434dee496fc0f27c0ba8fcbb5d57c56ffa1bb15f +0 -0
- package/libs/imgly/background-removal-data/a984abd436e7a8119dc170730260a37436ce0d0542984b71c5a1a386777ab7fd +0 -0
- package/libs/imgly/background-removal-data/af8fb2b72ffb03ed999778c4de73fd4ade196890be6e0253230b198dd11e9db0 +0 -0
- package/libs/imgly/background-removal-data/b53229786ebfbaabcfec4955c248135ba47a13972bf700116a2ff85b86507d2e +0 -0
- package/libs/imgly/background-removal-data/bbf8e366b8f11bb64e60c8532fc2ffed21535fa1cf981464ac45485972107855 +0 -0
- package/libs/imgly/background-removal-data/c1eba9d5d2ee58ba832bf98b50624ea8813f2279505643401c23674c6b326d0b +0 -0
- package/libs/imgly/background-removal-data/c9f954707cb992edf62319d9aed365b4fc9ec3f08693a020db30040c0f953198 +0 -0
- package/libs/imgly/background-removal-data/cad6b95099faeba3ea1299d717990453208cc075b53332db9123a4e2bdaf160c +0 -0
- package/libs/imgly/background-removal-data/dd4fad06953738263bc4d5f94974376467fc74081cba665cef18af8223894ed4 +0 -0
- package/libs/imgly/background-removal-data/e9445ca5ac21e04579658183cd886440f3524caafe6a8947dd20a73b34fba5b0 +0 -0
- package/libs/imgly/background-removal-data/ea46f83f60203065638f183fc8a5446dfc28a163d7ba1922fc3bc6cf40347fa2 +0 -0
- package/libs/imgly/background-removal-data/ef7fb517ae63534f48efa657702b3821fb5d59e4fd372016793edc0389341cc0 +0 -0
- package/libs/imgly/background-removal-data/f69890cf74d0a687904dd088c0aaadce598c8bc217366ebee6993eadd4d56208 +0 -0
- package/libs/imgly/background-removal-data/f6e7e01556358ed875f260bdfb22fb6f7213ac6fd4098ed72c0e7af081f0c23c +0 -0
- package/libs/imgly/background-removal-data/fa3e4102c796fb6d1dab5417c5c0b4b5d219e6b9624d045d7361a033e7db183f +0 -0
- package/libs/imgly/background-removal-data/resources.json +0 -462
- package/libs/mammoth/mammoth.browser.min.js +0 -21
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
|
|
8
8
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
9
|
}
|
|
10
|
-
})((typeof self !== 'undefined' ? self : this), function(
|
|
10
|
+
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__757__) {
|
|
11
11
|
return /******/ (function() { // webpackBootstrap
|
|
12
12
|
/******/ "use strict";
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
15
|
-
/***/
|
|
15
|
+
/***/ 757:
|
|
16
16
|
/***/ (function(module) {
|
|
17
17
|
|
|
18
|
-
module.exports =
|
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__757__;
|
|
19
19
|
|
|
20
20
|
/***/ })
|
|
21
21
|
|
|
@@ -77,14 +77,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__771__;
|
|
|
77
77
|
/******/
|
|
78
78
|
/************************************************************************/
|
|
79
79
|
var __webpack_exports__ = {};
|
|
80
|
-
|
|
81
|
-
!function() {
|
|
82
|
-
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(771);
|
|
80
|
+
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(757);
|
|
83
81
|
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
|
|
84
82
|
/* eslint-disable */
|
|
85
|
-
|
|
86
83
|
/* -*- Mode: JavaScript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
|
|
87
|
-
|
|
88
84
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
89
85
|
|
|
90
86
|
/*************************************************************
|
|
@@ -127,26 +123,30 @@ var __webpack_exports__ = {};
|
|
|
127
123
|
* See the License for the specific language governing permissions and
|
|
128
124
|
* limitations under the License.
|
|
129
125
|
*/
|
|
126
|
+
|
|
130
127
|
//
|
|
131
128
|
// Coding Style
|
|
132
129
|
// - use '' for identifiers that can by minified/uglified
|
|
133
130
|
// - use "" for strings that need to stay untouched
|
|
131
|
+
|
|
134
132
|
// version: "3.3.0" for MathJax and KaTeX
|
|
133
|
+
|
|
135
134
|
// Add \ce, \pu, and \tripledash to the KaTeX macros.
|
|
135
|
+
|
|
136
136
|
katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\ce", function (context) {
|
|
137
137
|
return chemParse(context.consumeArgs(1)[0], "ce");
|
|
138
138
|
});
|
|
139
|
-
|
|
140
139
|
katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\pu", function (context) {
|
|
141
140
|
return chemParse(context.consumeArgs(1)[0], "pu");
|
|
142
|
-
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Needed for \bond for the ~ forms
|
|
143
144
|
// Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not
|
|
144
145
|
// a mathematical minus, U+2212. So we need that extra 0.56.
|
|
145
|
-
|
|
146
|
-
|
|
147
146
|
katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
|
|
148
147
|
|
|
149
|
-
|
|
148
|
+
|
|
149
|
+
//
|
|
150
150
|
// This is the main function for handing the \ce and \pu commands.
|
|
151
151
|
// It takes the argument to \ce or \pu and returns the corresponding TeX string.
|
|
152
152
|
//
|
|
@@ -155,27 +155,23 @@ var chemParse = function (tokens, stateMachine) {
|
|
|
155
155
|
// Recreate the argument string from KaTeX's array of tokens.
|
|
156
156
|
var str = "";
|
|
157
157
|
var expectedLoc = tokens.length && tokens[tokens.length - 1].loc.start;
|
|
158
|
-
|
|
159
158
|
for (var i = tokens.length - 1; i >= 0; i--) {
|
|
160
159
|
if (tokens[i].loc.start > expectedLoc) {
|
|
161
160
|
// context.consumeArgs has eaten a space.
|
|
162
161
|
str += " ";
|
|
163
162
|
expectedLoc = tokens[i].loc.start;
|
|
164
163
|
}
|
|
165
|
-
|
|
166
164
|
str += tokens[i].text;
|
|
167
165
|
expectedLoc += tokens[i].text.length;
|
|
168
166
|
}
|
|
169
|
-
|
|
170
167
|
var tex = texify.go(mhchemParser.go(str, stateMachine));
|
|
171
168
|
return tex;
|
|
172
|
-
};
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
//
|
|
173
172
|
// Core parser for mhchem syntax (recursive)
|
|
174
173
|
//
|
|
175
|
-
|
|
176
174
|
/** @type {MhchemParser} */
|
|
177
|
-
|
|
178
|
-
|
|
179
175
|
var mhchemParser = {
|
|
180
176
|
//
|
|
181
177
|
// Parses mchem \ce syntax
|
|
@@ -187,12 +183,12 @@ var mhchemParser = {
|
|
|
187
183
|
if (!input) {
|
|
188
184
|
return [];
|
|
189
185
|
}
|
|
190
|
-
|
|
191
186
|
if (stateMachine === undefined) {
|
|
192
187
|
stateMachine = 'ce';
|
|
193
188
|
}
|
|
189
|
+
var state = '0';
|
|
194
190
|
|
|
195
|
-
|
|
191
|
+
//
|
|
196
192
|
// String buffers for parsing:
|
|
197
193
|
//
|
|
198
194
|
// buffer.a == amount
|
|
@@ -225,79 +221,68 @@ var mhchemParser = {
|
|
|
225
221
|
// 3 == next atom
|
|
226
222
|
// c == macro
|
|
227
223
|
//
|
|
228
|
-
|
|
229
224
|
/** @type {Buffer} */
|
|
230
|
-
|
|
231
225
|
var buffer = {};
|
|
232
226
|
buffer['parenthesisLevel'] = 0;
|
|
233
227
|
input = input.replace(/\n/g, " ");
|
|
234
228
|
input = input.replace(/[\u2212\u2013\u2014\u2010]/g, "-");
|
|
235
|
-
input = input.replace(/[\u2026]/g, "...");
|
|
229
|
+
input = input.replace(/[\u2026]/g, "...");
|
|
230
|
+
|
|
231
|
+
//
|
|
236
232
|
// Looks through mhchemParser.transitions, to execute a matching action
|
|
237
233
|
// (recursive)
|
|
238
234
|
//
|
|
239
|
-
|
|
240
235
|
var lastInput;
|
|
241
236
|
var watchdog = 10;
|
|
242
237
|
/** @type {ParserOutput[]} */
|
|
243
|
-
|
|
244
238
|
var output = [];
|
|
245
|
-
|
|
246
239
|
while (true) {
|
|
247
240
|
if (lastInput !== input) {
|
|
248
241
|
watchdog = 10;
|
|
249
242
|
lastInput = input;
|
|
250
243
|
} else {
|
|
251
244
|
watchdog--;
|
|
252
|
-
}
|
|
245
|
+
}
|
|
246
|
+
//
|
|
253
247
|
// Find actions in transition table
|
|
254
248
|
//
|
|
255
|
-
|
|
256
|
-
|
|
257
249
|
var machine = mhchemParser.stateMachines[stateMachine];
|
|
258
250
|
var t = machine.transitions[state] || machine.transitions['*'];
|
|
259
|
-
|
|
260
251
|
iterateTransitions: for (var i = 0; i < t.length; i++) {
|
|
261
252
|
var matches = mhchemParser.patterns.match_(t[i].pattern, input);
|
|
262
|
-
|
|
263
253
|
if (matches) {
|
|
264
254
|
//
|
|
265
255
|
// Execute actions
|
|
266
256
|
//
|
|
267
257
|
var task = t[i].task;
|
|
268
|
-
|
|
269
258
|
for (var iA = 0; iA < task.action_.length; iA++) {
|
|
270
|
-
var o;
|
|
259
|
+
var o;
|
|
260
|
+
//
|
|
271
261
|
// Find and execute action
|
|
272
262
|
//
|
|
273
|
-
|
|
274
263
|
if (machine.actions[task.action_[iA].type_]) {
|
|
275
264
|
o = machine.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
|
|
276
265
|
} else if (mhchemParser.actions[task.action_[iA].type_]) {
|
|
277
266
|
o = mhchemParser.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
|
|
278
267
|
} else {
|
|
279
268
|
throw ["MhchemBugA", "mhchem bug A. Please report. (" + task.action_[iA].type_ + ")"]; // Trying to use non-existing action
|
|
280
|
-
}
|
|
269
|
+
}
|
|
270
|
+
//
|
|
281
271
|
// Add output
|
|
282
272
|
//
|
|
283
|
-
|
|
284
|
-
|
|
285
273
|
mhchemParser.concatArray(output, o);
|
|
286
|
-
}
|
|
274
|
+
}
|
|
275
|
+
//
|
|
287
276
|
// Set next state,
|
|
288
277
|
// Shorten input,
|
|
289
278
|
// Continue with next character
|
|
290
279
|
// (= apply only one transition per position)
|
|
291
280
|
//
|
|
292
|
-
|
|
293
|
-
|
|
294
281
|
state = task.nextState || state;
|
|
295
|
-
|
|
296
282
|
if (input.length > 0) {
|
|
297
283
|
if (!task.revisit) {
|
|
298
284
|
input = matches.remainder;
|
|
299
285
|
}
|
|
300
|
-
|
|
301
286
|
if (!task.toContinue) {
|
|
302
287
|
break iterateTransitions;
|
|
303
288
|
}
|
|
@@ -305,11 +290,10 @@ var mhchemParser = {
|
|
|
305
290
|
return output;
|
|
306
291
|
}
|
|
307
292
|
}
|
|
308
|
-
}
|
|
293
|
+
}
|
|
294
|
+
//
|
|
309
295
|
// Prevent infinite loop
|
|
310
296
|
//
|
|
311
|
-
|
|
312
|
-
|
|
313
297
|
if (watchdog <= 0) {
|
|
314
298
|
throw ["MhchemBugU", "mhchem bug U. Please report."]; // Unexpected character
|
|
315
299
|
}
|
|
@@ -353,46 +337,37 @@ var mhchemParser = {
|
|
|
353
337
|
'-9.,9 no missing 0': /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
|
|
354
338
|
'(-)(9.,9)(e)(99)': function (input) {
|
|
355
339
|
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]+\}))?/);
|
|
356
|
-
|
|
357
340
|
if (m && m[0]) {
|
|
358
341
|
return {
|
|
359
342
|
match_: m.splice(1),
|
|
360
343
|
remainder: input.substr(m[0].length)
|
|
361
344
|
};
|
|
362
345
|
}
|
|
363
|
-
|
|
364
346
|
return null;
|
|
365
347
|
},
|
|
366
348
|
'(-)(9)^(-9)': function (input) {
|
|
367
349
|
var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
|
|
368
|
-
|
|
369
350
|
if (m && m[0]) {
|
|
370
351
|
return {
|
|
371
352
|
match_: m.splice(1),
|
|
372
353
|
remainder: input.substr(m[0].length)
|
|
373
354
|
};
|
|
374
355
|
}
|
|
375
|
-
|
|
376
356
|
return null;
|
|
377
357
|
},
|
|
378
358
|
'state of aggregation $': function (input) {
|
|
379
359
|
// ... or crystal system
|
|
380
360
|
var a = mhchemParser.patterns.findObserveGroups(input, "", /^\([a-z]{1,3}(?=[\),])/, ")", ""); // (aq), (aq,$\infty$), (aq, sat)
|
|
381
|
-
|
|
382
361
|
if (a && a.remainder.match(/^($|[\s,;\)\]\}])/)) {
|
|
383
362
|
return a;
|
|
384
363
|
} // AND end of 'phrase'
|
|
385
|
-
|
|
386
|
-
|
|
387
364
|
var m = input.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/); // OR crystal system ($o$) (\ca$c$)
|
|
388
|
-
|
|
389
365
|
if (m) {
|
|
390
366
|
return {
|
|
391
367
|
match_: m[0],
|
|
392
368
|
remainder: input.substr(m[0].length)
|
|
393
369
|
};
|
|
394
370
|
}
|
|
395
|
-
|
|
396
371
|
return null;
|
|
397
372
|
},
|
|
398
373
|
'_{(state of aggregation)}$': /^_\{(\([a-z]{1,3}\))\}/,
|
|
@@ -514,23 +489,19 @@ var mhchemParser = {
|
|
|
514
489
|
'roman numeral': /^[IVX]+/,
|
|
515
490
|
'1/2$': /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
|
|
516
491
|
'amount': function (input) {
|
|
517
|
-
var match;
|
|
518
|
-
|
|
492
|
+
var match;
|
|
493
|
+
// e.g. 2, 0.5, 1/2, -2, n/2, +; $a$ could be added later in parsing
|
|
519
494
|
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))/);
|
|
520
|
-
|
|
521
495
|
if (match) {
|
|
522
496
|
return {
|
|
523
497
|
match_: match[0],
|
|
524
498
|
remainder: input.substr(match[0].length)
|
|
525
499
|
};
|
|
526
500
|
}
|
|
527
|
-
|
|
528
501
|
var a = mhchemParser.patterns.findObserveGroups(input, "", "$", "$", "");
|
|
529
|
-
|
|
530
502
|
if (a) {
|
|
531
503
|
// e.g. $2n-1$, $-$
|
|
532
504
|
match = a.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/);
|
|
533
|
-
|
|
534
505
|
if (match) {
|
|
535
506
|
return {
|
|
536
507
|
match_: match[0],
|
|
@@ -538,7 +509,6 @@ var mhchemParser = {
|
|
|
538
509
|
};
|
|
539
510
|
}
|
|
540
511
|
}
|
|
541
|
-
|
|
542
512
|
return null;
|
|
543
513
|
},
|
|
544
514
|
'amount2': function (input) {
|
|
@@ -549,17 +519,13 @@ var mhchemParser = {
|
|
|
549
519
|
if (input.match(/^\([a-z]+\)$/)) {
|
|
550
520
|
return null;
|
|
551
521
|
} // state of aggregation = no formula
|
|
552
|
-
|
|
553
|
-
|
|
554
522
|
var match = input.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
|
|
555
|
-
|
|
556
523
|
if (match) {
|
|
557
524
|
return {
|
|
558
525
|
match_: match[0],
|
|
559
526
|
remainder: input.substr(match[0].length)
|
|
560
527
|
};
|
|
561
528
|
}
|
|
562
|
-
|
|
563
529
|
return null;
|
|
564
530
|
},
|
|
565
531
|
'uprightEntities': /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,
|
|
@@ -574,29 +540,21 @@ var mhchemParser = {
|
|
|
574
540
|
if (input.indexOf(pattern) !== 0) {
|
|
575
541
|
return null;
|
|
576
542
|
}
|
|
577
|
-
|
|
578
543
|
return pattern;
|
|
579
544
|
} else {
|
|
580
545
|
var match = input.match(pattern);
|
|
581
|
-
|
|
582
546
|
if (!match) {
|
|
583
547
|
return null;
|
|
584
548
|
}
|
|
585
|
-
|
|
586
549
|
return match[0];
|
|
587
550
|
}
|
|
588
551
|
};
|
|
589
552
|
/** @type {{(input: string, i: number, endChars: string | RegExp): {endMatchBegin: number, endMatchEnd: number} | null;}} */
|
|
590
|
-
|
|
591
|
-
|
|
592
553
|
var _findObserveGroups = function (input, i, endChars) {
|
|
593
554
|
var braces = 0;
|
|
594
|
-
|
|
595
555
|
while (i < input.length) {
|
|
596
556
|
var a = input.charAt(i);
|
|
597
|
-
|
|
598
557
|
var match = _match(input.substr(i), endChars);
|
|
599
|
-
|
|
600
558
|
if (match !== null && braces === 0) {
|
|
601
559
|
return {
|
|
602
560
|
endMatchBegin: i,
|
|
@@ -611,38 +569,27 @@ var mhchemParser = {
|
|
|
611
569
|
braces--;
|
|
612
570
|
}
|
|
613
571
|
}
|
|
614
|
-
|
|
615
572
|
i++;
|
|
616
573
|
}
|
|
617
|
-
|
|
618
574
|
if (braces > 0) {
|
|
619
575
|
return null;
|
|
620
576
|
}
|
|
621
|
-
|
|
622
577
|
return null;
|
|
623
578
|
};
|
|
624
|
-
|
|
625
579
|
var match = _match(input, begExcl);
|
|
626
|
-
|
|
627
580
|
if (match === null) {
|
|
628
581
|
return null;
|
|
629
582
|
}
|
|
630
|
-
|
|
631
583
|
input = input.substr(match.length);
|
|
632
584
|
match = _match(input, begIncl);
|
|
633
|
-
|
|
634
585
|
if (match === null) {
|
|
635
586
|
return null;
|
|
636
587
|
}
|
|
637
|
-
|
|
638
588
|
var e = _findObserveGroups(input, match.length, endIncl || endExcl);
|
|
639
|
-
|
|
640
589
|
if (e === null) {
|
|
641
590
|
return null;
|
|
642
591
|
}
|
|
643
|
-
|
|
644
592
|
var match1 = input.substring(0, endIncl ? e.endMatchEnd : e.endMatchBegin);
|
|
645
|
-
|
|
646
593
|
if (!(beg2Excl || beg2Incl)) {
|
|
647
594
|
return {
|
|
648
595
|
match_: match1,
|
|
@@ -650,13 +597,10 @@ var mhchemParser = {
|
|
|
650
597
|
};
|
|
651
598
|
} else {
|
|
652
599
|
var group2 = this.findObserveGroups(input.substr(e.endMatchEnd), beg2Excl, beg2Incl, end2Incl, end2Excl);
|
|
653
|
-
|
|
654
600
|
if (group2 === null) {
|
|
655
601
|
return null;
|
|
656
602
|
}
|
|
657
603
|
/** @type {string[]} */
|
|
658
|
-
|
|
659
|
-
|
|
660
604
|
var matchRet = [match1, group2.match_];
|
|
661
605
|
return {
|
|
662
606
|
match_: combine ? matchRet.join("") : matchRet,
|
|
@@ -671,7 +615,6 @@ var mhchemParser = {
|
|
|
671
615
|
//
|
|
672
616
|
match_: function (m, input) {
|
|
673
617
|
var pattern = mhchemParser.patterns.patterns[m];
|
|
674
|
-
|
|
675
618
|
if (pattern === undefined) {
|
|
676
619
|
throw ["MhchemBugP", "mhchem bug P. Please report. (" + m + ")"]; // Trying to use non-existing pattern
|
|
677
620
|
} else if (typeof pattern === "function") {
|
|
@@ -679,10 +622,8 @@ var mhchemParser = {
|
|
|
679
622
|
} else {
|
|
680
623
|
// RegExp
|
|
681
624
|
var match = input.match(pattern);
|
|
682
|
-
|
|
683
625
|
if (match) {
|
|
684
626
|
var mm;
|
|
685
|
-
|
|
686
627
|
if (match[2]) {
|
|
687
628
|
mm = [match[1], match[2]];
|
|
688
629
|
} else if (match[1]) {
|
|
@@ -690,13 +631,11 @@ var mhchemParser = {
|
|
|
690
631
|
} else {
|
|
691
632
|
mm = match[0];
|
|
692
633
|
}
|
|
693
|
-
|
|
694
634
|
return {
|
|
695
635
|
match_: mm,
|
|
696
636
|
remainder: input.substr(match[0].length)
|
|
697
637
|
};
|
|
698
638
|
}
|
|
699
|
-
|
|
700
639
|
return null;
|
|
701
640
|
}
|
|
702
641
|
}
|
|
@@ -789,12 +728,10 @@ var mhchemParser = {
|
|
|
789
728
|
'1/2': function (buffer, m) {
|
|
790
729
|
/** @type {ParserOutput[]} */
|
|
791
730
|
var ret = [];
|
|
792
|
-
|
|
793
731
|
if (m.match(/^[+\-]/)) {
|
|
794
732
|
ret.push(m.substr(0, 1));
|
|
795
733
|
m = m.substr(1);
|
|
796
734
|
}
|
|
797
|
-
|
|
798
735
|
var n = m.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
|
|
799
736
|
n[1] = n[1].replace(/\$/g, "");
|
|
800
737
|
ret.push({
|
|
@@ -802,7 +739,6 @@ var mhchemParser = {
|
|
|
802
739
|
p1: n[1],
|
|
803
740
|
p2: n[2]
|
|
804
741
|
});
|
|
805
|
-
|
|
806
742
|
if (n[3]) {
|
|
807
743
|
n[3] = n[3].replace(/\$/g, "");
|
|
808
744
|
ret.push({
|
|
@@ -810,7 +746,6 @@ var mhchemParser = {
|
|
|
810
746
|
p1: n[3]
|
|
811
747
|
});
|
|
812
748
|
}
|
|
813
|
-
|
|
814
749
|
return ret;
|
|
815
750
|
},
|
|
816
751
|
'9,9': function (buffer, m) {
|
|
@@ -825,46 +760,37 @@ var mhchemParser = {
|
|
|
825
760
|
createTransitions: function (o) {
|
|
826
761
|
var pattern, state;
|
|
827
762
|
/** @type {string[]} */
|
|
828
|
-
|
|
829
763
|
var stateArray;
|
|
830
|
-
var i;
|
|
764
|
+
var i;
|
|
765
|
+
//
|
|
831
766
|
// 1. Collect all states
|
|
832
767
|
//
|
|
833
|
-
|
|
834
768
|
/** @type {Transitions} */
|
|
835
|
-
|
|
836
769
|
var transitions = {};
|
|
837
|
-
|
|
838
770
|
for (pattern in o) {
|
|
839
771
|
for (state in o[pattern]) {
|
|
840
772
|
stateArray = state.split("|");
|
|
841
773
|
o[pattern][state].stateArray = stateArray;
|
|
842
|
-
|
|
843
774
|
for (i = 0; i < stateArray.length; i++) {
|
|
844
775
|
transitions[stateArray[i]] = [];
|
|
845
776
|
}
|
|
846
777
|
}
|
|
847
|
-
}
|
|
778
|
+
}
|
|
779
|
+
//
|
|
848
780
|
// 2. Fill states
|
|
849
781
|
//
|
|
850
|
-
|
|
851
|
-
|
|
852
782
|
for (pattern in o) {
|
|
853
783
|
for (state in o[pattern]) {
|
|
854
784
|
stateArray = o[pattern][state].stateArray || [];
|
|
855
|
-
|
|
856
785
|
for (i = 0; i < stateArray.length; i++) {
|
|
857
786
|
//
|
|
858
787
|
// 2a. Normalize actions into array: 'text=' ==> [{type_:'text='}]
|
|
859
788
|
// (Note to myself: Resolving the function here would be problematic. It would need .bind (for *this*) and currying (for *option*).)
|
|
860
789
|
//
|
|
861
|
-
|
|
862
790
|
/** @type {any} */
|
|
863
791
|
var p = o[pattern][state];
|
|
864
|
-
|
|
865
792
|
if (p.action_) {
|
|
866
793
|
p.action_ = [].concat(p.action_);
|
|
867
|
-
|
|
868
794
|
for (var k = 0; k < p.action_.length; k++) {
|
|
869
795
|
if (typeof p.action_[k] === "string") {
|
|
870
796
|
p.action_[k] = {
|
|
@@ -874,13 +800,11 @@ var mhchemParser = {
|
|
|
874
800
|
}
|
|
875
801
|
} else {
|
|
876
802
|
p.action_ = [];
|
|
877
|
-
}
|
|
803
|
+
}
|
|
804
|
+
//
|
|
878
805
|
// 2.b Multi-insert
|
|
879
806
|
//
|
|
880
|
-
|
|
881
|
-
|
|
882
807
|
var patternArray = pattern.split("|");
|
|
883
|
-
|
|
884
808
|
for (var j = 0; j < patternArray.length; j++) {
|
|
885
809
|
if (stateArray[i] === '*') {
|
|
886
810
|
// insert into all
|
|
@@ -900,14 +824,14 @@ var mhchemParser = {
|
|
|
900
824
|
}
|
|
901
825
|
}
|
|
902
826
|
}
|
|
903
|
-
|
|
904
827
|
return transitions;
|
|
905
828
|
},
|
|
906
829
|
stateMachines: {}
|
|
907
|
-
};
|
|
830
|
+
};
|
|
831
|
+
|
|
832
|
+
//
|
|
908
833
|
// Definition of state machines
|
|
909
834
|
//
|
|
910
|
-
|
|
911
835
|
mhchemParser.stateMachines = {
|
|
912
836
|
//
|
|
913
837
|
// \ce state machines
|
|
@@ -1555,7 +1479,6 @@ mhchemParser.stateMachines = {
|
|
|
1555
1479
|
actions: {
|
|
1556
1480
|
'o after d': function (buffer, m) {
|
|
1557
1481
|
var ret;
|
|
1558
|
-
|
|
1559
1482
|
if ((buffer.d || "").match(/^[0-9]+$/)) {
|
|
1560
1483
|
var tmp = buffer.d;
|
|
1561
1484
|
buffer.d = undefined;
|
|
@@ -1564,7 +1487,6 @@ mhchemParser.stateMachines = {
|
|
|
1564
1487
|
} else {
|
|
1565
1488
|
ret = this['output'](buffer);
|
|
1566
1489
|
}
|
|
1567
|
-
|
|
1568
1490
|
mhchemParser.actions['o='](buffer, m);
|
|
1569
1491
|
return ret;
|
|
1570
1492
|
},
|
|
@@ -1589,15 +1511,11 @@ mhchemParser.stateMachines = {
|
|
|
1589
1511
|
var c3 = mhchemParser.patterns.match_('one lowercase latin letter $', buffer.o || "");
|
|
1590
1512
|
var c4 = mhchemParser.patterns.match_('$one lowercase latin letter$ $', buffer.o || "");
|
|
1591
1513
|
var hyphenFollows = m === "-" && (c1 && c1.remainder === "" || c2 || c3 || c4);
|
|
1592
|
-
|
|
1593
1514
|
if (hyphenFollows && !buffer.a && !buffer.b && !buffer.p && !buffer.d && !buffer.q && !c1 && c3) {
|
|
1594
1515
|
buffer.o = '$' + buffer.o + '$';
|
|
1595
1516
|
}
|
|
1596
1517
|
/** @type {ParserOutput[]} */
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
1518
|
var ret = [];
|
|
1600
|
-
|
|
1601
1519
|
if (hyphenFollows) {
|
|
1602
1520
|
mhchemParser.concatArray(ret, this['output'](buffer));
|
|
1603
1521
|
ret.push({
|
|
@@ -1605,7 +1523,6 @@ mhchemParser.stateMachines = {
|
|
|
1605
1523
|
});
|
|
1606
1524
|
} else {
|
|
1607
1525
|
c1 = mhchemParser.patterns.match_('digits', buffer.d || "");
|
|
1608
|
-
|
|
1609
1526
|
if (isAfterD && c1 && c1.remainder === '') {
|
|
1610
1527
|
mhchemParser.concatArray(ret, mhchemParser.actions['d='](buffer, m));
|
|
1611
1528
|
mhchemParser.concatArray(ret, this['output'](buffer));
|
|
@@ -1614,7 +1531,6 @@ mhchemParser.stateMachines = {
|
|
|
1614
1531
|
mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-"));
|
|
1615
1532
|
}
|
|
1616
1533
|
}
|
|
1617
|
-
|
|
1618
1534
|
return ret;
|
|
1619
1535
|
},
|
|
1620
1536
|
'a to o': function (buffer) {
|
|
@@ -1648,7 +1564,6 @@ mhchemParser.stateMachines = {
|
|
|
1648
1564
|
'comma': function (buffer, m) {
|
|
1649
1565
|
var a = m.replace(/\s*$/, '');
|
|
1650
1566
|
var withSpace = a !== m;
|
|
1651
|
-
|
|
1652
1567
|
if (withSpace && buffer['parenthesisLevel'] === 0) {
|
|
1653
1568
|
return {
|
|
1654
1569
|
type_: 'comma enumeration L',
|
|
@@ -1666,21 +1581,18 @@ mhchemParser.stateMachines = {
|
|
|
1666
1581
|
// undefined = if we have nothing else to output, also ignore the just read space (buffer.sb)
|
|
1667
1582
|
// 1 = an entity follows, never omit the space if there was one just read before (can only apply to state 1)
|
|
1668
1583
|
// 2 = 1 + the entity can have an amount, so output a\, instead of converting it to o (can only apply to states a|as)
|
|
1669
|
-
|
|
1670
1584
|
/** @type {ParserOutput | ParserOutput[]} */
|
|
1671
1585
|
var ret;
|
|
1672
|
-
|
|
1673
1586
|
if (!buffer.r) {
|
|
1674
1587
|
ret = [];
|
|
1675
|
-
|
|
1676
|
-
|
|
1588
|
+
if (!buffer.a && !buffer.b && !buffer.p && !buffer.o && !buffer.q && !buffer.d && !entityFollows) {
|
|
1589
|
+
//ret = [];
|
|
1677
1590
|
} else {
|
|
1678
1591
|
if (buffer.sb) {
|
|
1679
1592
|
ret.push({
|
|
1680
1593
|
type_: 'entitySkip'
|
|
1681
1594
|
});
|
|
1682
1595
|
}
|
|
1683
|
-
|
|
1684
1596
|
if (!buffer.o && !buffer.q && !buffer.d && !buffer.b && !buffer.p && entityFollows !== 2) {
|
|
1685
1597
|
buffer.o = buffer.a;
|
|
1686
1598
|
buffer.a = undefined;
|
|
@@ -1696,7 +1608,6 @@ mhchemParser.stateMachines = {
|
|
|
1696
1608
|
buffer.dType = undefined;
|
|
1697
1609
|
}
|
|
1698
1610
|
}
|
|
1699
|
-
|
|
1700
1611
|
ret.push({
|
|
1701
1612
|
type_: 'chemfive',
|
|
1702
1613
|
a: mhchemParser.go(buffer.a, 'a'),
|
|
@@ -1710,10 +1621,8 @@ mhchemParser.stateMachines = {
|
|
|
1710
1621
|
}
|
|
1711
1622
|
} else {
|
|
1712
1623
|
// r
|
|
1713
|
-
|
|
1714
1624
|
/** @type {ParserOutput[]} */
|
|
1715
1625
|
var rd;
|
|
1716
|
-
|
|
1717
1626
|
if (buffer.rdt === 'M') {
|
|
1718
1627
|
rd = mhchemParser.go(buffer.rd, 'tex-math');
|
|
1719
1628
|
} else if (buffer.rdt === 'T') {
|
|
@@ -1725,10 +1634,7 @@ mhchemParser.stateMachines = {
|
|
|
1725
1634
|
rd = mhchemParser.go(buffer.rd);
|
|
1726
1635
|
}
|
|
1727
1636
|
/** @type {ParserOutput[]} */
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
1637
|
var rq;
|
|
1731
|
-
|
|
1732
1638
|
if (buffer.rqt === 'M') {
|
|
1733
1639
|
rq = mhchemParser.go(buffer.rq, 'tex-math');
|
|
1734
1640
|
} else if (buffer.rqt === 'T') {
|
|
@@ -1739,7 +1645,6 @@ mhchemParser.stateMachines = {
|
|
|
1739
1645
|
} else {
|
|
1740
1646
|
rq = mhchemParser.go(buffer.rq);
|
|
1741
1647
|
}
|
|
1742
|
-
|
|
1743
1648
|
ret = {
|
|
1744
1649
|
type_: 'arrow',
|
|
1745
1650
|
r: buffer.r,
|
|
@@ -1747,13 +1652,11 @@ mhchemParser.stateMachines = {
|
|
|
1747
1652
|
rq: rq
|
|
1748
1653
|
};
|
|
1749
1654
|
}
|
|
1750
|
-
|
|
1751
1655
|
for (var p in buffer) {
|
|
1752
1656
|
if (p !== 'parenthesisLevel' && p !== 'beginsWithBond') {
|
|
1753
1657
|
delete buffer[p];
|
|
1754
1658
|
}
|
|
1755
1659
|
}
|
|
1756
|
-
|
|
1757
1660
|
return ret;
|
|
1758
1661
|
},
|
|
1759
1662
|
'oxidation-output': function (buffer, m) {
|
|
@@ -1951,11 +1854,9 @@ mhchemParser.stateMachines = {
|
|
|
1951
1854
|
type_: 'text',
|
|
1952
1855
|
p1: buffer.text_
|
|
1953
1856
|
};
|
|
1954
|
-
|
|
1955
1857
|
for (var p in buffer) {
|
|
1956
1858
|
delete buffer[p];
|
|
1957
1859
|
}
|
|
1958
|
-
|
|
1959
1860
|
return ret;
|
|
1960
1861
|
}
|
|
1961
1862
|
}
|
|
@@ -2244,11 +2145,9 @@ mhchemParser.stateMachines = {
|
|
|
2244
2145
|
type_: 'tex-math',
|
|
2245
2146
|
p1: buffer.o
|
|
2246
2147
|
};
|
|
2247
|
-
|
|
2248
2148
|
for (var p in buffer) {
|
|
2249
2149
|
delete buffer[p];
|
|
2250
2150
|
}
|
|
2251
|
-
|
|
2252
2151
|
return ret;
|
|
2253
2152
|
}
|
|
2254
2153
|
}
|
|
@@ -2293,11 +2192,9 @@ mhchemParser.stateMachines = {
|
|
|
2293
2192
|
type_: 'tex-math',
|
|
2294
2193
|
p1: buffer.o
|
|
2295
2194
|
};
|
|
2296
|
-
|
|
2297
2195
|
for (var p in buffer) {
|
|
2298
2196
|
delete buffer[p];
|
|
2299
2197
|
}
|
|
2300
|
-
|
|
2301
2198
|
return ret;
|
|
2302
2199
|
}
|
|
2303
2200
|
}
|
|
@@ -2410,16 +2307,13 @@ mhchemParser.stateMachines = {
|
|
|
2410
2307
|
'enumber': function (buffer, m) {
|
|
2411
2308
|
/** @type {ParserOutput[]} */
|
|
2412
2309
|
var ret = [];
|
|
2413
|
-
|
|
2414
2310
|
if (m[0] === "+-" || m[0] === "+/-") {
|
|
2415
2311
|
ret.push("\\pm ");
|
|
2416
2312
|
} else if (m[0]) {
|
|
2417
2313
|
ret.push(m[0]);
|
|
2418
2314
|
}
|
|
2419
|
-
|
|
2420
2315
|
if (m[1]) {
|
|
2421
2316
|
mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9'));
|
|
2422
|
-
|
|
2423
2317
|
if (m[2]) {
|
|
2424
2318
|
if (m[2].match(/[,.]/)) {
|
|
2425
2319
|
mhchemParser.concatArray(ret, mhchemParser.go(m[2], 'pu-9,9'));
|
|
@@ -2427,12 +2321,9 @@ mhchemParser.stateMachines = {
|
|
|
2427
2321
|
ret.push(m[2]);
|
|
2428
2322
|
}
|
|
2429
2323
|
}
|
|
2430
|
-
|
|
2431
2324
|
m[3] = m[4] || m[3];
|
|
2432
|
-
|
|
2433
2325
|
if (m[3]) {
|
|
2434
2326
|
m[3] = m[3].trim();
|
|
2435
|
-
|
|
2436
2327
|
if (m[3] === "e" || m[3].substr(0, 1) === "*") {
|
|
2437
2328
|
ret.push({
|
|
2438
2329
|
type_: 'cdot'
|
|
@@ -2444,23 +2335,19 @@ mhchemParser.stateMachines = {
|
|
|
2444
2335
|
}
|
|
2445
2336
|
}
|
|
2446
2337
|
}
|
|
2447
|
-
|
|
2448
2338
|
if (m[3]) {
|
|
2449
2339
|
ret.push("10^{" + m[5] + "}");
|
|
2450
2340
|
}
|
|
2451
|
-
|
|
2452
2341
|
return ret;
|
|
2453
2342
|
},
|
|
2454
2343
|
'number^': function (buffer, m) {
|
|
2455
2344
|
/** @type {ParserOutput[]} */
|
|
2456
2345
|
var ret = [];
|
|
2457
|
-
|
|
2458
2346
|
if (m[0] === "+-" || m[0] === "+/-") {
|
|
2459
2347
|
ret.push("\\pm ");
|
|
2460
2348
|
} else if (m[0]) {
|
|
2461
2349
|
ret.push(m[0]);
|
|
2462
2350
|
}
|
|
2463
|
-
|
|
2464
2351
|
mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9'));
|
|
2465
2352
|
ret.push("^{" + m[2] + "}");
|
|
2466
2353
|
return ret;
|
|
@@ -2480,22 +2367,17 @@ mhchemParser.stateMachines = {
|
|
|
2480
2367
|
/** @type {ParserOutput | ParserOutput[]} */
|
|
2481
2368
|
var ret;
|
|
2482
2369
|
var md = mhchemParser.patterns.match_('{(...)}', buffer.d || "");
|
|
2483
|
-
|
|
2484
2370
|
if (md && md.remainder === '') {
|
|
2485
2371
|
buffer.d = md.match_;
|
|
2486
2372
|
}
|
|
2487
|
-
|
|
2488
2373
|
var mq = mhchemParser.patterns.match_('{(...)}', buffer.q || "");
|
|
2489
|
-
|
|
2490
2374
|
if (mq && mq.remainder === '') {
|
|
2491
2375
|
buffer.q = mq.match_;
|
|
2492
2376
|
}
|
|
2493
|
-
|
|
2494
2377
|
if (buffer.d) {
|
|
2495
2378
|
buffer.d = buffer.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C");
|
|
2496
2379
|
buffer.d = buffer.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
|
|
2497
2380
|
}
|
|
2498
|
-
|
|
2499
2381
|
if (buffer.q) {
|
|
2500
2382
|
// fraction
|
|
2501
2383
|
buffer.q = buffer.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C");
|
|
@@ -2504,7 +2386,6 @@ mhchemParser.stateMachines = {
|
|
|
2504
2386
|
d: mhchemParser.go(buffer.d, 'pu'),
|
|
2505
2387
|
q: mhchemParser.go(buffer.q, 'pu')
|
|
2506
2388
|
};
|
|
2507
|
-
|
|
2508
2389
|
if (buffer.o === '//') {
|
|
2509
2390
|
ret = {
|
|
2510
2391
|
type_: 'pu-frac',
|
|
@@ -2513,7 +2394,6 @@ mhchemParser.stateMachines = {
|
|
|
2513
2394
|
};
|
|
2514
2395
|
} else {
|
|
2515
2396
|
ret = b5.d;
|
|
2516
|
-
|
|
2517
2397
|
if (b5.d.length > 1 || b5.q.length > 1) {
|
|
2518
2398
|
ret.push({
|
|
2519
2399
|
type_: ' / '
|
|
@@ -2523,18 +2403,15 @@ mhchemParser.stateMachines = {
|
|
|
2523
2403
|
type_: '/'
|
|
2524
2404
|
});
|
|
2525
2405
|
}
|
|
2526
|
-
|
|
2527
2406
|
mhchemParser.concatArray(ret, b5.q);
|
|
2528
2407
|
}
|
|
2529
2408
|
} else {
|
|
2530
2409
|
// no fraction
|
|
2531
2410
|
ret = mhchemParser.go(buffer.d, 'pu-2');
|
|
2532
2411
|
}
|
|
2533
|
-
|
|
2534
2412
|
for (var p in buffer) {
|
|
2535
2413
|
delete buffer[p];
|
|
2536
2414
|
}
|
|
2537
|
-
|
|
2538
2415
|
return ret;
|
|
2539
2416
|
}
|
|
2540
2417
|
}
|
|
@@ -2602,10 +2479,8 @@ mhchemParser.stateMachines = {
|
|
|
2602
2479
|
'output': function (buffer) {
|
|
2603
2480
|
/** @type {ParserOutput | ParserOutput[]} */
|
|
2604
2481
|
var ret = [];
|
|
2605
|
-
|
|
2606
2482
|
if (buffer.rm) {
|
|
2607
2483
|
var mrm = mhchemParser.patterns.match_('{(...)}', buffer.rm || "");
|
|
2608
|
-
|
|
2609
2484
|
if (mrm && mrm.remainder === '') {
|
|
2610
2485
|
ret = mhchemParser.go(mrm.match_, 'pu');
|
|
2611
2486
|
} else {
|
|
@@ -2615,11 +2490,9 @@ mhchemParser.stateMachines = {
|
|
|
2615
2490
|
};
|
|
2616
2491
|
}
|
|
2617
2492
|
}
|
|
2618
|
-
|
|
2619
2493
|
for (var p in buffer) {
|
|
2620
2494
|
delete buffer[p];
|
|
2621
2495
|
}
|
|
2622
|
-
|
|
2623
2496
|
return ret;
|
|
2624
2497
|
}
|
|
2625
2498
|
}
|
|
@@ -2662,109 +2535,90 @@ mhchemParser.stateMachines = {
|
|
|
2662
2535
|
/** @type {ParserOutput[]} */
|
|
2663
2536
|
var ret = [];
|
|
2664
2537
|
buffer.text_ = buffer.text_ || "";
|
|
2665
|
-
|
|
2666
2538
|
if (buffer.text_.length > 4) {
|
|
2667
2539
|
var a = buffer.text_.length % 3;
|
|
2668
|
-
|
|
2669
2540
|
if (a === 0) {
|
|
2670
2541
|
a = 3;
|
|
2671
2542
|
}
|
|
2672
|
-
|
|
2673
2543
|
for (var i = buffer.text_.length - 3; i > 0; i -= 3) {
|
|
2674
2544
|
ret.push(buffer.text_.substr(i, 3));
|
|
2675
2545
|
ret.push({
|
|
2676
2546
|
type_: '1000 separator'
|
|
2677
2547
|
});
|
|
2678
2548
|
}
|
|
2679
|
-
|
|
2680
2549
|
ret.push(buffer.text_.substr(0, a));
|
|
2681
2550
|
ret.reverse();
|
|
2682
2551
|
} else {
|
|
2683
2552
|
ret.push(buffer.text_);
|
|
2684
2553
|
}
|
|
2685
|
-
|
|
2686
2554
|
for (var p in buffer) {
|
|
2687
2555
|
delete buffer[p];
|
|
2688
2556
|
}
|
|
2689
|
-
|
|
2690
2557
|
return ret;
|
|
2691
2558
|
},
|
|
2692
2559
|
'output-o': function (buffer) {
|
|
2693
2560
|
/** @type {ParserOutput[]} */
|
|
2694
2561
|
var ret = [];
|
|
2695
2562
|
buffer.text_ = buffer.text_ || "";
|
|
2696
|
-
|
|
2697
2563
|
if (buffer.text_.length > 4) {
|
|
2698
2564
|
var a = buffer.text_.length - 3;
|
|
2699
|
-
|
|
2700
2565
|
for (var i = 0; i < a; i += 3) {
|
|
2701
2566
|
ret.push(buffer.text_.substr(i, 3));
|
|
2702
2567
|
ret.push({
|
|
2703
2568
|
type_: '1000 separator'
|
|
2704
2569
|
});
|
|
2705
2570
|
}
|
|
2706
|
-
|
|
2707
2571
|
ret.push(buffer.text_.substr(i));
|
|
2708
2572
|
} else {
|
|
2709
2573
|
ret.push(buffer.text_);
|
|
2710
2574
|
}
|
|
2711
|
-
|
|
2712
2575
|
for (var p in buffer) {
|
|
2713
2576
|
delete buffer[p];
|
|
2714
2577
|
}
|
|
2715
|
-
|
|
2716
2578
|
return ret;
|
|
2717
2579
|
}
|
|
2718
2580
|
}
|
|
2719
|
-
}
|
|
2581
|
+
}
|
|
2582
|
+
//#endregion
|
|
2583
|
+
};
|
|
2720
2584
|
|
|
2721
|
-
|
|
2585
|
+
//
|
|
2722
2586
|
// texify: Take MhchemParser output and convert it to TeX
|
|
2723
2587
|
//
|
|
2724
|
-
|
|
2725
2588
|
/** @type {Texify} */
|
|
2726
|
-
|
|
2727
2589
|
var texify = {
|
|
2728
2590
|
go: function (input, isInner) {
|
|
2729
2591
|
// (recursive, max 4 levels)
|
|
2730
2592
|
if (!input) {
|
|
2731
2593
|
return "";
|
|
2732
2594
|
}
|
|
2733
|
-
|
|
2734
2595
|
var res = "";
|
|
2735
2596
|
var cee = false;
|
|
2736
|
-
|
|
2737
2597
|
for (var i = 0; i < input.length; i++) {
|
|
2738
2598
|
var inputi = input[i];
|
|
2739
|
-
|
|
2740
2599
|
if (typeof inputi === "string") {
|
|
2741
2600
|
res += inputi;
|
|
2742
2601
|
} else {
|
|
2743
2602
|
res += texify._go2(inputi);
|
|
2744
|
-
|
|
2745
2603
|
if (inputi.type_ === '1st-level escape') {
|
|
2746
2604
|
cee = true;
|
|
2747
2605
|
}
|
|
2748
2606
|
}
|
|
2749
2607
|
}
|
|
2750
|
-
|
|
2751
2608
|
if (!isInner && !cee && res) {
|
|
2752
2609
|
res = "{" + res + "}";
|
|
2753
2610
|
}
|
|
2754
|
-
|
|
2755
2611
|
return res;
|
|
2756
2612
|
},
|
|
2757
2613
|
_goInner: function (input) {
|
|
2758
2614
|
if (!input) {
|
|
2759
2615
|
return input;
|
|
2760
2616
|
}
|
|
2761
|
-
|
|
2762
2617
|
return texify.go(input, true);
|
|
2763
2618
|
},
|
|
2764
2619
|
_go2: function (buf) {
|
|
2765
2620
|
/** @type {undefined | string} */
|
|
2766
2621
|
var res;
|
|
2767
|
-
|
|
2768
2622
|
switch (buf.type_) {
|
|
2769
2623
|
case 'chemfive':
|
|
2770
2624
|
res = "";
|
|
@@ -2775,52 +2629,45 @@ var texify = {
|
|
|
2775
2629
|
o: texify._goInner(buf.o),
|
|
2776
2630
|
q: texify._goInner(buf.q),
|
|
2777
2631
|
d: texify._goInner(buf.d)
|
|
2778
|
-
};
|
|
2632
|
+
};
|
|
2633
|
+
//
|
|
2779
2634
|
// a
|
|
2780
2635
|
//
|
|
2781
|
-
|
|
2782
2636
|
if (b5.a) {
|
|
2783
2637
|
if (b5.a.match(/^[+\-]/)) {
|
|
2784
2638
|
b5.a = "{" + b5.a + "}";
|
|
2785
2639
|
}
|
|
2786
|
-
|
|
2787
2640
|
res += b5.a + "\\,";
|
|
2788
|
-
}
|
|
2641
|
+
}
|
|
2642
|
+
//
|
|
2789
2643
|
// b and p
|
|
2790
2644
|
//
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
2645
|
if (b5.b || b5.p) {
|
|
2794
2646
|
res += "{\\vphantom{X}}";
|
|
2795
2647
|
res += "^{\\hphantom{" + (b5.b || "") + "}}_{\\hphantom{" + (b5.p || "") + "}}";
|
|
2796
2648
|
res += "{\\vphantom{X}}";
|
|
2797
2649
|
res += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (b5.b || "") + "}}";
|
|
2798
2650
|
res += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (b5.p || "") + "}}}";
|
|
2799
|
-
}
|
|
2651
|
+
}
|
|
2652
|
+
//
|
|
2800
2653
|
// o
|
|
2801
2654
|
//
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
2655
|
if (b5.o) {
|
|
2805
2656
|
if (b5.o.match(/^[+\-]/)) {
|
|
2806
2657
|
b5.o = "{" + b5.o + "}";
|
|
2807
2658
|
}
|
|
2808
|
-
|
|
2809
2659
|
res += b5.o;
|
|
2810
|
-
}
|
|
2660
|
+
}
|
|
2661
|
+
//
|
|
2811
2662
|
// q and d
|
|
2812
2663
|
//
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
2664
|
if (buf.dType === 'kv') {
|
|
2816
2665
|
if (b5.d || b5.q) {
|
|
2817
2666
|
res += "{\\vphantom{X}}";
|
|
2818
2667
|
}
|
|
2819
|
-
|
|
2820
2668
|
if (b5.d) {
|
|
2821
2669
|
res += "^{" + b5.d + "}";
|
|
2822
2670
|
}
|
|
2823
|
-
|
|
2824
2671
|
if (b5.q) {
|
|
2825
2672
|
res += "_{\\smash[t]{" + b5.q + "}}";
|
|
2826
2673
|
}
|
|
@@ -2829,7 +2676,6 @@ var texify = {
|
|
|
2829
2676
|
res += "{\\vphantom{X}}";
|
|
2830
2677
|
res += "^{" + b5.d + "}";
|
|
2831
2678
|
}
|
|
2832
|
-
|
|
2833
2679
|
if (b5.q) {
|
|
2834
2680
|
res += "{\\vphantom{X}}";
|
|
2835
2681
|
res += "_{\\smash[t]{" + b5.q + "}}";
|
|
@@ -2839,19 +2685,15 @@ var texify = {
|
|
|
2839
2685
|
res += "{\\vphantom{X}}";
|
|
2840
2686
|
res += "_{\\smash[t]{" + b5.q + "}}";
|
|
2841
2687
|
}
|
|
2842
|
-
|
|
2843
2688
|
if (b5.d) {
|
|
2844
2689
|
res += "{\\vphantom{X}}";
|
|
2845
2690
|
res += "^{" + b5.d + "}";
|
|
2846
2691
|
}
|
|
2847
2692
|
}
|
|
2848
|
-
|
|
2849
2693
|
break;
|
|
2850
|
-
|
|
2851
2694
|
case 'rm':
|
|
2852
2695
|
res = "\\mathrm{" + buf.p1 + "}";
|
|
2853
2696
|
break;
|
|
2854
|
-
|
|
2855
2697
|
case 'text':
|
|
2856
2698
|
if (buf.p1.match(/[\^_]/)) {
|
|
2857
2699
|
buf.p1 = buf.p1.replace(" ", "~").replace("-", "\\text{-}");
|
|
@@ -2859,196 +2701,147 @@ var texify = {
|
|
|
2859
2701
|
} else {
|
|
2860
2702
|
res = "\\text{" + buf.p1 + "}";
|
|
2861
2703
|
}
|
|
2862
|
-
|
|
2863
2704
|
break;
|
|
2864
|
-
|
|
2865
2705
|
case 'roman numeral':
|
|
2866
2706
|
res = "\\mathrm{" + buf.p1 + "}";
|
|
2867
2707
|
break;
|
|
2868
|
-
|
|
2869
2708
|
case 'state of aggregation':
|
|
2870
2709
|
res = "\\mskip2mu " + texify._goInner(buf.p1);
|
|
2871
2710
|
break;
|
|
2872
|
-
|
|
2873
2711
|
case 'state of aggregation subscript':
|
|
2874
2712
|
res = "\\mskip1mu " + texify._goInner(buf.p1);
|
|
2875
2713
|
break;
|
|
2876
|
-
|
|
2877
2714
|
case 'bond':
|
|
2878
2715
|
res = texify._getBond(buf.kind_);
|
|
2879
|
-
|
|
2880
2716
|
if (!res) {
|
|
2881
2717
|
throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + buf.kind_ + ")"];
|
|
2882
2718
|
}
|
|
2883
|
-
|
|
2884
2719
|
break;
|
|
2885
|
-
|
|
2886
2720
|
case 'frac':
|
|
2887
2721
|
var c = "\\frac{" + buf.p1 + "}{" + buf.p2 + "}";
|
|
2888
2722
|
res = "\\mathchoice{\\textstyle" + c + "}{" + c + "}{" + c + "}{" + c + "}";
|
|
2889
2723
|
break;
|
|
2890
|
-
|
|
2891
2724
|
case 'pu-frac':
|
|
2892
2725
|
var d = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
|
|
2893
2726
|
res = "\\mathchoice{\\textstyle" + d + "}{" + d + "}{" + d + "}{" + d + "}";
|
|
2894
2727
|
break;
|
|
2895
|
-
|
|
2896
2728
|
case 'tex-math':
|
|
2897
2729
|
res = buf.p1 + " ";
|
|
2898
2730
|
break;
|
|
2899
|
-
|
|
2900
2731
|
case 'frac-ce':
|
|
2901
2732
|
res = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
|
|
2902
2733
|
break;
|
|
2903
|
-
|
|
2904
2734
|
case 'overset':
|
|
2905
2735
|
res = "\\overset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
|
|
2906
2736
|
break;
|
|
2907
|
-
|
|
2908
2737
|
case 'underset':
|
|
2909
2738
|
res = "\\underset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
|
|
2910
2739
|
break;
|
|
2911
|
-
|
|
2912
2740
|
case 'underbrace':
|
|
2913
2741
|
res = "\\underbrace{" + texify._goInner(buf.p1) + "}_{" + texify._goInner(buf.p2) + "}";
|
|
2914
2742
|
break;
|
|
2915
|
-
|
|
2916
2743
|
case 'color':
|
|
2917
2744
|
res = "{\\color{" + buf.color1 + "}{" + texify._goInner(buf.color2) + "}}";
|
|
2918
2745
|
break;
|
|
2919
|
-
|
|
2920
2746
|
case 'color0':
|
|
2921
2747
|
res = "\\color{" + buf.color + "}";
|
|
2922
2748
|
break;
|
|
2923
|
-
|
|
2924
2749
|
case 'arrow':
|
|
2925
2750
|
var b6 = {
|
|
2926
2751
|
rd: texify._goInner(buf.rd),
|
|
2927
2752
|
rq: texify._goInner(buf.rq)
|
|
2928
2753
|
};
|
|
2929
|
-
|
|
2930
2754
|
var arrow = "\\x" + texify._getArrow(buf.r);
|
|
2931
|
-
|
|
2932
2755
|
if (b6.rq) {
|
|
2933
2756
|
arrow += "[{" + b6.rq + "}]";
|
|
2934
2757
|
}
|
|
2935
|
-
|
|
2936
2758
|
if (b6.rd) {
|
|
2937
2759
|
arrow += "{" + b6.rd + "}";
|
|
2938
2760
|
} else {
|
|
2939
2761
|
arrow += "{}";
|
|
2940
2762
|
}
|
|
2941
|
-
|
|
2942
2763
|
res = arrow;
|
|
2943
2764
|
break;
|
|
2944
|
-
|
|
2945
2765
|
case 'operator':
|
|
2946
2766
|
res = texify._getOperator(buf.kind_);
|
|
2947
2767
|
break;
|
|
2948
|
-
|
|
2949
2768
|
case '1st-level escape':
|
|
2950
2769
|
res = buf.p1 + " "; // &, \\\\, \\hlin
|
|
2951
|
-
|
|
2952
2770
|
break;
|
|
2953
|
-
|
|
2954
2771
|
case 'space':
|
|
2955
2772
|
res = " ";
|
|
2956
2773
|
break;
|
|
2957
|
-
|
|
2958
2774
|
case 'entitySkip':
|
|
2959
2775
|
res = "~";
|
|
2960
2776
|
break;
|
|
2961
|
-
|
|
2962
2777
|
case 'pu-space-1':
|
|
2963
2778
|
res = "~";
|
|
2964
2779
|
break;
|
|
2965
|
-
|
|
2966
2780
|
case 'pu-space-2':
|
|
2967
2781
|
res = "\\mkern3mu ";
|
|
2968
2782
|
break;
|
|
2969
|
-
|
|
2970
2783
|
case '1000 separator':
|
|
2971
2784
|
res = "\\mkern2mu ";
|
|
2972
2785
|
break;
|
|
2973
|
-
|
|
2974
2786
|
case 'commaDecimal':
|
|
2975
2787
|
res = "{,}";
|
|
2976
2788
|
break;
|
|
2977
|
-
|
|
2978
2789
|
case 'comma enumeration L':
|
|
2979
2790
|
res = "{" + buf.p1 + "}\\mkern6mu ";
|
|
2980
2791
|
break;
|
|
2981
|
-
|
|
2982
2792
|
case 'comma enumeration M':
|
|
2983
2793
|
res = "{" + buf.p1 + "}\\mkern3mu ";
|
|
2984
2794
|
break;
|
|
2985
|
-
|
|
2986
2795
|
case 'comma enumeration S':
|
|
2987
2796
|
res = "{" + buf.p1 + "}\\mkern1mu ";
|
|
2988
2797
|
break;
|
|
2989
|
-
|
|
2990
2798
|
case 'hyphen':
|
|
2991
2799
|
res = "\\text{-}";
|
|
2992
2800
|
break;
|
|
2993
|
-
|
|
2994
2801
|
case 'addition compound':
|
|
2995
2802
|
res = "\\,{\\cdot}\\,";
|
|
2996
2803
|
break;
|
|
2997
|
-
|
|
2998
2804
|
case 'electron dot':
|
|
2999
2805
|
res = "\\mkern1mu \\bullet\\mkern1mu ";
|
|
3000
2806
|
break;
|
|
3001
|
-
|
|
3002
2807
|
case 'KV x':
|
|
3003
2808
|
res = "{\\times}";
|
|
3004
2809
|
break;
|
|
3005
|
-
|
|
3006
2810
|
case 'prime':
|
|
3007
2811
|
res = "\\prime ";
|
|
3008
2812
|
break;
|
|
3009
|
-
|
|
3010
2813
|
case 'cdot':
|
|
3011
2814
|
res = "\\cdot ";
|
|
3012
2815
|
break;
|
|
3013
|
-
|
|
3014
2816
|
case 'tight cdot':
|
|
3015
2817
|
res = "\\mkern1mu{\\cdot}\\mkern1mu ";
|
|
3016
2818
|
break;
|
|
3017
|
-
|
|
3018
2819
|
case 'times':
|
|
3019
2820
|
res = "\\times ";
|
|
3020
2821
|
break;
|
|
3021
|
-
|
|
3022
2822
|
case 'circa':
|
|
3023
2823
|
res = "{\\sim}";
|
|
3024
2824
|
break;
|
|
3025
|
-
|
|
3026
2825
|
case '^':
|
|
3027
2826
|
res = "uparrow";
|
|
3028
2827
|
break;
|
|
3029
|
-
|
|
3030
2828
|
case 'v':
|
|
3031
2829
|
res = "downarrow";
|
|
3032
2830
|
break;
|
|
3033
|
-
|
|
3034
2831
|
case 'ellipsis':
|
|
3035
2832
|
res = "\\ldots ";
|
|
3036
2833
|
break;
|
|
3037
|
-
|
|
3038
2834
|
case '/':
|
|
3039
2835
|
res = "/";
|
|
3040
2836
|
break;
|
|
3041
|
-
|
|
3042
2837
|
case ' / ':
|
|
3043
2838
|
res = "\\,/\\,";
|
|
3044
2839
|
break;
|
|
3045
|
-
|
|
3046
2840
|
default:
|
|
3047
2841
|
assertNever(buf);
|
|
3048
2842
|
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
3049
2843
|
// Missing texify rule or unknown MhchemParser output
|
|
3050
2844
|
}
|
|
3051
|
-
|
|
3052
2845
|
assertString(res);
|
|
3053
2846
|
return res;
|
|
3054
2847
|
},
|
|
@@ -3056,34 +2849,24 @@ var texify = {
|
|
|
3056
2849
|
switch (a) {
|
|
3057
2850
|
case "->":
|
|
3058
2851
|
return "rightarrow";
|
|
3059
|
-
|
|
3060
2852
|
case "\u2192":
|
|
3061
2853
|
return "rightarrow";
|
|
3062
|
-
|
|
3063
2854
|
case "\u27F6":
|
|
3064
2855
|
return "rightarrow";
|
|
3065
|
-
|
|
3066
2856
|
case "<-":
|
|
3067
2857
|
return "leftarrow";
|
|
3068
|
-
|
|
3069
2858
|
case "<->":
|
|
3070
2859
|
return "leftrightarrow";
|
|
3071
|
-
|
|
3072
2860
|
case "<-->":
|
|
3073
2861
|
return "rightleftarrows";
|
|
3074
|
-
|
|
3075
2862
|
case "<=>":
|
|
3076
2863
|
return "rightleftharpoons";
|
|
3077
|
-
|
|
3078
2864
|
case "\u21CC":
|
|
3079
2865
|
return "rightleftharpoons";
|
|
3080
|
-
|
|
3081
2866
|
case "<=>>":
|
|
3082
2867
|
return "rightequilibrium";
|
|
3083
|
-
|
|
3084
2868
|
case "<<=>":
|
|
3085
2869
|
return "leftequilibrium";
|
|
3086
|
-
|
|
3087
2870
|
default:
|
|
3088
2871
|
assertNever(a);
|
|
3089
2872
|
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
@@ -3093,55 +2876,38 @@ var texify = {
|
|
|
3093
2876
|
switch (a) {
|
|
3094
2877
|
case "-":
|
|
3095
2878
|
return "{-}";
|
|
3096
|
-
|
|
3097
2879
|
case "1":
|
|
3098
2880
|
return "{-}";
|
|
3099
|
-
|
|
3100
2881
|
case "=":
|
|
3101
2882
|
return "{=}";
|
|
3102
|
-
|
|
3103
2883
|
case "2":
|
|
3104
2884
|
return "{=}";
|
|
3105
|
-
|
|
3106
2885
|
case "#":
|
|
3107
2886
|
return "{\\equiv}";
|
|
3108
|
-
|
|
3109
2887
|
case "3":
|
|
3110
2888
|
return "{\\equiv}";
|
|
3111
|
-
|
|
3112
2889
|
case "~":
|
|
3113
2890
|
return "{\\tripledash}";
|
|
3114
|
-
|
|
3115
2891
|
case "~-":
|
|
3116
2892
|
return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
|
|
3117
|
-
|
|
3118
2893
|
case "~=":
|
|
3119
2894
|
return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
|
|
3120
|
-
|
|
3121
2895
|
case "~--":
|
|
3122
2896
|
return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
|
|
3123
|
-
|
|
3124
2897
|
case "-~-":
|
|
3125
2898
|
return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
|
|
3126
|
-
|
|
3127
2899
|
case "...":
|
|
3128
2900
|
return "{{\\cdot}{\\cdot}{\\cdot}}";
|
|
3129
|
-
|
|
3130
2901
|
case "....":
|
|
3131
2902
|
return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
|
|
3132
|
-
|
|
3133
2903
|
case "->":
|
|
3134
2904
|
return "{\\rightarrow}";
|
|
3135
|
-
|
|
3136
2905
|
case "<-":
|
|
3137
2906
|
return "{\\leftarrow}";
|
|
3138
|
-
|
|
3139
2907
|
case "<":
|
|
3140
2908
|
return "{<}";
|
|
3141
|
-
|
|
3142
2909
|
case ">":
|
|
3143
2910
|
return "{>}";
|
|
3144
|
-
|
|
3145
2911
|
default:
|
|
3146
2912
|
assertNever(a);
|
|
3147
2913
|
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
@@ -3151,64 +2917,47 @@ var texify = {
|
|
|
3151
2917
|
switch (a) {
|
|
3152
2918
|
case "+":
|
|
3153
2919
|
return " {}+{} ";
|
|
3154
|
-
|
|
3155
2920
|
case "-":
|
|
3156
2921
|
return " {}-{} ";
|
|
3157
|
-
|
|
3158
2922
|
case "=":
|
|
3159
2923
|
return " {}={} ";
|
|
3160
|
-
|
|
3161
2924
|
case "<":
|
|
3162
2925
|
return " {}<{} ";
|
|
3163
|
-
|
|
3164
2926
|
case ">":
|
|
3165
2927
|
return " {}>{} ";
|
|
3166
|
-
|
|
3167
2928
|
case "<<":
|
|
3168
2929
|
return " {}\\ll{} ";
|
|
3169
|
-
|
|
3170
2930
|
case ">>":
|
|
3171
2931
|
return " {}\\gg{} ";
|
|
3172
|
-
|
|
3173
2932
|
case "\\pm":
|
|
3174
2933
|
return " {}\\pm{} ";
|
|
3175
|
-
|
|
3176
2934
|
case "\\approx":
|
|
3177
2935
|
return " {}\\approx{} ";
|
|
3178
|
-
|
|
3179
2936
|
case "$\\approx$":
|
|
3180
2937
|
return " {}\\approx{} ";
|
|
3181
|
-
|
|
3182
2938
|
case "v":
|
|
3183
2939
|
return " \\downarrow{} ";
|
|
3184
|
-
|
|
3185
2940
|
case "(v)":
|
|
3186
2941
|
return " \\downarrow{} ";
|
|
3187
|
-
|
|
3188
2942
|
case "^":
|
|
3189
2943
|
return " \\uparrow{} ";
|
|
3190
|
-
|
|
3191
2944
|
case "(^)":
|
|
3192
2945
|
return " \\uparrow{} ";
|
|
3193
|
-
|
|
3194
2946
|
default:
|
|
3195
2947
|
assertNever(a);
|
|
3196
2948
|
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
3197
2949
|
}
|
|
3198
2950
|
}
|
|
3199
|
-
};
|
|
2951
|
+
};
|
|
2952
|
+
|
|
2953
|
+
//
|
|
3200
2954
|
// Helpers for code analysis
|
|
3201
2955
|
// Will show type error at calling position
|
|
3202
2956
|
//
|
|
3203
|
-
|
|
3204
2957
|
/** @param {number} a */
|
|
3205
|
-
|
|
3206
2958
|
function assertNever(a) {}
|
|
3207
2959
|
/** @param {string} a */
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
2960
|
function assertString(a) {}
|
|
3211
|
-
}();
|
|
3212
2961
|
__webpack_exports__ = __webpack_exports__["default"];
|
|
3213
2962
|
/******/ return __webpack_exports__;
|
|
3214
2963
|
/******/ })()
|