temml 0.13.3 → 0.13.4

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/dist/temml.mjs CHANGED
@@ -785,7 +785,7 @@ const estimatedWidth = node => {
785
785
  };
786
786
 
787
787
  const stretchyCodePoint = {
788
- widehat: "^",
788
+ widehat: "\u02c6", // Shorter than \u005e, which is appropriate for an accent.
789
789
  widecheck: "ˇ",
790
790
  widetilde: "~",
791
791
  wideparen: "⏜", // \u23dc
@@ -848,19 +848,30 @@ const mathMLnode = function(label) {
848
848
  return node
849
849
  };
850
850
 
851
- const crookedWides = ["\\widetilde", "\\widehat", "\\widecheck", "\\utilde"];
851
+ const wideHats = ["\\widehat", "\\widecheck"];
852
852
 
853
- // TODO: Remove when Chromium stretches \widetilde & \widehat
853
+ // TODO: Remove if/when Chromium stretches \widetilde & \widehat
854
854
  const accentNode = (group) => {
855
855
  const mo = mathMLnode(group.label);
856
- if (crookedWides.includes(group.label)) {
856
+ if (group.label.indexOf("tilde") > -1) {
857
857
  const width = estimatedWidth(group.base);
858
858
  if (1 < width && width < 1.6) {
859
- mo.classes.push("tml-crooked-2");
859
+ mo.classes.push("tml-tilde-2");
860
+ } else if (1.6 <= width && width < 2.5) {
861
+ mo.classes.push("tml-tilde-3");
862
+ } else if (2.5 <= width) {
863
+ mo.classes.push("tml-tilde-4");
864
+ }
865
+ } else if (wideHats.includes(group.label)) {
866
+ const width = estimatedWidth(group.base);
867
+ if (0 < width && width <= 1) {
868
+ mo.classes.push("tml-hat-1");
869
+ } else if (1 < width && width < 1.6) {
870
+ mo.classes.push("tml-hat-2");
860
871
  } else if (1.6 <= width && width < 2.5) {
861
- mo.classes.push("tml-crooked-3");
872
+ mo.classes.push("tml-hat-3");
862
873
  } else if (2.5 <= width) {
863
- mo.classes.push("tml-crooked-4");
874
+ mo.classes.push("tml-hat-4");
864
875
  }
865
876
  }
866
877
  return mo
@@ -1769,7 +1780,7 @@ defineSymbol(math, accent, "\u007e", "\\tilde");
1769
1780
  defineSymbol(math, accent, "\u203e", "\\bar");
1770
1781
  defineSymbol(math, accent, "\u02d8", "\\breve");
1771
1782
  defineSymbol(math, accent, "\u02c7", "\\check");
1772
- defineSymbol(math, accent, "\u005e", "\\hat");
1783
+ defineSymbol(math, accent, "\u02c6", "\\hat");
1773
1784
  defineSymbol(math, accent, "\u2192", "\\vec");
1774
1785
  defineSymbol(math, accent, "\u02d9", "\\dot");
1775
1786
  defineSymbol(math, accent, "\u02da", "\\mathring");
@@ -14195,7 +14206,7 @@ class Style {
14195
14206
  * https://mit-license.org/
14196
14207
  */
14197
14208
 
14198
- const version = "0.13.3";
14209
+ const version = "0.13.4";
14199
14210
 
14200
14211
  function postProcess(block) {
14201
14212
  const labelMap = {};
@@ -11,7 +11,7 @@
11
11
  * https://mit-license.org/
12
12
  */
13
13
 
14
- const version = "0.13.3";
14
+ const version = "0.13.4";
15
15
 
16
16
  function postProcess(block) {
17
17
  const labelMap = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "temml",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "description": "TeX to MathML conversion in JavaScript.",
5
5
  "main": "dist/temml.js",
6
6
  "engines": {
@@ -5,7 +5,7 @@
5
5
  * https://mit-license.org/
6
6
  */
7
7
 
8
- export const version = "0.13.3";
8
+ export const version = "0.13.4";
9
9
 
10
10
  export function postProcess(block) {
11
11
  const labelMap = {}
package/src/stretchy.js CHANGED
@@ -35,7 +35,7 @@ const estimatedWidth = node => {
35
35
  }
36
36
 
37
37
  const stretchyCodePoint = {
38
- widehat: "^",
38
+ widehat: "\u02c6", // Shorter than \u005e, which is appropriate for an accent.
39
39
  widecheck: "ˇ",
40
40
  widetilde: "~",
41
41
  wideparen: "⏜", // \u23dc
@@ -98,19 +98,30 @@ export const mathMLnode = function(label) {
98
98
  return node
99
99
  }
100
100
 
101
- const crookedWides = ["\\widetilde", "\\widehat", "\\widecheck", "\\utilde"]
101
+ const wideHats = ["\\widehat", "\\widecheck"];
102
102
 
103
- // TODO: Remove when Chromium stretches \widetilde & \widehat
103
+ // TODO: Remove if/when Chromium stretches \widetilde & \widehat
104
104
  export const accentNode = (group) => {
105
105
  const mo = mathMLnode(group.label)
106
- if (crookedWides.includes(group.label)) {
106
+ if (group.label.indexOf("tilde") > -1) {
107
107
  const width = estimatedWidth(group.base)
108
108
  if (1 < width && width < 1.6) {
109
- mo.classes.push("tml-crooked-2")
109
+ mo.classes.push("tml-tilde-2")
110
+ } else if (1.6 <= width && width < 2.5) {
111
+ mo.classes.push("tml-tilde-3")
112
+ } else if (2.5 <= width) {
113
+ mo.classes.push("tml-tilde-4")
114
+ }
115
+ } else if (wideHats.includes(group.label)) {
116
+ const width = estimatedWidth(group.base)
117
+ if (0 < width && width <= 1) {
118
+ mo.classes.push("tml-hat-1")
119
+ } else if (1 < width && width < 1.6) {
120
+ mo.classes.push("tml-hat-2")
110
121
  } else if (1.6 <= width && width < 2.5) {
111
- mo.classes.push("tml-crooked-3")
122
+ mo.classes.push("tml-hat-3")
112
123
  } else if (2.5 <= width) {
113
- mo.classes.push("tml-crooked-4")
124
+ mo.classes.push("tml-hat-4")
114
125
  }
115
126
  }
116
127
  return mo
package/src/symbols.js CHANGED
@@ -902,7 +902,7 @@ defineSymbol(math, accent, "\u007e", "\\tilde");
902
902
  defineSymbol(math, accent, "\u203e", "\\bar");
903
903
  defineSymbol(math, accent, "\u02d8", "\\breve");
904
904
  defineSymbol(math, accent, "\u02c7", "\\check");
905
- defineSymbol(math, accent, "\u005e", "\\hat");
905
+ defineSymbol(math, accent, "\u02c6", "\\hat");
906
906
  defineSymbol(math, accent, "\u2192", "\\vec");
907
907
  defineSymbol(math, accent, "\u02d9", "\\dot");
908
908
  defineSymbol(math, accent, "\u02da", "\\mathring");