proskomma-core 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/index.js +28 -18
- package/dist/index.mjs +28 -18
- package/package.json +1 -1
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.
|
|
15995
|
+
const version = "0.11.4";
|
|
15996
15996
|
const description$h = "A Scripture Runtime Engine";
|
|
15997
15997
|
const files = [
|
|
15998
15998
|
"dist"
|
|
@@ -43696,31 +43696,30 @@ const Block = class {
|
|
|
43696
43696
|
}
|
|
43697
43697
|
}
|
|
43698
43698
|
for (const swaStart of swaStarts) {
|
|
43699
|
+
const spanLabel = this.items[swaStart - 1].payload;
|
|
43700
|
+
const attPrefix = `attribute/${spanLabel}/`;
|
|
43699
43701
|
let pos = swaStart;
|
|
43700
|
-
let
|
|
43702
|
+
let others = [];
|
|
43701
43703
|
let scopes = [];
|
|
43702
|
-
while (
|
|
43703
|
-
if (pos >= this.items.length) {
|
|
43704
|
-
break;
|
|
43705
|
-
}
|
|
43704
|
+
while (pos < this.items.length) {
|
|
43706
43705
|
const item = this.items[pos];
|
|
43707
|
-
if (item.type === "
|
|
43708
|
-
|
|
43709
|
-
} else if (item.subType === "start" && item.payload.startsWith(
|
|
43706
|
+
if (item.type === "scope" && item.payload === spanLabel) {
|
|
43707
|
+
break;
|
|
43708
|
+
} else if (item.subType === "start" && item.payload.startsWith(attPrefix)) {
|
|
43710
43709
|
scopes.push(item);
|
|
43711
43710
|
} else {
|
|
43712
|
-
|
|
43711
|
+
others.push(item);
|
|
43713
43712
|
}
|
|
43714
43713
|
pos++;
|
|
43715
43714
|
}
|
|
43716
|
-
if (
|
|
43715
|
+
if (others.length !== 0 && scopes.length !== 0) {
|
|
43717
43716
|
let pos2 = swaStart;
|
|
43718
43717
|
for (const s of scopes) {
|
|
43719
43718
|
this.items[pos2] = s;
|
|
43720
43719
|
pos2++;
|
|
43721
43720
|
}
|
|
43722
|
-
for (const
|
|
43723
|
-
this.items[pos2] =
|
|
43721
|
+
for (const o of others) {
|
|
43722
|
+
this.items[pos2] = o;
|
|
43724
43723
|
pos2++;
|
|
43725
43724
|
}
|
|
43726
43725
|
}
|
|
@@ -44563,7 +44562,7 @@ const specs = (pt) => [
|
|
|
44563
44562
|
{
|
|
44564
44563
|
// END MILESTONE - close scope, clear attribute context
|
|
44565
44564
|
contexts: [["endMilestoneMarker"]],
|
|
44566
|
-
parser: { during: (parser) => parser.clearAttributeContext() }
|
|
44565
|
+
parser: { during: (parser) => parser.clearAttributeContext("milestone") }
|
|
44567
44566
|
},
|
|
44568
44567
|
{
|
|
44569
44568
|
// ATTRIBUTE - open scope based on attribute context
|
|
@@ -44721,7 +44720,9 @@ const Parser2 = class {
|
|
|
44721
44720
|
parentSequence: null,
|
|
44722
44721
|
baseSequenceType: "main",
|
|
44723
44722
|
inlineSequenceType: null,
|
|
44724
|
-
attributeContext: null
|
|
44723
|
+
attributeContext: null,
|
|
44724
|
+
spanAttributeContext: null,
|
|
44725
|
+
milestoneAttributeContext: null
|
|
44725
44726
|
};
|
|
44726
44727
|
}
|
|
44727
44728
|
parseItem(lexedItem) {
|
|
@@ -45130,11 +45131,20 @@ const Parser2 = class {
|
|
|
45130
45131
|
payload: label
|
|
45131
45132
|
});
|
|
45132
45133
|
}
|
|
45134
|
+
// Milestones may sit inside spans with attributes (eg \w ... \zx-s |a="b"\* ... \zx-e\* |lemma="c"\w*),
|
|
45135
|
+
// so keep separate contexts for each, with the milestone context taking priority while it is open
|
|
45133
45136
|
setAttributeContext(label) {
|
|
45134
|
-
|
|
45137
|
+
const contextKey = label.startsWith("milestone") ? "milestoneAttributeContext" : "spanAttributeContext";
|
|
45138
|
+
this.current[contextKey] = label;
|
|
45139
|
+
this.updateAttributeContext();
|
|
45140
|
+
}
|
|
45141
|
+
clearAttributeContext(scopeType) {
|
|
45142
|
+
const contextKey = scopeType === "milestone" ? "milestoneAttributeContext" : "spanAttributeContext";
|
|
45143
|
+
this.current[contextKey] = null;
|
|
45144
|
+
this.updateAttributeContext();
|
|
45135
45145
|
}
|
|
45136
|
-
|
|
45137
|
-
this.current.attributeContext = null;
|
|
45146
|
+
updateAttributeContext() {
|
|
45147
|
+
this.current.attributeContext = this.current.milestoneAttributeContext || this.current.spanAttributeContext || null;
|
|
45138
45148
|
}
|
|
45139
45149
|
};
|
|
45140
45150
|
const ByteArray$2 = utils.ByteArray;
|
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.
|
|
15993
|
+
const version = "0.11.4";
|
|
15994
15994
|
const description$h = "A Scripture Runtime Engine";
|
|
15995
15995
|
const files = [
|
|
15996
15996
|
"dist"
|
|
@@ -43694,31 +43694,30 @@ const Block = class {
|
|
|
43694
43694
|
}
|
|
43695
43695
|
}
|
|
43696
43696
|
for (const swaStart of swaStarts) {
|
|
43697
|
+
const spanLabel = this.items[swaStart - 1].payload;
|
|
43698
|
+
const attPrefix = `attribute/${spanLabel}/`;
|
|
43697
43699
|
let pos = swaStart;
|
|
43698
|
-
let
|
|
43700
|
+
let others = [];
|
|
43699
43701
|
let scopes = [];
|
|
43700
|
-
while (
|
|
43701
|
-
if (pos >= this.items.length) {
|
|
43702
|
-
break;
|
|
43703
|
-
}
|
|
43702
|
+
while (pos < this.items.length) {
|
|
43704
43703
|
const item = this.items[pos];
|
|
43705
|
-
if (item.type === "
|
|
43706
|
-
|
|
43707
|
-
} else if (item.subType === "start" && item.payload.startsWith(
|
|
43704
|
+
if (item.type === "scope" && item.payload === spanLabel) {
|
|
43705
|
+
break;
|
|
43706
|
+
} else if (item.subType === "start" && item.payload.startsWith(attPrefix)) {
|
|
43708
43707
|
scopes.push(item);
|
|
43709
43708
|
} else {
|
|
43710
|
-
|
|
43709
|
+
others.push(item);
|
|
43711
43710
|
}
|
|
43712
43711
|
pos++;
|
|
43713
43712
|
}
|
|
43714
|
-
if (
|
|
43713
|
+
if (others.length !== 0 && scopes.length !== 0) {
|
|
43715
43714
|
let pos2 = swaStart;
|
|
43716
43715
|
for (const s of scopes) {
|
|
43717
43716
|
this.items[pos2] = s;
|
|
43718
43717
|
pos2++;
|
|
43719
43718
|
}
|
|
43720
|
-
for (const
|
|
43721
|
-
this.items[pos2] =
|
|
43719
|
+
for (const o of others) {
|
|
43720
|
+
this.items[pos2] = o;
|
|
43722
43721
|
pos2++;
|
|
43723
43722
|
}
|
|
43724
43723
|
}
|
|
@@ -44561,7 +44560,7 @@ const specs = (pt) => [
|
|
|
44561
44560
|
{
|
|
44562
44561
|
// END MILESTONE - close scope, clear attribute context
|
|
44563
44562
|
contexts: [["endMilestoneMarker"]],
|
|
44564
|
-
parser: { during: (parser) => parser.clearAttributeContext() }
|
|
44563
|
+
parser: { during: (parser) => parser.clearAttributeContext("milestone") }
|
|
44565
44564
|
},
|
|
44566
44565
|
{
|
|
44567
44566
|
// ATTRIBUTE - open scope based on attribute context
|
|
@@ -44719,7 +44718,9 @@ const Parser2 = class {
|
|
|
44719
44718
|
parentSequence: null,
|
|
44720
44719
|
baseSequenceType: "main",
|
|
44721
44720
|
inlineSequenceType: null,
|
|
44722
|
-
attributeContext: null
|
|
44721
|
+
attributeContext: null,
|
|
44722
|
+
spanAttributeContext: null,
|
|
44723
|
+
milestoneAttributeContext: null
|
|
44723
44724
|
};
|
|
44724
44725
|
}
|
|
44725
44726
|
parseItem(lexedItem) {
|
|
@@ -45128,11 +45129,20 @@ const Parser2 = class {
|
|
|
45128
45129
|
payload: label
|
|
45129
45130
|
});
|
|
45130
45131
|
}
|
|
45132
|
+
// Milestones may sit inside spans with attributes (eg \w ... \zx-s |a="b"\* ... \zx-e\* |lemma="c"\w*),
|
|
45133
|
+
// so keep separate contexts for each, with the milestone context taking priority while it is open
|
|
45131
45134
|
setAttributeContext(label) {
|
|
45132
|
-
|
|
45135
|
+
const contextKey = label.startsWith("milestone") ? "milestoneAttributeContext" : "spanAttributeContext";
|
|
45136
|
+
this.current[contextKey] = label;
|
|
45137
|
+
this.updateAttributeContext();
|
|
45138
|
+
}
|
|
45139
|
+
clearAttributeContext(scopeType) {
|
|
45140
|
+
const contextKey = scopeType === "milestone" ? "milestoneAttributeContext" : "spanAttributeContext";
|
|
45141
|
+
this.current[contextKey] = null;
|
|
45142
|
+
this.updateAttributeContext();
|
|
45133
45143
|
}
|
|
45134
|
-
|
|
45135
|
-
this.current.attributeContext = null;
|
|
45144
|
+
updateAttributeContext() {
|
|
45145
|
+
this.current.attributeContext = this.current.milestoneAttributeContext || this.current.spanAttributeContext || null;
|
|
45136
45146
|
}
|
|
45137
45147
|
};
|
|
45138
45148
|
const ByteArray$2 = utils.ByteArray;
|