temml 0.10.23 → 0.10.24
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/Temml-Asana.css +2 -0
- package/dist/Temml-Fira.css +2 -0
- package/dist/Temml-Latin-Modern.css +2 -0
- package/dist/Temml-Libertinus.css +2 -0
- package/dist/Temml-Local.css +2 -0
- package/dist/Temml-STIX2.css +2 -0
- package/dist/temml.cjs +98 -9
- package/dist/temml.js +98 -9
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +98 -9
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Settings.js +5 -1
- package/src/functions/def.js +3 -0
- package/src/postProcess.js +1 -1
- package/src/symbols.js +68 -4
- package/src/utils.js +21 -3
package/dist/temml.mjs
CHANGED
@@ -144,11 +144,29 @@ const assert = function(value) {
|
|
144
144
|
|
145
145
|
/**
|
146
146
|
* Return the protocol of a URL, or "_relative" if the URL does not specify a
|
147
|
-
* protocol (and thus is relative)
|
147
|
+
* protocol (and thus is relative), or `null` if URL has invalid protocol
|
148
|
+
* (so should be outright rejected).
|
148
149
|
*/
|
149
150
|
const protocolFromUrl = function(url) {
|
150
|
-
|
151
|
-
|
151
|
+
// Check for possible leading protocol.
|
152
|
+
// https://url.spec.whatwg.org/#url-parsing strips leading whitespace
|
153
|
+
// (\x00) or C0 control (\x00-\x1F) characters.
|
154
|
+
// eslint-disable-next-line no-control-regex
|
155
|
+
const protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(url);
|
156
|
+
if (!protocol) {
|
157
|
+
return "_relative";
|
158
|
+
}
|
159
|
+
// Reject weird colons
|
160
|
+
if (protocol[2] !== ":") {
|
161
|
+
return null;
|
162
|
+
}
|
163
|
+
// Reject invalid characters in scheme according to
|
164
|
+
// https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
|
165
|
+
if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
|
166
|
+
return null;
|
167
|
+
}
|
168
|
+
// Lowercase the protocol
|
169
|
+
return protocol[1].toLowerCase();
|
152
170
|
};
|
153
171
|
|
154
172
|
/**
|
@@ -213,7 +231,11 @@ class Settings {
|
|
213
231
|
*/
|
214
232
|
isTrusted(context) {
|
215
233
|
if (context.url && !context.protocol) {
|
216
|
-
|
234
|
+
const protocol = utils.protocolFromUrl(context.url);
|
235
|
+
if (protocol == null) {
|
236
|
+
return false
|
237
|
+
}
|
238
|
+
context.protocol = protocol;
|
217
239
|
}
|
218
240
|
const trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
|
219
241
|
return Boolean(trust);
|
@@ -1252,7 +1274,72 @@ defineSymbol(math, bin, "\u27d5", "\\leftouterjoin", true);
|
|
1252
1274
|
defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
|
1253
1275
|
defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
|
1254
1276
|
|
1255
|
-
|
1277
|
+
// stix Binary Operators
|
1278
|
+
defineSymbol(math, bin, "\u2238", "\\dotminus", true);
|
1279
|
+
defineSymbol(math, bin, "\u27D1", "\\wedgedot", true);
|
1280
|
+
defineSymbol(math, bin, "\u27C7", "\\veedot", true);
|
1281
|
+
defineSymbol(math, bin, "\u2A62", "\\doublebarvee", true);
|
1282
|
+
defineSymbol(math, bin, "\u2A63", "\\veedoublebar", true);
|
1283
|
+
defineSymbol(math, bin, "\u2A5F", "\\wedgebar", true);
|
1284
|
+
defineSymbol(math, bin, "\u2A60", "\\wedgedoublebar", true);
|
1285
|
+
defineSymbol(math, bin, "\u2A54", "\\Vee", true);
|
1286
|
+
defineSymbol(math, bin, "\u2A53", "\\Wedge", true);
|
1287
|
+
defineSymbol(math, bin, "\u2A43", "\\barcap", true);
|
1288
|
+
defineSymbol(math, bin, "\u2A42", "\\barcup", true);
|
1289
|
+
defineSymbol(math, bin, "\u2A48", "\\capbarcup", true);
|
1290
|
+
defineSymbol(math, bin, "\u2A40", "\\capdot", true);
|
1291
|
+
defineSymbol(math, bin, "\u2A47", "\\capovercup", true);
|
1292
|
+
defineSymbol(math, bin, "\u2A46", "\\cupovercap", true);
|
1293
|
+
defineSymbol(math, bin, "\u2A4D", "\\closedvarcap", true);
|
1294
|
+
defineSymbol(math, bin, "\u2A4C", "\\closedvarcup", true);
|
1295
|
+
defineSymbol(math, bin, "\u2A2A", "\\minusdot", true);
|
1296
|
+
defineSymbol(math, bin, "\u2A2B", "\\minusfdots", true);
|
1297
|
+
defineSymbol(math, bin, "\u2A2C", "\\minusrdots", true);
|
1298
|
+
defineSymbol(math, bin, "\u22BB", "\\Xor", true);
|
1299
|
+
defineSymbol(math, bin, "\u22BC", "\\Nand", true);
|
1300
|
+
defineSymbol(math, bin, "\u22BD", "\\Nor", true);
|
1301
|
+
defineSymbol(math, bin, "\u22BD", "\\barvee");
|
1302
|
+
defineSymbol(math, bin, "\u2AF4", "\\interleave", true);
|
1303
|
+
defineSymbol(math, bin, "\u29E2", "\\shuffle", true);
|
1304
|
+
defineSymbol(math, bin, "\u2AF6", "\\threedotcolon", true);
|
1305
|
+
defineSymbol(math, bin, "\u2982", "\\typecolon", true);
|
1306
|
+
defineSymbol(math, bin, "\u223E", "\\invlazys", true);
|
1307
|
+
defineSymbol(math, bin, "\u2A4B", "\\twocaps", true);
|
1308
|
+
defineSymbol(math, bin, "\u2A4A", "\\twocups", true);
|
1309
|
+
defineSymbol(math, bin, "\u2A4E", "\\Sqcap", true);
|
1310
|
+
defineSymbol(math, bin, "\u2A4F", "\\Sqcup", true);
|
1311
|
+
defineSymbol(math, bin, "\u2A56", "\\veeonvee", true);
|
1312
|
+
defineSymbol(math, bin, "\u2A55", "\\wedgeonwedge", true);
|
1313
|
+
defineSymbol(math, bin, "\u29D7", "\\blackhourglass", true);
|
1314
|
+
defineSymbol(math, bin, "\u29C6", "\\boxast", true);
|
1315
|
+
defineSymbol(math, bin, "\u29C8", "\\boxbox", true);
|
1316
|
+
defineSymbol(math, bin, "\u29C7", "\\boxcircle", true);
|
1317
|
+
defineSymbol(math, bin, "\u229C", "\\circledequal", true);
|
1318
|
+
defineSymbol(math, bin, "\u29B7", "\\circledparallel", true);
|
1319
|
+
defineSymbol(math, bin, "\u29B6", "\\circledvert", true);
|
1320
|
+
defineSymbol(math, bin, "\u29B5", "\\circlehbar", true);
|
1321
|
+
defineSymbol(math, bin, "\u27E1", "\\concavediamond", true);
|
1322
|
+
defineSymbol(math, bin, "\u27E2", "\\concavediamondtickleft", true);
|
1323
|
+
defineSymbol(math, bin, "\u27E3", "\\concavediamondtickright", true);
|
1324
|
+
defineSymbol(math, bin, "\u22C4", "\\diamond", true);
|
1325
|
+
defineSymbol(math, bin, "\u29D6", "\\hourglass", true);
|
1326
|
+
defineSymbol(math, bin, "\u27E0", "\\lozengeminus", true);
|
1327
|
+
defineSymbol(math, bin, "\u233D", "\\obar", true);
|
1328
|
+
defineSymbol(math, bin, "\u29B8", "\\obslash", true);
|
1329
|
+
defineSymbol(math, bin, "\u2A38", "\\odiv", true);
|
1330
|
+
defineSymbol(math, bin, "\u29C1", "\\ogreaterthan", true);
|
1331
|
+
defineSymbol(math, bin, "\u29C0", "\\olessthan", true);
|
1332
|
+
defineSymbol(math, bin, "\u29B9", "\\operp", true);
|
1333
|
+
defineSymbol(math, bin, "\u2A37", "\\Otimes", true);
|
1334
|
+
defineSymbol(math, bin, "\u2A36", "\\otimeshat", true);
|
1335
|
+
defineSymbol(math, bin, "\u22C6", "\\star", true);
|
1336
|
+
defineSymbol(math, bin, "\u25B3", "\\triangle", true);
|
1337
|
+
defineSymbol(math, bin, "\u2A3A", "\\triangleminus", true);
|
1338
|
+
defineSymbol(math, bin, "\u2A39", "\\triangleplus", true);
|
1339
|
+
defineSymbol(math, bin, "\u2A3B", "\\triangletimes", true);
|
1340
|
+
defineSymbol(math, bin, "\u27E4", "\\whitesquaretickleft", true);
|
1341
|
+
defineSymbol(math, bin, "\u27E5", "\\whitesquaretickright", true);
|
1342
|
+
defineSymbol(math, bin, "\u2A33", "\\smashtimes", true);
|
1256
1343
|
|
1257
1344
|
// AMS Arrows
|
1258
1345
|
// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
|
@@ -1494,8 +1581,8 @@ defineSymbol(math, spacing, null, "\\allowbreak");
|
|
1494
1581
|
defineSymbol(math, punct, ",", ",");
|
1495
1582
|
defineSymbol(text, punct, ":", ":");
|
1496
1583
|
defineSymbol(math, punct, ";", ";");
|
1497
|
-
defineSymbol(math, bin, "\u22bc", "\\barwedge"
|
1498
|
-
defineSymbol(math, bin, "\u22bb", "\\veebar"
|
1584
|
+
defineSymbol(math, bin, "\u22bc", "\\barwedge");
|
1585
|
+
defineSymbol(math, bin, "\u22bb", "\\veebar");
|
1499
1586
|
defineSymbol(math, bin, "\u2299", "\\odot", true);
|
1500
1587
|
// Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
|
1501
1588
|
defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
|
@@ -1508,7 +1595,6 @@ defineSymbol(math, bin, "\u25b3", "\\bigtriangleup");
|
|
1508
1595
|
defineSymbol(math, bin, "\u25bd", "\\bigtriangledown");
|
1509
1596
|
defineSymbol(math, bin, "\u2020", "\\dagger");
|
1510
1597
|
defineSymbol(math, bin, "\u22c4", "\\diamond");
|
1511
|
-
defineSymbol(math, bin, "\u22c6", "\\star");
|
1512
1598
|
defineSymbol(math, bin, "\u25c3", "\\triangleleft");
|
1513
1599
|
defineSymbol(math, bin, "\u25b9", "\\triangleright");
|
1514
1600
|
defineSymbol(math, open, "{", "\\{");
|
@@ -3483,6 +3569,9 @@ defineFunction({
|
|
3483
3569
|
|
3484
3570
|
if (funcName === "\\edef" || funcName === "\\xdef") {
|
3485
3571
|
tokens = parser.gullet.expandTokens(tokens);
|
3572
|
+
if (tokens.length > parser.gullet.settings.maxExpand) {
|
3573
|
+
throw new ParseError("Too many expansions in an " + funcName);
|
3574
|
+
}
|
3486
3575
|
tokens.reverse(); // to fit in with stack order
|
3487
3576
|
}
|
3488
3577
|
// Final arg is the expansion of the macro
|
@@ -13221,7 +13310,7 @@ class Style {
|
|
13221
13310
|
* https://mit-license.org/
|
13222
13311
|
*/
|
13223
13312
|
|
13224
|
-
const version = "0.10.
|
13313
|
+
const version = "0.10.24";
|
13225
13314
|
|
13226
13315
|
function postProcess(block) {
|
13227
13316
|
const labelMap = {};
|
package/dist/temmlPostProcess.js
CHANGED
package/package.json
CHANGED
package/src/Settings.js
CHANGED
@@ -42,7 +42,11 @@ export default class Settings {
|
|
42
42
|
*/
|
43
43
|
isTrusted(context) {
|
44
44
|
if (context.url && !context.protocol) {
|
45
|
-
|
45
|
+
const protocol = utils.protocolFromUrl(context.url);
|
46
|
+
if (protocol == null) {
|
47
|
+
return false
|
48
|
+
}
|
49
|
+
context.protocol = protocol
|
46
50
|
}
|
47
51
|
const trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
|
48
52
|
return Boolean(trust);
|
package/src/functions/def.js
CHANGED
@@ -141,6 +141,9 @@ defineFunction({
|
|
141
141
|
|
142
142
|
if (funcName === "\\edef" || funcName === "\\xdef") {
|
143
143
|
tokens = parser.gullet.expandTokens(tokens);
|
144
|
+
if (tokens.length > parser.gullet.settings.maxExpand) {
|
145
|
+
throw new ParseError("Too many expansions in an " + funcName);
|
146
|
+
}
|
144
147
|
tokens.reverse(); // to fit in with stack order
|
145
148
|
}
|
146
149
|
// Final arg is the expansion of the macro
|
package/src/postProcess.js
CHANGED
package/src/symbols.js
CHANGED
@@ -446,7 +446,72 @@ defineSymbol(math, bin, "\u27d5", "\\leftouterjoin", true);
|
|
446
446
|
defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
|
447
447
|
defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
|
448
448
|
|
449
|
-
|
449
|
+
// stix Binary Operators
|
450
|
+
defineSymbol(math, bin, "\u2238", "\\dotminus", true);
|
451
|
+
defineSymbol(math, bin, "\u27D1", "\\wedgedot", true);
|
452
|
+
defineSymbol(math, bin, "\u27C7", "\\veedot", true);
|
453
|
+
defineSymbol(math, bin, "\u2A62", "\\doublebarvee", true);
|
454
|
+
defineSymbol(math, bin, "\u2A63", "\\veedoublebar", true)
|
455
|
+
defineSymbol(math, bin, "\u2A5F", "\\wedgebar", true)
|
456
|
+
defineSymbol(math, bin, "\u2A60", "\\wedgedoublebar", true)
|
457
|
+
defineSymbol(math, bin, "\u2A54", "\\Vee", true)
|
458
|
+
defineSymbol(math, bin, "\u2A53", "\\Wedge", true)
|
459
|
+
defineSymbol(math, bin, "\u2A43", "\\barcap", true)
|
460
|
+
defineSymbol(math, bin, "\u2A42", "\\barcup", true)
|
461
|
+
defineSymbol(math, bin, "\u2A48", "\\capbarcup", true)
|
462
|
+
defineSymbol(math, bin, "\u2A40", "\\capdot", true)
|
463
|
+
defineSymbol(math, bin, "\u2A47", "\\capovercup", true)
|
464
|
+
defineSymbol(math, bin, "\u2A46", "\\cupovercap", true)
|
465
|
+
defineSymbol(math, bin, "\u2A4D", "\\closedvarcap", true)
|
466
|
+
defineSymbol(math, bin, "\u2A4C", "\\closedvarcup", true)
|
467
|
+
defineSymbol(math, bin, "\u2A2A", "\\minusdot", true)
|
468
|
+
defineSymbol(math, bin, "\u2A2B", "\\minusfdots", true)
|
469
|
+
defineSymbol(math, bin, "\u2A2C", "\\minusrdots", true)
|
470
|
+
defineSymbol(math, bin, "\u22BB", "\\Xor", true)
|
471
|
+
defineSymbol(math, bin, "\u22BC", "\\Nand", true)
|
472
|
+
defineSymbol(math, bin, "\u22BD", "\\Nor", true)
|
473
|
+
defineSymbol(math, bin, "\u22BD", "\\barvee")
|
474
|
+
defineSymbol(math, bin, "\u2AF4", "\\interleave", true)
|
475
|
+
defineSymbol(math, bin, "\u29E2", "\\shuffle", true)
|
476
|
+
defineSymbol(math, bin, "\u2AF6", "\\threedotcolon", true)
|
477
|
+
defineSymbol(math, bin, "\u2982", "\\typecolon", true)
|
478
|
+
defineSymbol(math, bin, "\u223E", "\\invlazys", true)
|
479
|
+
defineSymbol(math, bin, "\u2A4B", "\\twocaps", true)
|
480
|
+
defineSymbol(math, bin, "\u2A4A", "\\twocups", true)
|
481
|
+
defineSymbol(math, bin, "\u2A4E", "\\Sqcap", true)
|
482
|
+
defineSymbol(math, bin, "\u2A4F", "\\Sqcup", true)
|
483
|
+
defineSymbol(math, bin, "\u2A56", "\\veeonvee", true)
|
484
|
+
defineSymbol(math, bin, "\u2A55", "\\wedgeonwedge", true)
|
485
|
+
defineSymbol(math, bin, "\u29D7", "\\blackhourglass", true)
|
486
|
+
defineSymbol(math, bin, "\u29C6", "\\boxast", true)
|
487
|
+
defineSymbol(math, bin, "\u29C8", "\\boxbox", true)
|
488
|
+
defineSymbol(math, bin, "\u29C7", "\\boxcircle", true)
|
489
|
+
defineSymbol(math, bin, "\u229C", "\\circledequal", true)
|
490
|
+
defineSymbol(math, bin, "\u29B7", "\\circledparallel", true)
|
491
|
+
defineSymbol(math, bin, "\u29B6", "\\circledvert", true)
|
492
|
+
defineSymbol(math, bin, "\u29B5", "\\circlehbar", true)
|
493
|
+
defineSymbol(math, bin, "\u27E1", "\\concavediamond", true)
|
494
|
+
defineSymbol(math, bin, "\u27E2", "\\concavediamondtickleft", true)
|
495
|
+
defineSymbol(math, bin, "\u27E3", "\\concavediamondtickright", true)
|
496
|
+
defineSymbol(math, bin, "\u22C4", "\\diamond", true)
|
497
|
+
defineSymbol(math, bin, "\u29D6", "\\hourglass", true)
|
498
|
+
defineSymbol(math, bin, "\u27E0", "\\lozengeminus", true)
|
499
|
+
defineSymbol(math, bin, "\u233D", "\\obar", true)
|
500
|
+
defineSymbol(math, bin, "\u29B8", "\\obslash", true)
|
501
|
+
defineSymbol(math, bin, "\u2A38", "\\odiv", true)
|
502
|
+
defineSymbol(math, bin, "\u29C1", "\\ogreaterthan", true)
|
503
|
+
defineSymbol(math, bin, "\u29C0", "\\olessthan", true)
|
504
|
+
defineSymbol(math, bin, "\u29B9", "\\operp", true)
|
505
|
+
defineSymbol(math, bin, "\u2A37", "\\Otimes", true)
|
506
|
+
defineSymbol(math, bin, "\u2A36", "\\otimeshat", true)
|
507
|
+
defineSymbol(math, bin, "\u22C6", "\\star", true)
|
508
|
+
defineSymbol(math, bin, "\u25B3", "\\triangle", true)
|
509
|
+
defineSymbol(math, bin, "\u2A3A", "\\triangleminus", true)
|
510
|
+
defineSymbol(math, bin, "\u2A39", "\\triangleplus", true)
|
511
|
+
defineSymbol(math, bin, "\u2A3B", "\\triangletimes", true)
|
512
|
+
defineSymbol(math, bin, "\u27E4", "\\whitesquaretickleft", true)
|
513
|
+
defineSymbol(math, bin, "\u27E5", "\\whitesquaretickright", true)
|
514
|
+
defineSymbol(math, bin, "\u2A33", "\\smashtimes", true)
|
450
515
|
|
451
516
|
// AMS Arrows
|
452
517
|
// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
|
@@ -688,8 +753,8 @@ defineSymbol(math, spacing, null, "\\allowbreak");
|
|
688
753
|
defineSymbol(math, punct, ",", ",");
|
689
754
|
defineSymbol(text, punct, ":", ":");
|
690
755
|
defineSymbol(math, punct, ";", ";");
|
691
|
-
defineSymbol(math, bin, "\u22bc", "\\barwedge"
|
692
|
-
defineSymbol(math, bin, "\u22bb", "\\veebar"
|
756
|
+
defineSymbol(math, bin, "\u22bc", "\\barwedge");
|
757
|
+
defineSymbol(math, bin, "\u22bb", "\\veebar");
|
693
758
|
defineSymbol(math, bin, "\u2299", "\\odot", true);
|
694
759
|
// Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
|
695
760
|
defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
|
@@ -702,7 +767,6 @@ defineSymbol(math, bin, "\u25b3", "\\bigtriangleup");
|
|
702
767
|
defineSymbol(math, bin, "\u25bd", "\\bigtriangledown");
|
703
768
|
defineSymbol(math, bin, "\u2020", "\\dagger");
|
704
769
|
defineSymbol(math, bin, "\u22c4", "\\diamond");
|
705
|
-
defineSymbol(math, bin, "\u22c6", "\\star");
|
706
770
|
defineSymbol(math, bin, "\u25c3", "\\triangleleft");
|
707
771
|
defineSymbol(math, bin, "\u25b9", "\\triangleright");
|
708
772
|
defineSymbol(math, open, "{", "\\{");
|
package/src/utils.js
CHANGED
@@ -81,11 +81,29 @@ export const assert = function(value) {
|
|
81
81
|
|
82
82
|
/**
|
83
83
|
* Return the protocol of a URL, or "_relative" if the URL does not specify a
|
84
|
-
* protocol (and thus is relative)
|
84
|
+
* protocol (and thus is relative), or `null` if URL has invalid protocol
|
85
|
+
* (so should be outright rejected).
|
85
86
|
*/
|
86
87
|
export const protocolFromUrl = function(url) {
|
87
|
-
|
88
|
-
|
88
|
+
// Check for possible leading protocol.
|
89
|
+
// https://url.spec.whatwg.org/#url-parsing strips leading whitespace
|
90
|
+
// (\x00) or C0 control (\x00-\x1F) characters.
|
91
|
+
// eslint-disable-next-line no-control-regex
|
92
|
+
const protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(url);
|
93
|
+
if (!protocol) {
|
94
|
+
return "_relative";
|
95
|
+
}
|
96
|
+
// Reject weird colons
|
97
|
+
if (protocol[2] !== ":") {
|
98
|
+
return null;
|
99
|
+
}
|
100
|
+
// Reject invalid characters in scheme according to
|
101
|
+
// https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
|
102
|
+
if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
|
103
|
+
return null;
|
104
|
+
}
|
105
|
+
// Lowercase the protocol
|
106
|
+
return protocol[1].toLowerCase();
|
89
107
|
};
|
90
108
|
|
91
109
|
/**
|