@gmb/bitmark-parser-generator 4.10.0 → 4.12.0

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.cjs CHANGED
@@ -1115,6 +1115,7 @@ var groupKeys = {
1115
1115
  group_mark: "group_mark",
1116
1116
  group_bookCommon: "group_bookCommon",
1117
1117
  group_learningPathCommon: "group_learningPathCommon",
1118
+ group_advertisingCommon: "group_advertisingCommon",
1118
1119
  group_quizCommon: "group_quizCommon",
1119
1120
  group_resourceBitTags: "group_resourceBitTags",
1120
1121
  group_resourceCommon: "group_resourceCommon",
@@ -1158,6 +1159,7 @@ var propertyKeys = {
1158
1159
  property_action: "@action",
1159
1160
  property_activityType: "@activityType",
1160
1161
  property_additionalSolutions: "@additionalSolutions",
1162
+ property_advertisingClickUrl: "@advertisingClickUrl",
1161
1163
  property_ageRange: "@ageRange",
1162
1164
  property_aiGenerated: "@aiGenerated",
1163
1165
  property_allowedBit: "@allowedBit",
@@ -1322,6 +1324,7 @@ var propertyKeys = {
1322
1324
  property_siteName: "@siteName",
1323
1325
  property_size: "@size",
1324
1326
  property_slug: "@slug",
1327
+ property_sourceDocument: "@sourceDocument",
1325
1328
  property_spaceId: "@spaceId",
1326
1329
  property_src1x: "@src1x",
1327
1330
  property_src2x: "@src2x",
@@ -2874,7 +2877,7 @@ var GROUPS = {
2874
2877
  },
2875
2878
  [ConfigKey.group_standardItemLeadInstructionHint]: {
2876
2879
  type: GroupConfigType.standard,
2877
- description: "Standard group for item, lead, page number, margin number, instruction and hint tags",
2880
+ description: "Standard group for item, lead, page number, source page number, margin number, instruction and hint tags",
2878
2881
  tags: [
2879
2882
  {
2880
2883
  key: ConfigKey.tag_item,
@@ -2882,8 +2885,8 @@ var GROUPS = {
2882
2885
  chain: [
2883
2886
  {
2884
2887
  key: ConfigKey.tag_item,
2885
- description: "The lead, page number, and margin number for the bit",
2886
- maxCount: 3
2888
+ description: "The lead, page number, source page number, and margin number for the bit",
2889
+ maxCount: 4
2887
2890
  }
2888
2891
  ]
2889
2892
  },
@@ -3278,6 +3281,11 @@ var GROUPS = {
3278
3281
  key: ConfigKey.property_maxTocChapterLevel,
3279
3282
  description: "The maximum table of contents chapter level",
3280
3283
  format: TagFormat.number
3284
+ },
3285
+ {
3286
+ key: ConfigKey.property_sourceDocument,
3287
+ description: "Url of the source document for the book (for example, a PDF file)",
3288
+ format: TagFormat.plainText
3281
3289
  }
3282
3290
  ]
3283
3291
  },
@@ -3356,6 +3364,17 @@ var GROUPS = {
3356
3364
  }
3357
3365
  ]
3358
3366
  },
3367
+ [ConfigKey.group_advertisingCommon]: {
3368
+ type: GroupConfigType.standard,
3369
+ description: "Common advertising tags",
3370
+ tags: [
3371
+ {
3372
+ key: ConfigKey.property_advertisingClickUrl,
3373
+ description: "The URL to which the advertisement should link",
3374
+ format: TagFormat.plainText
3375
+ }
3376
+ ]
3377
+ },
3359
3378
  [ConfigKey.group_quizCommon]: {
3360
3379
  type: GroupConfigType.standard,
3361
3380
  description: "Common quiz tags",
@@ -5268,67 +5287,145 @@ var BITS = {
5268
5287
  [BitType.advertising]: {
5269
5288
  since: "4.2.0",
5270
5289
  baseBitType: BitType.article,
5271
- description: "General advertising content bit"
5290
+ description: "General advertising content bit",
5291
+ tags: [
5292
+ {
5293
+ key: ConfigKey.group_advertisingCommon,
5294
+ description: "Common advertising tags"
5295
+ }
5296
+ ]
5272
5297
  },
5273
5298
  [BitType.advertisingAdvertorial]: {
5274
5299
  since: "4.2.0",
5275
5300
  baseBitType: BitType.article,
5276
- description: "Advertorial content bit (sponsored article)"
5301
+ description: "Advertorial content bit (sponsored article)",
5302
+ tags: [
5303
+ {
5304
+ key: ConfigKey.group_advertisingCommon,
5305
+ description: "Common advertising tags"
5306
+ }
5307
+ ]
5277
5308
  },
5278
5309
  [BitType.advertisingCallToAction]: {
5279
5310
  since: "4.2.0",
5280
5311
  baseBitType: BitType.callToAction,
5281
- description: "Call-to-action for advertising"
5312
+ description: "Call-to-action for advertising",
5313
+ tags: [
5314
+ {
5315
+ key: ConfigKey.group_advertisingCommon,
5316
+ description: "Common advertising tags"
5317
+ }
5318
+ ]
5282
5319
  },
5283
5320
  [BitType.advertisingCallToActionMeeting]: {
5284
5321
  since: "4.2.0",
5285
5322
  baseBitType: BitType.callToAction,
5286
- description: "Call-to-action for meeting or appointment"
5323
+ description: "Call-to-action for meeting or appointment",
5324
+ tags: [
5325
+ {
5326
+ key: ConfigKey.group_advertisingCommon,
5327
+ description: "Common advertising tags"
5328
+ }
5329
+ ]
5287
5330
  },
5288
5331
  [BitType.advertisingBanner]: {
5289
5332
  since: "4.2.0",
5290
5333
  baseBitType: BitType.image,
5291
- description: "Banner advertisement bit"
5334
+ description: "Banner advertisement bit",
5335
+ tags: [
5336
+ {
5337
+ key: ConfigKey.group_advertisingCommon,
5338
+ description: "Common advertising tags"
5339
+ }
5340
+ ]
5292
5341
  },
5293
5342
  [BitType.advertisingSkyscraper]: {
5294
5343
  since: "4.2.0",
5295
5344
  baseBitType: BitType.image,
5296
- description: "Skyscraper (vertical) advertisement bit"
5345
+ description: "Skyscraper (vertical) advertisement bit",
5346
+ tags: [
5347
+ {
5348
+ key: ConfigKey.group_advertisingCommon,
5349
+ description: "Common advertising tags"
5350
+ }
5351
+ ]
5297
5352
  },
5298
5353
  [BitType.advertisingRectangle]: {
5299
5354
  since: "4.2.0",
5300
5355
  baseBitType: BitType.image,
5301
- description: "Rectangle advertisement bit"
5356
+ description: "Rectangle advertisement bit",
5357
+ tags: [
5358
+ {
5359
+ key: ConfigKey.group_advertisingCommon,
5360
+ description: "Common advertising tags"
5361
+ }
5362
+ ]
5302
5363
  },
5303
5364
  [BitType.advertisingFullPage]: {
5304
5365
  since: "4.2.0",
5305
5366
  baseBitType: BitType.image,
5306
- description: "Full-page advertisement bit"
5367
+ description: "Full-page advertisement bit",
5368
+ tags: [
5369
+ {
5370
+ key: ConfigKey.group_advertisingCommon,
5371
+ description: "Common advertising tags"
5372
+ }
5373
+ ]
5307
5374
  },
5308
5375
  [BitType.advertisingHalfPage]: {
5309
5376
  since: "4.2.0",
5310
5377
  baseBitType: BitType.image,
5311
- description: "Half-page advertisement bit"
5378
+ description: "Half-page advertisement bit",
5379
+ tags: [
5380
+ {
5381
+ key: ConfigKey.group_advertisingCommon,
5382
+ description: "Common advertising tags"
5383
+ }
5384
+ ]
5312
5385
  },
5313
5386
  [BitType.advertisingQuarterPage]: {
5314
5387
  since: "4.2.0",
5315
5388
  baseBitType: BitType.image,
5316
- description: "Quarter-page advertisement bit"
5389
+ description: "Quarter-page advertisement bit",
5390
+ tags: [
5391
+ {
5392
+ key: ConfigKey.group_advertisingCommon,
5393
+ description: "Common advertising tags"
5394
+ }
5395
+ ]
5317
5396
  },
5318
5397
  [BitType.advertisingClassifiedPage]: {
5319
5398
  since: "4.2.0",
5320
5399
  baseBitType: BitType.image,
5321
- description: "Classifieds advertisement page bit"
5400
+ description: "Classifieds advertisement page bit",
5401
+ tags: [
5402
+ {
5403
+ key: ConfigKey.group_advertisingCommon,
5404
+ description: "Common advertising tags"
5405
+ }
5406
+ ]
5322
5407
  },
5323
5408
  [BitType.advertisingLandscape]: {
5324
5409
  since: "4.2.0",
5325
5410
  baseBitType: BitType.image,
5326
- description: "Landscape format advertisement bit"
5411
+ description: "Landscape format advertisement bit",
5412
+ tags: [
5413
+ {
5414
+ key: ConfigKey.group_advertisingCommon,
5415
+ description: "Common advertising tags"
5416
+ }
5417
+ ]
5327
5418
  },
5328
5419
  [BitType.advertisingPortrait]: {
5329
5420
  since: "4.2.0",
5330
5421
  baseBitType: BitType.image,
5331
- description: "Portrait format advertisement bit"
5422
+ description: "Portrait format advertisement bit",
5423
+ tags: [
5424
+ {
5425
+ key: ConfigKey.group_advertisingCommon,
5426
+ description: "Common advertising tags"
5427
+ }
5428
+ ]
5332
5429
  },
5333
5430
  [BitType.cookPreparation]: {
5334
5431
  since: "1.3.0",
@@ -9185,7 +9282,7 @@ var instance2 = new Config();
9185
9282
  // src/generated/package_info.ts
9186
9283
  var PACKAGE_INFO = {
9187
9284
  "name": "@gmb/bitmark-parser-generator",
9188
- "version": "4.10.0",
9285
+ "version": "4.12.0",
9189
9286
  "author": "Get More Brain Ltd",
9190
9287
  "license": "ISC",
9191
9288
  "description": "A bitmark parser and generator using Peggy.js"
@@ -9527,6 +9624,8 @@ var NodeType = (0, import_superenum20.superenum)({
9527
9624
  activityTypeValue: "activityTypeValue",
9528
9625
  additionalSolutions: "additionalSolutions",
9529
9626
  additionalSolutionsValue: "additionalSolutionsValue",
9627
+ advertisingClickUrl: "advertisingClickUrl",
9628
+ advertisingClickUrlValue: "advertisingClickUrlValue",
9530
9629
  ageRange: "ageRange",
9531
9630
  ageRangeValue: "ageRangeValue",
9532
9631
  aiGenerated: "aiGenerated",
@@ -9593,8 +9692,6 @@ var NodeType = (0, import_superenum20.superenum)({
9593
9692
  botValue: "botValue",
9594
9693
  bubbleTag: "bubbleTag",
9595
9694
  bubbleTagValue: "bubbleTagValue",
9596
- extractorTag: "extractorTag",
9597
- extractorTagValue: "extractorTagValue",
9598
9695
  buttonCaption: "buttonCaption",
9599
9696
  buttonCaptionValue: "buttonCaptionValue",
9600
9697
  callToActionUrl: "callToActionUrl",
@@ -9692,6 +9789,8 @@ var NodeType = (0, import_superenum20.superenum)({
9692
9789
  externalIdValue: "externalIdValue",
9693
9790
  externalLink: "externalLink",
9694
9791
  externalLinkText: "externalLinkText",
9792
+ extractorTag: "extractorTag",
9793
+ extractorTagValue: "extractorTagValue",
9695
9794
  extraProperties: "extraProperties",
9696
9795
  feedback: "feedback",
9697
9796
  feedbackEngine: "feedbackEngine",
@@ -9976,15 +10075,18 @@ var NodeType = (0, import_superenum20.superenum)({
9976
10075
  solution: "solution",
9977
10076
  solutions: "solutions",
9978
10077
  solutionsValue: "solutionsValue",
10078
+ sourceDocument: "sourceDocument",
10079
+ sourceDocumentValue: "sourceDocumentValue",
10080
+ sourcePageNumber: "sourcePageNumber",
9979
10081
  spaceId: "spaceId",
9980
10082
  spaceIdValue: "spaceIdValue",
9981
10083
  src: "src",
9982
- srcAlt: "srcAlt",
9983
- srcAltValue: "srcAltValue",
9984
10084
  src1x: "src1x",
9985
10085
  src2x: "src2x",
9986
10086
  src3x: "src3x",
9987
10087
  src4x: "src4x",
10088
+ srcAlt: "srcAlt",
10089
+ srcAltValue: "srcAltValue",
9988
10090
  start: "start",
9989
10091
  statement: "statement",
9990
10092
  statements: "statements",
@@ -22927,6 +23029,12 @@ var Builder = class extends BaseBuilder {
22927
23029
  data.callToActionUrl,
22928
23030
  options
22929
23031
  ),
23032
+ advertisingClickUrl: this.toAstProperty(
23033
+ bitType,
23034
+ ConfigKey.property_advertisingClickUrl,
23035
+ data.advertisingClickUrl,
23036
+ options
23037
+ ),
22930
23038
  caption: this.handleJsonText(context, TextLocation.tag, data.caption),
22931
23039
  quotedPerson: this.toAstProperty(
22932
23040
  bitType,
@@ -22984,6 +23092,12 @@ var Builder = class extends BaseBuilder {
22984
23092
  data.maxTocChapterLevel,
22985
23093
  options
22986
23094
  ),
23095
+ sourceDocument: this.toAstProperty(
23096
+ bitType,
23097
+ ConfigKey.property_sourceDocument,
23098
+ data.sourceDocument,
23099
+ options
23100
+ ),
22987
23101
  tocResource: this.toAstProperty(
22988
23102
  bitType,
22989
23103
  ConfigKey.property_tocResource,
@@ -23068,6 +23182,7 @@ var Builder = class extends BaseBuilder {
23068
23182
  item: this.handleJsonText(context, TextLocation.tag, data.item),
23069
23183
  lead: this.handleJsonText(context, TextLocation.tag, data.lead),
23070
23184
  pageNumber: this.handleJsonText(context, TextLocation.tag, data.pageNumber),
23185
+ sourcePageNumber: this.handleJsonText(context, TextLocation.tag, data.sourcePageNumber),
23071
23186
  marginNumber: this.handleJsonText(context, TextLocation.tag, data.marginNumber),
23072
23187
  hint: this.handleJsonText(context, TextLocation.tag, data.hint),
23073
23188
  instruction: this.handleJsonText(context, TextLocation.tag, data.instruction),
@@ -23170,7 +23285,15 @@ var Builder = class extends BaseBuilder {
23170
23285
  objectUtils.removeUnwantedProperties(node, {
23171
23286
  ignoreAllFalse: true,
23172
23287
  ignoreUndefined: ["example"],
23173
- ignoreEmptyArrays: ["item", "lead", "pageNumber", "marginNumber", "hint", "instruction"]
23288
+ ignoreEmptyArrays: [
23289
+ "item",
23290
+ "lead",
23291
+ "pageNumber",
23292
+ "sourcePageNumber",
23293
+ "marginNumber",
23294
+ "hint",
23295
+ "instruction"
23296
+ ]
23174
23297
  });
23175
23298
  return nodeValidator.validateBit(node);
23176
23299
  }
@@ -25483,6 +25606,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25483
25606
  if (this.isEmptyText(item)) return false;
25484
25607
  if (!this.isEmptyText(parent?.value?.lead)) return true;
25485
25608
  if (!this.isEmptyText(parent?.value?.pageNumber)) return true;
25609
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25486
25610
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25487
25611
  this.writeNL_IfNotChain(route);
25488
25612
  this.writeOPC();
@@ -25496,6 +25620,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25496
25620
  const parent = this.getParentNode(route);
25497
25621
  if (this.isEmptyText(lead)) return false;
25498
25622
  if (!this.isEmptyText(parent?.value?.pageNumber)) return true;
25623
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25499
25624
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25500
25625
  this.writeNL_IfNotChain(route);
25501
25626
  this.writeOPC();
@@ -25511,6 +25636,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25511
25636
  const pageNumber = node.value;
25512
25637
  const parent = this.getParentNode(route);
25513
25638
  if (this.isEmptyText(pageNumber)) return false;
25639
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25514
25640
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25515
25641
  this.writeNL_IfNotChain(route);
25516
25642
  this.writeOPC();
@@ -25524,6 +25650,31 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25524
25650
  this.writeCL();
25525
25651
  return true;
25526
25652
  }
25653
+ // bitmarkAst -> bits -> bitsValue -> sourcePageNumber
25654
+ enter_sourcePageNumber(node, route) {
25655
+ const sourcePageNumber = node.value;
25656
+ const parent = this.getParentNode(route);
25657
+ if (this.isEmptyText(sourcePageNumber)) return false;
25658
+ if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25659
+ this.writeNL_IfNotChain(route);
25660
+ this.writeOPC();
25661
+ this.writeTextOrValue(parent?.value?.item ?? "", TextFormat.bitmarkText, TextLocation.tag);
25662
+ this.writeCL();
25663
+ this.writeOPC();
25664
+ this.writeTextOrValue(parent?.value?.lead ?? "", TextFormat.bitmarkText, TextLocation.tag);
25665
+ this.writeCL();
25666
+ this.writeOPC();
25667
+ this.writeTextOrValue(
25668
+ parent?.value?.pageNumber ?? "",
25669
+ TextFormat.bitmarkText,
25670
+ TextLocation.tag
25671
+ );
25672
+ this.writeCL();
25673
+ this.writeOPC();
25674
+ this.writeTextOrValue(sourcePageNumber ?? "", TextFormat.bitmarkText, TextLocation.tag);
25675
+ this.writeCL();
25676
+ return true;
25677
+ }
25527
25678
  // bitmarkAst -> bits -> bitsValue -> marginNumber
25528
25679
  enter_marginNumber(node, route) {
25529
25680
  const marginNumber = node.value;
@@ -25544,6 +25695,13 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25544
25695
  );
25545
25696
  this.writeCL();
25546
25697
  this.writeOPC();
25698
+ this.writeTextOrValue(
25699
+ parent?.value?.sourcePageNumber ?? "",
25700
+ TextFormat.bitmarkText,
25701
+ TextLocation.tag
25702
+ );
25703
+ this.writeCL();
25704
+ this.writeOPC();
25547
25705
  this.writeTextOrValue(marginNumber, TextFormat.bitmarkText, TextLocation.tag);
25548
25706
  this.writeCL();
25549
25707
  return true;
@@ -27368,6 +27526,10 @@ var JsonGenerator = class extends AstWalkerGenerator {
27368
27526
  enter_pageNumber(node, route) {
27369
27527
  return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
27370
27528
  }
27529
+ // bitmarkAst -> bits -> bitsValue -> sourcePageNumber
27530
+ enter_sourcePageNumber(node, route) {
27531
+ return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
27532
+ }
27371
27533
  // bitmarkAst -> bits -> bitsValue -> marginNumber
27372
27534
  enter_marginNumber(node, route) {
27373
27535
  return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
@@ -28090,6 +28252,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
28090
28252
  delete bitJson.item;
28091
28253
  delete bitJson.lead;
28092
28254
  delete bitJson.pageNumber;
28255
+ delete bitJson.sourcePageNumber;
28093
28256
  delete bitJson.marginNumber;
28094
28257
  delete bitJson.hint;
28095
28258
  delete bitJson.instruction;
@@ -28101,6 +28264,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
28101
28264
  if (bitJson.lead == null || bitJson.lead?.length === 0) delete bitJson.lead;
28102
28265
  if (bitJson.pageNumber == null || bitJson.pageNumber?.length === 0)
28103
28266
  delete bitJson.pageNumber;
28267
+ if (bitJson.sourcePageNumber == null || bitJson.sourcePageNumber?.length === 0)
28268
+ delete bitJson.sourcePageNumber;
28104
28269
  if (bitJson.marginNumber == null || bitJson.marginNumber?.length === 0)
28105
28270
  delete bitJson.marginNumber;
28106
28271
  if (bitJson.hint == null || bitJson.hint?.length === 0) delete bitJson.hint;
@@ -28112,6 +28277,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
28112
28277
  if (bitJson.hint == null) bitJson.hint = this.textDefault;
28113
28278
  if (bitJson.instruction == null) bitJson.instruction = this.textDefault;
28114
28279
  if (bitJson.pageNumber == null) bitJson.pageNumber = this.textDefault;
28280
+ if (bitJson.sourcePageNumber == null) bitJson.sourcePageNumber = this.textDefault;
28115
28281
  if (bitJson.marginNumber == null) bitJson.marginNumber = this.textDefault;
28116
28282
  }
28117
28283
  if (bitJson.body == null) bitJson.body = this.bodyDefault;
@@ -32573,7 +32739,8 @@ var BitmarkPegParserProcessor = class {
32573
32739
  if (l > 0) result.item = result.itemLead[0];
32574
32740
  if (l > 1) result.lead = result.itemLead[1];
32575
32741
  if (l > 2) result.pageNumber = result.itemLead[2];
32576
- if (l > 3) result.marginNumber = result.itemLead[l - 1];
32742
+ if (l > 3) result.sourcePageNumber = result.itemLead[3];
32743
+ if (l > 4) result.marginNumber = result.itemLead[l - 1];
32577
32744
  }
32578
32745
  if (inBit) {
32579
32746
  result.body = instance11.process(