@gmb/bitmark-parser-generator 5.8.0 → 5.9.1

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.
@@ -1190,6 +1190,7 @@ var propertyKeys = {
1190
1190
  property_aiGenerated: "@aiGenerated",
1191
1191
  property_allowedBit: "@allowedBit",
1192
1192
  property_allowPrint: "@allowPrint",
1193
+ property_allowPrintEnforceSpaceConfiguration: "@allowPrintEnforceSpaceConfiguration",
1193
1194
  property_allowSubtitles: "@allowSubtitles",
1194
1195
  property_alt: "@alt",
1195
1196
  property_altLangTag: "@altLangTag",
@@ -1324,6 +1325,7 @@ var propertyKeys = {
1324
1325
  property_location: "@location",
1325
1326
  property_machineTranslated: "@machineTranslated",
1326
1327
  property_translationOf: "@translationOf",
1328
+ property_translationOfBook: "@translationOfBook",
1327
1329
  property_spansPageBreak: "@spansPageBreak",
1328
1330
  property_mailingList: "@mailingList",
1329
1331
  property_mark: "@mark",
@@ -2508,27 +2510,6 @@ var CARDSETS = {
2508
2510
  ]
2509
2511
  },
2510
2512
  [CardSetConfigKey.table]: {
2511
- variants: [
2512
- // Side 1
2513
- [
2514
- // Variant 1..N
2515
- {
2516
- tags: [
2517
- {
2518
- key: ConfigKey.group_standardItemLeadInstructionHint,
2519
- description: "Standard tags for lead, instruction, and hint."
2520
- },
2521
- {
2522
- key: ConfigKey.tag_title,
2523
- description: "Title of the table."
2524
- }
2525
- ],
2526
- repeatCount: Count.infinity
2527
- }
2528
- ]
2529
- ]
2530
- },
2531
- [CardSetConfigKey.tableExtended]: {
2532
2513
  variants: [
2533
2514
  // Side 1
2534
2515
  [
@@ -3462,6 +3443,11 @@ var GROUPS = {
3462
3443
  format: TagFormat.plainText,
3463
3444
  maxCount: Count.infinity
3464
3445
  },
3446
+ {
3447
+ key: ConfigKey.property_translationOfBook,
3448
+ description: "External Id of the translated book",
3449
+ format: TagFormat.plainText
3450
+ },
3465
3451
  {
3466
3452
  key: ConfigKey.property_duration,
3467
3453
  description: "The duration of the book",
@@ -3488,6 +3474,12 @@ var GROUPS = {
3488
3474
  format: TagFormat.boolean,
3489
3475
  defaultValue: "false"
3490
3476
  },
3477
+ {
3478
+ key: ConfigKey.property_allowPrintEnforceSpaceConfiguration,
3479
+ description: "If true, enforces space configuration for printing regardless of the allowPrint setting",
3480
+ format: TagFormat.boolean,
3481
+ defaultValue: "false"
3482
+ },
3491
3483
  {
3492
3484
  key: ConfigKey.property_hasPrintRestriction,
3493
3485
  description: "If true, the book has print restrictions",
@@ -7883,15 +7875,35 @@ var BITS = {
7883
7875
  },
7884
7876
  [BitType.tableImage]: {
7885
7877
  since: "1.5.15",
7886
- baseBitType: BitType.image,
7878
+ baseBitType: BitType.table,
7887
7879
  description: "Table image bit, used to create images in tables in articles or books",
7888
7880
  tags: [
7889
7881
  {
7890
7882
  key: ConfigKey.property_caption,
7891
7883
  description: "Caption for the table image, used to provide a description for the image",
7892
7884
  format: TagFormat.bitmarkText
7885
+ },
7886
+ {
7887
+ key: ConfigKey.resource_backgroundWallpaper,
7888
+ description: "Background wallpaper for the image, used to set a background for the image",
7889
+ chain: [
7890
+ {
7891
+ key: ConfigKey.group_resourceImageCommon,
7892
+ description: "Common resource image tags for images"
7893
+ }
7894
+ ]
7895
+ },
7896
+ {
7897
+ key: ConfigKey.group_resourceBitTags,
7898
+ description: "Resource bit tags for images, used to define additional properties for images"
7899
+ },
7900
+ {
7901
+ key: ConfigKey.group_resourceImage,
7902
+ description: "Resource image tags for images, used to attach images to the bit",
7903
+ minCount: 1
7893
7904
  }
7894
- ]
7905
+ ],
7906
+ resourceAttachmentAllowed: false
7895
7907
  },
7896
7908
  [BitType.tableImageAlt]: {
7897
7909
  since: "1.16.0",
@@ -9411,8 +9423,7 @@ var BITS = {
9411
9423
  [BitType.tableExtended]: {
9412
9424
  since: "4.14.0",
9413
9425
  baseBitType: BitType.table,
9414
- description: "Extended table bit, used to create complex tables with all HTML table features",
9415
- cardSet: CardSetConfigKey.tableExtended
9426
+ description: "Extended table bit, used to create complex tables with all HTML table features"
9416
9427
  },
9417
9428
  [BitType.tableAlt]: {
9418
9429
  since: "1.16.0",
@@ -10436,7 +10447,7 @@ var instance2 = new Config();
10436
10447
  // src/generated/package_info.ts
10437
10448
  var PACKAGE_INFO = {
10438
10449
  "name": "@gmb/bitmark-parser-generator",
10439
- "version": "5.8.0",
10450
+ "version": "5.9.1",
10440
10451
  "author": "Get More Brain Ltd",
10441
10452
  "license": "ISC",
10442
10453
  "description": "A bitmark parser and generator using Peggy.js"
@@ -11300,6 +11311,8 @@ var NodeType = {
11300
11311
  refPublisher: "refPublisher",
11301
11312
  relatedBook: "relatedBook",
11302
11313
  relatedBookValue: "relatedBookValue",
11314
+ translationOfBook: "translationOfBook",
11315
+ translationOfBookValue: "translationOfBookValue",
11303
11316
  releaseDate: "releaseDate",
11304
11317
  releaseDateValue: "releaseDateValue",
11305
11318
  releaseKind: "releaseKind",
@@ -12033,7 +12046,7 @@ function normalizeTableFormat(bitType, table) {
12033
12046
  delete t.columns;
12034
12047
  delete t.data;
12035
12048
  }
12036
- const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended);
12049
+ const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended) || instance2.isOfBitType(bitType, BitType.tableImage);
12037
12050
  if (isExtended && isTableBasicFormat(table)) {
12038
12051
  return convertBasicToExtendedTableFormat(table);
12039
12052
  }
@@ -24415,6 +24428,12 @@ var Builder = class extends BaseBuilder {
24415
24428
  data.relatedBook,
24416
24429
  options
24417
24430
  ),
24431
+ translationOfBook: this.toAstProperty(
24432
+ bitType,
24433
+ ConfigKey.property_translationOfBook,
24434
+ data.translationOfBook,
24435
+ options
24436
+ ),
24418
24437
  author: this.toAstProperty(bitType, ConfigKey.property_author, data.author, options),
24419
24438
  subject: this.toAstProperty(bitType, ConfigKey.property_subject, data.subject, options),
24420
24439
  date: this.toAstProperty(bitType, ConfigKey.property_date, data.date, options),
@@ -24991,6 +25010,12 @@ var Builder = class extends BaseBuilder {
24991
25010
  data.allowPrint,
24992
25011
  options
24993
25012
  ),
25013
+ allowPrintEnforceSpaceConfiguration: this.toAstProperty(
25014
+ bitType,
25015
+ ConfigKey.property_allowPrintEnforceSpaceConfiguration,
25016
+ data.allowPrintEnforceSpaceConfiguration,
25017
+ options
25018
+ ),
24994
25019
  printParentChapterLevel: this.toAstProperty(
24995
25020
  bitType,
24996
25021
  ConfigKey.property_printParentChapterLevel,
@@ -30638,7 +30663,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30638
30663
  if (bitJson.isTracked == null) bitJson.isTracked = true;
30639
30664
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
30640
30665
  }
30641
- if (instance2.isOfBitType(bitType, BitType.table)) {
30666
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
30642
30667
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
30643
30668
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
30644
30669
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -30653,6 +30678,11 @@ var JsonGenerator = class extends AstWalkerGenerator {
30653
30678
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
30654
30679
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
30655
30680
  }
30681
+ if (instance2.isOfBitType(bitType, BitType.tableImage)) {
30682
+ if (this.tableIsEmpty(bitJson.table)) {
30683
+ delete bitJson.table;
30684
+ }
30685
+ }
30656
30686
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
30657
30687
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
30658
30688
  if (bitJson.refBookTitle == null) bitJson.refBookTitle = "";
@@ -30793,6 +30823,19 @@ var JsonGenerator = class extends AstWalkerGenerator {
30793
30823
  }
30794
30824
  return bitJson;
30795
30825
  }
30826
+ tableIsEmpty(table) {
30827
+ if (!table) return true;
30828
+ if (Object.keys(table).length === 0) return true;
30829
+ const tableStandard = table;
30830
+ if (tableStandard.columns?.length === 0 && tableStandard.data?.length) {
30831
+ return true;
30832
+ }
30833
+ const tableExtended = table;
30834
+ if (tableExtended.header?.rows.length === 0 && tableExtended.body?.rows.length === 0 && tableExtended.footer?.rows.length === 0) {
30835
+ return true;
30836
+ }
30837
+ return false;
30838
+ }
30796
30839
  /**
30797
30840
  * Convert any bitmark texts to strings.
30798
30841
  */