temml 0.11.3 → 0.11.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.cjs CHANGED
@@ -6466,7 +6466,7 @@ const mathmlBuilder$9 = function(group, style) {
6466
6466
  const numColumns = group.body[0].length;
6467
6467
  // Fill out a short row with empty <mtd> elements.
6468
6468
  for (let k = 0; k < numColumns - rw.length; k++) {
6469
- row.push(new mathMLTree.MathNode("mtd", [], style));
6469
+ row.push(new mathMLTree.MathNode("mtd", [], [], style));
6470
6470
  }
6471
6471
  if (group.autoTag) {
6472
6472
  const tag = group.tags[i];
@@ -6926,7 +6926,9 @@ defineEnvironment({
6926
6926
  }
6927
6927
  }
6928
6928
  const res = parseArray(context.parser, payload, "text");
6929
- res.cols = new Array(res.body[0].length).fill({ type: "align", align: colAlign });
6929
+ res.cols = res.body.length > 0
6930
+ ? new Array(res.body[0].length).fill({ type: "align", align: colAlign })
6931
+ : [];
6930
6932
  const [arraystretch, arraycolsep] = arrayGaps(context.parser.gullet.macros);
6931
6933
  res.arraystretch = arraystretch;
6932
6934
  if (arraycolsep && !(arraycolsep === 6 && arraycolsep === "pt")) {
@@ -6955,7 +6957,9 @@ defineEnvironment({
6955
6957
  handler(context) {
6956
6958
  const payload = { cols: [], envClasses: ["bordermatrix"] };
6957
6959
  const res = parseArray(context.parser, payload, "text");
6958
- res.cols = new Array(res.body[0].length).fill({ type: "align", align: "c" });
6960
+ res.cols = res.body.length > 0
6961
+ ? new Array(res.body[0].length).fill({ type: "align", align: "c" })
6962
+ : [];
6959
6963
  res.envClasses = [];
6960
6964
  res.arraystretch = 1;
6961
6965
  if (context.envName === "matrix") { return res}
@@ -7389,6 +7393,9 @@ const mathmlBuilder$8 = (group, style) => {
7389
7393
  // So instead of wrapping the group in an <mstyle>, we apply
7390
7394
  // the color individually to each node and return a document fragment.
7391
7395
  let expr = buildExpression(group.body, style.withColor(group.color));
7396
+ if (expr.length === 0) {
7397
+ expr.push(new mathMLTree.MathNode("mrow"));
7398
+ }
7392
7399
  expr = expr.map(e => {
7393
7400
  e.style.color = group.color;
7394
7401
  return e
@@ -8475,17 +8482,20 @@ const mathmlBuilder$6 = (group, style) => {
8475
8482
  // Check if it is possible to consolidate elements into a single <mi> element.
8476
8483
  if (isLongVariableName(group, font)) {
8477
8484
  // This is a \mathrm{…} group. It gets special treatment because symbolsOrd.js
8478
- // wraps <mi> elements with <mrow>s to work around a Firefox bug.
8479
- const mi = mathGroup.children[0].children[0];
8485
+ // wraps <mi> elements with <mpadded>s to work around a Firefox bug.
8486
+ const mi = mathGroup.children[0].children[0].children
8487
+ ? mathGroup.children[0].children[0]
8488
+ : mathGroup.children[0];
8480
8489
  delete mi.attributes.mathvariant;
8481
8490
  for (let i = 1; i < mathGroup.children.length; i++) {
8482
8491
  mi.children[0].text += mathGroup.children[i].children[0].children
8483
8492
  ? mathGroup.children[i].children[0].children[0].text
8484
8493
  : mathGroup.children[i].children[0].text;
8485
8494
  }
8486
- // Wrap in a <mrow> to prevent the same Firefox bug.
8487
- const bogus = new mathMLTree.MathNode("mtext", new mathMLTree.TextNode("\u200b"));
8488
- return new mathMLTree.MathNode("mrow", [bogus, mi])
8495
+ // Wrap in a <mpadded> to prevent the same Firefox bug.
8496
+ const mpadded = new mathMLTree.MathNode("mpadded", [mi]);
8497
+ mpadded.setAttribute("lspace", "0");
8498
+ return mpadded
8489
8499
  }
8490
8500
  let canConsolidate = mathGroup.children[0].type === "mo";
8491
8501
  for (let i = 1; i < mathGroup.children.length; i++) {
@@ -13953,7 +13963,7 @@ class Style {
13953
13963
  * https://mit-license.org/
13954
13964
  */
13955
13965
 
13956
- const version = "0.11.03";
13966
+ const version = "0.11.04";
13957
13967
 
13958
13968
  function postProcess(block) {
13959
13969
  const labelMap = {};
package/dist/temml.js CHANGED
@@ -4553,7 +4553,7 @@ var temml = (function () {
4553
4553
  const numColumns = group.body[0].length;
4554
4554
  // Fill out a short row with empty <mtd> elements.
4555
4555
  for (let k = 0; k < numColumns - rw.length; k++) {
4556
- row.push(new mathMLTree.MathNode("mtd", [], style));
4556
+ row.push(new mathMLTree.MathNode("mtd", [], [], style));
4557
4557
  }
4558
4558
  if (group.autoTag) {
4559
4559
  const tag = group.tags[i];
@@ -5013,7 +5013,9 @@ var temml = (function () {
5013
5013
  }
5014
5014
  }
5015
5015
  const res = parseArray(context.parser, payload, "text");
5016
- res.cols = new Array(res.body[0].length).fill({ type: "align", align: colAlign });
5016
+ res.cols = res.body.length > 0
5017
+ ? new Array(res.body[0].length).fill({ type: "align", align: colAlign })
5018
+ : [];
5017
5019
  const [arraystretch, arraycolsep] = arrayGaps(context.parser.gullet.macros);
5018
5020
  res.arraystretch = arraystretch;
5019
5021
  if (arraycolsep && !(arraycolsep === 6 && arraycolsep === "pt")) {
@@ -5042,7 +5044,9 @@ var temml = (function () {
5042
5044
  handler(context) {
5043
5045
  const payload = { cols: [], envClasses: ["bordermatrix"] };
5044
5046
  const res = parseArray(context.parser, payload, "text");
5045
- res.cols = new Array(res.body[0].length).fill({ type: "align", align: "c" });
5047
+ res.cols = res.body.length > 0
5048
+ ? new Array(res.body[0].length).fill({ type: "align", align: "c" })
5049
+ : [];
5046
5050
  res.envClasses = [];
5047
5051
  res.arraystretch = 1;
5048
5052
  if (context.envName === "matrix") { return res}
@@ -5476,6 +5480,9 @@ var temml = (function () {
5476
5480
  // So instead of wrapping the group in an <mstyle>, we apply
5477
5481
  // the color individually to each node and return a document fragment.
5478
5482
  let expr = buildExpression(group.body, style.withColor(group.color));
5483
+ if (expr.length === 0) {
5484
+ expr.push(new mathMLTree.MathNode("mrow"));
5485
+ }
5479
5486
  expr = expr.map(e => {
5480
5487
  e.style.color = group.color;
5481
5488
  return e
@@ -6562,17 +6569,20 @@ var temml = (function () {
6562
6569
  // Check if it is possible to consolidate elements into a single <mi> element.
6563
6570
  if (isLongVariableName(group, font)) {
6564
6571
  // This is a \mathrm{…} group. It gets special treatment because symbolsOrd.js
6565
- // wraps <mi> elements with <mrow>s to work around a Firefox bug.
6566
- const mi = mathGroup.children[0].children[0];
6572
+ // wraps <mi> elements with <mpadded>s to work around a Firefox bug.
6573
+ const mi = mathGroup.children[0].children[0].children
6574
+ ? mathGroup.children[0].children[0]
6575
+ : mathGroup.children[0];
6567
6576
  delete mi.attributes.mathvariant;
6568
6577
  for (let i = 1; i < mathGroup.children.length; i++) {
6569
6578
  mi.children[0].text += mathGroup.children[i].children[0].children
6570
6579
  ? mathGroup.children[i].children[0].children[0].text
6571
6580
  : mathGroup.children[i].children[0].text;
6572
6581
  }
6573
- // Wrap in a <mrow> to prevent the same Firefox bug.
6574
- const bogus = new mathMLTree.MathNode("mtext", new mathMLTree.TextNode("\u200b"));
6575
- return new mathMLTree.MathNode("mrow", [bogus, mi])
6582
+ // Wrap in a <mpadded> to prevent the same Firefox bug.
6583
+ const mpadded = new mathMLTree.MathNode("mpadded", [mi]);
6584
+ mpadded.setAttribute("lspace", "0");
6585
+ return mpadded
6576
6586
  }
6577
6587
  let canConsolidate = mathGroup.children[0].type === "mo";
6578
6588
  for (let i = 1; i < mathGroup.children.length; i++) {
@@ -12040,7 +12050,7 @@ var temml = (function () {
12040
12050
  * https://mit-license.org/
12041
12051
  */
12042
12052
 
12043
- const version = "0.11.03";
12053
+ const version = "0.11.04";
12044
12054
 
12045
12055
  function postProcess(block) {
12046
12056
  const labelMap = {};