@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.
@@ -1056,6 +1056,7 @@ var groupKeys = {
1056
1056
  group_mark: "group_mark",
1057
1057
  group_bookCommon: "group_bookCommon",
1058
1058
  group_learningPathCommon: "group_learningPathCommon",
1059
+ group_advertisingCommon: "group_advertisingCommon",
1059
1060
  group_quizCommon: "group_quizCommon",
1060
1061
  group_resourceBitTags: "group_resourceBitTags",
1061
1062
  group_resourceCommon: "group_resourceCommon",
@@ -1099,6 +1100,7 @@ var propertyKeys = {
1099
1100
  property_action: "@action",
1100
1101
  property_activityType: "@activityType",
1101
1102
  property_additionalSolutions: "@additionalSolutions",
1103
+ property_advertisingClickUrl: "@advertisingClickUrl",
1102
1104
  property_ageRange: "@ageRange",
1103
1105
  property_aiGenerated: "@aiGenerated",
1104
1106
  property_allowedBit: "@allowedBit",
@@ -1263,6 +1265,7 @@ var propertyKeys = {
1263
1265
  property_siteName: "@siteName",
1264
1266
  property_size: "@size",
1265
1267
  property_slug: "@slug",
1268
+ property_sourceDocument: "@sourceDocument",
1266
1269
  property_spaceId: "@spaceId",
1267
1270
  property_src1x: "@src1x",
1268
1271
  property_src2x: "@src2x",
@@ -2815,7 +2818,7 @@ var GROUPS = {
2815
2818
  },
2816
2819
  [ConfigKey.group_standardItemLeadInstructionHint]: {
2817
2820
  type: GroupConfigType.standard,
2818
- description: "Standard group for item, lead, page number, margin number, instruction and hint tags",
2821
+ description: "Standard group for item, lead, page number, source page number, margin number, instruction and hint tags",
2819
2822
  tags: [
2820
2823
  {
2821
2824
  key: ConfigKey.tag_item,
@@ -2823,8 +2826,8 @@ var GROUPS = {
2823
2826
  chain: [
2824
2827
  {
2825
2828
  key: ConfigKey.tag_item,
2826
- description: "The lead, page number, and margin number for the bit",
2827
- maxCount: 3
2829
+ description: "The lead, page number, source page number, and margin number for the bit",
2830
+ maxCount: 4
2828
2831
  }
2829
2832
  ]
2830
2833
  },
@@ -3219,6 +3222,11 @@ var GROUPS = {
3219
3222
  key: ConfigKey.property_maxTocChapterLevel,
3220
3223
  description: "The maximum table of contents chapter level",
3221
3224
  format: TagFormat.number
3225
+ },
3226
+ {
3227
+ key: ConfigKey.property_sourceDocument,
3228
+ description: "Url of the source document for the book (for example, a PDF file)",
3229
+ format: TagFormat.plainText
3222
3230
  }
3223
3231
  ]
3224
3232
  },
@@ -3297,6 +3305,17 @@ var GROUPS = {
3297
3305
  }
3298
3306
  ]
3299
3307
  },
3308
+ [ConfigKey.group_advertisingCommon]: {
3309
+ type: GroupConfigType.standard,
3310
+ description: "Common advertising tags",
3311
+ tags: [
3312
+ {
3313
+ key: ConfigKey.property_advertisingClickUrl,
3314
+ description: "The URL to which the advertisement should link",
3315
+ format: TagFormat.plainText
3316
+ }
3317
+ ]
3318
+ },
3300
3319
  [ConfigKey.group_quizCommon]: {
3301
3320
  type: GroupConfigType.standard,
3302
3321
  description: "Common quiz tags",
@@ -5209,67 +5228,145 @@ var BITS = {
5209
5228
  [BitType.advertising]: {
5210
5229
  since: "4.2.0",
5211
5230
  baseBitType: BitType.article,
5212
- description: "General advertising content bit"
5231
+ description: "General advertising content bit",
5232
+ tags: [
5233
+ {
5234
+ key: ConfigKey.group_advertisingCommon,
5235
+ description: "Common advertising tags"
5236
+ }
5237
+ ]
5213
5238
  },
5214
5239
  [BitType.advertisingAdvertorial]: {
5215
5240
  since: "4.2.0",
5216
5241
  baseBitType: BitType.article,
5217
- description: "Advertorial content bit (sponsored article)"
5242
+ description: "Advertorial content bit (sponsored article)",
5243
+ tags: [
5244
+ {
5245
+ key: ConfigKey.group_advertisingCommon,
5246
+ description: "Common advertising tags"
5247
+ }
5248
+ ]
5218
5249
  },
5219
5250
  [BitType.advertisingCallToAction]: {
5220
5251
  since: "4.2.0",
5221
5252
  baseBitType: BitType.callToAction,
5222
- description: "Call-to-action for advertising"
5253
+ description: "Call-to-action for advertising",
5254
+ tags: [
5255
+ {
5256
+ key: ConfigKey.group_advertisingCommon,
5257
+ description: "Common advertising tags"
5258
+ }
5259
+ ]
5223
5260
  },
5224
5261
  [BitType.advertisingCallToActionMeeting]: {
5225
5262
  since: "4.2.0",
5226
5263
  baseBitType: BitType.callToAction,
5227
- description: "Call-to-action for meeting or appointment"
5264
+ description: "Call-to-action for meeting or appointment",
5265
+ tags: [
5266
+ {
5267
+ key: ConfigKey.group_advertisingCommon,
5268
+ description: "Common advertising tags"
5269
+ }
5270
+ ]
5228
5271
  },
5229
5272
  [BitType.advertisingBanner]: {
5230
5273
  since: "4.2.0",
5231
5274
  baseBitType: BitType.image,
5232
- description: "Banner advertisement bit"
5275
+ description: "Banner advertisement bit",
5276
+ tags: [
5277
+ {
5278
+ key: ConfigKey.group_advertisingCommon,
5279
+ description: "Common advertising tags"
5280
+ }
5281
+ ]
5233
5282
  },
5234
5283
  [BitType.advertisingSkyscraper]: {
5235
5284
  since: "4.2.0",
5236
5285
  baseBitType: BitType.image,
5237
- description: "Skyscraper (vertical) advertisement bit"
5286
+ description: "Skyscraper (vertical) advertisement bit",
5287
+ tags: [
5288
+ {
5289
+ key: ConfigKey.group_advertisingCommon,
5290
+ description: "Common advertising tags"
5291
+ }
5292
+ ]
5238
5293
  },
5239
5294
  [BitType.advertisingRectangle]: {
5240
5295
  since: "4.2.0",
5241
5296
  baseBitType: BitType.image,
5242
- description: "Rectangle advertisement bit"
5297
+ description: "Rectangle advertisement bit",
5298
+ tags: [
5299
+ {
5300
+ key: ConfigKey.group_advertisingCommon,
5301
+ description: "Common advertising tags"
5302
+ }
5303
+ ]
5243
5304
  },
5244
5305
  [BitType.advertisingFullPage]: {
5245
5306
  since: "4.2.0",
5246
5307
  baseBitType: BitType.image,
5247
- description: "Full-page advertisement bit"
5308
+ description: "Full-page advertisement bit",
5309
+ tags: [
5310
+ {
5311
+ key: ConfigKey.group_advertisingCommon,
5312
+ description: "Common advertising tags"
5313
+ }
5314
+ ]
5248
5315
  },
5249
5316
  [BitType.advertisingHalfPage]: {
5250
5317
  since: "4.2.0",
5251
5318
  baseBitType: BitType.image,
5252
- description: "Half-page advertisement bit"
5319
+ description: "Half-page advertisement bit",
5320
+ tags: [
5321
+ {
5322
+ key: ConfigKey.group_advertisingCommon,
5323
+ description: "Common advertising tags"
5324
+ }
5325
+ ]
5253
5326
  },
5254
5327
  [BitType.advertisingQuarterPage]: {
5255
5328
  since: "4.2.0",
5256
5329
  baseBitType: BitType.image,
5257
- description: "Quarter-page advertisement bit"
5330
+ description: "Quarter-page advertisement bit",
5331
+ tags: [
5332
+ {
5333
+ key: ConfigKey.group_advertisingCommon,
5334
+ description: "Common advertising tags"
5335
+ }
5336
+ ]
5258
5337
  },
5259
5338
  [BitType.advertisingClassifiedPage]: {
5260
5339
  since: "4.2.0",
5261
5340
  baseBitType: BitType.image,
5262
- description: "Classifieds advertisement page bit"
5341
+ description: "Classifieds advertisement page bit",
5342
+ tags: [
5343
+ {
5344
+ key: ConfigKey.group_advertisingCommon,
5345
+ description: "Common advertising tags"
5346
+ }
5347
+ ]
5263
5348
  },
5264
5349
  [BitType.advertisingLandscape]: {
5265
5350
  since: "4.2.0",
5266
5351
  baseBitType: BitType.image,
5267
- description: "Landscape format advertisement bit"
5352
+ description: "Landscape format advertisement bit",
5353
+ tags: [
5354
+ {
5355
+ key: ConfigKey.group_advertisingCommon,
5356
+ description: "Common advertising tags"
5357
+ }
5358
+ ]
5268
5359
  },
5269
5360
  [BitType.advertisingPortrait]: {
5270
5361
  since: "4.2.0",
5271
5362
  baseBitType: BitType.image,
5272
- description: "Portrait format advertisement bit"
5363
+ description: "Portrait format advertisement bit",
5364
+ tags: [
5365
+ {
5366
+ key: ConfigKey.group_advertisingCommon,
5367
+ description: "Common advertising tags"
5368
+ }
5369
+ ]
5273
5370
  },
5274
5371
  [BitType.cookPreparation]: {
5275
5372
  since: "1.3.0",
@@ -9126,7 +9223,7 @@ var instance2 = new Config();
9126
9223
  // src/generated/package_info.ts
9127
9224
  var PACKAGE_INFO = {
9128
9225
  "name": "@gmb/bitmark-parser-generator",
9129
- "version": "4.10.0",
9226
+ "version": "4.12.0",
9130
9227
  "author": "Get More Brain Ltd",
9131
9228
  "license": "ISC",
9132
9229
  "description": "A bitmark parser and generator using Peggy.js"
@@ -9468,6 +9565,8 @@ var NodeType = superenum20({
9468
9565
  activityTypeValue: "activityTypeValue",
9469
9566
  additionalSolutions: "additionalSolutions",
9470
9567
  additionalSolutionsValue: "additionalSolutionsValue",
9568
+ advertisingClickUrl: "advertisingClickUrl",
9569
+ advertisingClickUrlValue: "advertisingClickUrlValue",
9471
9570
  ageRange: "ageRange",
9472
9571
  ageRangeValue: "ageRangeValue",
9473
9572
  aiGenerated: "aiGenerated",
@@ -9534,8 +9633,6 @@ var NodeType = superenum20({
9534
9633
  botValue: "botValue",
9535
9634
  bubbleTag: "bubbleTag",
9536
9635
  bubbleTagValue: "bubbleTagValue",
9537
- extractorTag: "extractorTag",
9538
- extractorTagValue: "extractorTagValue",
9539
9636
  buttonCaption: "buttonCaption",
9540
9637
  buttonCaptionValue: "buttonCaptionValue",
9541
9638
  callToActionUrl: "callToActionUrl",
@@ -9633,6 +9730,8 @@ var NodeType = superenum20({
9633
9730
  externalIdValue: "externalIdValue",
9634
9731
  externalLink: "externalLink",
9635
9732
  externalLinkText: "externalLinkText",
9733
+ extractorTag: "extractorTag",
9734
+ extractorTagValue: "extractorTagValue",
9636
9735
  extraProperties: "extraProperties",
9637
9736
  feedback: "feedback",
9638
9737
  feedbackEngine: "feedbackEngine",
@@ -9917,15 +10016,18 @@ var NodeType = superenum20({
9917
10016
  solution: "solution",
9918
10017
  solutions: "solutions",
9919
10018
  solutionsValue: "solutionsValue",
10019
+ sourceDocument: "sourceDocument",
10020
+ sourceDocumentValue: "sourceDocumentValue",
10021
+ sourcePageNumber: "sourcePageNumber",
9920
10022
  spaceId: "spaceId",
9921
10023
  spaceIdValue: "spaceIdValue",
9922
10024
  src: "src",
9923
- srcAlt: "srcAlt",
9924
- srcAltValue: "srcAltValue",
9925
10025
  src1x: "src1x",
9926
10026
  src2x: "src2x",
9927
10027
  src3x: "src3x",
9928
10028
  src4x: "src4x",
10029
+ srcAlt: "srcAlt",
10030
+ srcAltValue: "srcAltValue",
9929
10031
  start: "start",
9930
10032
  statement: "statement",
9931
10033
  statements: "statements",
@@ -22868,6 +22970,12 @@ var Builder = class extends BaseBuilder {
22868
22970
  data.callToActionUrl,
22869
22971
  options
22870
22972
  ),
22973
+ advertisingClickUrl: this.toAstProperty(
22974
+ bitType,
22975
+ ConfigKey.property_advertisingClickUrl,
22976
+ data.advertisingClickUrl,
22977
+ options
22978
+ ),
22871
22979
  caption: this.handleJsonText(context, TextLocation2.tag, data.caption),
22872
22980
  quotedPerson: this.toAstProperty(
22873
22981
  bitType,
@@ -22925,6 +23033,12 @@ var Builder = class extends BaseBuilder {
22925
23033
  data.maxTocChapterLevel,
22926
23034
  options
22927
23035
  ),
23036
+ sourceDocument: this.toAstProperty(
23037
+ bitType,
23038
+ ConfigKey.property_sourceDocument,
23039
+ data.sourceDocument,
23040
+ options
23041
+ ),
22928
23042
  tocResource: this.toAstProperty(
22929
23043
  bitType,
22930
23044
  ConfigKey.property_tocResource,
@@ -23009,6 +23123,7 @@ var Builder = class extends BaseBuilder {
23009
23123
  item: this.handleJsonText(context, TextLocation2.tag, data.item),
23010
23124
  lead: this.handleJsonText(context, TextLocation2.tag, data.lead),
23011
23125
  pageNumber: this.handleJsonText(context, TextLocation2.tag, data.pageNumber),
23126
+ sourcePageNumber: this.handleJsonText(context, TextLocation2.tag, data.sourcePageNumber),
23012
23127
  marginNumber: this.handleJsonText(context, TextLocation2.tag, data.marginNumber),
23013
23128
  hint: this.handleJsonText(context, TextLocation2.tag, data.hint),
23014
23129
  instruction: this.handleJsonText(context, TextLocation2.tag, data.instruction),
@@ -23111,7 +23226,15 @@ var Builder = class extends BaseBuilder {
23111
23226
  objectUtils.removeUnwantedProperties(node, {
23112
23227
  ignoreAllFalse: true,
23113
23228
  ignoreUndefined: ["example"],
23114
- ignoreEmptyArrays: ["item", "lead", "pageNumber", "marginNumber", "hint", "instruction"]
23229
+ ignoreEmptyArrays: [
23230
+ "item",
23231
+ "lead",
23232
+ "pageNumber",
23233
+ "sourcePageNumber",
23234
+ "marginNumber",
23235
+ "hint",
23236
+ "instruction"
23237
+ ]
23115
23238
  });
23116
23239
  return nodeValidator.validateBit(node);
23117
23240
  }
@@ -25424,6 +25547,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25424
25547
  if (this.isEmptyText(item)) return false;
25425
25548
  if (!this.isEmptyText(parent?.value?.lead)) return true;
25426
25549
  if (!this.isEmptyText(parent?.value?.pageNumber)) return true;
25550
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25427
25551
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25428
25552
  this.writeNL_IfNotChain(route);
25429
25553
  this.writeOPC();
@@ -25437,6 +25561,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25437
25561
  const parent = this.getParentNode(route);
25438
25562
  if (this.isEmptyText(lead)) return false;
25439
25563
  if (!this.isEmptyText(parent?.value?.pageNumber)) return true;
25564
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25440
25565
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25441
25566
  this.writeNL_IfNotChain(route);
25442
25567
  this.writeOPC();
@@ -25452,6 +25577,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25452
25577
  const pageNumber = node.value;
25453
25578
  const parent = this.getParentNode(route);
25454
25579
  if (this.isEmptyText(pageNumber)) return false;
25580
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25455
25581
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25456
25582
  this.writeNL_IfNotChain(route);
25457
25583
  this.writeOPC();
@@ -25465,6 +25591,31 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25465
25591
  this.writeCL();
25466
25592
  return true;
25467
25593
  }
25594
+ // bitmarkAst -> bits -> bitsValue -> sourcePageNumber
25595
+ enter_sourcePageNumber(node, route) {
25596
+ const sourcePageNumber = node.value;
25597
+ const parent = this.getParentNode(route);
25598
+ if (this.isEmptyText(sourcePageNumber)) return false;
25599
+ if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25600
+ this.writeNL_IfNotChain(route);
25601
+ this.writeOPC();
25602
+ this.writeTextOrValue(parent?.value?.item ?? "", TextFormat2.bitmarkText, TextLocation2.tag);
25603
+ this.writeCL();
25604
+ this.writeOPC();
25605
+ this.writeTextOrValue(parent?.value?.lead ?? "", TextFormat2.bitmarkText, TextLocation2.tag);
25606
+ this.writeCL();
25607
+ this.writeOPC();
25608
+ this.writeTextOrValue(
25609
+ parent?.value?.pageNumber ?? "",
25610
+ TextFormat2.bitmarkText,
25611
+ TextLocation2.tag
25612
+ );
25613
+ this.writeCL();
25614
+ this.writeOPC();
25615
+ this.writeTextOrValue(sourcePageNumber ?? "", TextFormat2.bitmarkText, TextLocation2.tag);
25616
+ this.writeCL();
25617
+ return true;
25618
+ }
25468
25619
  // bitmarkAst -> bits -> bitsValue -> marginNumber
25469
25620
  enter_marginNumber(node, route) {
25470
25621
  const marginNumber = node.value;
@@ -25485,6 +25636,13 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25485
25636
  );
25486
25637
  this.writeCL();
25487
25638
  this.writeOPC();
25639
+ this.writeTextOrValue(
25640
+ parent?.value?.sourcePageNumber ?? "",
25641
+ TextFormat2.bitmarkText,
25642
+ TextLocation2.tag
25643
+ );
25644
+ this.writeCL();
25645
+ this.writeOPC();
25488
25646
  this.writeTextOrValue(marginNumber, TextFormat2.bitmarkText, TextLocation2.tag);
25489
25647
  this.writeCL();
25490
25648
  return true;
@@ -27309,6 +27467,10 @@ var JsonGenerator = class extends AstWalkerGenerator {
27309
27467
  enter_pageNumber(node, route) {
27310
27468
  return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
27311
27469
  }
27470
+ // bitmarkAst -> bits -> bitsValue -> sourcePageNumber
27471
+ enter_sourcePageNumber(node, route) {
27472
+ return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
27473
+ }
27312
27474
  // bitmarkAst -> bits -> bitsValue -> marginNumber
27313
27475
  enter_marginNumber(node, route) {
27314
27476
  return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
@@ -28031,6 +28193,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
28031
28193
  delete bitJson.item;
28032
28194
  delete bitJson.lead;
28033
28195
  delete bitJson.pageNumber;
28196
+ delete bitJson.sourcePageNumber;
28034
28197
  delete bitJson.marginNumber;
28035
28198
  delete bitJson.hint;
28036
28199
  delete bitJson.instruction;
@@ -28042,6 +28205,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
28042
28205
  if (bitJson.lead == null || bitJson.lead?.length === 0) delete bitJson.lead;
28043
28206
  if (bitJson.pageNumber == null || bitJson.pageNumber?.length === 0)
28044
28207
  delete bitJson.pageNumber;
28208
+ if (bitJson.sourcePageNumber == null || bitJson.sourcePageNumber?.length === 0)
28209
+ delete bitJson.sourcePageNumber;
28045
28210
  if (bitJson.marginNumber == null || bitJson.marginNumber?.length === 0)
28046
28211
  delete bitJson.marginNumber;
28047
28212
  if (bitJson.hint == null || bitJson.hint?.length === 0) delete bitJson.hint;
@@ -28053,6 +28218,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
28053
28218
  if (bitJson.hint == null) bitJson.hint = this.textDefault;
28054
28219
  if (bitJson.instruction == null) bitJson.instruction = this.textDefault;
28055
28220
  if (bitJson.pageNumber == null) bitJson.pageNumber = this.textDefault;
28221
+ if (bitJson.sourcePageNumber == null) bitJson.sourcePageNumber = this.textDefault;
28056
28222
  if (bitJson.marginNumber == null) bitJson.marginNumber = this.textDefault;
28057
28223
  }
28058
28224
  if (bitJson.body == null) bitJson.body = this.bodyDefault;
@@ -32492,7 +32658,8 @@ var BitmarkPegParserProcessor = class {
32492
32658
  if (l > 0) result.item = result.itemLead[0];
32493
32659
  if (l > 1) result.lead = result.itemLead[1];
32494
32660
  if (l > 2) result.pageNumber = result.itemLead[2];
32495
- if (l > 3) result.marginNumber = result.itemLead[l - 1];
32661
+ if (l > 3) result.sourcePageNumber = result.itemLead[3];
32662
+ if (l > 4) result.marginNumber = result.itemLead[l - 1];
32496
32663
  }
32497
32664
  if (inBit) {
32498
32665
  result.body = instance11.process(