temml 0.11.5 → 0.11.7
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.cjs +16 -89
- package/dist/temml.js +16 -89
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +16 -89
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/functions/kern.js +12 -5
- package/src/functions.js +0 -1
- package/src/postProcess.js +1 -1
- package/src/stretchy.js +3 -1
- package/src/functions/href.js +0 -88
package/README.md
CHANGED
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); }
|
@@ -8992,88 +8994,6 @@ defineFunction({
|
|
8992
8994
|
mathmlBuilder: mathmlBuilder$4
|
8993
8995
|
});
|
8994
8996
|
|
8995
|
-
defineFunction({
|
8996
|
-
type: "href",
|
8997
|
-
names: ["\\href"],
|
8998
|
-
props: {
|
8999
|
-
numArgs: 2,
|
9000
|
-
argTypes: ["url", "original"],
|
9001
|
-
allowedInText: true
|
9002
|
-
},
|
9003
|
-
handler: ({ parser, token }, args) => {
|
9004
|
-
const body = args[1];
|
9005
|
-
const href = assertNodeType(args[0], "url").url;
|
9006
|
-
|
9007
|
-
if (
|
9008
|
-
!parser.settings.isTrusted({
|
9009
|
-
command: "\\href",
|
9010
|
-
url: href
|
9011
|
-
})
|
9012
|
-
) {
|
9013
|
-
throw new ParseError(`Function "\\href" is not trusted`, token)
|
9014
|
-
}
|
9015
|
-
|
9016
|
-
return {
|
9017
|
-
type: "href",
|
9018
|
-
mode: parser.mode,
|
9019
|
-
href,
|
9020
|
-
body: ordargument(body)
|
9021
|
-
};
|
9022
|
-
},
|
9023
|
-
mathmlBuilder: (group, style) => {
|
9024
|
-
const math = new MathNode("math", [buildExpressionRow(group.body, style)]);
|
9025
|
-
const anchorNode = new AnchorNode(group.href, [], [math]);
|
9026
|
-
return anchorNode
|
9027
|
-
}
|
9028
|
-
});
|
9029
|
-
|
9030
|
-
defineFunction({
|
9031
|
-
type: "href",
|
9032
|
-
names: ["\\url"],
|
9033
|
-
props: {
|
9034
|
-
numArgs: 1,
|
9035
|
-
argTypes: ["url"],
|
9036
|
-
allowedInText: true
|
9037
|
-
},
|
9038
|
-
handler: ({ parser, token }, args) => {
|
9039
|
-
const href = assertNodeType(args[0], "url").url;
|
9040
|
-
|
9041
|
-
if (
|
9042
|
-
!parser.settings.isTrusted({
|
9043
|
-
command: "\\url",
|
9044
|
-
url: href
|
9045
|
-
})
|
9046
|
-
) {
|
9047
|
-
throw new ParseError(`Function "\\url" is not trusted`, token)
|
9048
|
-
}
|
9049
|
-
|
9050
|
-
const chars = [];
|
9051
|
-
for (let i = 0; i < href.length; i++) {
|
9052
|
-
let c = href[i];
|
9053
|
-
if (c === "~") {
|
9054
|
-
c = "\\textasciitilde";
|
9055
|
-
}
|
9056
|
-
chars.push({
|
9057
|
-
type: "textord",
|
9058
|
-
mode: "text",
|
9059
|
-
text: c
|
9060
|
-
});
|
9061
|
-
}
|
9062
|
-
const body = {
|
9063
|
-
type: "text",
|
9064
|
-
mode: parser.mode,
|
9065
|
-
font: "\\texttt",
|
9066
|
-
body: chars
|
9067
|
-
};
|
9068
|
-
return {
|
9069
|
-
type: "href",
|
9070
|
-
mode: parser.mode,
|
9071
|
-
href,
|
9072
|
-
body: ordargument(body)
|
9073
|
-
};
|
9074
|
-
}
|
9075
|
-
});
|
9076
|
-
|
9077
8997
|
defineFunction({
|
9078
8998
|
type: "html",
|
9079
8999
|
names: ["\\class", "\\id", "\\style", "\\data"],
|
@@ -9331,17 +9251,24 @@ defineFunction({
|
|
9331
9251
|
},
|
9332
9252
|
mathmlBuilder(group, style) {
|
9333
9253
|
const dimension = calculateSize(group.dimension, style);
|
9334
|
-
const ch = dimension.
|
9254
|
+
const ch = dimension.number > 0 && dimension.unit === "em"
|
9255
|
+
? spaceCharacter(dimension.number)
|
9256
|
+
: "";
|
9335
9257
|
if (group.mode === "text" && ch.length > 0) {
|
9336
9258
|
const character = new mathMLTree.TextNode(ch);
|
9337
9259
|
return new mathMLTree.MathNode("mtext", [character]);
|
9338
9260
|
} else {
|
9339
|
-
|
9340
|
-
|
9341
|
-
|
9261
|
+
if (dimension.number >= 0) {
|
9262
|
+
const node = new mathMLTree.MathNode("mspace");
|
9263
|
+
node.setAttribute("width", dimension.number + dimension.unit);
|
9264
|
+
return node
|
9265
|
+
} else {
|
9266
|
+
// Don't use <mspace> or <mpadded> because
|
9267
|
+
// WebKit recognizes negative left margin only on a <mrow> element
|
9268
|
+
const node = new mathMLTree.MathNode("mrow");
|
9342
9269
|
node.style.marginLeft = dimension.number + dimension.unit;
|
9270
|
+
return node
|
9343
9271
|
}
|
9344
|
-
return node;
|
9345
9272
|
}
|
9346
9273
|
}
|
9347
9274
|
});
|
@@ -13972,7 +13899,7 @@ class Style {
|
|
13972
13899
|
* https://mit-license.org/
|
13973
13900
|
*/
|
13974
13901
|
|
13975
|
-
const version = "0.11.
|
13902
|
+
const version = "0.11.07";
|
13976
13903
|
|
13977
13904
|
function postProcess(block) {
|
13978
13905
|
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); }
|
@@ -7079,88 +7081,6 @@ var temml = (function () {
|
|
7079
7081
|
mathmlBuilder: mathmlBuilder$4
|
7080
7082
|
});
|
7081
7083
|
|
7082
|
-
defineFunction({
|
7083
|
-
type: "href",
|
7084
|
-
names: ["\\href"],
|
7085
|
-
props: {
|
7086
|
-
numArgs: 2,
|
7087
|
-
argTypes: ["url", "original"],
|
7088
|
-
allowedInText: true
|
7089
|
-
},
|
7090
|
-
handler: ({ parser, token }, args) => {
|
7091
|
-
const body = args[1];
|
7092
|
-
const href = assertNodeType(args[0], "url").url;
|
7093
|
-
|
7094
|
-
if (
|
7095
|
-
!parser.settings.isTrusted({
|
7096
|
-
command: "\\href",
|
7097
|
-
url: href
|
7098
|
-
})
|
7099
|
-
) {
|
7100
|
-
throw new ParseError(`Function "\\href" is not trusted`, token)
|
7101
|
-
}
|
7102
|
-
|
7103
|
-
return {
|
7104
|
-
type: "href",
|
7105
|
-
mode: parser.mode,
|
7106
|
-
href,
|
7107
|
-
body: ordargument(body)
|
7108
|
-
};
|
7109
|
-
},
|
7110
|
-
mathmlBuilder: (group, style) => {
|
7111
|
-
const math = new MathNode("math", [buildExpressionRow(group.body, style)]);
|
7112
|
-
const anchorNode = new AnchorNode(group.href, [], [math]);
|
7113
|
-
return anchorNode
|
7114
|
-
}
|
7115
|
-
});
|
7116
|
-
|
7117
|
-
defineFunction({
|
7118
|
-
type: "href",
|
7119
|
-
names: ["\\url"],
|
7120
|
-
props: {
|
7121
|
-
numArgs: 1,
|
7122
|
-
argTypes: ["url"],
|
7123
|
-
allowedInText: true
|
7124
|
-
},
|
7125
|
-
handler: ({ parser, token }, args) => {
|
7126
|
-
const href = assertNodeType(args[0], "url").url;
|
7127
|
-
|
7128
|
-
if (
|
7129
|
-
!parser.settings.isTrusted({
|
7130
|
-
command: "\\url",
|
7131
|
-
url: href
|
7132
|
-
})
|
7133
|
-
) {
|
7134
|
-
throw new ParseError(`Function "\\url" is not trusted`, token)
|
7135
|
-
}
|
7136
|
-
|
7137
|
-
const chars = [];
|
7138
|
-
for (let i = 0; i < href.length; i++) {
|
7139
|
-
let c = href[i];
|
7140
|
-
if (c === "~") {
|
7141
|
-
c = "\\textasciitilde";
|
7142
|
-
}
|
7143
|
-
chars.push({
|
7144
|
-
type: "textord",
|
7145
|
-
mode: "text",
|
7146
|
-
text: c
|
7147
|
-
});
|
7148
|
-
}
|
7149
|
-
const body = {
|
7150
|
-
type: "text",
|
7151
|
-
mode: parser.mode,
|
7152
|
-
font: "\\texttt",
|
7153
|
-
body: chars
|
7154
|
-
};
|
7155
|
-
return {
|
7156
|
-
type: "href",
|
7157
|
-
mode: parser.mode,
|
7158
|
-
href,
|
7159
|
-
body: ordargument(body)
|
7160
|
-
};
|
7161
|
-
}
|
7162
|
-
});
|
7163
|
-
|
7164
7084
|
defineFunction({
|
7165
7085
|
type: "html",
|
7166
7086
|
names: ["\\class", "\\id", "\\style", "\\data"],
|
@@ -7418,17 +7338,24 @@ var temml = (function () {
|
|
7418
7338
|
},
|
7419
7339
|
mathmlBuilder(group, style) {
|
7420
7340
|
const dimension = calculateSize(group.dimension, style);
|
7421
|
-
const ch = dimension.
|
7341
|
+
const ch = dimension.number > 0 && dimension.unit === "em"
|
7342
|
+
? spaceCharacter(dimension.number)
|
7343
|
+
: "";
|
7422
7344
|
if (group.mode === "text" && ch.length > 0) {
|
7423
7345
|
const character = new mathMLTree.TextNode(ch);
|
7424
7346
|
return new mathMLTree.MathNode("mtext", [character]);
|
7425
7347
|
} else {
|
7426
|
-
|
7427
|
-
|
7428
|
-
|
7348
|
+
if (dimension.number >= 0) {
|
7349
|
+
const node = new mathMLTree.MathNode("mspace");
|
7350
|
+
node.setAttribute("width", dimension.number + dimension.unit);
|
7351
|
+
return node
|
7352
|
+
} else {
|
7353
|
+
// Don't use <mspace> or <mpadded> because
|
7354
|
+
// WebKit recognizes negative left margin only on a <mrow> element
|
7355
|
+
const node = new mathMLTree.MathNode("mrow");
|
7429
7356
|
node.style.marginLeft = dimension.number + dimension.unit;
|
7357
|
+
return node
|
7430
7358
|
}
|
7431
|
-
return node;
|
7432
7359
|
}
|
7433
7360
|
}
|
7434
7361
|
});
|
@@ -12059,7 +11986,7 @@ var temml = (function () {
|
|
12059
11986
|
* https://mit-license.org/
|
12060
11987
|
*/
|
12061
11988
|
|
12062
|
-
const version = "0.11.
|
11989
|
+
const version = "0.11.07";
|
12063
11990
|
|
12064
11991
|
function postProcess(block) {
|
12065
11992
|
const labelMap = {};
|