@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
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import katex from '../katex.mjs';
|
|
2
2
|
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
|
|
5
4
|
/* -*- Mode: JavaScript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
|
|
6
|
-
|
|
7
5
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
8
6
|
|
|
9
7
|
/*************************************************************
|
|
@@ -46,24 +44,29 @@ import katex from '../katex.mjs';
|
|
|
46
44
|
* See the License for the specific language governing permissions and
|
|
47
45
|
* limitations under the License.
|
|
48
46
|
*/
|
|
47
|
+
|
|
49
48
|
//
|
|
50
49
|
// Coding Style
|
|
51
50
|
// - use '' for identifiers that can by minified/uglified
|
|
52
51
|
// - use "" for strings that need to stay untouched
|
|
52
|
+
|
|
53
53
|
// version: "3.3.0" for MathJax and KaTeX
|
|
54
|
+
|
|
54
55
|
// Add \ce, \pu, and \tripledash to the KaTeX macros.
|
|
56
|
+
|
|
55
57
|
katex.__defineMacro("\\ce", function (context) {
|
|
56
58
|
return chemParse(context.consumeArgs(1)[0], "ce");
|
|
57
59
|
});
|
|
58
|
-
|
|
59
60
|
katex.__defineMacro("\\pu", function (context) {
|
|
60
61
|
return chemParse(context.consumeArgs(1)[0], "pu");
|
|
61
|
-
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Needed for \bond for the ~ forms
|
|
62
65
|
// Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not
|
|
63
66
|
// a mathematical minus, U+2212. So we need that extra 0.56.
|
|
64
|
-
|
|
65
|
-
|
|
66
67
|
katex.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
|
|
68
|
+
|
|
69
|
+
//
|
|
67
70
|
// This is the main function for handing the \ce and \pu commands.
|
|
68
71
|
// It takes the argument to \ce or \pu and returns the corresponding TeX string.
|
|
69
72
|
//
|
|
@@ -72,27 +75,23 @@ var chemParse = function chemParse(tokens, stateMachine) {
|
|
|
72
75
|
// Recreate the argument string from KaTeX's array of tokens.
|
|
73
76
|
var str = "";
|
|
74
77
|
var expectedLoc = tokens.length && tokens[tokens.length - 1].loc.start;
|
|
75
|
-
|
|
76
78
|
for (var i = tokens.length - 1; i >= 0; i--) {
|
|
77
79
|
if (tokens[i].loc.start > expectedLoc) {
|
|
78
80
|
// context.consumeArgs has eaten a space.
|
|
79
81
|
str += " ";
|
|
80
82
|
expectedLoc = tokens[i].loc.start;
|
|
81
83
|
}
|
|
82
|
-
|
|
83
84
|
str += tokens[i].text;
|
|
84
85
|
expectedLoc += tokens[i].text.length;
|
|
85
86
|
}
|
|
86
|
-
|
|
87
87
|
var tex = texify.go(mhchemParser.go(str, stateMachine));
|
|
88
88
|
return tex;
|
|
89
|
-
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
//
|
|
90
92
|
// Core parser for mhchem syntax (recursive)
|
|
91
93
|
//
|
|
92
|
-
|
|
93
94
|
/** @type {MhchemParser} */
|
|
94
|
-
|
|
95
|
-
|
|
96
95
|
var mhchemParser = {
|
|
97
96
|
//
|
|
98
97
|
// Parses mchem \ce syntax
|
|
@@ -104,12 +103,12 @@ var mhchemParser = {
|
|
|
104
103
|
if (!input) {
|
|
105
104
|
return [];
|
|
106
105
|
}
|
|
107
|
-
|
|
108
106
|
if (stateMachine === undefined) {
|
|
109
107
|
stateMachine = 'ce';
|
|
110
108
|
}
|
|
109
|
+
var state = '0';
|
|
111
110
|
|
|
112
|
-
|
|
111
|
+
//
|
|
113
112
|
// String buffers for parsing:
|
|
114
113
|
//
|
|
115
114
|
// buffer.a == amount
|
|
@@ -142,79 +141,68 @@ var mhchemParser = {
|
|
|
142
141
|
// 3 == next atom
|
|
143
142
|
// c == macro
|
|
144
143
|
//
|
|
145
|
-
|
|
146
144
|
/** @type {Buffer} */
|
|
147
|
-
|
|
148
145
|
var buffer = {};
|
|
149
146
|
buffer['parenthesisLevel'] = 0;
|
|
150
147
|
input = input.replace(/\n/g, " ");
|
|
151
148
|
input = input.replace(/[\u2212\u2013\u2014\u2010]/g, "-");
|
|
152
|
-
input = input.replace(/[\u2026]/g, "...");
|
|
149
|
+
input = input.replace(/[\u2026]/g, "...");
|
|
150
|
+
|
|
151
|
+
//
|
|
153
152
|
// Looks through mhchemParser.transitions, to execute a matching action
|
|
154
153
|
// (recursive)
|
|
155
154
|
//
|
|
156
|
-
|
|
157
155
|
var lastInput;
|
|
158
156
|
var watchdog = 10;
|
|
159
157
|
/** @type {ParserOutput[]} */
|
|
160
|
-
|
|
161
158
|
var output = [];
|
|
162
|
-
|
|
163
159
|
while (true) {
|
|
164
160
|
if (lastInput !== input) {
|
|
165
161
|
watchdog = 10;
|
|
166
162
|
lastInput = input;
|
|
167
163
|
} else {
|
|
168
164
|
watchdog--;
|
|
169
|
-
}
|
|
165
|
+
}
|
|
166
|
+
//
|
|
170
167
|
// Find actions in transition table
|
|
171
168
|
//
|
|
172
|
-
|
|
173
|
-
|
|
174
169
|
var machine = mhchemParser.stateMachines[stateMachine];
|
|
175
170
|
var t = machine.transitions[state] || machine.transitions['*'];
|
|
176
|
-
|
|
177
171
|
iterateTransitions: for (var i = 0; i < t.length; i++) {
|
|
178
172
|
var matches = mhchemParser.patterns.match_(t[i].pattern, input);
|
|
179
|
-
|
|
180
173
|
if (matches) {
|
|
181
174
|
//
|
|
182
175
|
// Execute actions
|
|
183
176
|
//
|
|
184
177
|
var task = t[i].task;
|
|
185
|
-
|
|
186
178
|
for (var iA = 0; iA < task.action_.length; iA++) {
|
|
187
|
-
var o;
|
|
179
|
+
var o;
|
|
180
|
+
//
|
|
188
181
|
// Find and execute action
|
|
189
182
|
//
|
|
190
|
-
|
|
191
183
|
if (machine.actions[task.action_[iA].type_]) {
|
|
192
184
|
o = machine.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
|
|
193
185
|
} else if (mhchemParser.actions[task.action_[iA].type_]) {
|
|
194
186
|
o = mhchemParser.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
|
|
195
187
|
} else {
|
|
196
188
|
throw ["MhchemBugA", "mhchem bug A. Please report. (" + task.action_[iA].type_ + ")"]; // Trying to use non-existing action
|
|
197
|
-
}
|
|
189
|
+
}
|
|
190
|
+
//
|
|
198
191
|
// Add output
|
|
199
192
|
//
|
|
200
|
-
|
|
201
|
-
|
|
202
193
|
mhchemParser.concatArray(output, o);
|
|
203
|
-
}
|
|
194
|
+
}
|
|
195
|
+
//
|
|
204
196
|
// Set next state,
|
|
205
197
|
// Shorten input,
|
|
206
198
|
// Continue with next character
|
|
207
199
|
// (= apply only one transition per position)
|
|
208
200
|
//
|
|
209
|
-
|
|
210
|
-
|
|
211
201
|
state = task.nextState || state;
|
|
212
|
-
|
|
213
202
|
if (input.length > 0) {
|
|
214
203
|
if (!task.revisit) {
|
|
215
204
|
input = matches.remainder;
|
|
216
205
|
}
|
|
217
|
-
|
|
218
206
|
if (!task.toContinue) {
|
|
219
207
|
break iterateTransitions;
|
|
220
208
|
}
|
|
@@ -222,11 +210,10 @@ var mhchemParser = {
|
|
|
222
210
|
return output;
|
|
223
211
|
}
|
|
224
212
|
}
|
|
225
|
-
}
|
|
213
|
+
}
|
|
214
|
+
//
|
|
226
215
|
// Prevent infinite loop
|
|
227
216
|
//
|
|
228
|
-
|
|
229
|
-
|
|
230
217
|
if (watchdog <= 0) {
|
|
231
218
|
throw ["MhchemBugU", "mhchem bug U. Please report."]; // Unexpected character
|
|
232
219
|
}
|
|
@@ -270,46 +257,37 @@ var mhchemParser = {
|
|
|
270
257
|
'-9.,9 no missing 0': /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
|
|
271
258
|
'(-)(9.,9)(e)(99)': function e99(input) {
|
|
272
259
|
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]+\}))?/);
|
|
273
|
-
|
|
274
260
|
if (m && m[0]) {
|
|
275
261
|
return {
|
|
276
262
|
match_: m.splice(1),
|
|
277
263
|
remainder: input.substr(m[0].length)
|
|
278
264
|
};
|
|
279
265
|
}
|
|
280
|
-
|
|
281
266
|
return null;
|
|
282
267
|
},
|
|
283
268
|
'(-)(9)^(-9)': function _(input) {
|
|
284
269
|
var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
|
|
285
|
-
|
|
286
270
|
if (m && m[0]) {
|
|
287
271
|
return {
|
|
288
272
|
match_: m.splice(1),
|
|
289
273
|
remainder: input.substr(m[0].length)
|
|
290
274
|
};
|
|
291
275
|
}
|
|
292
|
-
|
|
293
276
|
return null;
|
|
294
277
|
},
|
|
295
|
-
'state of aggregation $': function
|
|
278
|
+
'state of aggregation $': function state_of_aggregation_$(input) {
|
|
296
279
|
// ... or crystal system
|
|
297
280
|
var a = mhchemParser.patterns.findObserveGroups(input, "", /^\([a-z]{1,3}(?=[\),])/, ")", ""); // (aq), (aq,$\infty$), (aq, sat)
|
|
298
|
-
|
|
299
281
|
if (a && a.remainder.match(/^($|[\s,;\)\]\}])/)) {
|
|
300
282
|
return a;
|
|
301
283
|
} // AND end of 'phrase'
|
|
302
|
-
|
|
303
|
-
|
|
304
284
|
var m = input.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/); // OR crystal system ($o$) (\ca$c$)
|
|
305
|
-
|
|
306
285
|
if (m) {
|
|
307
286
|
return {
|
|
308
287
|
match_: m[0],
|
|
309
288
|
remainder: input.substr(m[0].length)
|
|
310
289
|
};
|
|
311
290
|
}
|
|
312
|
-
|
|
313
291
|
return null;
|
|
314
292
|
},
|
|
315
293
|
'_{(state of aggregation)}$': /^_\{(\([a-z]{1,3}\))\}/,
|
|
@@ -431,23 +409,19 @@ var mhchemParser = {
|
|
|
431
409
|
'roman numeral': /^[IVX]+/,
|
|
432
410
|
'1/2$': /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
|
|
433
411
|
'amount': function amount(input) {
|
|
434
|
-
var match;
|
|
435
|
-
|
|
412
|
+
var match;
|
|
413
|
+
// e.g. 2, 0.5, 1/2, -2, n/2, +; $a$ could be added later in parsing
|
|
436
414
|
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))/);
|
|
437
|
-
|
|
438
415
|
if (match) {
|
|
439
416
|
return {
|
|
440
417
|
match_: match[0],
|
|
441
418
|
remainder: input.substr(match[0].length)
|
|
442
419
|
};
|
|
443
420
|
}
|
|
444
|
-
|
|
445
421
|
var a = mhchemParser.patterns.findObserveGroups(input, "", "$", "$", "");
|
|
446
|
-
|
|
447
422
|
if (a) {
|
|
448
423
|
// e.g. $2n-1$, $-$
|
|
449
424
|
match = a.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/);
|
|
450
|
-
|
|
451
425
|
if (match) {
|
|
452
426
|
return {
|
|
453
427
|
match_: match[0],
|
|
@@ -455,7 +429,6 @@ var mhchemParser = {
|
|
|
455
429
|
};
|
|
456
430
|
}
|
|
457
431
|
}
|
|
458
|
-
|
|
459
432
|
return null;
|
|
460
433
|
},
|
|
461
434
|
'amount2': function amount2(input) {
|
|
@@ -466,17 +439,13 @@ var mhchemParser = {
|
|
|
466
439
|
if (input.match(/^\([a-z]+\)$/)) {
|
|
467
440
|
return null;
|
|
468
441
|
} // state of aggregation = no formula
|
|
469
|
-
|
|
470
|
-
|
|
471
442
|
var match = input.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
|
|
472
|
-
|
|
473
443
|
if (match) {
|
|
474
444
|
return {
|
|
475
445
|
match_: match[0],
|
|
476
446
|
remainder: input.substr(match[0].length)
|
|
477
447
|
};
|
|
478
448
|
}
|
|
479
|
-
|
|
480
449
|
return null;
|
|
481
450
|
},
|
|
482
451
|
'uprightEntities': /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,
|
|
@@ -491,29 +460,21 @@ var mhchemParser = {
|
|
|
491
460
|
if (input.indexOf(pattern) !== 0) {
|
|
492
461
|
return null;
|
|
493
462
|
}
|
|
494
|
-
|
|
495
463
|
return pattern;
|
|
496
464
|
} else {
|
|
497
465
|
var match = input.match(pattern);
|
|
498
|
-
|
|
499
466
|
if (!match) {
|
|
500
467
|
return null;
|
|
501
468
|
}
|
|
502
|
-
|
|
503
469
|
return match[0];
|
|
504
470
|
}
|
|
505
471
|
};
|
|
506
472
|
/** @type {{(input: string, i: number, endChars: string | RegExp): {endMatchBegin: number, endMatchEnd: number} | null;}} */
|
|
507
|
-
|
|
508
|
-
|
|
509
473
|
var _findObserveGroups = function _findObserveGroups(input, i, endChars) {
|
|
510
474
|
var braces = 0;
|
|
511
|
-
|
|
512
475
|
while (i < input.length) {
|
|
513
476
|
var a = input.charAt(i);
|
|
514
|
-
|
|
515
477
|
var match = _match(input.substr(i), endChars);
|
|
516
|
-
|
|
517
478
|
if (match !== null && braces === 0) {
|
|
518
479
|
return {
|
|
519
480
|
endMatchBegin: i,
|
|
@@ -528,38 +489,27 @@ var mhchemParser = {
|
|
|
528
489
|
braces--;
|
|
529
490
|
}
|
|
530
491
|
}
|
|
531
|
-
|
|
532
492
|
i++;
|
|
533
493
|
}
|
|
534
|
-
|
|
535
494
|
if (braces > 0) {
|
|
536
495
|
return null;
|
|
537
496
|
}
|
|
538
|
-
|
|
539
497
|
return null;
|
|
540
498
|
};
|
|
541
|
-
|
|
542
499
|
var match = _match(input, begExcl);
|
|
543
|
-
|
|
544
500
|
if (match === null) {
|
|
545
501
|
return null;
|
|
546
502
|
}
|
|
547
|
-
|
|
548
503
|
input = input.substr(match.length);
|
|
549
504
|
match = _match(input, begIncl);
|
|
550
|
-
|
|
551
505
|
if (match === null) {
|
|
552
506
|
return null;
|
|
553
507
|
}
|
|
554
|
-
|
|
555
508
|
var e = _findObserveGroups(input, match.length, endIncl || endExcl);
|
|
556
|
-
|
|
557
509
|
if (e === null) {
|
|
558
510
|
return null;
|
|
559
511
|
}
|
|
560
|
-
|
|
561
512
|
var match1 = input.substring(0, endIncl ? e.endMatchEnd : e.endMatchBegin);
|
|
562
|
-
|
|
563
513
|
if (!(beg2Excl || beg2Incl)) {
|
|
564
514
|
return {
|
|
565
515
|
match_: match1,
|
|
@@ -567,13 +517,10 @@ var mhchemParser = {
|
|
|
567
517
|
};
|
|
568
518
|
} else {
|
|
569
519
|
var group2 = this.findObserveGroups(input.substr(e.endMatchEnd), beg2Excl, beg2Incl, end2Incl, end2Excl);
|
|
570
|
-
|
|
571
520
|
if (group2 === null) {
|
|
572
521
|
return null;
|
|
573
522
|
}
|
|
574
523
|
/** @type {string[]} */
|
|
575
|
-
|
|
576
|
-
|
|
577
524
|
var matchRet = [match1, group2.match_];
|
|
578
525
|
return {
|
|
579
526
|
match_: combine ? matchRet.join("") : matchRet,
|
|
@@ -588,7 +535,6 @@ var mhchemParser = {
|
|
|
588
535
|
//
|
|
589
536
|
match_: function match_(m, input) {
|
|
590
537
|
var pattern = mhchemParser.patterns.patterns[m];
|
|
591
|
-
|
|
592
538
|
if (pattern === undefined) {
|
|
593
539
|
throw ["MhchemBugP", "mhchem bug P. Please report. (" + m + ")"]; // Trying to use non-existing pattern
|
|
594
540
|
} else if (typeof pattern === "function") {
|
|
@@ -596,10 +542,8 @@ var mhchemParser = {
|
|
|
596
542
|
} else {
|
|
597
543
|
// RegExp
|
|
598
544
|
var match = input.match(pattern);
|
|
599
|
-
|
|
600
545
|
if (match) {
|
|
601
546
|
var mm;
|
|
602
|
-
|
|
603
547
|
if (match[2]) {
|
|
604
548
|
mm = [match[1], match[2]];
|
|
605
549
|
} else if (match[1]) {
|
|
@@ -607,13 +551,11 @@ var mhchemParser = {
|
|
|
607
551
|
} else {
|
|
608
552
|
mm = match[0];
|
|
609
553
|
}
|
|
610
|
-
|
|
611
554
|
return {
|
|
612
555
|
match_: mm,
|
|
613
556
|
remainder: input.substr(match[0].length)
|
|
614
557
|
};
|
|
615
558
|
}
|
|
616
|
-
|
|
617
559
|
return null;
|
|
618
560
|
}
|
|
619
561
|
}
|
|
@@ -685,7 +627,7 @@ var mhchemParser = {
|
|
|
685
627
|
'tex-math': function texMath(buffer, m) {
|
|
686
628
|
return mhchemParser.go(m, 'tex-math');
|
|
687
629
|
},
|
|
688
|
-
'tex-math tight': function
|
|
630
|
+
'tex-math tight': function texMath_tight(buffer, m) {
|
|
689
631
|
return mhchemParser.go(m, 'tex-math tight');
|
|
690
632
|
},
|
|
691
633
|
'bond': function bond(buffer, m, k) {
|
|
@@ -703,15 +645,13 @@ var mhchemParser = {
|
|
|
703
645
|
'ce': function ce(buffer, m) {
|
|
704
646
|
return mhchemParser.go(m);
|
|
705
647
|
},
|
|
706
|
-
'1/2': function
|
|
648
|
+
'1/2': function _2(buffer, m) {
|
|
707
649
|
/** @type {ParserOutput[]} */
|
|
708
650
|
var ret = [];
|
|
709
|
-
|
|
710
651
|
if (m.match(/^[+\-]/)) {
|
|
711
652
|
ret.push(m.substr(0, 1));
|
|
712
653
|
m = m.substr(1);
|
|
713
654
|
}
|
|
714
|
-
|
|
715
655
|
var n = m.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
|
|
716
656
|
n[1] = n[1].replace(/\$/g, "");
|
|
717
657
|
ret.push({
|
|
@@ -719,7 +659,6 @@ var mhchemParser = {
|
|
|
719
659
|
p1: n[1],
|
|
720
660
|
p2: n[2]
|
|
721
661
|
});
|
|
722
|
-
|
|
723
662
|
if (n[3]) {
|
|
724
663
|
n[3] = n[3].replace(/\$/g, "");
|
|
725
664
|
ret.push({
|
|
@@ -727,7 +666,6 @@ var mhchemParser = {
|
|
|
727
666
|
p1: n[3]
|
|
728
667
|
});
|
|
729
668
|
}
|
|
730
|
-
|
|
731
669
|
return ret;
|
|
732
670
|
},
|
|
733
671
|
'9,9': function _(buffer, m) {
|
|
@@ -742,46 +680,37 @@ var mhchemParser = {
|
|
|
742
680
|
createTransitions: function createTransitions(o) {
|
|
743
681
|
var pattern, state;
|
|
744
682
|
/** @type {string[]} */
|
|
745
|
-
|
|
746
683
|
var stateArray;
|
|
747
|
-
var i;
|
|
684
|
+
var i;
|
|
685
|
+
//
|
|
748
686
|
// 1. Collect all states
|
|
749
687
|
//
|
|
750
|
-
|
|
751
688
|
/** @type {Transitions} */
|
|
752
|
-
|
|
753
689
|
var transitions = {};
|
|
754
|
-
|
|
755
690
|
for (pattern in o) {
|
|
756
691
|
for (state in o[pattern]) {
|
|
757
692
|
stateArray = state.split("|");
|
|
758
693
|
o[pattern][state].stateArray = stateArray;
|
|
759
|
-
|
|
760
694
|
for (i = 0; i < stateArray.length; i++) {
|
|
761
695
|
transitions[stateArray[i]] = [];
|
|
762
696
|
}
|
|
763
697
|
}
|
|
764
|
-
}
|
|
698
|
+
}
|
|
699
|
+
//
|
|
765
700
|
// 2. Fill states
|
|
766
701
|
//
|
|
767
|
-
|
|
768
|
-
|
|
769
702
|
for (pattern in o) {
|
|
770
703
|
for (state in o[pattern]) {
|
|
771
704
|
stateArray = o[pattern][state].stateArray || [];
|
|
772
|
-
|
|
773
705
|
for (i = 0; i < stateArray.length; i++) {
|
|
774
706
|
//
|
|
775
707
|
// 2a. Normalize actions into array: 'text=' ==> [{type_:'text='}]
|
|
776
708
|
// (Note to myself: Resolving the function here would be problematic. It would need .bind (for *this*) and currying (for *option*).)
|
|
777
709
|
//
|
|
778
|
-
|
|
779
710
|
/** @type {any} */
|
|
780
711
|
var p = o[pattern][state];
|
|
781
|
-
|
|
782
712
|
if (p.action_) {
|
|
783
713
|
p.action_ = [].concat(p.action_);
|
|
784
|
-
|
|
785
714
|
for (var k = 0; k < p.action_.length; k++) {
|
|
786
715
|
if (typeof p.action_[k] === "string") {
|
|
787
716
|
p.action_[k] = {
|
|
@@ -791,13 +720,11 @@ var mhchemParser = {
|
|
|
791
720
|
}
|
|
792
721
|
} else {
|
|
793
722
|
p.action_ = [];
|
|
794
|
-
}
|
|
723
|
+
}
|
|
724
|
+
//
|
|
795
725
|
// 2.b Multi-insert
|
|
796
726
|
//
|
|
797
|
-
|
|
798
|
-
|
|
799
727
|
var patternArray = pattern.split("|");
|
|
800
|
-
|
|
801
728
|
for (var j = 0; j < patternArray.length; j++) {
|
|
802
729
|
if (stateArray[i] === '*') {
|
|
803
730
|
// insert into all
|
|
@@ -817,14 +744,14 @@ var mhchemParser = {
|
|
|
817
744
|
}
|
|
818
745
|
}
|
|
819
746
|
}
|
|
820
|
-
|
|
821
747
|
return transitions;
|
|
822
748
|
},
|
|
823
749
|
stateMachines: {}
|
|
824
|
-
};
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
//
|
|
825
753
|
// Definition of state machines
|
|
826
754
|
//
|
|
827
|
-
|
|
828
755
|
mhchemParser.stateMachines = {
|
|
829
756
|
//
|
|
830
757
|
// \ce state machines
|
|
@@ -1470,9 +1397,8 @@ mhchemParser.stateMachines = {
|
|
|
1470
1397
|
}
|
|
1471
1398
|
}),
|
|
1472
1399
|
actions: {
|
|
1473
|
-
'o after d': function
|
|
1400
|
+
'o after d': function o_after_d(buffer, m) {
|
|
1474
1401
|
var ret;
|
|
1475
|
-
|
|
1476
1402
|
if ((buffer.d || "").match(/^[0-9]+$/)) {
|
|
1477
1403
|
var tmp = buffer.d;
|
|
1478
1404
|
buffer.d = undefined;
|
|
@@ -1481,15 +1407,14 @@ mhchemParser.stateMachines = {
|
|
|
1481
1407
|
} else {
|
|
1482
1408
|
ret = this['output'](buffer);
|
|
1483
1409
|
}
|
|
1484
|
-
|
|
1485
1410
|
mhchemParser.actions['o='](buffer, m);
|
|
1486
1411
|
return ret;
|
|
1487
1412
|
},
|
|
1488
|
-
'd= kv': function
|
|
1413
|
+
'd= kv': function d_kv(buffer, m) {
|
|
1489
1414
|
buffer.d = m;
|
|
1490
1415
|
buffer.dType = 'kv';
|
|
1491
1416
|
},
|
|
1492
|
-
'charge or bond': function
|
|
1417
|
+
'charge or bond': function charge_or_bond(buffer, m) {
|
|
1493
1418
|
if (buffer['beginsWithBond']) {
|
|
1494
1419
|
/** @type {ParserOutput[]} */
|
|
1495
1420
|
var ret = [];
|
|
@@ -1500,21 +1425,17 @@ mhchemParser.stateMachines = {
|
|
|
1500
1425
|
buffer.d = m;
|
|
1501
1426
|
}
|
|
1502
1427
|
},
|
|
1503
|
-
'- after o/d': function
|
|
1428
|
+
'- after o/d': function _after_o_d(buffer, m, isAfterD) {
|
|
1504
1429
|
var c1 = mhchemParser.patterns.match_('orbital', buffer.o || "");
|
|
1505
1430
|
var c2 = mhchemParser.patterns.match_('one lowercase greek letter $', buffer.o || "");
|
|
1506
1431
|
var c3 = mhchemParser.patterns.match_('one lowercase latin letter $', buffer.o || "");
|
|
1507
1432
|
var c4 = mhchemParser.patterns.match_('$one lowercase latin letter$ $', buffer.o || "");
|
|
1508
1433
|
var hyphenFollows = m === "-" && (c1 && c1.remainder === "" || c2 || c3 || c4);
|
|
1509
|
-
|
|
1510
1434
|
if (hyphenFollows && !buffer.a && !buffer.b && !buffer.p && !buffer.d && !buffer.q && !c1 && c3) {
|
|
1511
1435
|
buffer.o = '$' + buffer.o + '$';
|
|
1512
1436
|
}
|
|
1513
1437
|
/** @type {ParserOutput[]} */
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
1438
|
var ret = [];
|
|
1517
|
-
|
|
1518
1439
|
if (hyphenFollows) {
|
|
1519
1440
|
mhchemParser.concatArray(ret, this['output'](buffer));
|
|
1520
1441
|
ret.push({
|
|
@@ -1522,7 +1443,6 @@ mhchemParser.stateMachines = {
|
|
|
1522
1443
|
});
|
|
1523
1444
|
} else {
|
|
1524
1445
|
c1 = mhchemParser.patterns.match_('digits', buffer.d || "");
|
|
1525
|
-
|
|
1526
1446
|
if (isAfterD && c1 && c1.remainder === '') {
|
|
1527
1447
|
mhchemParser.concatArray(ret, mhchemParser.actions['d='](buffer, m));
|
|
1528
1448
|
mhchemParser.concatArray(ret, this['output'](buffer));
|
|
@@ -1531,10 +1451,9 @@ mhchemParser.stateMachines = {
|
|
|
1531
1451
|
mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-"));
|
|
1532
1452
|
}
|
|
1533
1453
|
}
|
|
1534
|
-
|
|
1535
1454
|
return ret;
|
|
1536
1455
|
},
|
|
1537
|
-
'a to o': function
|
|
1456
|
+
'a to o': function a_to_o(buffer) {
|
|
1538
1457
|
buffer.o = buffer.a;
|
|
1539
1458
|
buffer.a = undefined;
|
|
1540
1459
|
},
|
|
@@ -1556,7 +1475,7 @@ mhchemParser.stateMachines = {
|
|
|
1556
1475
|
'parenthesisLevel--': function parenthesisLevel(buffer) {
|
|
1557
1476
|
buffer['parenthesisLevel']--;
|
|
1558
1477
|
},
|
|
1559
|
-
'state of aggregation': function
|
|
1478
|
+
'state of aggregation': function state_of_aggregation(buffer, m) {
|
|
1560
1479
|
return {
|
|
1561
1480
|
type_: 'state of aggregation',
|
|
1562
1481
|
p1: mhchemParser.go(m, 'o')
|
|
@@ -1565,7 +1484,6 @@ mhchemParser.stateMachines = {
|
|
|
1565
1484
|
'comma': function comma(buffer, m) {
|
|
1566
1485
|
var a = m.replace(/\s*$/, '');
|
|
1567
1486
|
var withSpace = a !== m;
|
|
1568
|
-
|
|
1569
1487
|
if (withSpace && buffer['parenthesisLevel'] === 0) {
|
|
1570
1488
|
return {
|
|
1571
1489
|
type_: 'comma enumeration L',
|
|
@@ -1583,20 +1501,16 @@ mhchemParser.stateMachines = {
|
|
|
1583
1501
|
// undefined = if we have nothing else to output, also ignore the just read space (buffer.sb)
|
|
1584
1502
|
// 1 = an entity follows, never omit the space if there was one just read before (can only apply to state 1)
|
|
1585
1503
|
// 2 = 1 + the entity can have an amount, so output a\, instead of converting it to o (can only apply to states a|as)
|
|
1586
|
-
|
|
1587
1504
|
/** @type {ParserOutput | ParserOutput[]} */
|
|
1588
1505
|
var ret;
|
|
1589
|
-
|
|
1590
1506
|
if (!buffer.r) {
|
|
1591
1507
|
ret = [];
|
|
1592
|
-
|
|
1593
1508
|
if (!buffer.a && !buffer.b && !buffer.p && !buffer.o && !buffer.q && !buffer.d && !entityFollows) ; else {
|
|
1594
1509
|
if (buffer.sb) {
|
|
1595
1510
|
ret.push({
|
|
1596
1511
|
type_: 'entitySkip'
|
|
1597
1512
|
});
|
|
1598
1513
|
}
|
|
1599
|
-
|
|
1600
1514
|
if (!buffer.o && !buffer.q && !buffer.d && !buffer.b && !buffer.p && entityFollows !== 2) {
|
|
1601
1515
|
buffer.o = buffer.a;
|
|
1602
1516
|
buffer.a = undefined;
|
|
@@ -1612,7 +1526,6 @@ mhchemParser.stateMachines = {
|
|
|
1612
1526
|
buffer.dType = undefined;
|
|
1613
1527
|
}
|
|
1614
1528
|
}
|
|
1615
|
-
|
|
1616
1529
|
ret.push({
|
|
1617
1530
|
type_: 'chemfive',
|
|
1618
1531
|
a: mhchemParser.go(buffer.a, 'a'),
|
|
@@ -1626,10 +1539,8 @@ mhchemParser.stateMachines = {
|
|
|
1626
1539
|
}
|
|
1627
1540
|
} else {
|
|
1628
1541
|
// r
|
|
1629
|
-
|
|
1630
1542
|
/** @type {ParserOutput[]} */
|
|
1631
1543
|
var rd;
|
|
1632
|
-
|
|
1633
1544
|
if (buffer.rdt === 'M') {
|
|
1634
1545
|
rd = mhchemParser.go(buffer.rd, 'tex-math');
|
|
1635
1546
|
} else if (buffer.rdt === 'T') {
|
|
@@ -1641,10 +1552,7 @@ mhchemParser.stateMachines = {
|
|
|
1641
1552
|
rd = mhchemParser.go(buffer.rd);
|
|
1642
1553
|
}
|
|
1643
1554
|
/** @type {ParserOutput[]} */
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
1555
|
var rq;
|
|
1647
|
-
|
|
1648
1556
|
if (buffer.rqt === 'M') {
|
|
1649
1557
|
rq = mhchemParser.go(buffer.rq, 'tex-math');
|
|
1650
1558
|
} else if (buffer.rqt === 'T') {
|
|
@@ -1655,7 +1563,6 @@ mhchemParser.stateMachines = {
|
|
|
1655
1563
|
} else {
|
|
1656
1564
|
rq = mhchemParser.go(buffer.rq);
|
|
1657
1565
|
}
|
|
1658
|
-
|
|
1659
1566
|
ret = {
|
|
1660
1567
|
type_: 'arrow',
|
|
1661
1568
|
r: buffer.r,
|
|
@@ -1663,13 +1570,11 @@ mhchemParser.stateMachines = {
|
|
|
1663
1570
|
rq: rq
|
|
1664
1571
|
};
|
|
1665
1572
|
}
|
|
1666
|
-
|
|
1667
1573
|
for (var p in buffer) {
|
|
1668
1574
|
if (p !== 'parenthesisLevel' && p !== 'beginsWithBond') {
|
|
1669
1575
|
delete buffer[p];
|
|
1670
1576
|
}
|
|
1671
1577
|
}
|
|
1672
|
-
|
|
1673
1578
|
return ret;
|
|
1674
1579
|
},
|
|
1675
1580
|
'oxidation-output': function oxidationOutput(buffer, m) {
|
|
@@ -1867,11 +1772,9 @@ mhchemParser.stateMachines = {
|
|
|
1867
1772
|
type_: 'text',
|
|
1868
1773
|
p1: buffer.text_
|
|
1869
1774
|
};
|
|
1870
|
-
|
|
1871
1775
|
for (var p in buffer) {
|
|
1872
1776
|
delete buffer[p];
|
|
1873
1777
|
}
|
|
1874
|
-
|
|
1875
1778
|
return ret;
|
|
1876
1779
|
}
|
|
1877
1780
|
}
|
|
@@ -1976,7 +1879,7 @@ mhchemParser.stateMachines = {
|
|
|
1976
1879
|
}
|
|
1977
1880
|
}),
|
|
1978
1881
|
actions: {
|
|
1979
|
-
'state of aggregation': function
|
|
1882
|
+
'state of aggregation': function state_of_aggregation(buffer, m) {
|
|
1980
1883
|
return {
|
|
1981
1884
|
type_: 'state of aggregation subscript',
|
|
1982
1885
|
p1: mhchemParser.go(m, 'o')
|
|
@@ -2160,11 +2063,9 @@ mhchemParser.stateMachines = {
|
|
|
2160
2063
|
type_: 'tex-math',
|
|
2161
2064
|
p1: buffer.o
|
|
2162
2065
|
};
|
|
2163
|
-
|
|
2164
2066
|
for (var p in buffer) {
|
|
2165
2067
|
delete buffer[p];
|
|
2166
2068
|
}
|
|
2167
|
-
|
|
2168
2069
|
return ret;
|
|
2169
2070
|
}
|
|
2170
2071
|
}
|
|
@@ -2199,7 +2100,7 @@ mhchemParser.stateMachines = {
|
|
|
2199
2100
|
}
|
|
2200
2101
|
}),
|
|
2201
2102
|
actions: {
|
|
2202
|
-
'tight operator': function
|
|
2103
|
+
'tight operator': function tight_operator(buffer, m) {
|
|
2203
2104
|
buffer.o = (buffer.o || "") + "{" + m + "}";
|
|
2204
2105
|
},
|
|
2205
2106
|
'output': function output(buffer) {
|
|
@@ -2209,11 +2110,9 @@ mhchemParser.stateMachines = {
|
|
|
2209
2110
|
type_: 'tex-math',
|
|
2210
2111
|
p1: buffer.o
|
|
2211
2112
|
};
|
|
2212
|
-
|
|
2213
2113
|
for (var p in buffer) {
|
|
2214
2114
|
delete buffer[p];
|
|
2215
2115
|
}
|
|
2216
|
-
|
|
2217
2116
|
return ret;
|
|
2218
2117
|
}
|
|
2219
2118
|
}
|
|
@@ -2326,16 +2225,13 @@ mhchemParser.stateMachines = {
|
|
|
2326
2225
|
'enumber': function enumber(buffer, m) {
|
|
2327
2226
|
/** @type {ParserOutput[]} */
|
|
2328
2227
|
var ret = [];
|
|
2329
|
-
|
|
2330
2228
|
if (m[0] === "+-" || m[0] === "+/-") {
|
|
2331
2229
|
ret.push("\\pm ");
|
|
2332
2230
|
} else if (m[0]) {
|
|
2333
2231
|
ret.push(m[0]);
|
|
2334
2232
|
}
|
|
2335
|
-
|
|
2336
2233
|
if (m[1]) {
|
|
2337
2234
|
mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9'));
|
|
2338
|
-
|
|
2339
2235
|
if (m[2]) {
|
|
2340
2236
|
if (m[2].match(/[,.]/)) {
|
|
2341
2237
|
mhchemParser.concatArray(ret, mhchemParser.go(m[2], 'pu-9,9'));
|
|
@@ -2343,12 +2239,9 @@ mhchemParser.stateMachines = {
|
|
|
2343
2239
|
ret.push(m[2]);
|
|
2344
2240
|
}
|
|
2345
2241
|
}
|
|
2346
|
-
|
|
2347
2242
|
m[3] = m[4] || m[3];
|
|
2348
|
-
|
|
2349
2243
|
if (m[3]) {
|
|
2350
2244
|
m[3] = m[3].trim();
|
|
2351
|
-
|
|
2352
2245
|
if (m[3] === "e" || m[3].substr(0, 1) === "*") {
|
|
2353
2246
|
ret.push({
|
|
2354
2247
|
type_: 'cdot'
|
|
@@ -2360,23 +2253,19 @@ mhchemParser.stateMachines = {
|
|
|
2360
2253
|
}
|
|
2361
2254
|
}
|
|
2362
2255
|
}
|
|
2363
|
-
|
|
2364
2256
|
if (m[3]) {
|
|
2365
2257
|
ret.push("10^{" + m[5] + "}");
|
|
2366
2258
|
}
|
|
2367
|
-
|
|
2368
2259
|
return ret;
|
|
2369
2260
|
},
|
|
2370
2261
|
'number^': function number(buffer, m) {
|
|
2371
2262
|
/** @type {ParserOutput[]} */
|
|
2372
2263
|
var ret = [];
|
|
2373
|
-
|
|
2374
2264
|
if (m[0] === "+-" || m[0] === "+/-") {
|
|
2375
2265
|
ret.push("\\pm ");
|
|
2376
2266
|
} else if (m[0]) {
|
|
2377
2267
|
ret.push(m[0]);
|
|
2378
2268
|
}
|
|
2379
|
-
|
|
2380
2269
|
mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9'));
|
|
2381
2270
|
ret.push("^{" + m[2] + "}");
|
|
2382
2271
|
return ret;
|
|
@@ -2396,22 +2285,17 @@ mhchemParser.stateMachines = {
|
|
|
2396
2285
|
/** @type {ParserOutput | ParserOutput[]} */
|
|
2397
2286
|
var ret;
|
|
2398
2287
|
var md = mhchemParser.patterns.match_('{(...)}', buffer.d || "");
|
|
2399
|
-
|
|
2400
2288
|
if (md && md.remainder === '') {
|
|
2401
2289
|
buffer.d = md.match_;
|
|
2402
2290
|
}
|
|
2403
|
-
|
|
2404
2291
|
var mq = mhchemParser.patterns.match_('{(...)}', buffer.q || "");
|
|
2405
|
-
|
|
2406
2292
|
if (mq && mq.remainder === '') {
|
|
2407
2293
|
buffer.q = mq.match_;
|
|
2408
2294
|
}
|
|
2409
|
-
|
|
2410
2295
|
if (buffer.d) {
|
|
2411
2296
|
buffer.d = buffer.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C");
|
|
2412
2297
|
buffer.d = buffer.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
|
|
2413
2298
|
}
|
|
2414
|
-
|
|
2415
2299
|
if (buffer.q) {
|
|
2416
2300
|
// fraction
|
|
2417
2301
|
buffer.q = buffer.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C");
|
|
@@ -2420,7 +2304,6 @@ mhchemParser.stateMachines = {
|
|
|
2420
2304
|
d: mhchemParser.go(buffer.d, 'pu'),
|
|
2421
2305
|
q: mhchemParser.go(buffer.q, 'pu')
|
|
2422
2306
|
};
|
|
2423
|
-
|
|
2424
2307
|
if (buffer.o === '//') {
|
|
2425
2308
|
ret = {
|
|
2426
2309
|
type_: 'pu-frac',
|
|
@@ -2429,7 +2312,6 @@ mhchemParser.stateMachines = {
|
|
|
2429
2312
|
};
|
|
2430
2313
|
} else {
|
|
2431
2314
|
ret = b5.d;
|
|
2432
|
-
|
|
2433
2315
|
if (b5.d.length > 1 || b5.q.length > 1) {
|
|
2434
2316
|
ret.push({
|
|
2435
2317
|
type_: ' / '
|
|
@@ -2439,18 +2321,15 @@ mhchemParser.stateMachines = {
|
|
|
2439
2321
|
type_: '/'
|
|
2440
2322
|
});
|
|
2441
2323
|
}
|
|
2442
|
-
|
|
2443
2324
|
mhchemParser.concatArray(ret, b5.q);
|
|
2444
2325
|
}
|
|
2445
2326
|
} else {
|
|
2446
2327
|
// no fraction
|
|
2447
2328
|
ret = mhchemParser.go(buffer.d, 'pu-2');
|
|
2448
2329
|
}
|
|
2449
|
-
|
|
2450
2330
|
for (var p in buffer) {
|
|
2451
2331
|
delete buffer[p];
|
|
2452
2332
|
}
|
|
2453
|
-
|
|
2454
2333
|
return ret;
|
|
2455
2334
|
}
|
|
2456
2335
|
}
|
|
@@ -2518,10 +2397,8 @@ mhchemParser.stateMachines = {
|
|
|
2518
2397
|
'output': function output(buffer) {
|
|
2519
2398
|
/** @type {ParserOutput | ParserOutput[]} */
|
|
2520
2399
|
var ret = [];
|
|
2521
|
-
|
|
2522
2400
|
if (buffer.rm) {
|
|
2523
2401
|
var mrm = mhchemParser.patterns.match_('{(...)}', buffer.rm || "");
|
|
2524
|
-
|
|
2525
2402
|
if (mrm && mrm.remainder === '') {
|
|
2526
2403
|
ret = mhchemParser.go(mrm.match_, 'pu');
|
|
2527
2404
|
} else {
|
|
@@ -2531,11 +2408,9 @@ mhchemParser.stateMachines = {
|
|
|
2531
2408
|
};
|
|
2532
2409
|
}
|
|
2533
2410
|
}
|
|
2534
|
-
|
|
2535
2411
|
for (var p in buffer) {
|
|
2536
2412
|
delete buffer[p];
|
|
2537
2413
|
}
|
|
2538
|
-
|
|
2539
2414
|
return ret;
|
|
2540
2415
|
}
|
|
2541
2416
|
}
|
|
@@ -2578,109 +2453,90 @@ mhchemParser.stateMachines = {
|
|
|
2578
2453
|
/** @type {ParserOutput[]} */
|
|
2579
2454
|
var ret = [];
|
|
2580
2455
|
buffer.text_ = buffer.text_ || "";
|
|
2581
|
-
|
|
2582
2456
|
if (buffer.text_.length > 4) {
|
|
2583
2457
|
var a = buffer.text_.length % 3;
|
|
2584
|
-
|
|
2585
2458
|
if (a === 0) {
|
|
2586
2459
|
a = 3;
|
|
2587
2460
|
}
|
|
2588
|
-
|
|
2589
2461
|
for (var i = buffer.text_.length - 3; i > 0; i -= 3) {
|
|
2590
2462
|
ret.push(buffer.text_.substr(i, 3));
|
|
2591
2463
|
ret.push({
|
|
2592
2464
|
type_: '1000 separator'
|
|
2593
2465
|
});
|
|
2594
2466
|
}
|
|
2595
|
-
|
|
2596
2467
|
ret.push(buffer.text_.substr(0, a));
|
|
2597
2468
|
ret.reverse();
|
|
2598
2469
|
} else {
|
|
2599
2470
|
ret.push(buffer.text_);
|
|
2600
2471
|
}
|
|
2601
|
-
|
|
2602
2472
|
for (var p in buffer) {
|
|
2603
2473
|
delete buffer[p];
|
|
2604
2474
|
}
|
|
2605
|
-
|
|
2606
2475
|
return ret;
|
|
2607
2476
|
},
|
|
2608
2477
|
'output-o': function outputO(buffer) {
|
|
2609
2478
|
/** @type {ParserOutput[]} */
|
|
2610
2479
|
var ret = [];
|
|
2611
2480
|
buffer.text_ = buffer.text_ || "";
|
|
2612
|
-
|
|
2613
2481
|
if (buffer.text_.length > 4) {
|
|
2614
2482
|
var a = buffer.text_.length - 3;
|
|
2615
|
-
|
|
2616
2483
|
for (var i = 0; i < a; i += 3) {
|
|
2617
2484
|
ret.push(buffer.text_.substr(i, 3));
|
|
2618
2485
|
ret.push({
|
|
2619
2486
|
type_: '1000 separator'
|
|
2620
2487
|
});
|
|
2621
2488
|
}
|
|
2622
|
-
|
|
2623
2489
|
ret.push(buffer.text_.substr(i));
|
|
2624
2490
|
} else {
|
|
2625
2491
|
ret.push(buffer.text_);
|
|
2626
2492
|
}
|
|
2627
|
-
|
|
2628
2493
|
for (var p in buffer) {
|
|
2629
2494
|
delete buffer[p];
|
|
2630
2495
|
}
|
|
2631
|
-
|
|
2632
2496
|
return ret;
|
|
2633
2497
|
}
|
|
2634
2498
|
}
|
|
2635
|
-
}
|
|
2499
|
+
}
|
|
2500
|
+
//#endregion
|
|
2501
|
+
};
|
|
2636
2502
|
|
|
2637
|
-
|
|
2503
|
+
//
|
|
2638
2504
|
// texify: Take MhchemParser output and convert it to TeX
|
|
2639
2505
|
//
|
|
2640
|
-
|
|
2641
2506
|
/** @type {Texify} */
|
|
2642
|
-
|
|
2643
2507
|
var texify = {
|
|
2644
2508
|
go: function go(input, isInner) {
|
|
2645
2509
|
// (recursive, max 4 levels)
|
|
2646
2510
|
if (!input) {
|
|
2647
2511
|
return "";
|
|
2648
2512
|
}
|
|
2649
|
-
|
|
2650
2513
|
var res = "";
|
|
2651
2514
|
var cee = false;
|
|
2652
|
-
|
|
2653
2515
|
for (var i = 0; i < input.length; i++) {
|
|
2654
2516
|
var inputi = input[i];
|
|
2655
|
-
|
|
2656
2517
|
if (typeof inputi === "string") {
|
|
2657
2518
|
res += inputi;
|
|
2658
2519
|
} else {
|
|
2659
2520
|
res += texify._go2(inputi);
|
|
2660
|
-
|
|
2661
2521
|
if (inputi.type_ === '1st-level escape') {
|
|
2662
2522
|
cee = true;
|
|
2663
2523
|
}
|
|
2664
2524
|
}
|
|
2665
2525
|
}
|
|
2666
|
-
|
|
2667
2526
|
if (!isInner && !cee && res) {
|
|
2668
2527
|
res = "{" + res + "}";
|
|
2669
2528
|
}
|
|
2670
|
-
|
|
2671
2529
|
return res;
|
|
2672
2530
|
},
|
|
2673
2531
|
_goInner: function _goInner(input) {
|
|
2674
2532
|
if (!input) {
|
|
2675
2533
|
return input;
|
|
2676
2534
|
}
|
|
2677
|
-
|
|
2678
2535
|
return texify.go(input, true);
|
|
2679
2536
|
},
|
|
2680
2537
|
_go2: function _go2(buf) {
|
|
2681
2538
|
/** @type {undefined | string} */
|
|
2682
2539
|
var res;
|
|
2683
|
-
|
|
2684
2540
|
switch (buf.type_) {
|
|
2685
2541
|
case 'chemfive':
|
|
2686
2542
|
res = "";
|
|
@@ -2691,52 +2547,45 @@ var texify = {
|
|
|
2691
2547
|
o: texify._goInner(buf.o),
|
|
2692
2548
|
q: texify._goInner(buf.q),
|
|
2693
2549
|
d: texify._goInner(buf.d)
|
|
2694
|
-
};
|
|
2550
|
+
};
|
|
2551
|
+
//
|
|
2695
2552
|
// a
|
|
2696
2553
|
//
|
|
2697
|
-
|
|
2698
2554
|
if (b5.a) {
|
|
2699
2555
|
if (b5.a.match(/^[+\-]/)) {
|
|
2700
2556
|
b5.a = "{" + b5.a + "}";
|
|
2701
2557
|
}
|
|
2702
|
-
|
|
2703
2558
|
res += b5.a + "\\,";
|
|
2704
|
-
}
|
|
2559
|
+
}
|
|
2560
|
+
//
|
|
2705
2561
|
// b and p
|
|
2706
2562
|
//
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
2563
|
if (b5.b || b5.p) {
|
|
2710
2564
|
res += "{\\vphantom{X}}";
|
|
2711
2565
|
res += "^{\\hphantom{" + (b5.b || "") + "}}_{\\hphantom{" + (b5.p || "") + "}}";
|
|
2712
2566
|
res += "{\\vphantom{X}}";
|
|
2713
2567
|
res += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (b5.b || "") + "}}";
|
|
2714
2568
|
res += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (b5.p || "") + "}}}";
|
|
2715
|
-
}
|
|
2569
|
+
}
|
|
2570
|
+
//
|
|
2716
2571
|
// o
|
|
2717
2572
|
//
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
2573
|
if (b5.o) {
|
|
2721
2574
|
if (b5.o.match(/^[+\-]/)) {
|
|
2722
2575
|
b5.o = "{" + b5.o + "}";
|
|
2723
2576
|
}
|
|
2724
|
-
|
|
2725
2577
|
res += b5.o;
|
|
2726
|
-
}
|
|
2578
|
+
}
|
|
2579
|
+
//
|
|
2727
2580
|
// q and d
|
|
2728
2581
|
//
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
2582
|
if (buf.dType === 'kv') {
|
|
2732
2583
|
if (b5.d || b5.q) {
|
|
2733
2584
|
res += "{\\vphantom{X}}";
|
|
2734
2585
|
}
|
|
2735
|
-
|
|
2736
2586
|
if (b5.d) {
|
|
2737
2587
|
res += "^{" + b5.d + "}";
|
|
2738
2588
|
}
|
|
2739
|
-
|
|
2740
2589
|
if (b5.q) {
|
|
2741
2590
|
res += "_{\\smash[t]{" + b5.q + "}}";
|
|
2742
2591
|
}
|
|
@@ -2745,7 +2594,6 @@ var texify = {
|
|
|
2745
2594
|
res += "{\\vphantom{X}}";
|
|
2746
2595
|
res += "^{" + b5.d + "}";
|
|
2747
2596
|
}
|
|
2748
|
-
|
|
2749
2597
|
if (b5.q) {
|
|
2750
2598
|
res += "{\\vphantom{X}}";
|
|
2751
2599
|
res += "_{\\smash[t]{" + b5.q + "}}";
|
|
@@ -2755,19 +2603,15 @@ var texify = {
|
|
|
2755
2603
|
res += "{\\vphantom{X}}";
|
|
2756
2604
|
res += "_{\\smash[t]{" + b5.q + "}}";
|
|
2757
2605
|
}
|
|
2758
|
-
|
|
2759
2606
|
if (b5.d) {
|
|
2760
2607
|
res += "{\\vphantom{X}}";
|
|
2761
2608
|
res += "^{" + b5.d + "}";
|
|
2762
2609
|
}
|
|
2763
2610
|
}
|
|
2764
|
-
|
|
2765
2611
|
break;
|
|
2766
|
-
|
|
2767
2612
|
case 'rm':
|
|
2768
2613
|
res = "\\mathrm{" + buf.p1 + "}";
|
|
2769
2614
|
break;
|
|
2770
|
-
|
|
2771
2615
|
case 'text':
|
|
2772
2616
|
if (buf.p1.match(/[\^_]/)) {
|
|
2773
2617
|
buf.p1 = buf.p1.replace(" ", "~").replace("-", "\\text{-}");
|
|
@@ -2775,190 +2619,142 @@ var texify = {
|
|
|
2775
2619
|
} else {
|
|
2776
2620
|
res = "\\text{" + buf.p1 + "}";
|
|
2777
2621
|
}
|
|
2778
|
-
|
|
2779
2622
|
break;
|
|
2780
|
-
|
|
2781
2623
|
case 'roman numeral':
|
|
2782
2624
|
res = "\\mathrm{" + buf.p1 + "}";
|
|
2783
2625
|
break;
|
|
2784
|
-
|
|
2785
2626
|
case 'state of aggregation':
|
|
2786
2627
|
res = "\\mskip2mu " + texify._goInner(buf.p1);
|
|
2787
2628
|
break;
|
|
2788
|
-
|
|
2789
2629
|
case 'state of aggregation subscript':
|
|
2790
2630
|
res = "\\mskip1mu " + texify._goInner(buf.p1);
|
|
2791
2631
|
break;
|
|
2792
|
-
|
|
2793
2632
|
case 'bond':
|
|
2794
2633
|
res = texify._getBond(buf.kind_);
|
|
2795
|
-
|
|
2796
2634
|
if (!res) {
|
|
2797
2635
|
throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + buf.kind_ + ")"];
|
|
2798
2636
|
}
|
|
2799
|
-
|
|
2800
2637
|
break;
|
|
2801
|
-
|
|
2802
2638
|
case 'frac':
|
|
2803
2639
|
var c = "\\frac{" + buf.p1 + "}{" + buf.p2 + "}";
|
|
2804
2640
|
res = "\\mathchoice{\\textstyle" + c + "}{" + c + "}{" + c + "}{" + c + "}";
|
|
2805
2641
|
break;
|
|
2806
|
-
|
|
2807
2642
|
case 'pu-frac':
|
|
2808
2643
|
var d = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
|
|
2809
2644
|
res = "\\mathchoice{\\textstyle" + d + "}{" + d + "}{" + d + "}{" + d + "}";
|
|
2810
2645
|
break;
|
|
2811
|
-
|
|
2812
2646
|
case 'tex-math':
|
|
2813
2647
|
res = buf.p1 + " ";
|
|
2814
2648
|
break;
|
|
2815
|
-
|
|
2816
2649
|
case 'frac-ce':
|
|
2817
2650
|
res = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
|
|
2818
2651
|
break;
|
|
2819
|
-
|
|
2820
2652
|
case 'overset':
|
|
2821
2653
|
res = "\\overset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
|
|
2822
2654
|
break;
|
|
2823
|
-
|
|
2824
2655
|
case 'underset':
|
|
2825
2656
|
res = "\\underset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
|
|
2826
2657
|
break;
|
|
2827
|
-
|
|
2828
2658
|
case 'underbrace':
|
|
2829
2659
|
res = "\\underbrace{" + texify._goInner(buf.p1) + "}_{" + texify._goInner(buf.p2) + "}";
|
|
2830
2660
|
break;
|
|
2831
|
-
|
|
2832
2661
|
case 'color':
|
|
2833
2662
|
res = "{\\color{" + buf.color1 + "}{" + texify._goInner(buf.color2) + "}}";
|
|
2834
2663
|
break;
|
|
2835
|
-
|
|
2836
2664
|
case 'color0':
|
|
2837
2665
|
res = "\\color{" + buf.color + "}";
|
|
2838
2666
|
break;
|
|
2839
|
-
|
|
2840
2667
|
case 'arrow':
|
|
2841
2668
|
var b6 = {
|
|
2842
2669
|
rd: texify._goInner(buf.rd),
|
|
2843
2670
|
rq: texify._goInner(buf.rq)
|
|
2844
2671
|
};
|
|
2845
|
-
|
|
2846
2672
|
var arrow = "\\x" + texify._getArrow(buf.r);
|
|
2847
|
-
|
|
2848
2673
|
if (b6.rq) {
|
|
2849
2674
|
arrow += "[{" + b6.rq + "}]";
|
|
2850
2675
|
}
|
|
2851
|
-
|
|
2852
2676
|
if (b6.rd) {
|
|
2853
2677
|
arrow += "{" + b6.rd + "}";
|
|
2854
2678
|
} else {
|
|
2855
2679
|
arrow += "{}";
|
|
2856
2680
|
}
|
|
2857
|
-
|
|
2858
2681
|
res = arrow;
|
|
2859
2682
|
break;
|
|
2860
|
-
|
|
2861
2683
|
case 'operator':
|
|
2862
2684
|
res = texify._getOperator(buf.kind_);
|
|
2863
2685
|
break;
|
|
2864
|
-
|
|
2865
2686
|
case '1st-level escape':
|
|
2866
2687
|
res = buf.p1 + " "; // &, \\\\, \\hlin
|
|
2867
|
-
|
|
2868
2688
|
break;
|
|
2869
|
-
|
|
2870
2689
|
case 'space':
|
|
2871
2690
|
res = " ";
|
|
2872
2691
|
break;
|
|
2873
|
-
|
|
2874
2692
|
case 'entitySkip':
|
|
2875
2693
|
res = "~";
|
|
2876
2694
|
break;
|
|
2877
|
-
|
|
2878
2695
|
case 'pu-space-1':
|
|
2879
2696
|
res = "~";
|
|
2880
2697
|
break;
|
|
2881
|
-
|
|
2882
2698
|
case 'pu-space-2':
|
|
2883
2699
|
res = "\\mkern3mu ";
|
|
2884
2700
|
break;
|
|
2885
|
-
|
|
2886
2701
|
case '1000 separator':
|
|
2887
2702
|
res = "\\mkern2mu ";
|
|
2888
2703
|
break;
|
|
2889
|
-
|
|
2890
2704
|
case 'commaDecimal':
|
|
2891
2705
|
res = "{,}";
|
|
2892
2706
|
break;
|
|
2893
|
-
|
|
2894
2707
|
case 'comma enumeration L':
|
|
2895
2708
|
res = "{" + buf.p1 + "}\\mkern6mu ";
|
|
2896
2709
|
break;
|
|
2897
|
-
|
|
2898
2710
|
case 'comma enumeration M':
|
|
2899
2711
|
res = "{" + buf.p1 + "}\\mkern3mu ";
|
|
2900
2712
|
break;
|
|
2901
|
-
|
|
2902
2713
|
case 'comma enumeration S':
|
|
2903
2714
|
res = "{" + buf.p1 + "}\\mkern1mu ";
|
|
2904
2715
|
break;
|
|
2905
|
-
|
|
2906
2716
|
case 'hyphen':
|
|
2907
2717
|
res = "\\text{-}";
|
|
2908
2718
|
break;
|
|
2909
|
-
|
|
2910
2719
|
case 'addition compound':
|
|
2911
2720
|
res = "\\,{\\cdot}\\,";
|
|
2912
2721
|
break;
|
|
2913
|
-
|
|
2914
2722
|
case 'electron dot':
|
|
2915
2723
|
res = "\\mkern1mu \\bullet\\mkern1mu ";
|
|
2916
2724
|
break;
|
|
2917
|
-
|
|
2918
2725
|
case 'KV x':
|
|
2919
2726
|
res = "{\\times}";
|
|
2920
2727
|
break;
|
|
2921
|
-
|
|
2922
2728
|
case 'prime':
|
|
2923
2729
|
res = "\\prime ";
|
|
2924
2730
|
break;
|
|
2925
|
-
|
|
2926
2731
|
case 'cdot':
|
|
2927
2732
|
res = "\\cdot ";
|
|
2928
2733
|
break;
|
|
2929
|
-
|
|
2930
2734
|
case 'tight cdot':
|
|
2931
2735
|
res = "\\mkern1mu{\\cdot}\\mkern1mu ";
|
|
2932
2736
|
break;
|
|
2933
|
-
|
|
2934
2737
|
case 'times':
|
|
2935
2738
|
res = "\\times ";
|
|
2936
2739
|
break;
|
|
2937
|
-
|
|
2938
2740
|
case 'circa':
|
|
2939
2741
|
res = "{\\sim}";
|
|
2940
2742
|
break;
|
|
2941
|
-
|
|
2942
2743
|
case '^':
|
|
2943
2744
|
res = "uparrow";
|
|
2944
2745
|
break;
|
|
2945
|
-
|
|
2946
2746
|
case 'v':
|
|
2947
2747
|
res = "downarrow";
|
|
2948
2748
|
break;
|
|
2949
|
-
|
|
2950
2749
|
case 'ellipsis':
|
|
2951
2750
|
res = "\\ldots ";
|
|
2952
2751
|
break;
|
|
2953
|
-
|
|
2954
2752
|
case '/':
|
|
2955
2753
|
res = "/";
|
|
2956
2754
|
break;
|
|
2957
|
-
|
|
2958
2755
|
case ' / ':
|
|
2959
2756
|
res = "\\,/\\,";
|
|
2960
2757
|
break;
|
|
2961
|
-
|
|
2962
2758
|
default:
|
|
2963
2759
|
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
2964
2760
|
// Missing texify rule or unknown MhchemParser output
|
|
@@ -2969,34 +2765,24 @@ var texify = {
|
|
|
2969
2765
|
switch (a) {
|
|
2970
2766
|
case "->":
|
|
2971
2767
|
return "rightarrow";
|
|
2972
|
-
|
|
2973
2768
|
case "\u2192":
|
|
2974
2769
|
return "rightarrow";
|
|
2975
|
-
|
|
2976
2770
|
case "\u27F6":
|
|
2977
2771
|
return "rightarrow";
|
|
2978
|
-
|
|
2979
2772
|
case "<-":
|
|
2980
2773
|
return "leftarrow";
|
|
2981
|
-
|
|
2982
2774
|
case "<->":
|
|
2983
2775
|
return "leftrightarrow";
|
|
2984
|
-
|
|
2985
2776
|
case "<-->":
|
|
2986
2777
|
return "rightleftarrows";
|
|
2987
|
-
|
|
2988
2778
|
case "<=>":
|
|
2989
2779
|
return "rightleftharpoons";
|
|
2990
|
-
|
|
2991
2780
|
case "\u21CC":
|
|
2992
2781
|
return "rightleftharpoons";
|
|
2993
|
-
|
|
2994
2782
|
case "<=>>":
|
|
2995
2783
|
return "rightequilibrium";
|
|
2996
|
-
|
|
2997
2784
|
case "<<=>":
|
|
2998
2785
|
return "leftequilibrium";
|
|
2999
|
-
|
|
3000
2786
|
default:
|
|
3001
2787
|
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
3002
2788
|
}
|
|
@@ -3005,55 +2791,38 @@ var texify = {
|
|
|
3005
2791
|
switch (a) {
|
|
3006
2792
|
case "-":
|
|
3007
2793
|
return "{-}";
|
|
3008
|
-
|
|
3009
2794
|
case "1":
|
|
3010
2795
|
return "{-}";
|
|
3011
|
-
|
|
3012
2796
|
case "=":
|
|
3013
2797
|
return "{=}";
|
|
3014
|
-
|
|
3015
2798
|
case "2":
|
|
3016
2799
|
return "{=}";
|
|
3017
|
-
|
|
3018
2800
|
case "#":
|
|
3019
2801
|
return "{\\equiv}";
|
|
3020
|
-
|
|
3021
2802
|
case "3":
|
|
3022
2803
|
return "{\\equiv}";
|
|
3023
|
-
|
|
3024
2804
|
case "~":
|
|
3025
2805
|
return "{\\tripledash}";
|
|
3026
|
-
|
|
3027
2806
|
case "~-":
|
|
3028
2807
|
return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
|
|
3029
|
-
|
|
3030
2808
|
case "~=":
|
|
3031
2809
|
return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
|
|
3032
|
-
|
|
3033
2810
|
case "~--":
|
|
3034
2811
|
return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
|
|
3035
|
-
|
|
3036
2812
|
case "-~-":
|
|
3037
2813
|
return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
|
|
3038
|
-
|
|
3039
2814
|
case "...":
|
|
3040
2815
|
return "{{\\cdot}{\\cdot}{\\cdot}}";
|
|
3041
|
-
|
|
3042
2816
|
case "....":
|
|
3043
2817
|
return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
|
|
3044
|
-
|
|
3045
2818
|
case "->":
|
|
3046
2819
|
return "{\\rightarrow}";
|
|
3047
|
-
|
|
3048
2820
|
case "<-":
|
|
3049
2821
|
return "{\\leftarrow}";
|
|
3050
|
-
|
|
3051
2822
|
case "<":
|
|
3052
2823
|
return "{<}";
|
|
3053
|
-
|
|
3054
2824
|
case ">":
|
|
3055
2825
|
return "{>}";
|
|
3056
|
-
|
|
3057
2826
|
default:
|
|
3058
2827
|
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
3059
2828
|
}
|
|
@@ -3062,48 +2831,34 @@ var texify = {
|
|
|
3062
2831
|
switch (a) {
|
|
3063
2832
|
case "+":
|
|
3064
2833
|
return " {}+{} ";
|
|
3065
|
-
|
|
3066
2834
|
case "-":
|
|
3067
2835
|
return " {}-{} ";
|
|
3068
|
-
|
|
3069
2836
|
case "=":
|
|
3070
2837
|
return " {}={} ";
|
|
3071
|
-
|
|
3072
2838
|
case "<":
|
|
3073
2839
|
return " {}<{} ";
|
|
3074
|
-
|
|
3075
2840
|
case ">":
|
|
3076
2841
|
return " {}>{} ";
|
|
3077
|
-
|
|
3078
2842
|
case "<<":
|
|
3079
2843
|
return " {}\\ll{} ";
|
|
3080
|
-
|
|
3081
2844
|
case ">>":
|
|
3082
2845
|
return " {}\\gg{} ";
|
|
3083
|
-
|
|
3084
2846
|
case "\\pm":
|
|
3085
2847
|
return " {}\\pm{} ";
|
|
3086
|
-
|
|
3087
2848
|
case "\\approx":
|
|
3088
2849
|
return " {}\\approx{} ";
|
|
3089
|
-
|
|
3090
2850
|
case "$\\approx$":
|
|
3091
2851
|
return " {}\\approx{} ";
|
|
3092
|
-
|
|
3093
2852
|
case "v":
|
|
3094
2853
|
return " \\downarrow{} ";
|
|
3095
|
-
|
|
3096
2854
|
case "(v)":
|
|
3097
2855
|
return " \\downarrow{} ";
|
|
3098
|
-
|
|
3099
2856
|
case "^":
|
|
3100
2857
|
return " \\uparrow{} ";
|
|
3101
|
-
|
|
3102
2858
|
case "(^)":
|
|
3103
2859
|
return " \\uparrow{} ";
|
|
3104
|
-
|
|
3105
2860
|
default:
|
|
3106
2861
|
throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
3107
2862
|
}
|
|
3108
2863
|
}
|
|
3109
|
-
};
|
|
2864
|
+
};
|