temml 0.13.3 → 0.13.5
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/README.md +1 -1
- package/dist/Temml-Asana.css +19 -5
- package/dist/Temml-Latin-Modern.css +19 -5
- package/dist/Temml-Libertinus.css +19 -6
- package/dist/Temml-Local.css +21 -7
- package/dist/Temml-NotoSans.css +21 -7
- package/dist/Temml-STIX2.css +21 -7
- package/dist/temml.cjs +88 -39
- package/dist/temml.js +88 -39
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +88 -39
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Namespace.js +2 -2
- package/src/Settings.js +41 -15
- package/src/auto-render.js +1 -1
- package/src/defineMacro.js +1 -1
- package/src/postProcess.js +1 -1
- package/src/stretchy.js +18 -7
- package/src/symbols.js +13 -9
- package/src/utils.js +10 -2
- package/temml.js +1 -1
package/README.md
CHANGED
package/dist/Temml-Asana.css
CHANGED
|
@@ -287,15 +287,29 @@ menclose {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/* Stretch \widetilde */
|
|
290
|
-
.tml-
|
|
290
|
+
.tml-tilde-2 {
|
|
291
291
|
transform: scale(2.0, 1.1)
|
|
292
292
|
}
|
|
293
|
-
.tml-
|
|
293
|
+
.tml-tilde-3 {
|
|
294
294
|
transform: scale(3.0, 1.3)
|
|
295
295
|
}
|
|
296
|
-
.tml-
|
|
296
|
+
.tml-tilde-4 {
|
|
297
297
|
transform: scale(4.0, 1.4)
|
|
298
298
|
}
|
|
299
|
+
/* Stretch \widehat */
|
|
300
|
+
.tml-hat-1 {
|
|
301
|
+
transform: scale(1.8, 1.0)
|
|
302
|
+
}
|
|
303
|
+
.tml-hat-2 {
|
|
304
|
+
transform: scale(3.5, 1.0)
|
|
305
|
+
}
|
|
306
|
+
.tml-hat-3 {
|
|
307
|
+
transform: scale(5.4, 1.1)
|
|
308
|
+
}
|
|
309
|
+
.tml-hat-4 {
|
|
310
|
+
transform: scale(7.2, 1.1)
|
|
311
|
+
}
|
|
312
|
+
|
|
299
313
|
/* set array cell justification */
|
|
300
314
|
.tml-right {
|
|
301
315
|
text-align: -webkit-right;
|
|
@@ -317,7 +331,7 @@ math > mrow {
|
|
|
317
331
|
|
|
318
332
|
/* Default mtd top padding is 0.5ex per MathML-Core and user-agent CSS */
|
|
319
333
|
/* We adjust for jot and small */
|
|
320
|
-
mtable.tml-jot mtd {
|
|
334
|
+
mtable.tml-jot > mtr > mtd {
|
|
321
335
|
padding-top: 0.7ex;
|
|
322
336
|
padding-bottom: 0.7ex;
|
|
323
337
|
}
|
|
@@ -333,7 +347,7 @@ mtable.tml-small mtd {
|
|
|
333
347
|
math > mrow { padding: 0 }
|
|
334
348
|
/* Adjust Firefox spacing between array rows */
|
|
335
349
|
mtd, mtable.tml-small mtd { padding-top: 0; padding-bottom: 0; }
|
|
336
|
-
mtable.tml-jot mtd { padding-top: 0.2ex; padding-bottom: 0.
|
|
350
|
+
mtable.tml-jot > mtr > mtd { padding-top: 0.2ex; padding-bottom: 0.2ex; }
|
|
337
351
|
}
|
|
338
352
|
|
|
339
353
|
/* AMS environment auto-numbering via CSS counter. */
|
|
@@ -301,15 +301,29 @@ menclose {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
/* Stretch \widetilde */
|
|
304
|
-
.tml-
|
|
304
|
+
.tml-tilde-2 {
|
|
305
305
|
transform: scale(2.0, 1.1)
|
|
306
306
|
}
|
|
307
|
-
.tml-
|
|
307
|
+
.tml-tilde-3 {
|
|
308
308
|
transform: scale(3.0, 1.3)
|
|
309
309
|
}
|
|
310
|
-
.tml-
|
|
310
|
+
.tml-tilde-4 {
|
|
311
311
|
transform: scale(4.0, 1.4)
|
|
312
312
|
}
|
|
313
|
+
/* Stretch \widehat */
|
|
314
|
+
.tml-hat-1 {
|
|
315
|
+
transform: scale(1.8, 1.1)
|
|
316
|
+
}
|
|
317
|
+
.tml-hat-2 {
|
|
318
|
+
transform: scale(3.5, 1.1)
|
|
319
|
+
}
|
|
320
|
+
.tml-hat-3 {
|
|
321
|
+
transform: scale(5.4, 1.3)
|
|
322
|
+
}
|
|
323
|
+
.tml-hat-4 {
|
|
324
|
+
transform: scale(7.2, 1.4)
|
|
325
|
+
}
|
|
326
|
+
|
|
313
327
|
/* set array cell justification */
|
|
314
328
|
.tml-right {
|
|
315
329
|
text-align: -webkit-right;
|
|
@@ -335,7 +349,7 @@ math > mrow {
|
|
|
335
349
|
|
|
336
350
|
/* Default mtd top padding is 0.5ex per MathML-Core and user-agent CSS */
|
|
337
351
|
/* We adjust for jot and small */
|
|
338
|
-
mtable.tml-jot mtd {
|
|
352
|
+
mtable.tml-jot > mtr > mtd {
|
|
339
353
|
padding-top: 0.7ex;
|
|
340
354
|
padding-bottom: 0.7ex;
|
|
341
355
|
}
|
|
@@ -351,7 +365,7 @@ mtable.tml-small mtd {
|
|
|
351
365
|
math > mrow { padding: 0 }
|
|
352
366
|
/* Adjust Firefox spacing between array rows */
|
|
353
367
|
mtd, mtable.tml-small mtd { padding-top: 0; padding-bottom: 0; }
|
|
354
|
-
mtable.tml-jot mtd { padding-top: 0.2ex; padding-bottom: 0.
|
|
368
|
+
mtable.tml-jot > mtr > mtd { padding-top: 0.2ex; padding-bottom: 0.2ex; }
|
|
355
369
|
}
|
|
356
370
|
|
|
357
371
|
/* AMS environment auto-numbering via CSS counter. */
|
|
@@ -303,15 +303,29 @@ menclose {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
/* Stretch \widetilde */
|
|
306
|
-
.tml-
|
|
306
|
+
.tml-tilde-2 {
|
|
307
307
|
transform: scale(2.0, 1.1)
|
|
308
308
|
}
|
|
309
|
-
.tml-
|
|
309
|
+
.tml-tilde-3 {
|
|
310
310
|
transform: scale(3.0, 1.3)
|
|
311
311
|
}
|
|
312
|
-
.tml-
|
|
312
|
+
.tml-tilde-4 {
|
|
313
313
|
transform: scale(4.0, 1.4)
|
|
314
314
|
}
|
|
315
|
+
/* Stretch \widehat */
|
|
316
|
+
.tml-hat-1 {
|
|
317
|
+
transform: scale(2.0, 1.0)
|
|
318
|
+
}
|
|
319
|
+
.tml-hat-2 {
|
|
320
|
+
transform: scale(4.2, 1.0)
|
|
321
|
+
}
|
|
322
|
+
.tml-hat-3 {
|
|
323
|
+
transform: scale(6.2, 1.1)
|
|
324
|
+
}
|
|
325
|
+
.tml-hat-4 {
|
|
326
|
+
transform: scale(8.8, 1.1)
|
|
327
|
+
}
|
|
328
|
+
|
|
315
329
|
/* set array cell justification */
|
|
316
330
|
.tml-right {
|
|
317
331
|
text-align: -webkit-right;
|
|
@@ -320,7 +334,6 @@ menclose {
|
|
|
320
334
|
text-align: -webkit-left;
|
|
321
335
|
}
|
|
322
336
|
}
|
|
323
|
-
|
|
324
337
|
/* flex-wrap for line-breaking in Chromium */
|
|
325
338
|
math {
|
|
326
339
|
display: inline-flex;
|
|
@@ -333,7 +346,7 @@ math > mrow {
|
|
|
333
346
|
|
|
334
347
|
/* Default mtd top padding is 0.5ex per MathML-Core and user-agent CSS */
|
|
335
348
|
/* We adjust for jot and small */
|
|
336
|
-
mtable.tml-jot mtd {
|
|
349
|
+
mtable.tml-jot > mtr > mtd {
|
|
337
350
|
padding-top: 0.7ex;
|
|
338
351
|
padding-bottom: 0.7ex;
|
|
339
352
|
}
|
|
@@ -349,7 +362,7 @@ mtable.tml-small mtd {
|
|
|
349
362
|
math > mrow { padding: 0 }
|
|
350
363
|
/* Adjust Firefox spacing between array rows */
|
|
351
364
|
mtd, mtable.tml-small mtd { padding-top: 0; padding-bottom: 0; }
|
|
352
|
-
mtable.tml-jot mtd { padding-top: 0.2ex; padding-bottom: 0.
|
|
365
|
+
mtable.tml-jot > mtr > mtd { padding-top: 0.2ex; padding-bottom: 0.2ex; }
|
|
353
366
|
}
|
|
354
367
|
|
|
355
368
|
/* AMS environment auto-numbering via CSS counter. */
|
package/dist/Temml-Local.css
CHANGED
|
@@ -294,15 +294,29 @@ menclose {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
/* Stretch \widetilde */
|
|
297
|
-
.tml-
|
|
297
|
+
.tml-tilde-2 {
|
|
298
298
|
transform: scale(2.0, 1.1)
|
|
299
299
|
}
|
|
300
|
-
.tml-
|
|
301
|
-
transform: scale(3.0, 1.
|
|
300
|
+
.tml-tilde-3 {
|
|
301
|
+
transform: scale(3.0, 1.1)
|
|
302
302
|
}
|
|
303
|
-
.tml-
|
|
304
|
-
transform: scale(4.0, 1.
|
|
303
|
+
.tml-tilde-4 {
|
|
304
|
+
transform: scale(4.0, 1.1)
|
|
305
305
|
}
|
|
306
|
+
/* Stretch \widehat */
|
|
307
|
+
.tml-hat-1 {
|
|
308
|
+
transform: scale(1.9, 1.0)
|
|
309
|
+
}
|
|
310
|
+
.tml-hat-2 {
|
|
311
|
+
transform: scale(3.9, 1.0)
|
|
312
|
+
}
|
|
313
|
+
.tml-hat-3 {
|
|
314
|
+
transform: scale(5.8, 1.0)
|
|
315
|
+
}
|
|
316
|
+
.tml-hat-4 {
|
|
317
|
+
transform: scale(7.8, 1.0)
|
|
318
|
+
}
|
|
319
|
+
|
|
306
320
|
/* set array cell justification */
|
|
307
321
|
.tml-right {
|
|
308
322
|
text-align: -webkit-right;
|
|
@@ -328,7 +342,7 @@ math > mrow {
|
|
|
328
342
|
|
|
329
343
|
/* Default mtd top padding is 0.5ex per MathML-Core and user-agent CSS */
|
|
330
344
|
/* We adjust for jot and small */
|
|
331
|
-
mtable.tml-jot mtd {
|
|
345
|
+
mtable.tml-jot > mtr > mtd {
|
|
332
346
|
padding-top: 0.7ex;
|
|
333
347
|
padding-bottom: 0.7ex;
|
|
334
348
|
}
|
|
@@ -344,7 +358,7 @@ mtable.tml-small mtd {
|
|
|
344
358
|
math > mrow { padding: 0 }
|
|
345
359
|
/* Adjust Firefox spacing between array rows */
|
|
346
360
|
mtd, mtable.tml-small mtd { padding-top: 0; padding-bottom: 0; }
|
|
347
|
-
mtable.tml-jot mtd { padding-top: 0.2ex; padding-bottom: 0.
|
|
361
|
+
mtable.tml-jot > mtr > mtd { padding-top: 0.2ex; padding-bottom: 0.2ex; }
|
|
348
362
|
}
|
|
349
363
|
|
|
350
364
|
/* AMS environment auto-numbering via CSS counter. */
|
package/dist/Temml-NotoSans.css
CHANGED
|
@@ -296,15 +296,29 @@ menclose {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
/* Stretch \widetilde */
|
|
299
|
-
.tml-
|
|
299
|
+
.tml-tilde-2 {
|
|
300
300
|
transform: scale(2.0, 1.1)
|
|
301
301
|
}
|
|
302
|
-
.tml-
|
|
303
|
-
transform: scale(3.0, 1.
|
|
302
|
+
.tml-tilde-3 {
|
|
303
|
+
transform: scale(3.0, 1.1)
|
|
304
304
|
}
|
|
305
|
-
.tml-
|
|
306
|
-
transform: scale(4.0, 1.
|
|
305
|
+
.tml-tilde-4 {
|
|
306
|
+
transform: scale(4.0, 1.1)
|
|
307
307
|
}
|
|
308
|
+
/* Stretch \widehat */
|
|
309
|
+
.tml-hat-1 {
|
|
310
|
+
transform: scale(1.8, 1.0)
|
|
311
|
+
}
|
|
312
|
+
.tml-hat-2 {
|
|
313
|
+
transform: scale(3.5, 1.0)
|
|
314
|
+
}
|
|
315
|
+
.tml-hat-3 {
|
|
316
|
+
transform: scale(5.4, 1.0)
|
|
317
|
+
}
|
|
318
|
+
.tml-hat-4 {
|
|
319
|
+
transform: scale(7.2, 1.0)
|
|
320
|
+
}
|
|
321
|
+
|
|
308
322
|
/* set array cell justification */
|
|
309
323
|
.tml-right {
|
|
310
324
|
text-align: -webkit-right;
|
|
@@ -332,7 +346,7 @@ math > mrow {
|
|
|
332
346
|
|
|
333
347
|
/* Default mtd top padding is 0.5ex per MathML-Core and user-agent CSS */
|
|
334
348
|
/* We adjust for jot and small */
|
|
335
|
-
mtable.tml-jot mtd {
|
|
349
|
+
mtable.tml-jot > mtr > mtd {
|
|
336
350
|
padding-top: 0.7ex;
|
|
337
351
|
padding-bottom: 0.7ex;
|
|
338
352
|
}
|
|
@@ -348,7 +362,7 @@ mtable.tml-small mtd {
|
|
|
348
362
|
math > mrow { padding: 0 }
|
|
349
363
|
/* Adjust Firefox spacing between array rows */
|
|
350
364
|
mtd, mtable.tml-small mtd { padding-top: 0; padding-bottom: 0; }
|
|
351
|
-
mtable.tml-jot mtd { padding-top: 0.2ex; padding-bottom: 0.
|
|
365
|
+
mtable.tml-jot > mtr > mtd { padding-top: 0.2ex; padding-bottom: 0.2ex; }
|
|
352
366
|
}
|
|
353
367
|
|
|
354
368
|
/* AMS environment auto-numbering via CSS counter. */
|
package/dist/Temml-STIX2.css
CHANGED
|
@@ -293,15 +293,29 @@ menclose {
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
/* Stretch \widetilde */
|
|
296
|
-
.tml-
|
|
296
|
+
.tml-tilde-2 {
|
|
297
297
|
transform: scale(2.0, 1.1)
|
|
298
298
|
}
|
|
299
|
-
.tml-
|
|
300
|
-
transform: scale(3.0, 1.
|
|
299
|
+
.tml-tilde-3 {
|
|
300
|
+
transform: scale(3.0, 1.1)
|
|
301
301
|
}
|
|
302
|
-
.tml-
|
|
303
|
-
transform: scale(4.0, 1.
|
|
302
|
+
.tml-tilde-4 {
|
|
303
|
+
transform: scale(4.0, 1.1)
|
|
304
304
|
}
|
|
305
|
+
/* Stretch \widehat */
|
|
306
|
+
.tml-hat-1 {
|
|
307
|
+
transform: scale(1.9, 1.0)
|
|
308
|
+
}
|
|
309
|
+
.tml-hat-2 {
|
|
310
|
+
transform: scale(3.9, 1.0)
|
|
311
|
+
}
|
|
312
|
+
.tml-hat-3 {
|
|
313
|
+
transform: scale(5.8, 1.1)
|
|
314
|
+
}
|
|
315
|
+
.tml-hat-4 {
|
|
316
|
+
transform: scale(7.8, 1.1)
|
|
317
|
+
}
|
|
318
|
+
|
|
305
319
|
/* set array cell justification */
|
|
306
320
|
.tml-right {
|
|
307
321
|
text-align: -webkit-right;
|
|
@@ -323,7 +337,7 @@ math > mrow {
|
|
|
323
337
|
|
|
324
338
|
/* Default mtd top padding is 0.5ex per MathML-Core and user-agent CSS */
|
|
325
339
|
/* We adjust for jot and small */
|
|
326
|
-
mtable.tml-jot mtd {
|
|
340
|
+
mtable.tml-jot > mtr > mtd {
|
|
327
341
|
padding-top: 0.7ex;
|
|
328
342
|
padding-bottom: 0.7ex;
|
|
329
343
|
}
|
|
@@ -339,7 +353,7 @@ mtable.tml-small mtd {
|
|
|
339
353
|
math > mrow { padding: 0 }
|
|
340
354
|
/* Adjust Firefox spacing between array rows */
|
|
341
355
|
mtd, mtable.tml-small mtd { padding-top: 0; padding-bottom: 0; }
|
|
342
|
-
mtable.tml-jot mtd { padding-top: 0.2ex; padding-bottom: 0.
|
|
356
|
+
mtable.tml-jot > mtr > mtd { padding-top: 0.2ex; padding-bottom: 0.2ex; }
|
|
343
357
|
}
|
|
344
358
|
|
|
345
359
|
/* AMS environment auto-numbering via CSS counter. */
|
package/dist/temml.cjs
CHANGED
|
@@ -70,9 +70,17 @@ ParseError.prototype.__proto__ = Error.prototype;
|
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* Look up `key` on a user-supplied `options` object and return its value, or
|
|
74
|
+
* `defaultIfUndefined` if the setting is absent. Reads via
|
|
75
|
+
* `Object.prototype.hasOwnProperty.call` rather than plain property access,
|
|
76
|
+
* so a key that only exists because `Object.prototype` was polluted
|
|
77
|
+
* elsewhere is never mistaken for a setting the caller actually provided.
|
|
74
78
|
*/
|
|
75
|
-
const deflt = function(
|
|
79
|
+
const deflt = function(options, key, defaultIfUndefined) {
|
|
80
|
+
if (!Object.prototype.hasOwnProperty.call(options, key)) {
|
|
81
|
+
return defaultIfUndefined;
|
|
82
|
+
}
|
|
83
|
+
const setting = options[key];
|
|
76
84
|
return setting === undefined ? defaultIfUndefined : setting;
|
|
77
85
|
};
|
|
78
86
|
|
|
@@ -190,6 +198,27 @@ const smalls = "acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚
|
|
|
190
198
|
*/
|
|
191
199
|
|
|
192
200
|
|
|
201
|
+
const FORBIDDEN_MACRO_KEYS = ["__proto__", "prototype", "constructor"];
|
|
202
|
+
|
|
203
|
+
// Sanitize a user-supplied macros object: strip its prototype (so later
|
|
204
|
+
// bracket-notation writes, e.g. from \gdef, can never reach Object.prototype)
|
|
205
|
+
// and delete any own key that could be used to pollute it. This mutates
|
|
206
|
+
// `macros` in place and returns the same reference, rather than a copy,
|
|
207
|
+
// because callers such as auto-render.js rely on that identity to share
|
|
208
|
+
// \gdef'd macros across multiple render calls that pass the same options
|
|
209
|
+
// object.
|
|
210
|
+
const sanitizeMacros = (macros) => {
|
|
211
|
+
if (macros == null || typeof macros !== "object") {
|
|
212
|
+
return Object.create(null);
|
|
213
|
+
}
|
|
214
|
+
for (const key of FORBIDDEN_MACRO_KEYS) {
|
|
215
|
+
if (Object.prototype.hasOwnProperty.call(macros, key)) {
|
|
216
|
+
delete macros[key];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return Object.setPrototypeOf(macros, null);
|
|
220
|
+
};
|
|
221
|
+
|
|
193
222
|
/**
|
|
194
223
|
* The main Settings object
|
|
195
224
|
*/
|
|
@@ -197,24 +226,29 @@ class Settings {
|
|
|
197
226
|
constructor(options) {
|
|
198
227
|
// allow null options
|
|
199
228
|
options = options || {};
|
|
200
|
-
this.displayMode = deflt(options
|
|
201
|
-
this.annotate = deflt(options
|
|
202
|
-
this.leqno = deflt(options
|
|
203
|
-
this.throwOnError = deflt(options
|
|
204
|
-
this.errorColor = deflt(options
|
|
205
|
-
this.macros =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this.
|
|
209
|
-
this.
|
|
210
|
-
this.
|
|
211
|
-
this.
|
|
212
|
-
|
|
213
|
-
|
|
229
|
+
this.displayMode = deflt(options, "displayMode", false); // boolean
|
|
230
|
+
this.annotate = deflt(options, "annotate", false); // boolean
|
|
231
|
+
this.leqno = deflt(options, "leqno", false); // boolean
|
|
232
|
+
this.throwOnError = deflt(options, "throwOnError", false); // boolean
|
|
233
|
+
this.errorColor = deflt(options, "errorColor", "#b22222"); // string
|
|
234
|
+
this.macros = sanitizeMacros(
|
|
235
|
+
Object.prototype.hasOwnProperty.call(options, "macros") ? options.macros : undefined
|
|
236
|
+
);
|
|
237
|
+
this.wrap = deflt(options, "wrap", "none"); // "none" | "tex" | "="
|
|
238
|
+
this.xml = deflt(options, "xml", false); // boolean
|
|
239
|
+
this.colorIsTextColor = deflt(options, "colorIsTextColor", false); // boolean
|
|
240
|
+
this.strict = deflt(options, "strict", false); // boolean
|
|
241
|
+
this.trust = deflt(options, "trust", false); // trust context. See html.js.
|
|
242
|
+
const maxSize = Object.prototype.hasOwnProperty.call(options, "maxSize")
|
|
214
243
|
? options.maxSize
|
|
244
|
+
: undefined;
|
|
245
|
+
this.maxSize = (maxSize === undefined
|
|
246
|
+
? [Infinity, Infinity]
|
|
247
|
+
: Array.isArray(maxSize)
|
|
248
|
+
? maxSize
|
|
215
249
|
: [Infinity, Infinity]
|
|
216
250
|
);
|
|
217
|
-
this.maxExpand = Math.max(0, deflt(options
|
|
251
|
+
this.maxExpand = Math.max(0, deflt(options, "maxExpand", 1000)); // number
|
|
218
252
|
this.wrapDelimiterPairs = true; // boolean
|
|
219
253
|
}
|
|
220
254
|
|
|
@@ -787,7 +821,7 @@ const estimatedWidth = node => {
|
|
|
787
821
|
};
|
|
788
822
|
|
|
789
823
|
const stretchyCodePoint = {
|
|
790
|
-
widehat: "
|
|
824
|
+
widehat: "\u02c6", // Shorter than \u005e, which is appropriate for an accent.
|
|
791
825
|
widecheck: "ˇ",
|
|
792
826
|
widetilde: "~",
|
|
793
827
|
wideparen: "⏜", // \u23dc
|
|
@@ -850,19 +884,30 @@ const mathMLnode = function(label) {
|
|
|
850
884
|
return node
|
|
851
885
|
};
|
|
852
886
|
|
|
853
|
-
const
|
|
887
|
+
const wideHats = ["\\widehat", "\\widecheck"];
|
|
854
888
|
|
|
855
|
-
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
|
889
|
+
// TODO: Remove if/when Chromium stretches \widetilde & \widehat
|
|
856
890
|
const accentNode = (group) => {
|
|
857
891
|
const mo = mathMLnode(group.label);
|
|
858
|
-
if (
|
|
892
|
+
if (group.label.indexOf("tilde") > -1) {
|
|
859
893
|
const width = estimatedWidth(group.base);
|
|
860
894
|
if (1 < width && width < 1.6) {
|
|
861
|
-
mo.classes.push("tml-
|
|
895
|
+
mo.classes.push("tml-tilde-2");
|
|
862
896
|
} else if (1.6 <= width && width < 2.5) {
|
|
863
|
-
mo.classes.push("tml-
|
|
897
|
+
mo.classes.push("tml-tilde-3");
|
|
864
898
|
} else if (2.5 <= width) {
|
|
865
|
-
mo.classes.push("tml-
|
|
899
|
+
mo.classes.push("tml-tilde-4");
|
|
900
|
+
}
|
|
901
|
+
} else if (wideHats.includes(group.label)) {
|
|
902
|
+
const width = estimatedWidth(group.base);
|
|
903
|
+
if (0 < width && width <= 1) {
|
|
904
|
+
mo.classes.push("tml-hat-1");
|
|
905
|
+
} else if (1 < width && width < 1.6) {
|
|
906
|
+
mo.classes.push("tml-hat-2");
|
|
907
|
+
} else if (1.6 <= width && width < 2.5) {
|
|
908
|
+
mo.classes.push("tml-hat-3");
|
|
909
|
+
} else if (2.5 <= width) {
|
|
910
|
+
mo.classes.push("tml-hat-4");
|
|
866
911
|
}
|
|
867
912
|
}
|
|
868
913
|
return mo
|
|
@@ -903,22 +948,26 @@ const NON_ATOMS = {
|
|
|
903
948
|
textord: 1
|
|
904
949
|
};
|
|
905
950
|
|
|
906
|
-
const symbols =
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
};
|
|
951
|
+
const symbols = Object.create(null);
|
|
952
|
+
symbols.math = Object.create(null);
|
|
953
|
+
symbols.text = Object.create(null);
|
|
910
954
|
|
|
911
|
-
/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
|
|
912
955
|
function defineSymbol(mode, group, replace, name, acceptUnicodeChar) {
|
|
913
|
-
|
|
956
|
+
if (mode !== "math" && mode !== "text") {
|
|
957
|
+
throw new TypeError(`Invalid mode: ${mode} called in defineSymbol`);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
const entry = { group, replace };
|
|
961
|
+
symbols[mode][name] = entry;
|
|
914
962
|
|
|
963
|
+
/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
|
|
915
964
|
if (acceptUnicodeChar && replace) {
|
|
916
|
-
symbols[mode][replace] =
|
|
965
|
+
symbols[mode][replace] = entry;
|
|
917
966
|
}
|
|
918
967
|
}
|
|
919
968
|
|
|
920
969
|
// Some abbreviations for commonly used strings.
|
|
921
|
-
// This helps minify the code, and also spotting typos
|
|
970
|
+
// This helps minify the code, and also spotting typos via linter.
|
|
922
971
|
|
|
923
972
|
// modes:
|
|
924
973
|
const math = "math";
|
|
@@ -1771,7 +1820,7 @@ defineSymbol(math, accent, "\u007e", "\\tilde");
|
|
|
1771
1820
|
defineSymbol(math, accent, "\u203e", "\\bar");
|
|
1772
1821
|
defineSymbol(math, accent, "\u02d8", "\\breve");
|
|
1773
1822
|
defineSymbol(math, accent, "\u02c7", "\\check");
|
|
1774
|
-
defineSymbol(math, accent, "\
|
|
1823
|
+
defineSymbol(math, accent, "\u02c6", "\\hat");
|
|
1775
1824
|
defineSymbol(math, accent, "\u2192", "\\vec");
|
|
1776
1825
|
defineSymbol(math, accent, "\u02d9", "\\dot");
|
|
1777
1826
|
defineSymbol(math, accent, "\u02da", "\\mathring");
|
|
@@ -3548,7 +3597,7 @@ const StyleLevel = {
|
|
|
3548
3597
|
* `macros.js` exports this same dictionary again and makes it public.
|
|
3549
3598
|
* `Parser.js` requires this dictionary via `macros.js`.
|
|
3550
3599
|
*/
|
|
3551
|
-
const _macros =
|
|
3600
|
+
const _macros = Object.create(null);
|
|
3552
3601
|
|
|
3553
3602
|
// This function might one day accept an additional argument and do more things.
|
|
3554
3603
|
function defineMacro(name, body) {
|
|
@@ -11989,7 +12038,7 @@ class Namespace {
|
|
|
11989
12038
|
* of initial (global-level) mappings, which will constantly change
|
|
11990
12039
|
* according to any global/top-level `set`s done.
|
|
11991
12040
|
*/
|
|
11992
|
-
constructor(builtins =
|
|
12041
|
+
constructor(builtins = Object.create(null), globalMacros = Object.create(null)) {
|
|
11993
12042
|
this.current = globalMacros;
|
|
11994
12043
|
this.builtins = builtins;
|
|
11995
12044
|
this.undefStack = [];
|
|
@@ -11999,7 +12048,7 @@ class Namespace {
|
|
|
11999
12048
|
* Start a new nested group, affecting future local `set`s.
|
|
12000
12049
|
*/
|
|
12001
12050
|
beginGroup() {
|
|
12002
|
-
this.undefStack.push(
|
|
12051
|
+
this.undefStack.push(Object.create(null));
|
|
12003
12052
|
}
|
|
12004
12053
|
|
|
12005
12054
|
/**
|
|
@@ -14197,7 +14246,7 @@ class Style {
|
|
|
14197
14246
|
* https://mit-license.org/
|
|
14198
14247
|
*/
|
|
14199
14248
|
|
|
14200
|
-
const version = "0.13.
|
|
14249
|
+
const version = "0.13.5";
|
|
14201
14250
|
|
|
14202
14251
|
function postProcess(block) {
|
|
14203
14252
|
const labelMap = {};
|
|
@@ -14518,7 +14567,7 @@ const renderMathInElement = function(elem, options) {
|
|
|
14518
14567
|
|
|
14519
14568
|
// Enable sharing of global macros defined via `\gdef` between different
|
|
14520
14569
|
// math elements within a single call to `renderMathInElement`.
|
|
14521
|
-
optionsCopy.macros = optionsCopy.macros ||
|
|
14570
|
+
optionsCopy.macros = optionsCopy.macros || Object.create(null);
|
|
14522
14571
|
|
|
14523
14572
|
renderElem(elem, optionsCopy);
|
|
14524
14573
|
postProcess(elem);
|
|
@@ -14597,7 +14646,7 @@ const generateParseTree = function(expression, options) {
|
|
|
14597
14646
|
*/
|
|
14598
14647
|
const definePreamble = function(expression, options) {
|
|
14599
14648
|
const settings = new Settings(options);
|
|
14600
|
-
settings.macros =
|
|
14649
|
+
settings.macros = Object.create(null);
|
|
14601
14650
|
if (!(typeof expression === "string" || expression instanceof String)) {
|
|
14602
14651
|
throw new TypeError("Temml can only parse string typed expression")
|
|
14603
14652
|
}
|