temml 0.9.2 → 0.10.0
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 +0 -4
- package/dist/Temml-Latin-Modern.css +0 -5
- package/dist/Temml-Libertinus.css +0 -5
- package/dist/Temml-Local.css +0 -4
- package/dist/Temml-STIX2.css +0 -5
- package/dist/temml.cjs +53 -13
- package/dist/temml.js +53 -13
- package/dist/temml.min.js +1 -1
- package/dist/temml.mjs +53 -13
- package/dist/temmlPostProcess.js +1 -1
- package/package.json +1 -1
- package/src/Parser.js +17 -0
- package/src/asciiFromScript.js +29 -0
- package/src/functions/cr.js +2 -3
- package/src/functions/font.js +0 -1
- package/src/functions/symbolsOrd.js +1 -4
- package/src/postProcess.js +1 -1
- package/src/symbols.js +2 -0
- package/src/variant.js +1 -4
package/dist/temml.mjs
CHANGED
@@ -1232,6 +1232,8 @@ defineSymbol(math, textord, "\u2018", "`");
|
|
1232
1232
|
defineSymbol(math, textord, "$", "\\$");
|
1233
1233
|
defineSymbol(text, textord, "$", "\\$");
|
1234
1234
|
defineSymbol(text, textord, "$", "\\textdollar");
|
1235
|
+
defineSymbol(math, textord, "¢", "\\cent");
|
1236
|
+
defineSymbol(text, textord, "¢", "\\cent");
|
1235
1237
|
defineSymbol(math, textord, "%", "\\%");
|
1236
1238
|
defineSymbol(text, textord, "%", "\\%");
|
1237
1239
|
defineSymbol(math, textord, "_", "\\_");
|
@@ -3146,13 +3148,12 @@ defineFunction({
|
|
3146
3148
|
names: ["\\\\"],
|
3147
3149
|
props: {
|
3148
3150
|
numArgs: 0,
|
3149
|
-
numOptionalArgs:
|
3150
|
-
argTypes: ["size"],
|
3151
|
+
numOptionalArgs: 0,
|
3151
3152
|
allowedInText: true
|
3152
3153
|
},
|
3153
3154
|
|
3154
3155
|
handler({ parser }, args, optArgs) {
|
3155
|
-
const size =
|
3156
|
+
const size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
|
3156
3157
|
const newLine = !parser.settings.displayMode;
|
3157
3158
|
return {
|
3158
3159
|
type: "cr",
|
@@ -4912,7 +4913,6 @@ defineFunction({
|
|
4912
4913
|
"\\mathscr",
|
4913
4914
|
"\\mathsf",
|
4914
4915
|
"\\mathtt",
|
4915
|
-
"\\oldstylenums",
|
4916
4916
|
|
4917
4917
|
// aliases
|
4918
4918
|
"\\Bbb",
|
@@ -7326,8 +7326,7 @@ const fontMap = {
|
|
7326
7326
|
mathfrak: "fraktur",
|
7327
7327
|
mathscr: "script",
|
7328
7328
|
mathsf: "sans-serif",
|
7329
|
-
mathtt: "monospace"
|
7330
|
-
oldstylenums: "oldstylenums"
|
7329
|
+
mathtt: "monospace"
|
7331
7330
|
};
|
7332
7331
|
|
7333
7332
|
/**
|
@@ -7397,8 +7396,6 @@ const getVariant = function(group, style) {
|
|
7397
7396
|
return "sans-serif"
|
7398
7397
|
case "mathtt":
|
7399
7398
|
return "monospace"
|
7400
|
-
case "oldstylenums":
|
7401
|
-
return "oldstylenums"
|
7402
7399
|
}
|
7403
7400
|
|
7404
7401
|
let text = group.text;
|
@@ -7694,10 +7691,7 @@ defineFunctionBuilders({
|
|
7694
7691
|
let node;
|
7695
7692
|
if (numberRegEx$1.test(group.text)) {
|
7696
7693
|
const tag = group.mode === "text" ? "mtext" : "mn";
|
7697
|
-
if (variant === "
|
7698
|
-
const ms = new mathMLTree.MathNode("mstyle", [text], ["oldstylenums"]);
|
7699
|
-
node = new mathMLTree.MathNode(tag, [ms]);
|
7700
|
-
} else if (variant === "italic" || variant === "bold-italic") {
|
7694
|
+
if (variant === "italic" || variant === "bold-italic") {
|
7701
7695
|
return italicNumber(text, variant, tag)
|
7702
7696
|
} else {
|
7703
7697
|
if (variant !== "normal") {
|
@@ -11428,6 +11422,36 @@ const uSubsAndSups = Object.freeze({
|
|
11428
11422
|
'\u1DBF': 'θ'
|
11429
11423
|
});
|
11430
11424
|
|
11425
|
+
// Used for Unicode input of calligraphic and script letters
|
11426
|
+
const asciiFromScript = Object.freeze({
|
11427
|
+
"\ud835\udc9c": "A",
|
11428
|
+
"\u212c": "B",
|
11429
|
+
"\ud835\udc9e": "C",
|
11430
|
+
"\ud835\udc9f": "D",
|
11431
|
+
"\u2130": "E",
|
11432
|
+
"\u2131": "F",
|
11433
|
+
"\ud835\udca2": "G",
|
11434
|
+
"\u210B": "H",
|
11435
|
+
"\u2110": "I",
|
11436
|
+
"\ud835\udca5": "J",
|
11437
|
+
"\ud835\udca6": "K",
|
11438
|
+
"\u2112": "L",
|
11439
|
+
"\u2113": "M",
|
11440
|
+
"\ud835\udca9": "N",
|
11441
|
+
"\ud835\udcaa": "O",
|
11442
|
+
"\ud835\udcab": "P",
|
11443
|
+
"\ud835\udcac": "Q",
|
11444
|
+
"\u211B": "R",
|
11445
|
+
"\ud835\udcae": "S",
|
11446
|
+
"\ud835\udcaf": "T",
|
11447
|
+
"\ud835\udcb0": "U",
|
11448
|
+
"\ud835\udcb1": "V",
|
11449
|
+
"\ud835\udcb2": "W",
|
11450
|
+
"\ud835\udcb3": "X",
|
11451
|
+
"\ud835\udcb4": "Y",
|
11452
|
+
"\ud835\udcb5": "Z"
|
11453
|
+
});
|
11454
|
+
|
11431
11455
|
// Mapping of Unicode accent characters to their LaTeX equivalent in text and
|
11432
11456
|
// math mode (when they exist).
|
11433
11457
|
var unicodeAccents = {
|
@@ -12663,6 +12687,22 @@ class Parser {
|
|
12663
12687
|
text
|
12664
12688
|
};
|
12665
12689
|
} else {
|
12690
|
+
if (asciiFromScript[text]) {
|
12691
|
+
// Unicode 14 disambiguates chancery from roundhand.
|
12692
|
+
// See https://www.unicode.org/charts/PDF/U1D400.pdf
|
12693
|
+
this.consume();
|
12694
|
+
const nextCode = this.fetch().text.charCodeAt(0);
|
12695
|
+
// mathcal is Temml default. Use mathscript if called for.
|
12696
|
+
const font = nextCode === 0xfe01 ? "mathscr" : "mathcal";
|
12697
|
+
if (nextCode === 0xfe00 || nextCode === 0xfe01) { this.consume(); }
|
12698
|
+
return {
|
12699
|
+
type: "font",
|
12700
|
+
mode: "math",
|
12701
|
+
font,
|
12702
|
+
body: { type: "mathord", mode: "math", loc, text: asciiFromScript[text] }
|
12703
|
+
}
|
12704
|
+
}
|
12705
|
+
// Default ord character. No disambiguation necessary.
|
12666
12706
|
s = {
|
12667
12707
|
type: group,
|
12668
12708
|
mode: this.mode,
|
@@ -12919,7 +12959,7 @@ class Style {
|
|
12919
12959
|
* https://mit-license.org/
|
12920
12960
|
*/
|
12921
12961
|
|
12922
|
-
const version = "0.
|
12962
|
+
const version = "0.10.0";
|
12923
12963
|
|
12924
12964
|
function postProcess(block) {
|
12925
12965
|
const labelMap = {};
|
package/dist/temmlPostProcess.js
CHANGED
package/package.json
CHANGED
package/src/Parser.js
CHANGED
@@ -7,6 +7,7 @@ import { supportedCodepoint } from "./unicodeScripts";
|
|
7
7
|
import ParseError from "./ParseError";
|
8
8
|
import { combiningDiacriticalMarksEndRegex } from "./Lexer";
|
9
9
|
import { uSubsAndSups, unicodeSubRegEx } from "./unicodeSupOrSub"
|
10
|
+
import { asciiFromScript } from "./asciiFromScript"
|
10
11
|
import SourceLocation from "./SourceLocation";
|
11
12
|
import { Token } from "./Token";
|
12
13
|
|
@@ -909,6 +910,22 @@ export default class Parser {
|
|
909
910
|
text
|
910
911
|
};
|
911
912
|
} else {
|
913
|
+
if (asciiFromScript[text]) {
|
914
|
+
// Unicode 14 disambiguates chancery from roundhand.
|
915
|
+
// See https://www.unicode.org/charts/PDF/U1D400.pdf
|
916
|
+
this.consume()
|
917
|
+
const nextCode = this.fetch().text.charCodeAt(0)
|
918
|
+
// mathcal is Temml default. Use mathscript if called for.
|
919
|
+
const font = nextCode === 0xfe01 ? "mathscr" : "mathcal";
|
920
|
+
if (nextCode === 0xfe00 || nextCode === 0xfe01) { this.consume() }
|
921
|
+
return {
|
922
|
+
type: "font",
|
923
|
+
mode: "math",
|
924
|
+
font,
|
925
|
+
body: { type: "mathord", mode: "math", loc, text: asciiFromScript[text] }
|
926
|
+
}
|
927
|
+
}
|
928
|
+
// Default ord character. No disambiguation necessary.
|
912
929
|
s = {
|
913
930
|
type: group,
|
914
931
|
mode: this.mode,
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// Used for Unicode input of calligraphic and script letters
|
2
|
+
export const asciiFromScript = Object.freeze({
|
3
|
+
"\ud835\udc9c": "A",
|
4
|
+
"\u212c": "B",
|
5
|
+
"\ud835\udc9e": "C",
|
6
|
+
"\ud835\udc9f": "D",
|
7
|
+
"\u2130": "E",
|
8
|
+
"\u2131": "F",
|
9
|
+
"\ud835\udca2": "G",
|
10
|
+
"\u210B": "H",
|
11
|
+
"\u2110": "I",
|
12
|
+
"\ud835\udca5": "J",
|
13
|
+
"\ud835\udca6": "K",
|
14
|
+
"\u2112": "L",
|
15
|
+
"\u2113": "M",
|
16
|
+
"\ud835\udca9": "N",
|
17
|
+
"\ud835\udcaa": "O",
|
18
|
+
"\ud835\udcab": "P",
|
19
|
+
"\ud835\udcac": "Q",
|
20
|
+
"\u211B": "R",
|
21
|
+
"\ud835\udcae": "S",
|
22
|
+
"\ud835\udcaf": "T",
|
23
|
+
"\ud835\udcb0": "U",
|
24
|
+
"\ud835\udcb1": "V",
|
25
|
+
"\ud835\udcb2": "W",
|
26
|
+
"\ud835\udcb3": "X",
|
27
|
+
"\ud835\udcb4": "Y",
|
28
|
+
"\ud835\udcb5": "Z"
|
29
|
+
})
|
package/src/functions/cr.js
CHANGED
@@ -11,13 +11,12 @@ defineFunction({
|
|
11
11
|
names: ["\\\\"],
|
12
12
|
props: {
|
13
13
|
numArgs: 0,
|
14
|
-
numOptionalArgs:
|
15
|
-
argTypes: ["size"],
|
14
|
+
numOptionalArgs: 0,
|
16
15
|
allowedInText: true
|
17
16
|
},
|
18
17
|
|
19
18
|
handler({ parser }, args, optArgs) {
|
20
|
-
const size =
|
19
|
+
const size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
|
21
20
|
const newLine = !parser.settings.displayMode;
|
22
21
|
return {
|
23
22
|
type: "cr",
|
package/src/functions/font.js
CHANGED
@@ -63,10 +63,7 @@ defineFunctionBuilders({
|
|
63
63
|
let node
|
64
64
|
if (numberRegEx.test(group.text)) {
|
65
65
|
const tag = group.mode === "text" ? "mtext" : "mn"
|
66
|
-
if (variant === "
|
67
|
-
const ms = new mathMLTree.MathNode("mstyle", [text], ["oldstylenums"])
|
68
|
-
node = new mathMLTree.MathNode(tag, [ms])
|
69
|
-
} else if (variant === "italic" || variant === "bold-italic") {
|
66
|
+
if (variant === "italic" || variant === "bold-italic") {
|
70
67
|
return italicNumber(text, variant, tag)
|
71
68
|
} else {
|
72
69
|
if (variant !== "normal") {
|
package/src/postProcess.js
CHANGED
package/src/symbols.js
CHANGED
@@ -474,6 +474,8 @@ defineSymbol(math, textord, "\u2018", "`");
|
|
474
474
|
defineSymbol(math, textord, "$", "\\$");
|
475
475
|
defineSymbol(text, textord, "$", "\\$");
|
476
476
|
defineSymbol(text, textord, "$", "\\textdollar");
|
477
|
+
defineSymbol(math, textord, "¢", "\\cent");
|
478
|
+
defineSymbol(text, textord, "¢", "\\cent");
|
477
479
|
defineSymbol(math, textord, "%", "\\%");
|
478
480
|
defineSymbol(text, textord, "%", "\\%");
|
479
481
|
defineSymbol(math, textord, "_", "\\_");
|
package/src/variant.js
CHANGED
@@ -17,8 +17,7 @@ const fontMap = {
|
|
17
17
|
mathfrak: "fraktur",
|
18
18
|
mathscr: "script",
|
19
19
|
mathsf: "sans-serif",
|
20
|
-
mathtt: "monospace"
|
21
|
-
oldstylenums: "oldstylenums"
|
20
|
+
mathtt: "monospace"
|
22
21
|
}
|
23
22
|
|
24
23
|
/**
|
@@ -88,8 +87,6 @@ export const getVariant = function(group, style) {
|
|
88
87
|
return "sans-serif"
|
89
88
|
case "mathtt":
|
90
89
|
return "monospace"
|
91
|
-
case "oldstylenums":
|
92
|
-
return "oldstylenums"
|
93
90
|
default:
|
94
91
|
break
|
95
92
|
}
|