temml 0.11.4 → 0.11.5

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  | Library | Minified JavaScript + CSS |
4
4
  |:--------------|:-------------------------:|
5
- | Temml | 168 KB |
5
+ | Temml | 169 KB |
6
6
  | MathJax 2.7.5 | 338 KB |
7
7
  | KaTeX | 280 KB |
8
8
  | TeXZilla | 168 KB |
@@ -36,9 +36,12 @@ math {
36
36
  font-family: Asana Math, math;
37
37
  }
38
38
 
39
- /* Next line is active in Firefox and Safari.
39
+ /* display: block is necessary in Firefox and Safari.
40
40
  * Not in Chromium, which recognizes display: "block math" written inline. */
41
- math.tml-display { display: block; }
41
+ math.tml-display {
42
+ display: block;
43
+ width: 100%;
44
+ }
42
45
 
43
46
  *.mathcal,
44
47
  mo.tml-prime {
@@ -46,9 +46,12 @@ math {
46
46
  font-family: "Latin Modern Math", math;
47
47
  }
48
48
 
49
- /* Next line is active in Firefox and Safari.
49
+ /* display: block is necessary in Firefox and Safari.
50
50
  * Not in Chromium, which recognizes display: "block math" written inline. */
51
- math.tml-display { display: block; }
51
+ math.tml-display {
52
+ display: block;
53
+ width: 100%;
54
+ }
52
55
 
53
56
  *.mathscr {
54
57
  font-family: "Temml";
@@ -44,9 +44,12 @@ math {
44
44
  font-family: Libertinus Math, math;
45
45
  }
46
46
 
47
- /* Next line is active in Firefox and Safari.
47
+ /* display: block is necessary in Firefox and Safari.
48
48
  * Not in Chromium, which recognizes display: "block math" written inline. */
49
- math.tml-display { display: block; }
49
+ math.tml-display {
50
+ display: block;
51
+ width: 100%;
52
+ }
50
53
 
51
54
  *.mathcal {
52
55
  font-family: "Cambria Math", 'STIXTwoMath-Regular', "Times New Roman", math;
@@ -30,9 +30,12 @@ math * {
30
30
  border-color: currentColor;
31
31
  }
32
32
 
33
- /* Next line is active in Firefox and Safari.
33
+ /* display: block is necessary in Firefox and Safari.
34
34
  * Not in Chromium, which recognizes display: "block math" written inline. */
35
- math.tml-display { display: block; }
35
+ math.tml-display {
36
+ display: block;
37
+ width: 100%;
38
+ }
36
39
 
37
40
  *.mathcal {
38
41
  /* NotoSans */
@@ -32,9 +32,12 @@ math {
32
32
  font-family: "NotoSans Math", math;
33
33
  }
34
34
 
35
- /* Next line is active in Firefox and Safari.
35
+ /* display: block is necessary in Firefox and Safari.
36
36
  * Not in Chromium, which recognizes display: "block math" written inline. */
37
- math.tml-display { display: block; }
37
+ math.tml-display {
38
+ display: block;
39
+ width: 100%;
40
+ }
38
41
 
39
42
  math .mathscr {
40
43
  font-family: "ssty1";
@@ -30,9 +30,12 @@ math * {
30
30
  border-color: currentColor;
31
31
  }
32
32
 
33
- /* Next line is active in Firefox and Safari.
33
+ /* display: block is necessary in Firefox and Safari.
34
34
  * Not in Chromium, which recognizes display: "block math" written inline. */
35
- math.tml-display { display: block; }
35
+ math.tml-display {
36
+ display: block;
37
+ width: 100%;
38
+ }
36
39
 
37
40
  math {
38
41
  font-family: STIX2, math;
package/dist/temml.cjs CHANGED
@@ -2456,9 +2456,6 @@ function buildMathML(tree, texExpression, style, settings) {
2456
2456
  if (settings.xml) {
2457
2457
  math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
2458
2458
  }
2459
- if (wrapper.style.width) {
2460
- math.style.width = "100%";
2461
- }
2462
2459
  if (settings.displayMode) {
2463
2460
  math.setAttribute("display", "block");
2464
2461
  math.style.display = "block math"; // necessary in Chromium.
@@ -10570,7 +10567,8 @@ defineFunction({
10570
10567
  names: ["\\relax"],
10571
10568
  props: {
10572
10569
  numArgs: 0,
10573
- allowedInText: true
10570
+ allowedInText: true,
10571
+ allowedInArgument: true
10574
10572
  },
10575
10573
  handler({ parser }) {
10576
10574
  return {
@@ -12986,6 +12984,7 @@ class Parser {
12986
12984
  if (!atom) {
12987
12985
  break;
12988
12986
  } else if (atom.type === "internal") {
12987
+ // Internal nodes do not appear in parse tree
12989
12988
  continue;
12990
12989
  }
12991
12990
  body.push(atom);
@@ -13060,7 +13059,11 @@ class Parser {
13060
13059
  const symbol = symbolToken.text;
13061
13060
  this.consume();
13062
13061
  this.consumeSpaces(); // ignore spaces before sup/subscript argument
13063
- const group = this.parseGroup(name);
13062
+ // Skip over allowed internal nodes such as \relax
13063
+ let group;
13064
+ do {
13065
+ group = this.parseGroup(name);
13066
+ } while (group.type && group.type === "internal")
13064
13067
 
13065
13068
  if (!group) {
13066
13069
  throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
@@ -13104,9 +13107,15 @@ class Parser {
13104
13107
  // \left(x\right)^2 work correctly.
13105
13108
  const base = this.parseGroup("atom", breakOnTokenText);
13106
13109
 
13110
+ // Internal nodes (e.g. \relax) cannot support super/subscripts.
13111
+ // Instead we will pick up super/subscripts with blank base next round.
13112
+ if (base && base.type === "internal") {
13113
+ return base
13114
+ }
13115
+
13107
13116
  // In text mode, we don't have superscripts or subscripts
13108
13117
  if (this.mode === "text") {
13109
- return base;
13118
+ return base
13110
13119
  }
13111
13120
 
13112
13121
  // Note that base may be empty (i.e. null) at this point.
@@ -13963,7 +13972,7 @@ class Style {
13963
13972
  * https://mit-license.org/
13964
13973
  */
13965
13974
 
13966
- const version = "0.11.04";
13975
+ const version = "0.11.05";
13967
13976
 
13968
13977
  function postProcess(block) {
13969
13978
  const labelMap = {};
package/dist/temml.js CHANGED
@@ -2457,9 +2457,6 @@ var temml = (function () {
2457
2457
  if (settings.xml) {
2458
2458
  math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
2459
2459
  }
2460
- if (wrapper.style.width) {
2461
- math.style.width = "100%";
2462
- }
2463
2460
  if (settings.displayMode) {
2464
2461
  math.setAttribute("display", "block");
2465
2462
  math.style.display = "block math"; // necessary in Chromium.
@@ -8657,7 +8654,8 @@ var temml = (function () {
8657
8654
  names: ["\\relax"],
8658
8655
  props: {
8659
8656
  numArgs: 0,
8660
- allowedInText: true
8657
+ allowedInText: true,
8658
+ allowedInArgument: true
8661
8659
  },
8662
8660
  handler({ parser }) {
8663
8661
  return {
@@ -11073,6 +11071,7 @@ var temml = (function () {
11073
11071
  if (!atom) {
11074
11072
  break;
11075
11073
  } else if (atom.type === "internal") {
11074
+ // Internal nodes do not appear in parse tree
11076
11075
  continue;
11077
11076
  }
11078
11077
  body.push(atom);
@@ -11147,7 +11146,11 @@ var temml = (function () {
11147
11146
  const symbol = symbolToken.text;
11148
11147
  this.consume();
11149
11148
  this.consumeSpaces(); // ignore spaces before sup/subscript argument
11150
- const group = this.parseGroup(name);
11149
+ // Skip over allowed internal nodes such as \relax
11150
+ let group;
11151
+ do {
11152
+ group = this.parseGroup(name);
11153
+ } while (group.type && group.type === "internal")
11151
11154
 
11152
11155
  if (!group) {
11153
11156
  throw new ParseError("Expected group after '" + symbol + "'", symbolToken);
@@ -11191,9 +11194,15 @@ var temml = (function () {
11191
11194
  // \left(x\right)^2 work correctly.
11192
11195
  const base = this.parseGroup("atom", breakOnTokenText);
11193
11196
 
11197
+ // Internal nodes (e.g. \relax) cannot support super/subscripts.
11198
+ // Instead we will pick up super/subscripts with blank base next round.
11199
+ if (base && base.type === "internal") {
11200
+ return base
11201
+ }
11202
+
11194
11203
  // In text mode, we don't have superscripts or subscripts
11195
11204
  if (this.mode === "text") {
11196
- return base;
11205
+ return base
11197
11206
  }
11198
11207
 
11199
11208
  // Note that base may be empty (i.e. null) at this point.
@@ -12050,7 +12059,7 @@ var temml = (function () {
12050
12059
  * https://mit-license.org/
12051
12060
  */
12052
12061
 
12053
- const version = "0.11.04";
12062
+ const version = "0.11.05";
12054
12063
 
12055
12064
  function postProcess(block) {
12056
12065
  const labelMap = {};