temml 0.9.1 → 0.9.2
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 +3 -0
- package/dist/Temml-Latin-Modern.css +3 -0
- package/dist/Temml-Libertinus.css +3 -0
- package/dist/Temml-Local.css +3 -0
- package/dist/Temml-STIX2.css +3 -0
- package/dist/temml.cjs +38 -26
- package/dist/temml.js +38 -26
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +38 -26
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/buildMathML.js +1 -3
- package/src/functions/enclose.js +20 -1
- package/src/functions/pmb.js +3 -4
- package/src/functions/symbolsOrd.js +12 -16
- package/src/macros.js +1 -1
- package/src/postProcess.js +1 -1
package/README.md
CHANGED
package/dist/Temml-Asana.css
CHANGED
@@ -87,18 +87,21 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
87
87
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
88
88
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
89
89
|
text-align: -webkit-left;
|
90
|
+
text-align: -moz-left;
|
90
91
|
}
|
91
92
|
|
92
93
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
93
94
|
mtable.tml-alignat > mtr > mtd:nth-child(even),
|
94
95
|
mtable.tml-aligned > mtr > mtd:nth-child(odd) {
|
95
96
|
text-align: -webkit-right;
|
97
|
+
text-align: -moz-right;
|
96
98
|
}
|
97
99
|
|
98
100
|
mtable.tml-cases > mtr > mtd {
|
99
101
|
padding-left: 0em;
|
100
102
|
padding-right: 0em;
|
101
103
|
text-align: -webkit-left;
|
104
|
+
text-align: -moz-left;
|
102
105
|
}
|
103
106
|
|
104
107
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
@@ -101,6 +101,7 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
101
101
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
102
102
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
103
103
|
text-align: -webkit-left;
|
104
|
+
text-align: -moz-left;
|
104
105
|
}
|
105
106
|
|
106
107
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
@@ -108,12 +109,14 @@ mtable.tml-alignat > mtr > mtd:nth-child(even),
|
|
108
109
|
mtable.tml-aligned > mtr > mtd:nth-child(odd),
|
109
110
|
mtable.tml-align-star > mtr > mtd:nth-child(odd) {
|
110
111
|
text-align: -webkit-right;
|
112
|
+
text-align: -moz-right;
|
111
113
|
}
|
112
114
|
|
113
115
|
mtable.tml-cases > mtr > mtd {
|
114
116
|
padding-left: 0em;
|
115
117
|
padding-right: 0em;
|
116
118
|
text-align: -webkit-left;
|
119
|
+
text-align: -moz-left;
|
117
120
|
}
|
118
121
|
|
119
122
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
@@ -99,6 +99,7 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
99
99
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
100
100
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
101
101
|
text-align: -webkit-left;
|
102
|
+
text-align: -moz-left;
|
102
103
|
}
|
103
104
|
|
104
105
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
@@ -106,12 +107,14 @@ mtable.tml-alignat > mtr > mtd:nth-child(even),
|
|
106
107
|
mtable.tml-aligned > mtr > mtd:nth-child(odd),
|
107
108
|
mtable.tml-align-star > mtr > mtd:nth-child(odd) {
|
108
109
|
text-align: -webkit-right;
|
110
|
+
text-align: -moz-right;
|
109
111
|
}
|
110
112
|
|
111
113
|
mtable.tml-cases > mtr > mtd {
|
112
114
|
padding-left: 0em;
|
113
115
|
padding-right: 0em;
|
114
116
|
text-align: -webkit-left;
|
117
|
+
text-align: -moz-left;
|
115
118
|
}
|
116
119
|
|
117
120
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
package/dist/Temml-Local.css
CHANGED
@@ -80,18 +80,21 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
80
80
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
81
81
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
82
82
|
text-align: -webkit-left;
|
83
|
+
text-align: -moz-left;
|
83
84
|
}
|
84
85
|
|
85
86
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
86
87
|
mtable.tml-alignat > mtr > mtd:nth-child(even),
|
87
88
|
mtable.tml-aligned > mtr > mtd:nth-child(odd) {
|
88
89
|
text-align: -webkit-right;
|
90
|
+
text-align: -moz-right;
|
89
91
|
}
|
90
92
|
|
91
93
|
mtable.tml-cases > mtr > mtd {
|
92
94
|
padding-left: 0em;
|
93
95
|
padding-right: 0em;
|
94
96
|
text-align: -webkit-left;
|
97
|
+
text-align: -moz-left;
|
95
98
|
}
|
96
99
|
|
97
100
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
package/dist/Temml-STIX2.css
CHANGED
@@ -89,18 +89,21 @@ mtable.tml-align > mtr > mtd:nth-child(odd),
|
|
89
89
|
mtable.tml-alignat > mtr > mtd:nth-child(odd),
|
90
90
|
mtable.tml-aligned > mtr > mtd:nth-child(even) {
|
91
91
|
text-align: -webkit-left;
|
92
|
+
text-align: -moz-left;
|
92
93
|
}
|
93
94
|
|
94
95
|
mtable.tml-align > mtr > mtd:nth-child(even),
|
95
96
|
mtable.tml-alignat > mtr > mtd:nth-child(even),
|
96
97
|
mtable.tml-aligned > mtr > mtd:nth-child(odd) {
|
97
98
|
text-align: -webkit-right;
|
99
|
+
text-align: -moz-right;
|
98
100
|
}
|
99
101
|
|
100
102
|
mtable.tml-cases > mtr > mtd {
|
101
103
|
padding-left: 0em;
|
102
104
|
padding-right: 0em;
|
103
105
|
text-align: -webkit-left;
|
106
|
+
text-align: -moz-left;
|
104
107
|
}
|
105
108
|
|
106
109
|
mtable.tml-cases > mtr > mtd:nth-child(2) {
|
package/dist/temml.cjs
CHANGED
@@ -2079,8 +2079,6 @@ function buildMathML(tree, texExpression, style, settings) {
|
|
2079
2079
|
let wrapper = expression.length === 1 && tag === null && (n1 instanceof MathNode)
|
2080
2080
|
&& !(n1.type === "mstyle" && n1.attributes.mathcolor)
|
2081
2081
|
? expression[0]
|
2082
|
-
: expression.length > 1 && wrap === "none"
|
2083
|
-
? new mathMLTree.MathNode("mrow", expression)
|
2084
2082
|
: setLineBreaks(expression, wrap, settings.displayMode);
|
2085
2083
|
|
2086
2084
|
if (tag) {
|
@@ -2095,7 +2093,7 @@ function buildMathML(tree, texExpression, style, settings) {
|
|
2095
2093
|
wrapper = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
|
2096
2094
|
}
|
2097
2095
|
|
2098
|
-
if (wrap !== "none") {
|
2096
|
+
if (wrap !== "none" && wrapper.children.length > 1) {
|
2099
2097
|
const maths = [];
|
2100
2098
|
for (let i = 0; i < wrapper.children.length; i++) {
|
2101
2099
|
const math = new mathMLTree.MathNode("math", [wrapper.children[i]]);
|
@@ -3909,7 +3907,7 @@ defineFunction({
|
|
3909
3907
|
|
3910
3908
|
defineFunction({
|
3911
3909
|
type: "enclose",
|
3912
|
-
names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline"
|
3910
|
+
names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline"],
|
3913
3911
|
// , "\\phase", "\\longdiv"
|
3914
3912
|
props: {
|
3915
3913
|
numArgs: 1
|
@@ -3926,6 +3924,25 @@ defineFunction({
|
|
3926
3924
|
mathmlBuilder: mathmlBuilder$8
|
3927
3925
|
});
|
3928
3926
|
|
3927
|
+
defineFunction({
|
3928
|
+
type: "enclose",
|
3929
|
+
names: ["\\underline"],
|
3930
|
+
props: {
|
3931
|
+
numArgs: 1,
|
3932
|
+
allowedInText: true
|
3933
|
+
},
|
3934
|
+
handler({ parser, funcName }, args) {
|
3935
|
+
const body = args[0];
|
3936
|
+
return {
|
3937
|
+
type: "enclose",
|
3938
|
+
mode: parser.mode,
|
3939
|
+
label: funcName,
|
3940
|
+
body
|
3941
|
+
};
|
3942
|
+
},
|
3943
|
+
mathmlBuilder: mathmlBuilder$8
|
3944
|
+
});
|
3945
|
+
|
3929
3946
|
/**
|
3930
3947
|
* All registered environments.
|
3931
3948
|
* `environments.js` exports this same dictionary again and makes it public.
|
@@ -6731,10 +6748,9 @@ defineFunction({
|
|
6731
6748
|
}
|
6732
6749
|
});
|
6733
6750
|
|
6734
|
-
// \pmb is a simulation of bold font.
|
6751
|
+
// In LaTeX, \pmb is a simulation of bold font.
|
6735
6752
|
// The version of \pmb in ambsy.sty works by typesetting three copies of the argument
|
6736
|
-
// with small offsets. We use CSS
|
6737
|
-
// It's a hack. Not as good as a real bold font. Better than nothing.
|
6753
|
+
// with small offsets. We use CSS font-weight:bold.
|
6738
6754
|
|
6739
6755
|
defineFunction({
|
6740
6756
|
type: "pmb",
|
@@ -6754,7 +6770,7 @@ defineFunction({
|
|
6754
6770
|
const inner = buildExpression(group.body, style);
|
6755
6771
|
// Wrap with an <mstyle> element.
|
6756
6772
|
const node = wrapWithMstyle(inner);
|
6757
|
-
node.setAttribute("style", "
|
6773
|
+
node.setAttribute("style", "font-weight:bold");
|
6758
6774
|
return node
|
6759
6775
|
}
|
6760
6776
|
});
|
@@ -7627,8 +7643,8 @@ const smallCaps = Object.freeze({
|
|
7627
7643
|
const numberRegEx$1 = /^\d(?:[\d,.]*\d)?$/; // Keep in sync with numberRegEx in Parser.js
|
7628
7644
|
const latinRegEx = /[A-Ba-z]/;
|
7629
7645
|
|
7630
|
-
const italicNumber = (text, variant) => {
|
7631
|
-
const mn = new mathMLTree.MathNode(
|
7646
|
+
const italicNumber = (text, variant, tag) => {
|
7647
|
+
const mn = new mathMLTree.MathNode(tag, [text]);
|
7632
7648
|
const wrapper = new mathMLTree.MathNode("mstyle", [mn]);
|
7633
7649
|
wrapper.style["font-style"] = "italic";
|
7634
7650
|
wrapper.style["font-family"] = "Cambria, 'Times New Roman', serif";
|
@@ -7678,28 +7694,24 @@ defineFunctionBuilders({
|
|
7678
7694
|
const variant = getVariant(group, style) || "normal";
|
7679
7695
|
|
7680
7696
|
let node;
|
7681
|
-
if (group.
|
7682
|
-
|
7683
|
-
if (numberRegEx$1.test(group.text)) {
|
7684
|
-
return italicNumber(text, variant)
|
7685
|
-
}
|
7686
|
-
}
|
7687
|
-
if (variant !== "normal") {
|
7688
|
-
text.text = variantChar(text.text, variant);
|
7689
|
-
}
|
7690
|
-
node = new mathMLTree.MathNode("mtext", [text]);
|
7691
|
-
} else if (numberRegEx$1.test(group.text)) {
|
7697
|
+
if (numberRegEx$1.test(group.text)) {
|
7698
|
+
const tag = group.mode === "text" ? "mtext" : "mn";
|
7692
7699
|
if (variant === "oldstylenums") {
|
7693
7700
|
const ms = new mathMLTree.MathNode("mstyle", [text], ["oldstylenums"]);
|
7694
|
-
node = new mathMLTree.MathNode(
|
7701
|
+
node = new mathMLTree.MathNode(tag, [ms]);
|
7695
7702
|
} else if (variant === "italic" || variant === "bold-italic") {
|
7696
|
-
return italicNumber(text, variant)
|
7703
|
+
return italicNumber(text, variant, tag)
|
7697
7704
|
} else {
|
7698
7705
|
if (variant !== "normal") {
|
7699
7706
|
text.text = text.text.split("").map(c => variantChar(c, variant)).join("");
|
7700
7707
|
}
|
7701
|
-
node = new mathMLTree.MathNode(
|
7708
|
+
node = new mathMLTree.MathNode(tag, [text]);
|
7702
7709
|
}
|
7710
|
+
} else if (group.mode === "text") {
|
7711
|
+
if (variant !== "normal") {
|
7712
|
+
text.text = variantChar(text.text, variant);
|
7713
|
+
}
|
7714
|
+
node = new mathMLTree.MathNode("mtext", [text]);
|
7703
7715
|
} else if (group.text === "\\prime") {
|
7704
7716
|
node = new mathMLTree.MathNode("mo", [text]);
|
7705
7717
|
// TODO: If/when Chromium uses ssty variant for prime, remove the next line.
|
@@ -8398,7 +8410,7 @@ defineMacro("\\underbar", "\\underline{\\text{#1}}");
|
|
8398
8410
|
// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
|
8399
8411
|
// We'll call \varvdots, which gets a glyph from symbols.js.
|
8400
8412
|
// The zero-width rule gets us an equivalent to the vertical 6pt kern.
|
8401
|
-
defineMacro("\\vdots", "
|
8413
|
+
defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
|
8402
8414
|
defineMacro("\u22ee", "\\vdots");
|
8403
8415
|
|
8404
8416
|
//////////////////////////////////////////////////////////////////////
|
@@ -12909,7 +12921,7 @@ class Style {
|
|
12909
12921
|
* https://mit-license.org/
|
12910
12922
|
*/
|
12911
12923
|
|
12912
|
-
const version = "0.9.
|
12924
|
+
const version = "0.9.2";
|
12913
12925
|
|
12914
12926
|
function postProcess(block) {
|
12915
12927
|
const labelMap = {};
|
package/dist/temml.js
CHANGED
@@ -2080,8 +2080,6 @@ var temml = (function () {
|
|
2080
2080
|
let wrapper = expression.length === 1 && tag === null && (n1 instanceof MathNode)
|
2081
2081
|
&& !(n1.type === "mstyle" && n1.attributes.mathcolor)
|
2082
2082
|
? expression[0]
|
2083
|
-
: expression.length > 1 && wrap === "none"
|
2084
|
-
? new mathMLTree.MathNode("mrow", expression)
|
2085
2083
|
: setLineBreaks(expression, wrap, settings.displayMode);
|
2086
2084
|
|
2087
2085
|
if (tag) {
|
@@ -2096,7 +2094,7 @@ var temml = (function () {
|
|
2096
2094
|
wrapper = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
|
2097
2095
|
}
|
2098
2096
|
|
2099
|
-
if (wrap !== "none") {
|
2097
|
+
if (wrap !== "none" && wrapper.children.length > 1) {
|
2100
2098
|
const maths = [];
|
2101
2099
|
for (let i = 0; i < wrapper.children.length; i++) {
|
2102
2100
|
const math = new mathMLTree.MathNode("math", [wrapper.children[i]]);
|
@@ -3910,7 +3908,7 @@ var temml = (function () {
|
|
3910
3908
|
|
3911
3909
|
defineFunction({
|
3912
3910
|
type: "enclose",
|
3913
|
-
names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline"
|
3911
|
+
names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline"],
|
3914
3912
|
// , "\\phase", "\\longdiv"
|
3915
3913
|
props: {
|
3916
3914
|
numArgs: 1
|
@@ -3927,6 +3925,25 @@ var temml = (function () {
|
|
3927
3925
|
mathmlBuilder: mathmlBuilder$8
|
3928
3926
|
});
|
3929
3927
|
|
3928
|
+
defineFunction({
|
3929
|
+
type: "enclose",
|
3930
|
+
names: ["\\underline"],
|
3931
|
+
props: {
|
3932
|
+
numArgs: 1,
|
3933
|
+
allowedInText: true
|
3934
|
+
},
|
3935
|
+
handler({ parser, funcName }, args) {
|
3936
|
+
const body = args[0];
|
3937
|
+
return {
|
3938
|
+
type: "enclose",
|
3939
|
+
mode: parser.mode,
|
3940
|
+
label: funcName,
|
3941
|
+
body
|
3942
|
+
};
|
3943
|
+
},
|
3944
|
+
mathmlBuilder: mathmlBuilder$8
|
3945
|
+
});
|
3946
|
+
|
3930
3947
|
/**
|
3931
3948
|
* All registered environments.
|
3932
3949
|
* `environments.js` exports this same dictionary again and makes it public.
|
@@ -6732,10 +6749,9 @@ var temml = (function () {
|
|
6732
6749
|
}
|
6733
6750
|
});
|
6734
6751
|
|
6735
|
-
// \pmb is a simulation of bold font.
|
6752
|
+
// In LaTeX, \pmb is a simulation of bold font.
|
6736
6753
|
// The version of \pmb in ambsy.sty works by typesetting three copies of the argument
|
6737
|
-
// with small offsets. We use CSS
|
6738
|
-
// It's a hack. Not as good as a real bold font. Better than nothing.
|
6754
|
+
// with small offsets. We use CSS font-weight:bold.
|
6739
6755
|
|
6740
6756
|
defineFunction({
|
6741
6757
|
type: "pmb",
|
@@ -6755,7 +6771,7 @@ var temml = (function () {
|
|
6755
6771
|
const inner = buildExpression(group.body, style);
|
6756
6772
|
// Wrap with an <mstyle> element.
|
6757
6773
|
const node = wrapWithMstyle(inner);
|
6758
|
-
node.setAttribute("style", "
|
6774
|
+
node.setAttribute("style", "font-weight:bold");
|
6759
6775
|
return node
|
6760
6776
|
}
|
6761
6777
|
});
|
@@ -7628,8 +7644,8 @@ var temml = (function () {
|
|
7628
7644
|
const numberRegEx$1 = /^\d(?:[\d,.]*\d)?$/; // Keep in sync with numberRegEx in Parser.js
|
7629
7645
|
const latinRegEx = /[A-Ba-z]/;
|
7630
7646
|
|
7631
|
-
const italicNumber = (text, variant) => {
|
7632
|
-
const mn = new mathMLTree.MathNode(
|
7647
|
+
const italicNumber = (text, variant, tag) => {
|
7648
|
+
const mn = new mathMLTree.MathNode(tag, [text]);
|
7633
7649
|
const wrapper = new mathMLTree.MathNode("mstyle", [mn]);
|
7634
7650
|
wrapper.style["font-style"] = "italic";
|
7635
7651
|
wrapper.style["font-family"] = "Cambria, 'Times New Roman', serif";
|
@@ -7679,28 +7695,24 @@ var temml = (function () {
|
|
7679
7695
|
const variant = getVariant(group, style) || "normal";
|
7680
7696
|
|
7681
7697
|
let node;
|
7682
|
-
if (group.
|
7683
|
-
|
7684
|
-
if (numberRegEx$1.test(group.text)) {
|
7685
|
-
return italicNumber(text, variant)
|
7686
|
-
}
|
7687
|
-
}
|
7688
|
-
if (variant !== "normal") {
|
7689
|
-
text.text = variantChar(text.text, variant);
|
7690
|
-
}
|
7691
|
-
node = new mathMLTree.MathNode("mtext", [text]);
|
7692
|
-
} else if (numberRegEx$1.test(group.text)) {
|
7698
|
+
if (numberRegEx$1.test(group.text)) {
|
7699
|
+
const tag = group.mode === "text" ? "mtext" : "mn";
|
7693
7700
|
if (variant === "oldstylenums") {
|
7694
7701
|
const ms = new mathMLTree.MathNode("mstyle", [text], ["oldstylenums"]);
|
7695
|
-
node = new mathMLTree.MathNode(
|
7702
|
+
node = new mathMLTree.MathNode(tag, [ms]);
|
7696
7703
|
} else if (variant === "italic" || variant === "bold-italic") {
|
7697
|
-
return italicNumber(text, variant)
|
7704
|
+
return italicNumber(text, variant, tag)
|
7698
7705
|
} else {
|
7699
7706
|
if (variant !== "normal") {
|
7700
7707
|
text.text = text.text.split("").map(c => variantChar(c, variant)).join("");
|
7701
7708
|
}
|
7702
|
-
node = new mathMLTree.MathNode(
|
7709
|
+
node = new mathMLTree.MathNode(tag, [text]);
|
7703
7710
|
}
|
7711
|
+
} else if (group.mode === "text") {
|
7712
|
+
if (variant !== "normal") {
|
7713
|
+
text.text = variantChar(text.text, variant);
|
7714
|
+
}
|
7715
|
+
node = new mathMLTree.MathNode("mtext", [text]);
|
7704
7716
|
} else if (group.text === "\\prime") {
|
7705
7717
|
node = new mathMLTree.MathNode("mo", [text]);
|
7706
7718
|
// TODO: If/when Chromium uses ssty variant for prime, remove the next line.
|
@@ -8399,7 +8411,7 @@ var temml = (function () {
|
|
8399
8411
|
// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
|
8400
8412
|
// We'll call \varvdots, which gets a glyph from symbols.js.
|
8401
8413
|
// The zero-width rule gets us an equivalent to the vertical 6pt kern.
|
8402
|
-
defineMacro("\\vdots", "
|
8414
|
+
defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
|
8403
8415
|
defineMacro("\u22ee", "\\vdots");
|
8404
8416
|
|
8405
8417
|
//////////////////////////////////////////////////////////////////////
|
@@ -11010,7 +11022,7 @@ var temml = (function () {
|
|
11010
11022
|
* https://mit-license.org/
|
11011
11023
|
*/
|
11012
11024
|
|
11013
|
-
const version = "0.9.
|
11025
|
+
const version = "0.9.2";
|
11014
11026
|
|
11015
11027
|
function postProcess(block) {
|
11016
11028
|
const labelMap = {};
|