@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.
package/dist/index.cjs CHANGED
@@ -1204,6 +1204,7 @@ var propertyKeys = {
1204
1204
  property_aiGenerated: "@aiGenerated",
1205
1205
  property_allowedBit: "@allowedBit",
1206
1206
  property_allowPrint: "@allowPrint",
1207
+ property_allowPrintEnforceSpaceConfiguration: "@allowPrintEnforceSpaceConfiguration",
1207
1208
  property_allowSubtitles: "@allowSubtitles",
1208
1209
  property_alt: "@alt",
1209
1210
  property_altLangTag: "@altLangTag",
@@ -1338,6 +1339,7 @@ var propertyKeys = {
1338
1339
  property_location: "@location",
1339
1340
  property_machineTranslated: "@machineTranslated",
1340
1341
  property_translationOf: "@translationOf",
1342
+ property_translationOfBook: "@translationOfBook",
1341
1343
  property_spansPageBreak: "@spansPageBreak",
1342
1344
  property_mailingList: "@mailingList",
1343
1345
  property_mark: "@mark",
@@ -2522,27 +2524,6 @@ var CARDSETS = {
2522
2524
  ]
2523
2525
  },
2524
2526
  [CardSetConfigKey.table]: {
2525
- variants: [
2526
- // Side 1
2527
- [
2528
- // Variant 1..N
2529
- {
2530
- tags: [
2531
- {
2532
- key: ConfigKey.group_standardItemLeadInstructionHint,
2533
- description: "Standard tags for lead, instruction, and hint."
2534
- },
2535
- {
2536
- key: ConfigKey.tag_title,
2537
- description: "Title of the table."
2538
- }
2539
- ],
2540
- repeatCount: Count.infinity
2541
- }
2542
- ]
2543
- ]
2544
- },
2545
- [CardSetConfigKey.tableExtended]: {
2546
2527
  variants: [
2547
2528
  // Side 1
2548
2529
  [
@@ -3476,6 +3457,11 @@ var GROUPS = {
3476
3457
  format: TagFormat.plainText,
3477
3458
  maxCount: Count.infinity
3478
3459
  },
3460
+ {
3461
+ key: ConfigKey.property_translationOfBook,
3462
+ description: "External Id of the translated book",
3463
+ format: TagFormat.plainText
3464
+ },
3479
3465
  {
3480
3466
  key: ConfigKey.property_duration,
3481
3467
  description: "The duration of the book",
@@ -3502,6 +3488,12 @@ var GROUPS = {
3502
3488
  format: TagFormat.boolean,
3503
3489
  defaultValue: "false"
3504
3490
  },
3491
+ {
3492
+ key: ConfigKey.property_allowPrintEnforceSpaceConfiguration,
3493
+ description: "If true, enforces space configuration for printing regardless of the allowPrint setting",
3494
+ format: TagFormat.boolean,
3495
+ defaultValue: "false"
3496
+ },
3505
3497
  {
3506
3498
  key: ConfigKey.property_hasPrintRestriction,
3507
3499
  description: "If true, the book has print restrictions",
@@ -7897,15 +7889,35 @@ var BITS = {
7897
7889
  },
7898
7890
  [BitType.tableImage]: {
7899
7891
  since: "1.5.15",
7900
- baseBitType: BitType.image,
7892
+ baseBitType: BitType.table,
7901
7893
  description: "Table image bit, used to create images in tables in articles or books",
7902
7894
  tags: [
7903
7895
  {
7904
7896
  key: ConfigKey.property_caption,
7905
7897
  description: "Caption for the table image, used to provide a description for the image",
7906
7898
  format: TagFormat.bitmarkText
7899
+ },
7900
+ {
7901
+ key: ConfigKey.resource_backgroundWallpaper,
7902
+ description: "Background wallpaper for the image, used to set a background for the image",
7903
+ chain: [
7904
+ {
7905
+ key: ConfigKey.group_resourceImageCommon,
7906
+ description: "Common resource image tags for images"
7907
+ }
7908
+ ]
7909
+ },
7910
+ {
7911
+ key: ConfigKey.group_resourceBitTags,
7912
+ description: "Resource bit tags for images, used to define additional properties for images"
7913
+ },
7914
+ {
7915
+ key: ConfigKey.group_resourceImage,
7916
+ description: "Resource image tags for images, used to attach images to the bit",
7917
+ minCount: 1
7907
7918
  }
7908
- ]
7919
+ ],
7920
+ resourceAttachmentAllowed: false
7909
7921
  },
7910
7922
  [BitType.tableImageAlt]: {
7911
7923
  since: "1.16.0",
@@ -9425,8 +9437,7 @@ var BITS = {
9425
9437
  [BitType.tableExtended]: {
9426
9438
  since: "4.14.0",
9427
9439
  baseBitType: BitType.table,
9428
- description: "Extended table bit, used to create complex tables with all HTML table features",
9429
- cardSet: CardSetConfigKey.tableExtended
9440
+ description: "Extended table bit, used to create complex tables with all HTML table features"
9430
9441
  },
9431
9442
  [BitType.tableAlt]: {
9432
9443
  since: "1.16.0",
@@ -10450,7 +10461,7 @@ var instance2 = new Config();
10450
10461
  // src/generated/package_info.ts
10451
10462
  var PACKAGE_INFO = {
10452
10463
  "name": "@gmb/bitmark-parser-generator",
10453
- "version": "5.8.0",
10464
+ "version": "5.9.1",
10454
10465
  "author": "Get More Brain Ltd",
10455
10466
  "license": "ISC",
10456
10467
  "description": "A bitmark parser and generator using Peggy.js"
@@ -11314,6 +11325,8 @@ var NodeType = {
11314
11325
  refPublisher: "refPublisher",
11315
11326
  relatedBook: "relatedBook",
11316
11327
  relatedBookValue: "relatedBookValue",
11328
+ translationOfBook: "translationOfBook",
11329
+ translationOfBookValue: "translationOfBookValue",
11317
11330
  releaseDate: "releaseDate",
11318
11331
  releaseDateValue: "releaseDateValue",
11319
11332
  releaseKind: "releaseKind",
@@ -12047,7 +12060,7 @@ function normalizeTableFormat(bitType, table) {
12047
12060
  delete t.columns;
12048
12061
  delete t.data;
12049
12062
  }
12050
- const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended);
12063
+ const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended) || instance2.isOfBitType(bitType, BitType.tableImage);
12051
12064
  if (isExtended && isTableBasicFormat(table)) {
12052
12065
  return convertBasicToExtendedTableFormat(table);
12053
12066
  }
@@ -24429,6 +24442,12 @@ var Builder = class extends BaseBuilder {
24429
24442
  data.relatedBook,
24430
24443
  options
24431
24444
  ),
24445
+ translationOfBook: this.toAstProperty(
24446
+ bitType,
24447
+ ConfigKey.property_translationOfBook,
24448
+ data.translationOfBook,
24449
+ options
24450
+ ),
24432
24451
  author: this.toAstProperty(bitType, ConfigKey.property_author, data.author, options),
24433
24452
  subject: this.toAstProperty(bitType, ConfigKey.property_subject, data.subject, options),
24434
24453
  date: this.toAstProperty(bitType, ConfigKey.property_date, data.date, options),
@@ -25005,6 +25024,12 @@ var Builder = class extends BaseBuilder {
25005
25024
  data.allowPrint,
25006
25025
  options
25007
25026
  ),
25027
+ allowPrintEnforceSpaceConfiguration: this.toAstProperty(
25028
+ bitType,
25029
+ ConfigKey.property_allowPrintEnforceSpaceConfiguration,
25030
+ data.allowPrintEnforceSpaceConfiguration,
25031
+ options
25032
+ ),
25008
25033
  printParentChapterLevel: this.toAstProperty(
25009
25034
  bitType,
25010
25035
  ConfigKey.property_printParentChapterLevel,
@@ -30652,7 +30677,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30652
30677
  if (bitJson.isTracked == null) bitJson.isTracked = true;
30653
30678
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
30654
30679
  }
30655
- if (instance2.isOfBitType(bitType, BitType.table)) {
30680
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
30656
30681
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
30657
30682
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
30658
30683
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -30667,6 +30692,11 @@ var JsonGenerator = class extends AstWalkerGenerator {
30667
30692
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
30668
30693
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
30669
30694
  }
30695
+ if (instance2.isOfBitType(bitType, BitType.tableImage)) {
30696
+ if (this.tableIsEmpty(bitJson.table)) {
30697
+ delete bitJson.table;
30698
+ }
30699
+ }
30670
30700
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
30671
30701
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
30672
30702
  if (bitJson.refBookTitle == null) bitJson.refBookTitle = "";
@@ -30807,6 +30837,19 @@ var JsonGenerator = class extends AstWalkerGenerator {
30807
30837
  }
30808
30838
  return bitJson;
30809
30839
  }
30840
+ tableIsEmpty(table) {
30841
+ if (!table) return true;
30842
+ if (Object.keys(table).length === 0) return true;
30843
+ const tableStandard = table;
30844
+ if (tableStandard.columns?.length === 0 && tableStandard.data?.length) {
30845
+ return true;
30846
+ }
30847
+ const tableExtended = table;
30848
+ if (tableExtended.header?.rows.length === 0 && tableExtended.body?.rows.length === 0 && tableExtended.footer?.rows.length === 0) {
30849
+ return true;
30850
+ }
30851
+ return false;
30852
+ }
30810
30853
  /**
30811
30854
  * Convert any bitmark texts to strings.
30812
30855
  */