temml 0.10.16 → 0.10.17
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/contrib/copy-tex/README.md +42 -0
- package/contrib/copy-tex/copy-tex.js +66 -0
- package/contrib/copy-tex/copy-tex.min.js +1 -0
- package/dist/Temml-Asana.css +23 -3
- package/dist/Temml-Latin-Modern.css +21 -1
- package/dist/Temml-Libertinus.css +23 -3
- package/dist/Temml-Local.css +23 -3
- package/dist/Temml-STIX2.css +21 -1
- package/dist/temml.cjs +13306 -13280
- package/dist/temml.js +11409 -11383
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +13304 -13278
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/buildMathML.js +2 -7
- package/src/environments/array.js +11 -9
- package/src/functions/accent.js +30 -0
- package/src/functions/enclose.js +4 -1
- package/src/functions/lap.js +1 -1
- package/src/postProcess.js +1 -1
- package/src/symbols.js +0 -2
package/dist/temmlPostProcess.js
CHANGED
package/package.json
CHANGED
package/src/buildMathML.js
CHANGED
@@ -207,13 +207,8 @@ const taggedExpression = (expression, tag, style, leqno) => {
|
|
207
207
|
|
208
208
|
expression = new mathMLTree.MathNode("mtd", [expression])
|
209
209
|
const rowArray = [glue(), expression, glue()]
|
210
|
-
|
211
|
-
|
212
|
-
rowArray[0].style.textAlign = "-webkit-left"
|
213
|
-
} else {
|
214
|
-
rowArray[2].children.push(tag)
|
215
|
-
rowArray[2].style.textAlign = "-webkit-right"
|
216
|
-
}
|
210
|
+
rowArray[leqno ? 0 : 2].classes.push(leqno ? "tml-left" : "tml-right")
|
211
|
+
rowArray[leqno ? 0 : 2].children.push(tag)
|
217
212
|
const mtr = new mathMLTree.MathNode("mtr", rowArray, ["tml-tageqn"])
|
218
213
|
const table = new mathMLTree.MathNode("mtable", [mtr])
|
219
214
|
table.style.width = "100%"
|
@@ -2,6 +2,7 @@ import defineEnvironment from "../defineEnvironment";
|
|
2
2
|
import { parseCD } from "./cd";
|
3
3
|
import defineFunction from "../defineFunction";
|
4
4
|
import mathMLTree from "../mathMLTree";
|
5
|
+
import { Span } from "../domTree"
|
5
6
|
import { StyleLevel } from "../constants"
|
6
7
|
import ParseError from "../ParseError";
|
7
8
|
import { assertNodeType, assertSymbolNodeType } from "../parseNode";
|
@@ -57,8 +58,9 @@ const getTag = (group, style, rowNum) => {
|
|
57
58
|
return tag
|
58
59
|
} else {
|
59
60
|
// AMS automatcally numbered equaton.
|
60
|
-
// Insert a class so the element can be populated by a
|
61
|
-
|
61
|
+
// Insert a class so the element can be populated by a CSS counter.
|
62
|
+
// WebKit will display the CSS counter only inside a span.
|
63
|
+
tag = new mathMLTree.MathNode("mtext", [new Span(["tml-eqn"])])
|
62
64
|
}
|
63
65
|
return tag
|
64
66
|
}
|
@@ -255,7 +257,7 @@ const mathmlBuilder = function(group, style) {
|
|
255
257
|
const align = i === 0 ? "left" : i === numRows - 1 ? "right" : "center"
|
256
258
|
mtd.setAttribute("columnalign", align)
|
257
259
|
if (align !== "center") {
|
258
|
-
mtd.
|
260
|
+
mtd.classes.push("tml-" + align)
|
259
261
|
}
|
260
262
|
}
|
261
263
|
row.push(mtd)
|
@@ -266,10 +268,10 @@ const mathmlBuilder = function(group, style) {
|
|
266
268
|
const tag = getTag(group, style.withLevel(cellLevel), i)
|
267
269
|
if (group.leqno) {
|
268
270
|
row[0].children.push(tag)
|
269
|
-
row[0].
|
271
|
+
row[0].classes.push("tml-left")
|
270
272
|
} else {
|
271
273
|
row[row.length - 1].children.push(tag)
|
272
|
-
row[row.length - 1].
|
274
|
+
row[row.length - 1].classes.push("tml-right")
|
273
275
|
}
|
274
276
|
}
|
275
277
|
const mtr = new mathMLTree.MathNode("mtr", row, [])
|
@@ -340,11 +342,11 @@ const mathmlBuilder = function(group, style) {
|
|
340
342
|
for (let j = 0; j < row.children.length; j++) {
|
341
343
|
// Chromium does not recognize text-align: left. Use -webkit-
|
342
344
|
// TODO: Remove -webkit- when Chromium no longer needs it.
|
343
|
-
row.children[j].
|
345
|
+
row.children[j].classes = ["tml-" + (j % 2 ? "left" : "right")]
|
344
346
|
}
|
345
347
|
if (group.addEqnNum) {
|
346
348
|
const k = group.leqno ? 0 : row.children.length - 1
|
347
|
-
row.children[k].
|
349
|
+
row.children[k].classes = ["tml-" + (group.leqno ? "left" : "right")]
|
348
350
|
}
|
349
351
|
}
|
350
352
|
if (row.children.length > 1 && group.envClasses.includes("cases")) {
|
@@ -353,7 +355,7 @@ const mathmlBuilder = function(group, style) {
|
|
353
355
|
|
354
356
|
if (group.envClasses.includes("cases") || group.envClasses.includes("subarray")) {
|
355
357
|
for (const cell of row.children) {
|
356
|
-
cell.
|
358
|
+
cell.classes.push("tml-left")
|
357
359
|
}
|
358
360
|
}
|
359
361
|
}
|
@@ -408,7 +410,7 @@ const mathmlBuilder = function(group, style) {
|
|
408
410
|
iCol += 1
|
409
411
|
for (const row of table.children) {
|
410
412
|
if (colAlign.trim() !== "center" && iCol < row.children.length) {
|
411
|
-
row.children[iCol].
|
413
|
+
row.children[iCol].classes = ["tml-" + colAlign.trim()]
|
412
414
|
}
|
413
415
|
}
|
414
416
|
prevTypeWasAlign = true;
|
package/src/functions/accent.js
CHANGED
@@ -2,6 +2,16 @@ import defineFunction, { normalizeArgument } from "../defineFunction"
|
|
2
2
|
import mathMLTree from "../mathMLTree"
|
3
3
|
import stretchy from "../stretchy"
|
4
4
|
import * as mml from "../buildMathML"
|
5
|
+
import utils from "../utils"
|
6
|
+
|
7
|
+
const smalls = "acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳"
|
8
|
+
const talls = "ABCDEFGHIJKLMNOPQRSTUVWXYZbdfhkltΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβδλζφθψ"
|
9
|
+
+ "𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐛𝐝𝐟𝐡𝐤𝐥𝐭"
|
10
|
+
const longSmalls = new Set(["\\alpha", "\\gamma", "\\delta", "\\epsilon", "\\eta", "\\iota",
|
11
|
+
"\\kappa", "\\mu", "\\nu", "\\pi", "\\rho", "\\sigma", "\\tau", "\\upsilon", "\\chi", "\\psi",
|
12
|
+
"\\omega", "\\imath", "\\jmath"])
|
13
|
+
const longTalls = new Set(["\\Gamma", "\\Delta", "\\Sigma", "\\Omega", "\\beta", "\\delta",
|
14
|
+
"\\lambda", "\\theta", "\\psi"])
|
5
15
|
|
6
16
|
const mathmlBuilder = (group, style) => {
|
7
17
|
const accentNode = group.isStretchy
|
@@ -13,6 +23,13 @@ const mathmlBuilder = (group, style) => {
|
|
13
23
|
} else {
|
14
24
|
accentNode.style.mathStyle = "normal"
|
15
25
|
accentNode.style.mathDepth = "0"
|
26
|
+
if (needWebkitShift.has(group.label) && utils.isCharacterBox(group.base)) {
|
27
|
+
let shift = ""
|
28
|
+
const ch = group.base.text
|
29
|
+
if (smalls.indexOf(ch) > -1 || longSmalls.has(ch)) { shift = "tml-xshift" }
|
30
|
+
if (talls.indexOf(ch) > -1 || longTalls.has(ch)) { shift = "tml-capshift" }
|
31
|
+
if (shift) { accentNode.classes.push(shift) }
|
32
|
+
}
|
16
33
|
}
|
17
34
|
if (!group.isStretchy) {
|
18
35
|
accentNode.setAttribute("stretchy", "false")
|
@@ -41,6 +58,19 @@ const nonStretchyAccents = new Set([
|
|
41
58
|
"\\mathring"
|
42
59
|
])
|
43
60
|
|
61
|
+
const needWebkitShift = new Set([
|
62
|
+
"\\acute",
|
63
|
+
"\\bar",
|
64
|
+
"\\breve",
|
65
|
+
"\\check",
|
66
|
+
"\\dot",
|
67
|
+
"\\ddot",
|
68
|
+
"\\grave",
|
69
|
+
"\\hat",
|
70
|
+
"\\mathring",
|
71
|
+
"\\'", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v"
|
72
|
+
])
|
73
|
+
|
44
74
|
// Accents
|
45
75
|
defineFunction({
|
46
76
|
type: "accent",
|
package/src/functions/enclose.js
CHANGED
@@ -63,7 +63,10 @@ rgba(0,0,0,0) 100%);`
|
|
63
63
|
node.style.marginRight = "0.03889em"
|
64
64
|
break
|
65
65
|
case "\\sout":
|
66
|
-
node.style
|
66
|
+
node.style.backgroundImage = 'linear-gradient(black, black)'
|
67
|
+
node.style.backgroundRepeat = 'no-repeat'
|
68
|
+
node.style.backgroundSize = '100% 1.5px'
|
69
|
+
node.style.backgroundPosition = '0 center'
|
67
70
|
break
|
68
71
|
case "\\boxed":
|
69
72
|
// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} from amsmath.sty
|
package/src/functions/lap.js
CHANGED
package/src/postProcess.js
CHANGED
package/src/symbols.js
CHANGED
@@ -913,8 +913,6 @@ for (let i = 0; i < letters.length; i++) {
|
|
913
913
|
defineSymbol(math, mathord, ch, ch);
|
914
914
|
defineSymbol(text, textord, ch, ch);
|
915
915
|
}
|
916
|
-
// Prevent Firefox from using a dotless i.
|
917
|
-
defineSymbol(text, textord, "i\uFE0E", "i")
|
918
916
|
|
919
917
|
// Some more letters in Unicode Basic Multilingual Plane.
|
920
918
|
const narrow = "ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ";
|