proskomma-core 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/dist/index.js CHANGED
@@ -15992,7 +15992,7 @@ var bitset = { exports: {} };
15992
15992
  var bitsetExports = bitset.exports;
15993
15993
  const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
15994
15994
  const name = "proskomma-core";
15995
- const version = "0.11.4";
15995
+ const version = "0.11.5";
15996
15996
  const description$h = "A Scripture Runtime Engine";
15997
15997
  const files = [
15998
15998
  "dist"
@@ -43377,6 +43377,16 @@ const Sequence = class {
43377
43377
  }
43378
43378
  this.activeScopes = [];
43379
43379
  }
43380
+ closeCellScopes(parser) {
43381
+ const firstCellIndex = this.activeScopes.findIndex((sc) => sc.label.startsWith("cell/"));
43382
+ if (firstCellIndex < 0) {
43383
+ return;
43384
+ }
43385
+ for (const activeScope of this.activeScopes.slice(firstCellIndex).reverse()) {
43386
+ this.closeActiveScope(parser, activeScope);
43387
+ }
43388
+ this.activeScopes = this.activeScopes.slice(0, firstCellIndex);
43389
+ }
43380
43390
  closeActiveScope(parser, sc) {
43381
43391
  this.addItem({
43382
43392
  type: "scope",
@@ -44272,6 +44282,8 @@ const specs = (pt) => [
44272
44282
  // ROW - Make new block
44273
44283
  contexts: [["startTag", "tagName", ["tr"]]],
44274
44284
  parser: {
44285
+ // End open cells in the row they belong to, before the new row's block is created
44286
+ before: (parser) => parser.closeActiveScopes("endBlock"),
44275
44287
  newBlock: true,
44276
44288
  newScopes: []
44277
44289
  }
@@ -44512,22 +44524,13 @@ const specs = (pt) => [
44512
44524
  // CELL - unpick tagName, add scope
44513
44525
  contexts: [["startTag", "tagName", ["th", "thr", "tc", "tcr"]]],
44514
44526
  parser: {
44527
+ // Cells don't nest, so any cell marker (any column number or range) ends an open cell
44528
+ before: (parser) => parser.closeActiveScopes("startCell"),
44515
44529
  newScopes: [
44516
44530
  {
44517
44531
  label: (pt2) => labelForScope$2("cell", [pt2.fullTagName]),
44518
44532
  endedBy: [
44519
- "startTag/th",
44520
- "startTag/thr",
44521
- "startTag/tc",
44522
- "startTag/tcr",
44523
- "startTag/th2",
44524
- "startTag/thr2",
44525
- "startTag/tc2",
44526
- "startTag/tcr2",
44527
- "startTag/th3",
44528
- "startTag/thr3",
44529
- "startTag/tc3",
44530
- "startTag/tcr3",
44533
+ "startCell",
44531
44534
  "endBlock",
44532
44535
  "endTag/$fullTagName$"
44533
44536
  ]
@@ -44810,6 +44813,7 @@ const Parser2 = class {
44810
44813
  if (emptySequences) {
44811
44814
  seq.removeGraftsToEmptySequences(emptySequences);
44812
44815
  }
44816
+ seq.closeCellScopes(this);
44813
44817
  seq.addTableScopes();
44814
44818
  seq.close(this);
44815
44819
  this.substitutePubNumberScopes(seq);
package/dist/index.mjs CHANGED
@@ -15990,7 +15990,7 @@ var bitset = { exports: {} };
15990
15990
  var bitsetExports = bitset.exports;
15991
15991
  const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
15992
15992
  const name = "proskomma-core";
15993
- const version = "0.11.4";
15993
+ const version = "0.11.5";
15994
15994
  const description$h = "A Scripture Runtime Engine";
15995
15995
  const files = [
15996
15996
  "dist"
@@ -43375,6 +43375,16 @@ const Sequence = class {
43375
43375
  }
43376
43376
  this.activeScopes = [];
43377
43377
  }
43378
+ closeCellScopes(parser) {
43379
+ const firstCellIndex = this.activeScopes.findIndex((sc) => sc.label.startsWith("cell/"));
43380
+ if (firstCellIndex < 0) {
43381
+ return;
43382
+ }
43383
+ for (const activeScope of this.activeScopes.slice(firstCellIndex).reverse()) {
43384
+ this.closeActiveScope(parser, activeScope);
43385
+ }
43386
+ this.activeScopes = this.activeScopes.slice(0, firstCellIndex);
43387
+ }
43378
43388
  closeActiveScope(parser, sc) {
43379
43389
  this.addItem({
43380
43390
  type: "scope",
@@ -44270,6 +44280,8 @@ const specs = (pt) => [
44270
44280
  // ROW - Make new block
44271
44281
  contexts: [["startTag", "tagName", ["tr"]]],
44272
44282
  parser: {
44283
+ // End open cells in the row they belong to, before the new row's block is created
44284
+ before: (parser) => parser.closeActiveScopes("endBlock"),
44273
44285
  newBlock: true,
44274
44286
  newScopes: []
44275
44287
  }
@@ -44510,22 +44522,13 @@ const specs = (pt) => [
44510
44522
  // CELL - unpick tagName, add scope
44511
44523
  contexts: [["startTag", "tagName", ["th", "thr", "tc", "tcr"]]],
44512
44524
  parser: {
44525
+ // Cells don't nest, so any cell marker (any column number or range) ends an open cell
44526
+ before: (parser) => parser.closeActiveScopes("startCell"),
44513
44527
  newScopes: [
44514
44528
  {
44515
44529
  label: (pt2) => labelForScope$2("cell", [pt2.fullTagName]),
44516
44530
  endedBy: [
44517
- "startTag/th",
44518
- "startTag/thr",
44519
- "startTag/tc",
44520
- "startTag/tcr",
44521
- "startTag/th2",
44522
- "startTag/thr2",
44523
- "startTag/tc2",
44524
- "startTag/tcr2",
44525
- "startTag/th3",
44526
- "startTag/thr3",
44527
- "startTag/tc3",
44528
- "startTag/tcr3",
44531
+ "startCell",
44529
44532
  "endBlock",
44530
44533
  "endTag/$fullTagName$"
44531
44534
  ]
@@ -44808,6 +44811,7 @@ const Parser2 = class {
44808
44811
  if (emptySequences) {
44809
44812
  seq.removeGraftsToEmptySequences(emptySequences);
44810
44813
  }
44814
+ seq.closeCellScopes(this);
44811
44815
  seq.addTableScopes();
44812
44816
  seq.close(this);
44813
44817
  this.substitutePubNumberScopes(seq);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proskomma-core",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "A Scripture Runtime Engine",
5
5
  "files": [
6
6
  "dist"