temml 0.10.22 → 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 +154 -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 +136 -12
- package/dist/temml.js +136 -12
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +136 -12
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Settings.js +5 -1
- package/src/buildMathML.js +7 -4
- package/src/functions/def.js +3 -0
- package/src/functions/font.js +30 -1
- package/src/postProcess.js +1 -1
- package/src/symbols.js +70 -3
- package/src/utils.js +21 -3
package/README.md
CHANGED
package/dist/Temml-Asana.css
CHANGED
@@ -0,0 +1,154 @@
|
|
1
|
+
/*
|
2
|
+
Fira Math fonts are released under the SIL OPEN FONT LICENSE Version 1.1.
|
3
|
+
|
4
|
+
The Fira Math WOFF2 font has been obtained from
|
5
|
+
http://www.gust.org.pl/projects/e-foundry/
|
6
|
+
|
7
|
+
The Temml.woff2 is a clone of KaTeX_Script-Regular, except that the code points
|
8
|
+
have been changed from ASCII to Unicode Mathematical Alphanumeric Symbols Script capitals,
|
9
|
+
Unicode range 1D49C to 1D4B5.
|
10
|
+
*/
|
11
|
+
|
12
|
+
@font-face {
|
13
|
+
font-family: 'Temml';
|
14
|
+
src: url('Temml.woff2') format('woff2');
|
15
|
+
font-weight: normal;
|
16
|
+
font-style: normal;
|
17
|
+
}
|
18
|
+
|
19
|
+
@font-face {
|
20
|
+
font-family: Fira Math;
|
21
|
+
src: url('FiraMath-Regular.woff2');
|
22
|
+
}
|
23
|
+
|
24
|
+
math {
|
25
|
+
font-style: normal;
|
26
|
+
font-weight: normal;
|
27
|
+
line-height: normal;
|
28
|
+
font-size-adjust: none;
|
29
|
+
text-indent: 0;
|
30
|
+
text-transform: none;
|
31
|
+
letter-spacing: normal;
|
32
|
+
word-wrap: normal;
|
33
|
+
direction: ltr;
|
34
|
+
/* Prevent Firefox from omitting the dot on i or j. */
|
35
|
+
font-feature-settings: "dtls" off;
|
36
|
+
}
|
37
|
+
|
38
|
+
math * {
|
39
|
+
border-color: currentColor;
|
40
|
+
}
|
41
|
+
|
42
|
+
math {
|
43
|
+
font-family: "Fira Math", math;
|
44
|
+
}
|
45
|
+
|
46
|
+
/* Next line is active in Firefox and Safari.
|
47
|
+
* Not in Chromium, which recognizes display: "block math" written inline. */
|
48
|
+
math.tml-display { display: block; }
|
49
|
+
|
50
|
+
*.mathscr {
|
51
|
+
font-family: "Temml";
|
52
|
+
}
|
53
|
+
|
54
|
+
/* Chromium prime alignment */
|
55
|
+
mo.tml-prime {
|
56
|
+
font-family: Temml;
|
57
|
+
}
|
58
|
+
|
59
|
+
mrow.tml-cancel {
|
60
|
+
background: linear-gradient(to top left,
|
61
|
+
rgba(0,0,0,0) 0%,
|
62
|
+
rgba(0,0,0,0) calc(50% - 0.06em),
|
63
|
+
rgba(0,0,0,1) 50%,
|
64
|
+
rgba(0,0,0,0) calc(50% + 0.06em),
|
65
|
+
rgba(0,0,0,0) 100%);
|
66
|
+
}
|
67
|
+
|
68
|
+
mrow.tml-bcancel {
|
69
|
+
background: linear-gradient(to top right,
|
70
|
+
rgba(0,0,0,0) 0%,
|
71
|
+
rgba(0,0,0,0) calc(50% - 0.06em),
|
72
|
+
rgba(0,0,0,1) 50%,
|
73
|
+
rgba(0,0,0,0) calc(50% + 0.06em),
|
74
|
+
rgba(0,0,0,0) 100%);
|
75
|
+
}
|
76
|
+
|
77
|
+
mrow.tml-xcancel {
|
78
|
+
background: linear-gradient(to top left,
|
79
|
+
rgba(0,0,0,0) 0%,
|
80
|
+
rgba(0,0,0,0) calc(50% - 0.06em),
|
81
|
+
rgba(0,0,0,1) 50%,
|
82
|
+
rgba(0,0,0,0) calc(50% + 0.06em),
|
83
|
+
rgba(0,0,0,0) 100%),
|
84
|
+
linear-gradient(to top right,
|
85
|
+
rgba(0,0,0,0) 0%,
|
86
|
+
rgba(0,0,0,0) calc(50% - 0.06em),
|
87
|
+
rgba(0,0,0,1) 50%,
|
88
|
+
rgba(0,0,0,0) calc(50% + 0.06em),
|
89
|
+
rgba(0,0,0,0) 100%)
|
90
|
+
}
|
91
|
+
|
92
|
+
/* Prevent f' from overlapping in Chromium */
|
93
|
+
mo.prime-pad {
|
94
|
+
padding-left: 0.08em;
|
95
|
+
}
|
96
|
+
|
97
|
+
/* Array cell justification in Firefox & WebKit */
|
98
|
+
.tml-right {
|
99
|
+
text-align: right;
|
100
|
+
}
|
101
|
+
.tml-left {
|
102
|
+
text-align: left;
|
103
|
+
}
|
104
|
+
|
105
|
+
/* Stretch \widetilde & set array cell justification in Chromium */
|
106
|
+
@supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
|
107
|
+
.tml-crooked-2 {
|
108
|
+
transform: scale(2.0, 1.1)
|
109
|
+
}
|
110
|
+
.tml-crooked-3 {
|
111
|
+
transform: scale(3.0, 1.3)
|
112
|
+
}
|
113
|
+
.tml-crooked-4 {
|
114
|
+
transform: scale(4.0, 1.4)
|
115
|
+
}
|
116
|
+
.tml-right {
|
117
|
+
text-align: -webkit-right;
|
118
|
+
}
|
119
|
+
.tml-left {
|
120
|
+
text-align: -webkit-left;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
/* Adjust WebKit accents */
|
125
|
+
@supports (-webkit-backdrop-filter: blur(1px)) {
|
126
|
+
.tml-xshift { transform: translate(0px, 0.45em) }
|
127
|
+
.tml-capshift { transform: translate(0px, 0.35em) }
|
128
|
+
}
|
129
|
+
|
130
|
+
/* flex-wrap for line-breaking in Chromium */
|
131
|
+
math {
|
132
|
+
display: inline-flex;
|
133
|
+
flex-wrap: wrap;
|
134
|
+
align-items: baseline;
|
135
|
+
}
|
136
|
+
math > mrow {
|
137
|
+
padding: 0.5ex 0ex;
|
138
|
+
}
|
139
|
+
|
140
|
+
/* Avoid flex-wrap in Firefox */
|
141
|
+
@-moz-document url-prefix() {
|
142
|
+
math { display: inline; }
|
143
|
+
math > mrow { padding: 0 }
|
144
|
+
}
|
145
|
+
|
146
|
+
/* AMS environment auto-numbering via CSS counter. */
|
147
|
+
.tml-eqn::before {
|
148
|
+
counter-increment: tmlEqnNo;
|
149
|
+
content: "(" counter(tmlEqnNo) ")";
|
150
|
+
}
|
151
|
+
|
152
|
+
body {
|
153
|
+
counter-reset: tmlEqnNo;
|
154
|
+
}
|
package/dist/Temml-Local.css
CHANGED
package/dist/Temml-STIX2.css
CHANGED
package/dist/temml.cjs
CHANGED
@@ -146,11 +146,29 @@ const assert = function(value) {
|
|
146
146
|
|
147
147
|
/**
|
148
148
|
* Return the protocol of a URL, or "_relative" if the URL does not specify a
|
149
|
-
* protocol (and thus is relative)
|
149
|
+
* protocol (and thus is relative), or `null` if URL has invalid protocol
|
150
|
+
* (so should be outright rejected).
|
150
151
|
*/
|
151
152
|
const protocolFromUrl = function(url) {
|
152
|
-
|
153
|
-
|
153
|
+
// Check for possible leading protocol.
|
154
|
+
// https://url.spec.whatwg.org/#url-parsing strips leading whitespace
|
155
|
+
// (\x00) or C0 control (\x00-\x1F) characters.
|
156
|
+
// eslint-disable-next-line no-control-regex
|
157
|
+
const protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(url);
|
158
|
+
if (!protocol) {
|
159
|
+
return "_relative";
|
160
|
+
}
|
161
|
+
// Reject weird colons
|
162
|
+
if (protocol[2] !== ":") {
|
163
|
+
return null;
|
164
|
+
}
|
165
|
+
// Reject invalid characters in scheme according to
|
166
|
+
// https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
|
167
|
+
if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
|
168
|
+
return null;
|
169
|
+
}
|
170
|
+
// Lowercase the protocol
|
171
|
+
return protocol[1].toLowerCase();
|
154
172
|
};
|
155
173
|
|
156
174
|
/**
|
@@ -215,7 +233,11 @@ class Settings {
|
|
215
233
|
*/
|
216
234
|
isTrusted(context) {
|
217
235
|
if (context.url && !context.protocol) {
|
218
|
-
|
236
|
+
const protocol = utils.protocolFromUrl(context.url);
|
237
|
+
if (protocol == null) {
|
238
|
+
return false
|
239
|
+
}
|
240
|
+
context.protocol = protocol;
|
219
241
|
}
|
220
242
|
const trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
|
221
243
|
return Boolean(trust);
|
@@ -1026,6 +1048,7 @@ defineSymbol(math, mathord, "\u2609", "\\astrosun", true);
|
|
1026
1048
|
defineSymbol(math, mathord, "\u263c", "\\sun", true);
|
1027
1049
|
defineSymbol(math, mathord, "\u263e", "\\leftmoon", true);
|
1028
1050
|
defineSymbol(math, mathord, "\u263d", "\\rightmoon", true);
|
1051
|
+
defineSymbol(math, mathord, "\u2295", "\\Earth");
|
1029
1052
|
|
1030
1053
|
// AMS Negated Binary Relations
|
1031
1054
|
defineSymbol(math, rel, "\u226e", "\\nless", true);
|
@@ -1253,6 +1276,73 @@ defineSymbol(math, bin, "\u27d5", "\\leftouterjoin", true);
|
|
1253
1276
|
defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
|
1254
1277
|
defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
|
1255
1278
|
|
1279
|
+
// stix Binary Operators
|
1280
|
+
defineSymbol(math, bin, "\u2238", "\\dotminus", true);
|
1281
|
+
defineSymbol(math, bin, "\u27D1", "\\wedgedot", true);
|
1282
|
+
defineSymbol(math, bin, "\u27C7", "\\veedot", true);
|
1283
|
+
defineSymbol(math, bin, "\u2A62", "\\doublebarvee", true);
|
1284
|
+
defineSymbol(math, bin, "\u2A63", "\\veedoublebar", true);
|
1285
|
+
defineSymbol(math, bin, "\u2A5F", "\\wedgebar", true);
|
1286
|
+
defineSymbol(math, bin, "\u2A60", "\\wedgedoublebar", true);
|
1287
|
+
defineSymbol(math, bin, "\u2A54", "\\Vee", true);
|
1288
|
+
defineSymbol(math, bin, "\u2A53", "\\Wedge", true);
|
1289
|
+
defineSymbol(math, bin, "\u2A43", "\\barcap", true);
|
1290
|
+
defineSymbol(math, bin, "\u2A42", "\\barcup", true);
|
1291
|
+
defineSymbol(math, bin, "\u2A48", "\\capbarcup", true);
|
1292
|
+
defineSymbol(math, bin, "\u2A40", "\\capdot", true);
|
1293
|
+
defineSymbol(math, bin, "\u2A47", "\\capovercup", true);
|
1294
|
+
defineSymbol(math, bin, "\u2A46", "\\cupovercap", true);
|
1295
|
+
defineSymbol(math, bin, "\u2A4D", "\\closedvarcap", true);
|
1296
|
+
defineSymbol(math, bin, "\u2A4C", "\\closedvarcup", true);
|
1297
|
+
defineSymbol(math, bin, "\u2A2A", "\\minusdot", true);
|
1298
|
+
defineSymbol(math, bin, "\u2A2B", "\\minusfdots", true);
|
1299
|
+
defineSymbol(math, bin, "\u2A2C", "\\minusrdots", true);
|
1300
|
+
defineSymbol(math, bin, "\u22BB", "\\Xor", true);
|
1301
|
+
defineSymbol(math, bin, "\u22BC", "\\Nand", true);
|
1302
|
+
defineSymbol(math, bin, "\u22BD", "\\Nor", true);
|
1303
|
+
defineSymbol(math, bin, "\u22BD", "\\barvee");
|
1304
|
+
defineSymbol(math, bin, "\u2AF4", "\\interleave", true);
|
1305
|
+
defineSymbol(math, bin, "\u29E2", "\\shuffle", true);
|
1306
|
+
defineSymbol(math, bin, "\u2AF6", "\\threedotcolon", true);
|
1307
|
+
defineSymbol(math, bin, "\u2982", "\\typecolon", true);
|
1308
|
+
defineSymbol(math, bin, "\u223E", "\\invlazys", true);
|
1309
|
+
defineSymbol(math, bin, "\u2A4B", "\\twocaps", true);
|
1310
|
+
defineSymbol(math, bin, "\u2A4A", "\\twocups", true);
|
1311
|
+
defineSymbol(math, bin, "\u2A4E", "\\Sqcap", true);
|
1312
|
+
defineSymbol(math, bin, "\u2A4F", "\\Sqcup", true);
|
1313
|
+
defineSymbol(math, bin, "\u2A56", "\\veeonvee", true);
|
1314
|
+
defineSymbol(math, bin, "\u2A55", "\\wedgeonwedge", true);
|
1315
|
+
defineSymbol(math, bin, "\u29D7", "\\blackhourglass", true);
|
1316
|
+
defineSymbol(math, bin, "\u29C6", "\\boxast", true);
|
1317
|
+
defineSymbol(math, bin, "\u29C8", "\\boxbox", true);
|
1318
|
+
defineSymbol(math, bin, "\u29C7", "\\boxcircle", true);
|
1319
|
+
defineSymbol(math, bin, "\u229C", "\\circledequal", true);
|
1320
|
+
defineSymbol(math, bin, "\u29B7", "\\circledparallel", true);
|
1321
|
+
defineSymbol(math, bin, "\u29B6", "\\circledvert", true);
|
1322
|
+
defineSymbol(math, bin, "\u29B5", "\\circlehbar", true);
|
1323
|
+
defineSymbol(math, bin, "\u27E1", "\\concavediamond", true);
|
1324
|
+
defineSymbol(math, bin, "\u27E2", "\\concavediamondtickleft", true);
|
1325
|
+
defineSymbol(math, bin, "\u27E3", "\\concavediamondtickright", true);
|
1326
|
+
defineSymbol(math, bin, "\u22C4", "\\diamond", true);
|
1327
|
+
defineSymbol(math, bin, "\u29D6", "\\hourglass", true);
|
1328
|
+
defineSymbol(math, bin, "\u27E0", "\\lozengeminus", true);
|
1329
|
+
defineSymbol(math, bin, "\u233D", "\\obar", true);
|
1330
|
+
defineSymbol(math, bin, "\u29B8", "\\obslash", true);
|
1331
|
+
defineSymbol(math, bin, "\u2A38", "\\odiv", true);
|
1332
|
+
defineSymbol(math, bin, "\u29C1", "\\ogreaterthan", true);
|
1333
|
+
defineSymbol(math, bin, "\u29C0", "\\olessthan", true);
|
1334
|
+
defineSymbol(math, bin, "\u29B9", "\\operp", true);
|
1335
|
+
defineSymbol(math, bin, "\u2A37", "\\Otimes", true);
|
1336
|
+
defineSymbol(math, bin, "\u2A36", "\\otimeshat", true);
|
1337
|
+
defineSymbol(math, bin, "\u22C6", "\\star", true);
|
1338
|
+
defineSymbol(math, bin, "\u25B3", "\\triangle", true);
|
1339
|
+
defineSymbol(math, bin, "\u2A3A", "\\triangleminus", true);
|
1340
|
+
defineSymbol(math, bin, "\u2A39", "\\triangleplus", true);
|
1341
|
+
defineSymbol(math, bin, "\u2A3B", "\\triangletimes", true);
|
1342
|
+
defineSymbol(math, bin, "\u27E4", "\\whitesquaretickleft", true);
|
1343
|
+
defineSymbol(math, bin, "\u27E5", "\\whitesquaretickright", true);
|
1344
|
+
defineSymbol(math, bin, "\u2A33", "\\smashtimes", true);
|
1345
|
+
|
1256
1346
|
// AMS Arrows
|
1257
1347
|
// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
|
1258
1348
|
// We'll map it to AMS function \dashrightarrow. It produces the same atom.
|
@@ -1493,8 +1583,8 @@ defineSymbol(math, spacing, null, "\\allowbreak");
|
|
1493
1583
|
defineSymbol(math, punct, ",", ",");
|
1494
1584
|
defineSymbol(text, punct, ":", ":");
|
1495
1585
|
defineSymbol(math, punct, ";", ";");
|
1496
|
-
defineSymbol(math, bin, "\u22bc", "\\barwedge"
|
1497
|
-
defineSymbol(math, bin, "\u22bb", "\\veebar"
|
1586
|
+
defineSymbol(math, bin, "\u22bc", "\\barwedge");
|
1587
|
+
defineSymbol(math, bin, "\u22bb", "\\veebar");
|
1498
1588
|
defineSymbol(math, bin, "\u2299", "\\odot", true);
|
1499
1589
|
// Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
|
1500
1590
|
defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
|
@@ -1507,7 +1597,6 @@ defineSymbol(math, bin, "\u25b3", "\\bigtriangleup");
|
|
1507
1597
|
defineSymbol(math, bin, "\u25bd", "\\bigtriangledown");
|
1508
1598
|
defineSymbol(math, bin, "\u2020", "\\dagger");
|
1509
1599
|
defineSymbol(math, bin, "\u22c4", "\\diamond");
|
1510
|
-
defineSymbol(math, bin, "\u22c6", "\\star");
|
1511
1600
|
defineSymbol(math, bin, "\u25c3", "\\triangleleft");
|
1512
1601
|
defineSymbol(math, bin, "\u25b9", "\\triangleright");
|
1513
1602
|
defineSymbol(math, open, "{", "\\{");
|
@@ -2021,9 +2110,11 @@ const consolidateText = mrow => {
|
|
2021
2110
|
};
|
2022
2111
|
|
2023
2112
|
const numberRegEx$1 = /^[0-9]$/;
|
2024
|
-
const
|
2025
|
-
return (node.type === "
|
2026
|
-
|
2113
|
+
const isDotOrComma = (node, followingNode) => {
|
2114
|
+
return ((node.type === "textord" && node.text === ".") ||
|
2115
|
+
(node.type === "atom" && node.text === ",")) &&
|
2116
|
+
// Don't consolidate if there is a space after the comma.
|
2117
|
+
node.loc && followingNode.loc && node.loc.end === followingNode.loc.start
|
2027
2118
|
};
|
2028
2119
|
const consolidateNumbers = expression => {
|
2029
2120
|
// Consolidate adjacent numbers. We want to return <mn>1,506.3</mn>,
|
@@ -2046,7 +2137,8 @@ const consolidateNumbers = expression => {
|
|
2046
2137
|
|
2047
2138
|
// Determine if numeral groups are separated by a comma or dot.
|
2048
2139
|
for (let i = nums.length - 1; i > 0; i--) {
|
2049
|
-
if (nums[i - 1].end === nums[i].start - 2 &&
|
2140
|
+
if (nums[i - 1].end === nums[i].start - 2 &&
|
2141
|
+
isDotOrComma(expression[nums[i].start - 1], expression[nums[i].start])) {
|
2050
2142
|
// Merge the two groups.
|
2051
2143
|
nums[i - 1].end = nums[i].end;
|
2052
2144
|
nums.splice(i, 1);
|
@@ -3479,6 +3571,9 @@ defineFunction({
|
|
3479
3571
|
|
3480
3572
|
if (funcName === "\\edef" || funcName === "\\xdef") {
|
3481
3573
|
tokens = parser.gullet.expandTokens(tokens);
|
3574
|
+
if (tokens.length > parser.gullet.settings.maxExpand) {
|
3575
|
+
throw new ParseError("Too many expansions in an " + funcName);
|
3576
|
+
}
|
3482
3577
|
tokens.reverse(); // to fit in with stack order
|
3483
3578
|
}
|
3484
3579
|
// Final arg is the expansion of the macro
|
@@ -5112,6 +5207,21 @@ defineFunction({
|
|
5112
5207
|
}
|
5113
5208
|
});
|
5114
5209
|
|
5210
|
+
const isLongVariableName = (group, font) => {
|
5211
|
+
if (font !== "mathrm" || group.body.type !== "ordgroup" || group.body.body.length === 1) {
|
5212
|
+
return false
|
5213
|
+
}
|
5214
|
+
if (group.body.body[0].type !== "mathord") { return false }
|
5215
|
+
for (let i = 1; i < group.body.body.length; i++) {
|
5216
|
+
const parseNodeType = group.body.body[i].type;
|
5217
|
+
if (!(parseNodeType === "mathord" ||
|
5218
|
+
(parseNodeType === "textord" && !isNaN(group.body.body[i].text)))) {
|
5219
|
+
return false
|
5220
|
+
}
|
5221
|
+
}
|
5222
|
+
return true
|
5223
|
+
};
|
5224
|
+
|
5115
5225
|
const mathmlBuilder$6 = (group, style) => {
|
5116
5226
|
const font = group.font;
|
5117
5227
|
const newStyle = style.withFont(font);
|
@@ -5123,6 +5233,20 @@ const mathmlBuilder$6 = (group, style) => {
|
|
5123
5233
|
return mathGroup
|
5124
5234
|
}
|
5125
5235
|
// Check if it is possible to consolidate elements into a single <mi> element.
|
5236
|
+
if (isLongVariableName(group, font)) {
|
5237
|
+
// This is a \mathrm{…} group. It gets special treatment because symbolsOrd.js
|
5238
|
+
// wraps <mi> elements with <mrow>s to work around a Firefox bug.
|
5239
|
+
const mi = mathGroup.children[0].children[0];
|
5240
|
+
delete mi.attributes.mathvariant;
|
5241
|
+
for (let i = 1; i < mathGroup.children.length; i++) {
|
5242
|
+
mi.children[0].text += mathGroup.children[i].type === "mn"
|
5243
|
+
? mathGroup.children[i].children[0].text
|
5244
|
+
: mathGroup.children[i].children[0].children[0].text;
|
5245
|
+
}
|
5246
|
+
// Wrap in a <mrow> to prevent the same Firefox bug.
|
5247
|
+
const bogus = new mathMLTree.MathNode("mtext", new mathMLTree.TextNode("\u200b"));
|
5248
|
+
return new mathMLTree.MathNode("mrow", [bogus, mi])
|
5249
|
+
}
|
5126
5250
|
let canConsolidate = mathGroup.children[0].type === "mo";
|
5127
5251
|
for (let i = 1; i < mathGroup.children.length; i++) {
|
5128
5252
|
if (mathGroup.children[i].type === "mo" && font === "boldsymbol") {
|
@@ -13188,7 +13312,7 @@ class Style {
|
|
13188
13312
|
* https://mit-license.org/
|
13189
13313
|
*/
|
13190
13314
|
|
13191
|
-
const version = "0.10.
|
13315
|
+
const version = "0.10.24";
|
13192
13316
|
|
13193
13317
|
function postProcess(block) {
|
13194
13318
|
const labelMap = {};
|
package/dist/temml.js
CHANGED
@@ -147,11 +147,29 @@ var temml = (function () {
|
|
147
147
|
|
148
148
|
/**
|
149
149
|
* Return the protocol of a URL, or "_relative" if the URL does not specify a
|
150
|
-
* protocol (and thus is relative)
|
150
|
+
* protocol (and thus is relative), or `null` if URL has invalid protocol
|
151
|
+
* (so should be outright rejected).
|
151
152
|
*/
|
152
153
|
const protocolFromUrl = function(url) {
|
153
|
-
|
154
|
-
|
154
|
+
// Check for possible leading protocol.
|
155
|
+
// https://url.spec.whatwg.org/#url-parsing strips leading whitespace
|
156
|
+
// (\x00) or C0 control (\x00-\x1F) characters.
|
157
|
+
// eslint-disable-next-line no-control-regex
|
158
|
+
const protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(url);
|
159
|
+
if (!protocol) {
|
160
|
+
return "_relative";
|
161
|
+
}
|
162
|
+
// Reject weird colons
|
163
|
+
if (protocol[2] !== ":") {
|
164
|
+
return null;
|
165
|
+
}
|
166
|
+
// Reject invalid characters in scheme according to
|
167
|
+
// https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
|
168
|
+
if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {
|
169
|
+
return null;
|
170
|
+
}
|
171
|
+
// Lowercase the protocol
|
172
|
+
return protocol[1].toLowerCase();
|
155
173
|
};
|
156
174
|
|
157
175
|
/**
|
@@ -216,7 +234,11 @@ var temml = (function () {
|
|
216
234
|
*/
|
217
235
|
isTrusted(context) {
|
218
236
|
if (context.url && !context.protocol) {
|
219
|
-
|
237
|
+
const protocol = utils.protocolFromUrl(context.url);
|
238
|
+
if (protocol == null) {
|
239
|
+
return false
|
240
|
+
}
|
241
|
+
context.protocol = protocol;
|
220
242
|
}
|
221
243
|
const trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
|
222
244
|
return Boolean(trust);
|
@@ -1027,6 +1049,7 @@ var temml = (function () {
|
|
1027
1049
|
defineSymbol(math, mathord, "\u263c", "\\sun", true);
|
1028
1050
|
defineSymbol(math, mathord, "\u263e", "\\leftmoon", true);
|
1029
1051
|
defineSymbol(math, mathord, "\u263d", "\\rightmoon", true);
|
1052
|
+
defineSymbol(math, mathord, "\u2295", "\\Earth");
|
1030
1053
|
|
1031
1054
|
// AMS Negated Binary Relations
|
1032
1055
|
defineSymbol(math, rel, "\u226e", "\\nless", true);
|
@@ -1254,6 +1277,73 @@ var temml = (function () {
|
|
1254
1277
|
defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
|
1255
1278
|
defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
|
1256
1279
|
|
1280
|
+
// stix Binary Operators
|
1281
|
+
defineSymbol(math, bin, "\u2238", "\\dotminus", true);
|
1282
|
+
defineSymbol(math, bin, "\u27D1", "\\wedgedot", true);
|
1283
|
+
defineSymbol(math, bin, "\u27C7", "\\veedot", true);
|
1284
|
+
defineSymbol(math, bin, "\u2A62", "\\doublebarvee", true);
|
1285
|
+
defineSymbol(math, bin, "\u2A63", "\\veedoublebar", true);
|
1286
|
+
defineSymbol(math, bin, "\u2A5F", "\\wedgebar", true);
|
1287
|
+
defineSymbol(math, bin, "\u2A60", "\\wedgedoublebar", true);
|
1288
|
+
defineSymbol(math, bin, "\u2A54", "\\Vee", true);
|
1289
|
+
defineSymbol(math, bin, "\u2A53", "\\Wedge", true);
|
1290
|
+
defineSymbol(math, bin, "\u2A43", "\\barcap", true);
|
1291
|
+
defineSymbol(math, bin, "\u2A42", "\\barcup", true);
|
1292
|
+
defineSymbol(math, bin, "\u2A48", "\\capbarcup", true);
|
1293
|
+
defineSymbol(math, bin, "\u2A40", "\\capdot", true);
|
1294
|
+
defineSymbol(math, bin, "\u2A47", "\\capovercup", true);
|
1295
|
+
defineSymbol(math, bin, "\u2A46", "\\cupovercap", true);
|
1296
|
+
defineSymbol(math, bin, "\u2A4D", "\\closedvarcap", true);
|
1297
|
+
defineSymbol(math, bin, "\u2A4C", "\\closedvarcup", true);
|
1298
|
+
defineSymbol(math, bin, "\u2A2A", "\\minusdot", true);
|
1299
|
+
defineSymbol(math, bin, "\u2A2B", "\\minusfdots", true);
|
1300
|
+
defineSymbol(math, bin, "\u2A2C", "\\minusrdots", true);
|
1301
|
+
defineSymbol(math, bin, "\u22BB", "\\Xor", true);
|
1302
|
+
defineSymbol(math, bin, "\u22BC", "\\Nand", true);
|
1303
|
+
defineSymbol(math, bin, "\u22BD", "\\Nor", true);
|
1304
|
+
defineSymbol(math, bin, "\u22BD", "\\barvee");
|
1305
|
+
defineSymbol(math, bin, "\u2AF4", "\\interleave", true);
|
1306
|
+
defineSymbol(math, bin, "\u29E2", "\\shuffle", true);
|
1307
|
+
defineSymbol(math, bin, "\u2AF6", "\\threedotcolon", true);
|
1308
|
+
defineSymbol(math, bin, "\u2982", "\\typecolon", true);
|
1309
|
+
defineSymbol(math, bin, "\u223E", "\\invlazys", true);
|
1310
|
+
defineSymbol(math, bin, "\u2A4B", "\\twocaps", true);
|
1311
|
+
defineSymbol(math, bin, "\u2A4A", "\\twocups", true);
|
1312
|
+
defineSymbol(math, bin, "\u2A4E", "\\Sqcap", true);
|
1313
|
+
defineSymbol(math, bin, "\u2A4F", "\\Sqcup", true);
|
1314
|
+
defineSymbol(math, bin, "\u2A56", "\\veeonvee", true);
|
1315
|
+
defineSymbol(math, bin, "\u2A55", "\\wedgeonwedge", true);
|
1316
|
+
defineSymbol(math, bin, "\u29D7", "\\blackhourglass", true);
|
1317
|
+
defineSymbol(math, bin, "\u29C6", "\\boxast", true);
|
1318
|
+
defineSymbol(math, bin, "\u29C8", "\\boxbox", true);
|
1319
|
+
defineSymbol(math, bin, "\u29C7", "\\boxcircle", true);
|
1320
|
+
defineSymbol(math, bin, "\u229C", "\\circledequal", true);
|
1321
|
+
defineSymbol(math, bin, "\u29B7", "\\circledparallel", true);
|
1322
|
+
defineSymbol(math, bin, "\u29B6", "\\circledvert", true);
|
1323
|
+
defineSymbol(math, bin, "\u29B5", "\\circlehbar", true);
|
1324
|
+
defineSymbol(math, bin, "\u27E1", "\\concavediamond", true);
|
1325
|
+
defineSymbol(math, bin, "\u27E2", "\\concavediamondtickleft", true);
|
1326
|
+
defineSymbol(math, bin, "\u27E3", "\\concavediamondtickright", true);
|
1327
|
+
defineSymbol(math, bin, "\u22C4", "\\diamond", true);
|
1328
|
+
defineSymbol(math, bin, "\u29D6", "\\hourglass", true);
|
1329
|
+
defineSymbol(math, bin, "\u27E0", "\\lozengeminus", true);
|
1330
|
+
defineSymbol(math, bin, "\u233D", "\\obar", true);
|
1331
|
+
defineSymbol(math, bin, "\u29B8", "\\obslash", true);
|
1332
|
+
defineSymbol(math, bin, "\u2A38", "\\odiv", true);
|
1333
|
+
defineSymbol(math, bin, "\u29C1", "\\ogreaterthan", true);
|
1334
|
+
defineSymbol(math, bin, "\u29C0", "\\olessthan", true);
|
1335
|
+
defineSymbol(math, bin, "\u29B9", "\\operp", true);
|
1336
|
+
defineSymbol(math, bin, "\u2A37", "\\Otimes", true);
|
1337
|
+
defineSymbol(math, bin, "\u2A36", "\\otimeshat", true);
|
1338
|
+
defineSymbol(math, bin, "\u22C6", "\\star", true);
|
1339
|
+
defineSymbol(math, bin, "\u25B3", "\\triangle", true);
|
1340
|
+
defineSymbol(math, bin, "\u2A3A", "\\triangleminus", true);
|
1341
|
+
defineSymbol(math, bin, "\u2A39", "\\triangleplus", true);
|
1342
|
+
defineSymbol(math, bin, "\u2A3B", "\\triangletimes", true);
|
1343
|
+
defineSymbol(math, bin, "\u27E4", "\\whitesquaretickleft", true);
|
1344
|
+
defineSymbol(math, bin, "\u27E5", "\\whitesquaretickright", true);
|
1345
|
+
defineSymbol(math, bin, "\u2A33", "\\smashtimes", true);
|
1346
|
+
|
1257
1347
|
// AMS Arrows
|
1258
1348
|
// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
|
1259
1349
|
// We'll map it to AMS function \dashrightarrow. It produces the same atom.
|
@@ -1494,8 +1584,8 @@ var temml = (function () {
|
|
1494
1584
|
defineSymbol(math, punct, ",", ",");
|
1495
1585
|
defineSymbol(text, punct, ":", ":");
|
1496
1586
|
defineSymbol(math, punct, ";", ";");
|
1497
|
-
defineSymbol(math, bin, "\u22bc", "\\barwedge"
|
1498
|
-
defineSymbol(math, bin, "\u22bb", "\\veebar"
|
1587
|
+
defineSymbol(math, bin, "\u22bc", "\\barwedge");
|
1588
|
+
defineSymbol(math, bin, "\u22bb", "\\veebar");
|
1499
1589
|
defineSymbol(math, bin, "\u2299", "\\odot", true);
|
1500
1590
|
// Firefox turns ⊕ into an emoji. So append \uFE0E. Define Unicode character in macros, not here.
|
1501
1591
|
defineSymbol(math, bin, "\u2295\uFE0E", "\\oplus");
|
@@ -1508,7 +1598,6 @@ var temml = (function () {
|
|
1508
1598
|
defineSymbol(math, bin, "\u25bd", "\\bigtriangledown");
|
1509
1599
|
defineSymbol(math, bin, "\u2020", "\\dagger");
|
1510
1600
|
defineSymbol(math, bin, "\u22c4", "\\diamond");
|
1511
|
-
defineSymbol(math, bin, "\u22c6", "\\star");
|
1512
1601
|
defineSymbol(math, bin, "\u25c3", "\\triangleleft");
|
1513
1602
|
defineSymbol(math, bin, "\u25b9", "\\triangleright");
|
1514
1603
|
defineSymbol(math, open, "{", "\\{");
|
@@ -2022,9 +2111,11 @@ var temml = (function () {
|
|
2022
2111
|
};
|
2023
2112
|
|
2024
2113
|
const numberRegEx$1 = /^[0-9]$/;
|
2025
|
-
const
|
2026
|
-
return (node.type === "
|
2027
|
-
|
2114
|
+
const isDotOrComma = (node, followingNode) => {
|
2115
|
+
return ((node.type === "textord" && node.text === ".") ||
|
2116
|
+
(node.type === "atom" && node.text === ",")) &&
|
2117
|
+
// Don't consolidate if there is a space after the comma.
|
2118
|
+
node.loc && followingNode.loc && node.loc.end === followingNode.loc.start
|
2028
2119
|
};
|
2029
2120
|
const consolidateNumbers = expression => {
|
2030
2121
|
// Consolidate adjacent numbers. We want to return <mn>1,506.3</mn>,
|
@@ -2047,7 +2138,8 @@ var temml = (function () {
|
|
2047
2138
|
|
2048
2139
|
// Determine if numeral groups are separated by a comma or dot.
|
2049
2140
|
for (let i = nums.length - 1; i > 0; i--) {
|
2050
|
-
if (nums[i - 1].end === nums[i].start - 2 &&
|
2141
|
+
if (nums[i - 1].end === nums[i].start - 2 &&
|
2142
|
+
isDotOrComma(expression[nums[i].start - 1], expression[nums[i].start])) {
|
2051
2143
|
// Merge the two groups.
|
2052
2144
|
nums[i - 1].end = nums[i].end;
|
2053
2145
|
nums.splice(i, 1);
|
@@ -3480,6 +3572,9 @@ var temml = (function () {
|
|
3480
3572
|
|
3481
3573
|
if (funcName === "\\edef" || funcName === "\\xdef") {
|
3482
3574
|
tokens = parser.gullet.expandTokens(tokens);
|
3575
|
+
if (tokens.length > parser.gullet.settings.maxExpand) {
|
3576
|
+
throw new ParseError("Too many expansions in an " + funcName);
|
3577
|
+
}
|
3483
3578
|
tokens.reverse(); // to fit in with stack order
|
3484
3579
|
}
|
3485
3580
|
// Final arg is the expansion of the macro
|
@@ -5113,6 +5208,21 @@ var temml = (function () {
|
|
5113
5208
|
}
|
5114
5209
|
});
|
5115
5210
|
|
5211
|
+
const isLongVariableName = (group, font) => {
|
5212
|
+
if (font !== "mathrm" || group.body.type !== "ordgroup" || group.body.body.length === 1) {
|
5213
|
+
return false
|
5214
|
+
}
|
5215
|
+
if (group.body.body[0].type !== "mathord") { return false }
|
5216
|
+
for (let i = 1; i < group.body.body.length; i++) {
|
5217
|
+
const parseNodeType = group.body.body[i].type;
|
5218
|
+
if (!(parseNodeType === "mathord" ||
|
5219
|
+
(parseNodeType === "textord" && !isNaN(group.body.body[i].text)))) {
|
5220
|
+
return false
|
5221
|
+
}
|
5222
|
+
}
|
5223
|
+
return true
|
5224
|
+
};
|
5225
|
+
|
5116
5226
|
const mathmlBuilder$6 = (group, style) => {
|
5117
5227
|
const font = group.font;
|
5118
5228
|
const newStyle = style.withFont(font);
|
@@ -5124,6 +5234,20 @@ var temml = (function () {
|
|
5124
5234
|
return mathGroup
|
5125
5235
|
}
|
5126
5236
|
// Check if it is possible to consolidate elements into a single <mi> element.
|
5237
|
+
if (isLongVariableName(group, font)) {
|
5238
|
+
// This is a \mathrm{…} group. It gets special treatment because symbolsOrd.js
|
5239
|
+
// wraps <mi> elements with <mrow>s to work around a Firefox bug.
|
5240
|
+
const mi = mathGroup.children[0].children[0];
|
5241
|
+
delete mi.attributes.mathvariant;
|
5242
|
+
for (let i = 1; i < mathGroup.children.length; i++) {
|
5243
|
+
mi.children[0].text += mathGroup.children[i].type === "mn"
|
5244
|
+
? mathGroup.children[i].children[0].text
|
5245
|
+
: mathGroup.children[i].children[0].children[0].text;
|
5246
|
+
}
|
5247
|
+
// Wrap in a <mrow> to prevent the same Firefox bug.
|
5248
|
+
const bogus = new mathMLTree.MathNode("mtext", new mathMLTree.TextNode("\u200b"));
|
5249
|
+
return new mathMLTree.MathNode("mrow", [bogus, mi])
|
5250
|
+
}
|
5127
5251
|
let canConsolidate = mathGroup.children[0].type === "mo";
|
5128
5252
|
for (let i = 1; i < mathGroup.children.length; i++) {
|
5129
5253
|
if (mathGroup.children[i].type === "mo" && font === "boldsymbol") {
|
@@ -11289,7 +11413,7 @@ var temml = (function () {
|
|
11289
11413
|
* https://mit-license.org/
|
11290
11414
|
*/
|
11291
11415
|
|
11292
|
-
const version = "0.10.
|
11416
|
+
const version = "0.10.24";
|
11293
11417
|
|
11294
11418
|
function postProcess(block) {
|
11295
11419
|
const labelMap = {};
|