temml 0.11.6 → 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 +13 -88
- package/dist/temml.js +13 -88
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +13 -88
- 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/functions/href.js +0 -88
package/dist/temml.mjs
CHANGED
@@ -8992,88 +8992,6 @@ defineFunction({
|
|
8992
8992
|
mathmlBuilder: mathmlBuilder$4
|
8993
8993
|
});
|
8994
8994
|
|
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
8995
|
defineFunction({
|
9078
8996
|
type: "html",
|
9079
8997
|
names: ["\\class", "\\id", "\\style", "\\data"],
|
@@ -9331,17 +9249,24 @@ defineFunction({
|
|
9331
9249
|
},
|
9332
9250
|
mathmlBuilder(group, style) {
|
9333
9251
|
const dimension = calculateSize(group.dimension, style);
|
9334
|
-
const ch = dimension.
|
9252
|
+
const ch = dimension.number > 0 && dimension.unit === "em"
|
9253
|
+
? spaceCharacter(dimension.number)
|
9254
|
+
: "";
|
9335
9255
|
if (group.mode === "text" && ch.length > 0) {
|
9336
9256
|
const character = new mathMLTree.TextNode(ch);
|
9337
9257
|
return new mathMLTree.MathNode("mtext", [character]);
|
9338
9258
|
} else {
|
9339
|
-
|
9340
|
-
|
9341
|
-
|
9259
|
+
if (dimension.number >= 0) {
|
9260
|
+
const node = new mathMLTree.MathNode("mspace");
|
9261
|
+
node.setAttribute("width", dimension.number + dimension.unit);
|
9262
|
+
return node
|
9263
|
+
} else {
|
9264
|
+
// Don't use <mspace> or <mpadded> because
|
9265
|
+
// WebKit recognizes negative left margin only on a <mrow> element
|
9266
|
+
const node = new mathMLTree.MathNode("mrow");
|
9342
9267
|
node.style.marginLeft = dimension.number + dimension.unit;
|
9268
|
+
return node
|
9343
9269
|
}
|
9344
|
-
return node;
|
9345
9270
|
}
|
9346
9271
|
}
|
9347
9272
|
});
|
@@ -13972,7 +13897,7 @@ class Style {
|
|
13972
13897
|
* https://mit-license.org/
|
13973
13898
|
*/
|
13974
13899
|
|
13975
|
-
const version = "0.11.
|
13900
|
+
const version = "0.11.07";
|
13976
13901
|
|
13977
13902
|
function postProcess(block) {
|
13978
13903
|
const labelMap = {};
|
package/dist/temmlPostProcess.js
CHANGED
package/package.json
CHANGED
package/src/functions/kern.js
CHANGED
@@ -45,17 +45,24 @@ defineFunction({
|
|
45
45
|
},
|
46
46
|
mathmlBuilder(group, style) {
|
47
47
|
const dimension = calculateSize(group.dimension, style);
|
48
|
-
const ch = dimension.
|
48
|
+
const ch = dimension.number > 0 && dimension.unit === "em"
|
49
|
+
? spaceCharacter(dimension.number)
|
50
|
+
: "";
|
49
51
|
if (group.mode === "text" && ch.length > 0) {
|
50
52
|
const character = new mathMLTree.TextNode(ch);
|
51
53
|
return new mathMLTree.MathNode("mtext", [character]);
|
52
54
|
} else {
|
53
|
-
|
54
|
-
|
55
|
-
|
55
|
+
if (dimension.number >= 0) {
|
56
|
+
const node = new mathMLTree.MathNode("mspace")
|
57
|
+
node.setAttribute("width", dimension.number + dimension.unit)
|
58
|
+
return node
|
59
|
+
} else {
|
60
|
+
// Don't use <mspace> or <mpadded> because
|
61
|
+
// WebKit recognizes negative left margin only on a <mrow> element
|
62
|
+
const node = new mathMLTree.MathNode("mrow")
|
56
63
|
node.style.marginLeft = dimension.number + dimension.unit
|
64
|
+
return node
|
57
65
|
}
|
58
|
-
return node;
|
59
66
|
}
|
60
67
|
}
|
61
68
|
});
|
package/src/functions.js
CHANGED
package/src/postProcess.js
CHANGED
package/src/functions/href.js
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
import defineFunction, { ordargument } from "../defineFunction";
|
2
|
-
import { assertNodeType } from "../parseNode";
|
3
|
-
import { MathNode } from "../mathMLTree";
|
4
|
-
import { AnchorNode } from "../domTree";
|
5
|
-
import * as mml from "../buildMathML";
|
6
|
-
import ParseError from "../ParseError";
|
7
|
-
|
8
|
-
defineFunction({
|
9
|
-
type: "href",
|
10
|
-
names: ["\\href"],
|
11
|
-
props: {
|
12
|
-
numArgs: 2,
|
13
|
-
argTypes: ["url", "original"],
|
14
|
-
allowedInText: true
|
15
|
-
},
|
16
|
-
handler: ({ parser, token }, args) => {
|
17
|
-
const body = args[1];
|
18
|
-
const href = assertNodeType(args[0], "url").url;
|
19
|
-
|
20
|
-
if (
|
21
|
-
!parser.settings.isTrusted({
|
22
|
-
command: "\\href",
|
23
|
-
url: href
|
24
|
-
})
|
25
|
-
) {
|
26
|
-
throw new ParseError(`Function "\\href" is not trusted`, token)
|
27
|
-
}
|
28
|
-
|
29
|
-
return {
|
30
|
-
type: "href",
|
31
|
-
mode: parser.mode,
|
32
|
-
href,
|
33
|
-
body: ordargument(body)
|
34
|
-
};
|
35
|
-
},
|
36
|
-
mathmlBuilder: (group, style) => {
|
37
|
-
const math = new MathNode("math", [mml.buildExpressionRow(group.body, style)])
|
38
|
-
const anchorNode = new AnchorNode(group.href, [], [math])
|
39
|
-
return anchorNode
|
40
|
-
}
|
41
|
-
});
|
42
|
-
|
43
|
-
defineFunction({
|
44
|
-
type: "href",
|
45
|
-
names: ["\\url"],
|
46
|
-
props: {
|
47
|
-
numArgs: 1,
|
48
|
-
argTypes: ["url"],
|
49
|
-
allowedInText: true
|
50
|
-
},
|
51
|
-
handler: ({ parser, token }, args) => {
|
52
|
-
const href = assertNodeType(args[0], "url").url;
|
53
|
-
|
54
|
-
if (
|
55
|
-
!parser.settings.isTrusted({
|
56
|
-
command: "\\url",
|
57
|
-
url: href
|
58
|
-
})
|
59
|
-
) {
|
60
|
-
throw new ParseError(`Function "\\url" is not trusted`, token)
|
61
|
-
}
|
62
|
-
|
63
|
-
const chars = [];
|
64
|
-
for (let i = 0; i < href.length; i++) {
|
65
|
-
let c = href[i];
|
66
|
-
if (c === "~") {
|
67
|
-
c = "\\textasciitilde";
|
68
|
-
}
|
69
|
-
chars.push({
|
70
|
-
type: "textord",
|
71
|
-
mode: "text",
|
72
|
-
text: c
|
73
|
-
});
|
74
|
-
}
|
75
|
-
const body = {
|
76
|
-
type: "text",
|
77
|
-
mode: parser.mode,
|
78
|
-
font: "\\texttt",
|
79
|
-
body: chars
|
80
|
-
};
|
81
|
-
return {
|
82
|
-
type: "href",
|
83
|
-
mode: parser.mode,
|
84
|
-
href,
|
85
|
-
body: ordargument(body)
|
86
|
-
};
|
87
|
-
}
|
88
|
-
});
|