temml 0.11.4 → 0.11.6
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 +5 -2
- package/dist/Temml-Latin-Modern.css +5 -2
- package/dist/Temml-Libertinus.css +5 -2
- package/dist/Temml-Local.css +5 -2
- package/dist/Temml-NotoSans.css +5 -2
- package/dist/Temml-STIX2.css +5 -2
- package/dist/temml.cjs +19 -8
- package/dist/temml.js +19 -8
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +19 -8
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Parser.js +14 -3
- package/src/buildMathML.js +0 -3
- package/src/functions/relax.js +2 -1
- package/src/postProcess.js +1 -1
- package/src/stretchy.js +3 -1
package/README.md
CHANGED
package/dist/Temml-Asana.css
CHANGED
@@ -36,9 +36,12 @@ math {
|
|
36
36
|
font-family: Asana Math, math;
|
37
37
|
}
|
38
38
|
|
39
|
-
/*
|
39
|
+
/* display: block is necessary in Firefox and Safari.
|
40
40
|
* Not in Chromium, which recognizes display: "block math" written inline. */
|
41
|
-
math.tml-display {
|
41
|
+
math.tml-display {
|
42
|
+
display: block;
|
43
|
+
width: 100%;
|
44
|
+
}
|
42
45
|
|
43
46
|
*.mathcal,
|
44
47
|
mo.tml-prime {
|
@@ -46,9 +46,12 @@ math {
|
|
46
46
|
font-family: "Latin Modern Math", math;
|
47
47
|
}
|
48
48
|
|
49
|
-
/*
|
49
|
+
/* display: block is necessary in Firefox and Safari.
|
50
50
|
* Not in Chromium, which recognizes display: "block math" written inline. */
|
51
|
-
math.tml-display {
|
51
|
+
math.tml-display {
|
52
|
+
display: block;
|
53
|
+
width: 100%;
|
54
|
+
}
|
52
55
|
|
53
56
|
*.mathscr {
|
54
57
|
font-family: "Temml";
|
@@ -44,9 +44,12 @@ math {
|
|
44
44
|
font-family: Libertinus Math, math;
|
45
45
|
}
|
46
46
|
|
47
|
-
/*
|
47
|
+
/* display: block is necessary in Firefox and Safari.
|
48
48
|
* Not in Chromium, which recognizes display: "block math" written inline. */
|
49
|
-
math.tml-display {
|
49
|
+
math.tml-display {
|
50
|
+
display: block;
|
51
|
+
width: 100%;
|
52
|
+
}
|
50
53
|
|
51
54
|
*.mathcal {
|
52
55
|
font-family: "Cambria Math", 'STIXTwoMath-Regular', "Times New Roman", math;
|
package/dist/Temml-Local.css
CHANGED
@@ -30,9 +30,12 @@ math * {
|
|
30
30
|
border-color: currentColor;
|
31
31
|
}
|
32
32
|
|
33
|
-
/*
|
33
|
+
/* display: block is necessary in Firefox and Safari.
|
34
34
|
* Not in Chromium, which recognizes display: "block math" written inline. */
|
35
|
-
math.tml-display {
|
35
|
+
math.tml-display {
|
36
|
+
display: block;
|
37
|
+
width: 100%;
|
38
|
+
}
|
36
39
|
|
37
40
|
*.mathcal {
|
38
41
|
/* NotoSans */
|
package/dist/Temml-NotoSans.css
CHANGED
@@ -32,9 +32,12 @@ math {
|
|
32
32
|
font-family: "NotoSans Math", math;
|
33
33
|
}
|
34
34
|
|
35
|
-
/*
|
35
|
+
/* display: block is necessary in Firefox and Safari.
|
36
36
|
* Not in Chromium, which recognizes display: "block math" written inline. */
|
37
|
-
math.tml-display {
|
37
|
+
math.tml-display {
|
38
|
+
display: block;
|
39
|
+
width: 100%;
|
40
|
+
}
|
38
41
|
|
39
42
|
math .mathscr {
|
40
43
|
font-family: "ssty1";
|
package/dist/Temml-STIX2.css
CHANGED
@@ -30,9 +30,12 @@ math * {
|
|
30
30
|
border-color: currentColor;
|
31
31
|
}
|
32
32
|
|
33
|
-
/*
|
33
|
+
/* display: block is necessary in Firefox and Safari.
|
34
34
|
* Not in Chromium, which recognizes display: "block math" written inline. */
|
35
|
-
math.tml-display {
|
35
|
+
math.tml-display {
|
36
|
+
display: block;
|
37
|
+
width: 100%;
|
38
|
+
}
|
36
39
|
|
37
40
|
math {
|
38
41
|
font-family: STIX2, math;
|
package/dist/temml.cjs
CHANGED
@@ -771,10 +771,12 @@ var mathMLTree = {
|
|
771
771
|
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
772
772
|
const estimatedWidth = node => {
|
773
773
|
let width = 0;
|
774
|
-
if (node.body) {
|
774
|
+
if (node.body && Array.isArray(node.body)) {
|
775
775
|
for (const item of node.body) {
|
776
776
|
width += estimatedWidth(item);
|
777
777
|
}
|
778
|
+
} else if (node.body) {
|
779
|
+
width += estimatedWidth(node.body);
|
778
780
|
} else if (node.type === "supsub") {
|
779
781
|
width += estimatedWidth(node.base);
|
780
782
|
if (node.sub) { width += 0.7 * estimatedWidth(node.sub); }
|
@@ -2456,9 +2458,6 @@ function buildMathML(tree, texExpression, style, settings) {
|
|
2456
2458
|
if (settings.xml) {
|
2457
2459
|
math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
|
2458
2460
|
}
|
2459
|
-
if (wrapper.style.width) {
|
2460
|
-
math.style.width = "100%";
|
2461
|
-
}
|
2462
2461
|
if (settings.displayMode) {
|
2463
2462
|
math.setAttribute("display", "block");
|
2464
2463
|
math.style.display = "block math"; // necessary in Chromium.
|
@@ -10570,7 +10569,8 @@ defineFunction({
|
|
10570
10569
|
names: ["\\relax"],
|
10571
10570
|
props: {
|
10572
10571
|
numArgs: 0,
|
10573
|
-
allowedInText: true
|
10572
|
+
allowedInText: true,
|
10573
|
+
allowedInArgument: true
|
10574
10574
|
},
|
10575
10575
|
handler({ parser }) {
|
10576
10576
|
return {
|
@@ -12986,6 +12986,7 @@ class Parser {
|
|
12986
12986
|
if (!atom) {
|
12987
12987
|
break;
|
12988
12988
|
} else if (atom.type === "internal") {
|
12989
|
+
// Internal nodes do not appear in parse tree
|
12989
12990
|
continue;
|
12990
12991
|
}
|
12991
12992
|
body.push(atom);
|
@@ -13060,7 +13061,11 @@ class Parser {
|
|
13060
13061
|
const symbol = symbolToken.text;
|
13061
13062
|
this.consume();
|
13062
13063
|
this.consumeSpaces(); // ignore spaces before sup/subscript argument
|
13063
|
-
|
13064
|
+
// Skip over allowed internal nodes such as \relax
|
13065
|
+
let group;
|
13066
|
+
do {
|
13067
|
+
group = this.parseGroup(name);
|
13068
|
+
} while (group.type && group.type === "internal")
|
13064
13069
|
|
13065
13070
|
if (!group) {
|
13066
13071
|
throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
|
@@ -13104,9 +13109,15 @@ class Parser {
|
|
13104
13109
|
// \left(x\right)^2 work correctly.
|
13105
13110
|
const base = this.parseGroup("atom", breakOnTokenText);
|
13106
13111
|
|
13112
|
+
// Internal nodes (e.g. \relax) cannot support super/subscripts.
|
13113
|
+
// Instead we will pick up super/subscripts with blank base next round.
|
13114
|
+
if (base && base.type === "internal") {
|
13115
|
+
return base
|
13116
|
+
}
|
13117
|
+
|
13107
13118
|
// In text mode, we don't have superscripts or subscripts
|
13108
13119
|
if (this.mode === "text") {
|
13109
|
-
return base
|
13120
|
+
return base
|
13110
13121
|
}
|
13111
13122
|
|
13112
13123
|
// Note that base may be empty (i.e. null) at this point.
|
@@ -13963,7 +13974,7 @@ class Style {
|
|
13963
13974
|
* https://mit-license.org/
|
13964
13975
|
*/
|
13965
13976
|
|
13966
|
-
const version = "0.11.
|
13977
|
+
const version = "0.11.06";
|
13967
13978
|
|
13968
13979
|
function postProcess(block) {
|
13969
13980
|
const labelMap = {};
|
package/dist/temml.js
CHANGED
@@ -772,10 +772,12 @@ var temml = (function () {
|
|
772
772
|
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
773
773
|
const estimatedWidth = node => {
|
774
774
|
let width = 0;
|
775
|
-
if (node.body) {
|
775
|
+
if (node.body && Array.isArray(node.body)) {
|
776
776
|
for (const item of node.body) {
|
777
777
|
width += estimatedWidth(item);
|
778
778
|
}
|
779
|
+
} else if (node.body) {
|
780
|
+
width += estimatedWidth(node.body);
|
779
781
|
} else if (node.type === "supsub") {
|
780
782
|
width += estimatedWidth(node.base);
|
781
783
|
if (node.sub) { width += 0.7 * estimatedWidth(node.sub); }
|
@@ -2457,9 +2459,6 @@ var temml = (function () {
|
|
2457
2459
|
if (settings.xml) {
|
2458
2460
|
math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
|
2459
2461
|
}
|
2460
|
-
if (wrapper.style.width) {
|
2461
|
-
math.style.width = "100%";
|
2462
|
-
}
|
2463
2462
|
if (settings.displayMode) {
|
2464
2463
|
math.setAttribute("display", "block");
|
2465
2464
|
math.style.display = "block math"; // necessary in Chromium.
|
@@ -8657,7 +8656,8 @@ var temml = (function () {
|
|
8657
8656
|
names: ["\\relax"],
|
8658
8657
|
props: {
|
8659
8658
|
numArgs: 0,
|
8660
|
-
allowedInText: true
|
8659
|
+
allowedInText: true,
|
8660
|
+
allowedInArgument: true
|
8661
8661
|
},
|
8662
8662
|
handler({ parser }) {
|
8663
8663
|
return {
|
@@ -11073,6 +11073,7 @@ var temml = (function () {
|
|
11073
11073
|
if (!atom) {
|
11074
11074
|
break;
|
11075
11075
|
} else if (atom.type === "internal") {
|
11076
|
+
// Internal nodes do not appear in parse tree
|
11076
11077
|
continue;
|
11077
11078
|
}
|
11078
11079
|
body.push(atom);
|
@@ -11147,7 +11148,11 @@ var temml = (function () {
|
|
11147
11148
|
const symbol = symbolToken.text;
|
11148
11149
|
this.consume();
|
11149
11150
|
this.consumeSpaces(); // ignore spaces before sup/subscript argument
|
11150
|
-
|
11151
|
+
// Skip over allowed internal nodes such as \relax
|
11152
|
+
let group;
|
11153
|
+
do {
|
11154
|
+
group = this.parseGroup(name);
|
11155
|
+
} while (group.type && group.type === "internal")
|
11151
11156
|
|
11152
11157
|
if (!group) {
|
11153
11158
|
throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
|
@@ -11191,9 +11196,15 @@ var temml = (function () {
|
|
11191
11196
|
// \left(x\right)^2 work correctly.
|
11192
11197
|
const base = this.parseGroup("atom", breakOnTokenText);
|
11193
11198
|
|
11199
|
+
// Internal nodes (e.g. \relax) cannot support super/subscripts.
|
11200
|
+
// Instead we will pick up super/subscripts with blank base next round.
|
11201
|
+
if (base && base.type === "internal") {
|
11202
|
+
return base
|
11203
|
+
}
|
11204
|
+
|
11194
11205
|
// In text mode, we don't have superscripts or subscripts
|
11195
11206
|
if (this.mode === "text") {
|
11196
|
-
return base
|
11207
|
+
return base
|
11197
11208
|
}
|
11198
11209
|
|
11199
11210
|
// Note that base may be empty (i.e. null) at this point.
|
@@ -12050,7 +12061,7 @@ var temml = (function () {
|
|
12050
12061
|
* https://mit-license.org/
|
12051
12062
|
*/
|
12052
12063
|
|
12053
|
-
const version = "0.11.
|
12064
|
+
const version = "0.11.06";
|
12054
12065
|
|
12055
12066
|
function postProcess(block) {
|
12056
12067
|
const labelMap = {};
|