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/dist/temml.mjs
CHANGED
@@ -769,10 +769,12 @@ var mathMLTree = {
|
|
769
769
|
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
770
770
|
const estimatedWidth = node => {
|
771
771
|
let width = 0;
|
772
|
-
if (node.body) {
|
772
|
+
if (node.body && Array.isArray(node.body)) {
|
773
773
|
for (const item of node.body) {
|
774
774
|
width += estimatedWidth(item);
|
775
775
|
}
|
776
|
+
} else if (node.body) {
|
777
|
+
width += estimatedWidth(node.body);
|
776
778
|
} else if (node.type === "supsub") {
|
777
779
|
width += estimatedWidth(node.base);
|
778
780
|
if (node.sub) { width += 0.7 * estimatedWidth(node.sub); }
|
@@ -2454,9 +2456,6 @@ function buildMathML(tree, texExpression, style, settings) {
|
|
2454
2456
|
if (settings.xml) {
|
2455
2457
|
math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
|
2456
2458
|
}
|
2457
|
-
if (wrapper.style.width) {
|
2458
|
-
math.style.width = "100%";
|
2459
|
-
}
|
2460
2459
|
if (settings.displayMode) {
|
2461
2460
|
math.setAttribute("display", "block");
|
2462
2461
|
math.style.display = "block math"; // necessary in Chromium.
|
@@ -10568,7 +10567,8 @@ defineFunction({
|
|
10568
10567
|
names: ["\\relax"],
|
10569
10568
|
props: {
|
10570
10569
|
numArgs: 0,
|
10571
|
-
allowedInText: true
|
10570
|
+
allowedInText: true,
|
10571
|
+
allowedInArgument: true
|
10572
10572
|
},
|
10573
10573
|
handler({ parser }) {
|
10574
10574
|
return {
|
@@ -12984,6 +12984,7 @@ class Parser {
|
|
12984
12984
|
if (!atom) {
|
12985
12985
|
break;
|
12986
12986
|
} else if (atom.type === "internal") {
|
12987
|
+
// Internal nodes do not appear in parse tree
|
12987
12988
|
continue;
|
12988
12989
|
}
|
12989
12990
|
body.push(atom);
|
@@ -13058,7 +13059,11 @@ class Parser {
|
|
13058
13059
|
const symbol = symbolToken.text;
|
13059
13060
|
this.consume();
|
13060
13061
|
this.consumeSpaces(); // ignore spaces before sup/subscript argument
|
13061
|
-
|
13062
|
+
// Skip over allowed internal nodes such as \relax
|
13063
|
+
let group;
|
13064
|
+
do {
|
13065
|
+
group = this.parseGroup(name);
|
13066
|
+
} while (group.type && group.type === "internal")
|
13062
13067
|
|
13063
13068
|
if (!group) {
|
13064
13069
|
throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
|
@@ -13102,9 +13107,15 @@ class Parser {
|
|
13102
13107
|
// \left(x\right)^2 work correctly.
|
13103
13108
|
const base = this.parseGroup("atom", breakOnTokenText);
|
13104
13109
|
|
13110
|
+
// Internal nodes (e.g. \relax) cannot support super/subscripts.
|
13111
|
+
// Instead we will pick up super/subscripts with blank base next round.
|
13112
|
+
if (base && base.type === "internal") {
|
13113
|
+
return base
|
13114
|
+
}
|
13115
|
+
|
13105
13116
|
// In text mode, we don't have superscripts or subscripts
|
13106
13117
|
if (this.mode === "text") {
|
13107
|
-
return base
|
13118
|
+
return base
|
13108
13119
|
}
|
13109
13120
|
|
13110
13121
|
// Note that base may be empty (i.e. null) at this point.
|
@@ -13961,7 +13972,7 @@ class Style {
|
|
13961
13972
|
* https://mit-license.org/
|
13962
13973
|
*/
|
13963
13974
|
|
13964
|
-
const version = "0.11.
|
13975
|
+
const version = "0.11.06";
|
13965
13976
|
|
13966
13977
|
function postProcess(block) {
|
13967
13978
|
const labelMap = {};
|
package/dist/temmlPostProcess.js
CHANGED
package/package.json
CHANGED
package/src/Parser.js
CHANGED
@@ -213,6 +213,7 @@ export default class Parser {
|
|
213
213
|
if (!atom) {
|
214
214
|
break;
|
215
215
|
} else if (atom.type === "internal") {
|
216
|
+
// Internal nodes do not appear in parse tree
|
216
217
|
continue;
|
217
218
|
}
|
218
219
|
body.push(atom);
|
@@ -287,7 +288,11 @@ export default class Parser {
|
|
287
288
|
const symbol = symbolToken.text;
|
288
289
|
this.consume();
|
289
290
|
this.consumeSpaces(); // ignore spaces before sup/subscript argument
|
290
|
-
|
291
|
+
// Skip over allowed internal nodes such as \relax
|
292
|
+
let group
|
293
|
+
do {
|
294
|
+
group = this.parseGroup(name);
|
295
|
+
} while (group.type && group.type === "internal")
|
291
296
|
|
292
297
|
if (!group) {
|
293
298
|
throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
|
@@ -329,11 +334,17 @@ export default class Parser {
|
|
329
334
|
parseAtom(breakOnTokenText) {
|
330
335
|
// The body of an atom is an implicit group, so that things like
|
331
336
|
// \left(x\right)^2 work correctly.
|
332
|
-
const base = this.parseGroup("atom", breakOnTokenText)
|
337
|
+
const base = this.parseGroup("atom", breakOnTokenText)
|
338
|
+
|
339
|
+
// Internal nodes (e.g. \relax) cannot support super/subscripts.
|
340
|
+
// Instead we will pick up super/subscripts with blank base next round.
|
341
|
+
if (base && base.type === "internal") {
|
342
|
+
return base
|
343
|
+
}
|
333
344
|
|
334
345
|
// In text mode, we don't have superscripts or subscripts
|
335
346
|
if (this.mode === "text") {
|
336
|
-
return base
|
347
|
+
return base
|
337
348
|
}
|
338
349
|
|
339
350
|
// Note that base may be empty (i.e. null) at this point.
|
package/src/buildMathML.js
CHANGED
@@ -341,9 +341,6 @@ export default function buildMathML(tree, texExpression, style, settings) {
|
|
341
341
|
if (settings.xml) {
|
342
342
|
math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML")
|
343
343
|
}
|
344
|
-
if (wrapper.style.width) {
|
345
|
-
math.style.width = "100%"
|
346
|
-
}
|
347
344
|
if (settings.displayMode) {
|
348
345
|
math.setAttribute("display", "block");
|
349
346
|
math.style.display = "block math" // necessary in Chromium.
|
package/src/functions/relax.js
CHANGED
package/src/postProcess.js
CHANGED
package/src/stretchy.js
CHANGED
@@ -7,10 +7,12 @@ import mathMLTree from "./mathMLTree"
|
|
7
7
|
// TODO: Remove when Chromium stretches \widetilde & \widehat
|
8
8
|
const estimatedWidth = node => {
|
9
9
|
let width = 0
|
10
|
-
if (node.body) {
|
10
|
+
if (node.body && Array.isArray(node.body)) {
|
11
11
|
for (const item of node.body) {
|
12
12
|
width += estimatedWidth(item)
|
13
13
|
}
|
14
|
+
} else if (node.body) {
|
15
|
+
width += estimatedWidth(node.body)
|
14
16
|
} else if (node.type === "supsub") {
|
15
17
|
width += estimatedWidth(node.base)
|
16
18
|
if (node.sub) { width += 0.7 * estimatedWidth(node.sub) }
|