proskomma-core 0.10.7 → 0.10.10

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
@@ -15986,7 +15986,7 @@ var bitset = {
15986
15986
  })(bitset, bitsetExports);
15987
15987
  const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
15988
15988
  const name = "proskomma-core";
15989
- const version = "0.10.7";
15989
+ const version = "0.10.10";
15990
15990
  const description$b = "A Scripture Runtime Engine";
15991
15991
  const files = [
15992
15992
  "dist"
@@ -18834,19 +18834,37 @@ const unsuccinctifyItemsWithScriptureCV = (docSet, block2, cv, options2) => {
18834
18834
  }
18835
18835
  };
18836
18836
  const ret = [];
18837
- for (const item of docSet.unsuccinctifyItems(
18838
- block2.c,
18839
- {},
18840
- block2.nt.nByte(0)
18841
- )) {
18842
- if (item[0] === "scope" && item[1] === "start") {
18843
- openScopes.add(item[2]);
18844
- }
18845
- if (itemMatchesCV() && itemInOptions(item)) {
18846
- ret.push(item);
18837
+ if (options2.excludeScopeTypes) {
18838
+ for (const item of docSet.unsuccinctifyItems(
18839
+ block2.c,
18840
+ options2,
18841
+ block2.nt.nByte(0)
18842
+ )) {
18843
+ if (item[0] === "scope" && item[1] === "start") {
18844
+ openScopes.add(item[2]);
18845
+ }
18846
+ if (itemMatchesCV() && itemInOptions(item)) {
18847
+ ret.push(item);
18848
+ }
18849
+ if (item[0] === "scope" && item[1] === "end") {
18850
+ openScopes.delete(item[2]);
18851
+ }
18847
18852
  }
18848
- if (item[0] === "scope" && item[1] === "end") {
18849
- openScopes.delete(item[2]);
18853
+ } else {
18854
+ for (const item of docSet.unsuccinctifyItems(
18855
+ block2.c,
18856
+ {},
18857
+ block2.nt.nByte(0)
18858
+ )) {
18859
+ if (item[0] === "scope" && item[1] === "start") {
18860
+ openScopes.add(item[2]);
18861
+ }
18862
+ if (itemMatchesCV() && itemInOptions(item)) {
18863
+ ret.push(item);
18864
+ }
18865
+ if (item[0] === "scope" && item[1] === "end") {
18866
+ openScopes.delete(item[2]);
18867
+ }
18850
18868
  }
18851
18869
  }
18852
18870
  return ret;
@@ -34022,19 +34040,19 @@ const lexingRegexes = [
34022
34040
  XRegExp('([ \\t]*\\|?[ \\t]*([A-Za-z0-9\\-]+)="([^"]*)"[ \\t]?)')
34023
34041
  ],
34024
34042
  ["attribute", "defaultAttribute", XRegExp("([ \\t]*\\|[ \\t]*([^\\|\\\\]*))")],
34025
- ["milestone", "emptyMilestone", XRegExp("(\\\\([a-z1-9]+)\\\\[*])")],
34043
+ ["milestone", "emptyMilestone", XRegExp('(\\\\([a-z1-9]+)([ \\t]*\\|[ \\t]*[a-z1-9]+="[^\\|\\\\"]*")*\\\\[*])')],
34026
34044
  ["milestone", "startMilestoneTag", XRegExp("(\\\\([a-z1-9]+)-([se]))")],
34027
34045
  ["milestone", "endMilestoneMarker", XRegExp("(\\\\([*]))")],
34028
34046
  ["tag", "endTag", XRegExp("(\\\\([+]?[a-z\\-]+)([1-9]?(-([1-9]))?)[*])")],
34029
34047
  ["tag", "startTag", XRegExp("(\\\\([+]?[a-z\\-]+)([1-9]?(-([1-9]))?)[ \\t]?)")],
34030
34048
  ["bad", "bareSlash", XRegExp("(\\\\)")],
34031
34049
  ["printable", "eol", XRegExp("([ \\t]*[\\r\\n]+[ \\t]*)")],
34032
- ["break", "noBreakSpace", XRegExp("~")],
34050
+ // ['break', 'noBreakSpace', xre('~')],
34033
34051
  ["break", "softLineBreak", XRegExp("//")],
34034
34052
  [
34035
34053
  "printable",
34036
34054
  "wordLike",
34037
- XRegExp("([\\p{Letter}\\p{Number}\\p{Mark}\\u2060]{1,127})")
34055
+ XRegExp("([\\p{Letter}\\p{Number}\\p{Mark}\\u2060~]{1,127})")
34038
34056
  ],
34039
34057
  ["printable", "lineSpace", XRegExp("([\\p{Separator} ]{1,127})")],
34040
34058
  [
@@ -34049,7 +34067,7 @@ const lexingRegexes = [
34049
34067
  const mainRegex = XRegExp.union(lexingRegexes.map((x) => x[2]));
34050
34068
  const makePrintable = (subclass, matchedBits) => ({
34051
34069
  subclass,
34052
- printValue: matchedBits[0]
34070
+ printValue: matchedBits[0].replace(/~/g, " ")
34053
34071
  });
34054
34072
  const makeChapter = (subclass, matchedBits) => ({
34055
34073
  subclass,
@@ -34111,6 +34129,12 @@ const makeMilestone = (subclass, matchedBits) => {
34111
34129
  ret.tagName = matchedBits[2];
34112
34130
  if (subclass === "emptyMilestone") {
34113
34131
  ret.printValue = `\\${ret.tagName}\\*`;
34132
+ ret.attributes = matchedBits[1] ? matchedBits[1].split("|").slice(1).map((a) => a.split("=")).map(
34133
+ (aa) => [
34134
+ aa[0],
34135
+ aa[1].replace(/"/g, "").replace(/[\\*]/g, "")
34136
+ ]
34137
+ ) : [];
34114
34138
  } else {
34115
34139
  ret.printValue = `\\${ret.tagName}`;
34116
34140
  ret.sOrE = matchedBits[3];
@@ -39491,7 +39515,9 @@ const specs = (pt) => [
39491
39515
  // EMPTY MILESTONE - add open and close scope
39492
39516
  contexts: [["emptyMilestone"]],
39493
39517
  parser: {
39494
- during: (parser, pt2) => parser.addEmptyMilestone(labelForScope$2("milestone", [pt2.tagName]))
39518
+ during: (parser, pt2) => {
39519
+ parser.addEmptyMilestone(labelForScope$2("milestone", [pt2.tagName]));
39520
+ }
39495
39521
  }
39496
39522
  },
39497
39523
  {
@@ -44249,8 +44275,14 @@ const blockResolvers = {
44249
44275
  return context.docSet.unsuccinctifyItemsWithScriptureCV(
44250
44276
  root,
44251
44277
  args.withScriptureCV,
44252
- {},
44253
- args.includeContext || false
44278
+ args.excludeScopeTypes ? {
44279
+ tokens: true,
44280
+ scopes: true,
44281
+ grafts: true,
44282
+ excludeScopeTypes: args.excludeScopeTypes || [],
44283
+ anyScope: args.anyScope || false,
44284
+ includeContext: args.includeContext || false
44285
+ } : {}
44254
44286
  );
44255
44287
  } else {
44256
44288
  return context.docSet.unsuccinctifyPrunedItems(root, {
@@ -50515,7 +50547,10 @@ class Proskomma {
50515
50547
  if (!bookCodes2 || bookCodes2.length === 0) {
50516
50548
  throw new Error("bookCodes argument must be present and contain at least one element in augmentSuccinctDocSet");
50517
50549
  }
50518
- const selectDocs = (dId) => bookCodes2.includes(succinctOb.docs[dId]).headers.bookCode;
50550
+ const selectDocs = (dId) => {
50551
+ const doc = succinctOb.docs[dId];
50552
+ return bookCodes2.includes(doc.headers.bookCode);
50553
+ };
50519
50554
  if (!this.docSets[succinctOb.id]) {
50520
50555
  throw new Error(`docSet id '${succinctOb.id}' not found in Proskomma when using augmentSuccinctDocSet. Load it first with optional bookCodes argument`);
50521
50556
  }
package/dist/index.mjs CHANGED
@@ -15984,7 +15984,7 @@ var bitset = {
15984
15984
  })(bitset, bitsetExports);
15985
15985
  const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
15986
15986
  const name = "proskomma-core";
15987
- const version = "0.10.7";
15987
+ const version = "0.10.10";
15988
15988
  const description$b = "A Scripture Runtime Engine";
15989
15989
  const files = [
15990
15990
  "dist"
@@ -18832,19 +18832,37 @@ const unsuccinctifyItemsWithScriptureCV = (docSet, block2, cv, options2) => {
18832
18832
  }
18833
18833
  };
18834
18834
  const ret = [];
18835
- for (const item of docSet.unsuccinctifyItems(
18836
- block2.c,
18837
- {},
18838
- block2.nt.nByte(0)
18839
- )) {
18840
- if (item[0] === "scope" && item[1] === "start") {
18841
- openScopes.add(item[2]);
18842
- }
18843
- if (itemMatchesCV() && itemInOptions(item)) {
18844
- ret.push(item);
18835
+ if (options2.excludeScopeTypes) {
18836
+ for (const item of docSet.unsuccinctifyItems(
18837
+ block2.c,
18838
+ options2,
18839
+ block2.nt.nByte(0)
18840
+ )) {
18841
+ if (item[0] === "scope" && item[1] === "start") {
18842
+ openScopes.add(item[2]);
18843
+ }
18844
+ if (itemMatchesCV() && itemInOptions(item)) {
18845
+ ret.push(item);
18846
+ }
18847
+ if (item[0] === "scope" && item[1] === "end") {
18848
+ openScopes.delete(item[2]);
18849
+ }
18845
18850
  }
18846
- if (item[0] === "scope" && item[1] === "end") {
18847
- openScopes.delete(item[2]);
18851
+ } else {
18852
+ for (const item of docSet.unsuccinctifyItems(
18853
+ block2.c,
18854
+ {},
18855
+ block2.nt.nByte(0)
18856
+ )) {
18857
+ if (item[0] === "scope" && item[1] === "start") {
18858
+ openScopes.add(item[2]);
18859
+ }
18860
+ if (itemMatchesCV() && itemInOptions(item)) {
18861
+ ret.push(item);
18862
+ }
18863
+ if (item[0] === "scope" && item[1] === "end") {
18864
+ openScopes.delete(item[2]);
18865
+ }
18848
18866
  }
18849
18867
  }
18850
18868
  return ret;
@@ -34020,19 +34038,19 @@ const lexingRegexes = [
34020
34038
  XRegExp('([ \\t]*\\|?[ \\t]*([A-Za-z0-9\\-]+)="([^"]*)"[ \\t]?)')
34021
34039
  ],
34022
34040
  ["attribute", "defaultAttribute", XRegExp("([ \\t]*\\|[ \\t]*([^\\|\\\\]*))")],
34023
- ["milestone", "emptyMilestone", XRegExp("(\\\\([a-z1-9]+)\\\\[*])")],
34041
+ ["milestone", "emptyMilestone", XRegExp('(\\\\([a-z1-9]+)([ \\t]*\\|[ \\t]*[a-z1-9]+="[^\\|\\\\"]*")*\\\\[*])')],
34024
34042
  ["milestone", "startMilestoneTag", XRegExp("(\\\\([a-z1-9]+)-([se]))")],
34025
34043
  ["milestone", "endMilestoneMarker", XRegExp("(\\\\([*]))")],
34026
34044
  ["tag", "endTag", XRegExp("(\\\\([+]?[a-z\\-]+)([1-9]?(-([1-9]))?)[*])")],
34027
34045
  ["tag", "startTag", XRegExp("(\\\\([+]?[a-z\\-]+)([1-9]?(-([1-9]))?)[ \\t]?)")],
34028
34046
  ["bad", "bareSlash", XRegExp("(\\\\)")],
34029
34047
  ["printable", "eol", XRegExp("([ \\t]*[\\r\\n]+[ \\t]*)")],
34030
- ["break", "noBreakSpace", XRegExp("~")],
34048
+ // ['break', 'noBreakSpace', xre('~')],
34031
34049
  ["break", "softLineBreak", XRegExp("//")],
34032
34050
  [
34033
34051
  "printable",
34034
34052
  "wordLike",
34035
- XRegExp("([\\p{Letter}\\p{Number}\\p{Mark}\\u2060]{1,127})")
34053
+ XRegExp("([\\p{Letter}\\p{Number}\\p{Mark}\\u2060~]{1,127})")
34036
34054
  ],
34037
34055
  ["printable", "lineSpace", XRegExp("([\\p{Separator} ]{1,127})")],
34038
34056
  [
@@ -34047,7 +34065,7 @@ const lexingRegexes = [
34047
34065
  const mainRegex = XRegExp.union(lexingRegexes.map((x) => x[2]));
34048
34066
  const makePrintable = (subclass, matchedBits) => ({
34049
34067
  subclass,
34050
- printValue: matchedBits[0]
34068
+ printValue: matchedBits[0].replace(/~/g, " ")
34051
34069
  });
34052
34070
  const makeChapter = (subclass, matchedBits) => ({
34053
34071
  subclass,
@@ -34109,6 +34127,12 @@ const makeMilestone = (subclass, matchedBits) => {
34109
34127
  ret.tagName = matchedBits[2];
34110
34128
  if (subclass === "emptyMilestone") {
34111
34129
  ret.printValue = `\\${ret.tagName}\\*`;
34130
+ ret.attributes = matchedBits[1] ? matchedBits[1].split("|").slice(1).map((a) => a.split("=")).map(
34131
+ (aa) => [
34132
+ aa[0],
34133
+ aa[1].replace(/"/g, "").replace(/[\\*]/g, "")
34134
+ ]
34135
+ ) : [];
34112
34136
  } else {
34113
34137
  ret.printValue = `\\${ret.tagName}`;
34114
34138
  ret.sOrE = matchedBits[3];
@@ -39489,7 +39513,9 @@ const specs = (pt) => [
39489
39513
  // EMPTY MILESTONE - add open and close scope
39490
39514
  contexts: [["emptyMilestone"]],
39491
39515
  parser: {
39492
- during: (parser, pt2) => parser.addEmptyMilestone(labelForScope$2("milestone", [pt2.tagName]))
39516
+ during: (parser, pt2) => {
39517
+ parser.addEmptyMilestone(labelForScope$2("milestone", [pt2.tagName]));
39518
+ }
39493
39519
  }
39494
39520
  },
39495
39521
  {
@@ -44247,8 +44273,14 @@ const blockResolvers = {
44247
44273
  return context.docSet.unsuccinctifyItemsWithScriptureCV(
44248
44274
  root,
44249
44275
  args.withScriptureCV,
44250
- {},
44251
- args.includeContext || false
44276
+ args.excludeScopeTypes ? {
44277
+ tokens: true,
44278
+ scopes: true,
44279
+ grafts: true,
44280
+ excludeScopeTypes: args.excludeScopeTypes || [],
44281
+ anyScope: args.anyScope || false,
44282
+ includeContext: args.includeContext || false
44283
+ } : {}
44252
44284
  );
44253
44285
  } else {
44254
44286
  return context.docSet.unsuccinctifyPrunedItems(root, {
@@ -50513,7 +50545,10 @@ class Proskomma {
50513
50545
  if (!bookCodes2 || bookCodes2.length === 0) {
50514
50546
  throw new Error("bookCodes argument must be present and contain at least one element in augmentSuccinctDocSet");
50515
50547
  }
50516
- const selectDocs = (dId) => bookCodes2.includes(succinctOb.docs[dId]).headers.bookCode;
50548
+ const selectDocs = (dId) => {
50549
+ const doc = succinctOb.docs[dId];
50550
+ return bookCodes2.includes(doc.headers.bookCode);
50551
+ };
50517
50552
  if (!this.docSets[succinctOb.id]) {
50518
50553
  throw new Error(`docSet id '${succinctOb.id}' not found in Proskomma when using augmentSuccinctDocSet. Load it first with optional bookCodes argument`);
50519
50554
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proskomma-core",
3
- "version": "0.10.7",
3
+ "version": "0.10.10",
4
4
  "description": "A Scripture Runtime Engine",
5
5
  "files": [
6
6
  "dist"