@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.d.cts CHANGED
@@ -718,6 +718,7 @@ declare const ConfigKey: {
718
718
  readonly property_aiGenerated: "@aiGenerated";
719
719
  readonly property_allowedBit: "@allowedBit";
720
720
  readonly property_allowPrint: "@allowPrint";
721
+ readonly property_allowPrintEnforceSpaceConfiguration: "@allowPrintEnforceSpaceConfiguration";
721
722
  readonly property_allowSubtitles: "@allowSubtitles";
722
723
  readonly property_alt: "@alt";
723
724
  readonly property_altLangTag: "@altLangTag";
@@ -852,6 +853,7 @@ declare const ConfigKey: {
852
853
  readonly property_location: "@location";
853
854
  readonly property_machineTranslated: "@machineTranslated";
854
855
  readonly property_translationOf: "@translationOf";
856
+ readonly property_translationOfBook: "@translationOfBook";
855
857
  readonly property_spansPageBreak: "@spansPageBreak";
856
858
  readonly property_mailingList: "@mailingList";
857
859
  readonly property_mark: "@mark";
@@ -1805,6 +1807,7 @@ interface BitJson {
1805
1807
  maxDisplayLevel: number;
1806
1808
  maxTocChapterLevel: number;
1807
1809
  allowPrint: boolean;
1810
+ allowPrintEnforceSpaceConfiguration: boolean;
1808
1811
  printParentChapterLevel: number;
1809
1812
  sourceDocument: string;
1810
1813
  internalPrintPdf: string;
@@ -2295,6 +2298,7 @@ interface Bit {
2295
2298
  coverColor?: Property;
2296
2299
  publications?: Property;
2297
2300
  relatedBook?: Property;
2301
+ translationOfBook?: Property;
2298
2302
  author?: Property;
2299
2303
  subject?: Property;
2300
2304
  date?: Property;
@@ -2432,6 +2436,7 @@ interface Bit {
2432
2436
  tocContent?: Property;
2433
2437
  page?: Property;
2434
2438
  allowPrint?: Property;
2439
+ allowPrintEnforceSpaceConfiguration?: Property;
2435
2440
  allowPrintValue?: Property;
2436
2441
  printParentChapterLevel?: Property;
2437
2442
  platformBrandTarget?: Property;
@@ -3079,6 +3084,8 @@ declare const NodeType: {
3079
3084
  readonly refPublisher: "refPublisher";
3080
3085
  readonly relatedBook: "relatedBook";
3081
3086
  readonly relatedBookValue: "relatedBookValue";
3087
+ readonly translationOfBook: "translationOfBook";
3088
+ readonly translationOfBookValue: "translationOfBookValue";
3082
3089
  readonly releaseDate: "releaseDate";
3083
3090
  readonly releaseDateValue: "releaseDateValue";
3084
3091
  readonly releaseKind: "releaseKind";
@@ -4125,6 +4132,7 @@ declare class Builder extends BaseBuilder {
4125
4132
  coverColor?: string;
4126
4133
  publications?: string | string[];
4127
4134
  relatedBook?: string | string[];
4135
+ translationOfBook?: string;
4128
4136
  author?: string | string[];
4129
4137
  subject?: string | string[];
4130
4138
  date?: string;
@@ -4251,6 +4259,7 @@ declare class Builder extends BaseBuilder {
4251
4259
  sourceDocument?: string;
4252
4260
  internalPrintPdf?: string;
4253
4261
  allowPrint?: boolean;
4262
+ allowPrintEnforceSpaceConfiguration?: boolean;
4254
4263
  hasPrintRestriction?: boolean;
4255
4264
  enforceUpdateOverUserInput?: boolean;
4256
4265
  extractorExtractionTimestamp?: string[];
@@ -6050,6 +6059,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
6050
6059
  * @returns
6051
6060
  */
6052
6061
  protected cleanBitJson(bitJson: Partial<BitJson>): Partial<BitJson>;
6062
+ protected tableIsEmpty(table: TableJson | TableExtendedJson | undefined): boolean;
6053
6063
  /**
6054
6064
  * Convert any bitmark texts to strings.
6055
6065
  */
package/dist/index.d.ts CHANGED
@@ -718,6 +718,7 @@ declare const ConfigKey: {
718
718
  readonly property_aiGenerated: "@aiGenerated";
719
719
  readonly property_allowedBit: "@allowedBit";
720
720
  readonly property_allowPrint: "@allowPrint";
721
+ readonly property_allowPrintEnforceSpaceConfiguration: "@allowPrintEnforceSpaceConfiguration";
721
722
  readonly property_allowSubtitles: "@allowSubtitles";
722
723
  readonly property_alt: "@alt";
723
724
  readonly property_altLangTag: "@altLangTag";
@@ -852,6 +853,7 @@ declare const ConfigKey: {
852
853
  readonly property_location: "@location";
853
854
  readonly property_machineTranslated: "@machineTranslated";
854
855
  readonly property_translationOf: "@translationOf";
856
+ readonly property_translationOfBook: "@translationOfBook";
855
857
  readonly property_spansPageBreak: "@spansPageBreak";
856
858
  readonly property_mailingList: "@mailingList";
857
859
  readonly property_mark: "@mark";
@@ -1805,6 +1807,7 @@ interface BitJson {
1805
1807
  maxDisplayLevel: number;
1806
1808
  maxTocChapterLevel: number;
1807
1809
  allowPrint: boolean;
1810
+ allowPrintEnforceSpaceConfiguration: boolean;
1808
1811
  printParentChapterLevel: number;
1809
1812
  sourceDocument: string;
1810
1813
  internalPrintPdf: string;
@@ -2295,6 +2298,7 @@ interface Bit {
2295
2298
  coverColor?: Property;
2296
2299
  publications?: Property;
2297
2300
  relatedBook?: Property;
2301
+ translationOfBook?: Property;
2298
2302
  author?: Property;
2299
2303
  subject?: Property;
2300
2304
  date?: Property;
@@ -2432,6 +2436,7 @@ interface Bit {
2432
2436
  tocContent?: Property;
2433
2437
  page?: Property;
2434
2438
  allowPrint?: Property;
2439
+ allowPrintEnforceSpaceConfiguration?: Property;
2435
2440
  allowPrintValue?: Property;
2436
2441
  printParentChapterLevel?: Property;
2437
2442
  platformBrandTarget?: Property;
@@ -3079,6 +3084,8 @@ declare const NodeType: {
3079
3084
  readonly refPublisher: "refPublisher";
3080
3085
  readonly relatedBook: "relatedBook";
3081
3086
  readonly relatedBookValue: "relatedBookValue";
3087
+ readonly translationOfBook: "translationOfBook";
3088
+ readonly translationOfBookValue: "translationOfBookValue";
3082
3089
  readonly releaseDate: "releaseDate";
3083
3090
  readonly releaseDateValue: "releaseDateValue";
3084
3091
  readonly releaseKind: "releaseKind";
@@ -4125,6 +4132,7 @@ declare class Builder extends BaseBuilder {
4125
4132
  coverColor?: string;
4126
4133
  publications?: string | string[];
4127
4134
  relatedBook?: string | string[];
4135
+ translationOfBook?: string;
4128
4136
  author?: string | string[];
4129
4137
  subject?: string | string[];
4130
4138
  date?: string;
@@ -4251,6 +4259,7 @@ declare class Builder extends BaseBuilder {
4251
4259
  sourceDocument?: string;
4252
4260
  internalPrintPdf?: string;
4253
4261
  allowPrint?: boolean;
4262
+ allowPrintEnforceSpaceConfiguration?: boolean;
4254
4263
  hasPrintRestriction?: boolean;
4255
4264
  enforceUpdateOverUserInput?: boolean;
4256
4265
  extractorExtractionTimestamp?: string[];
@@ -6050,6 +6059,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
6050
6059
  * @returns
6051
6060
  */
6052
6061
  protected cleanBitJson(bitJson: Partial<BitJson>): Partial<BitJson>;
6062
+ protected tableIsEmpty(table: TableJson | TableExtendedJson | undefined): boolean;
6053
6063
  /**
6054
6064
  * Convert any bitmark texts to strings.
6055
6065
  */
package/dist/index.js CHANGED
@@ -1143,6 +1143,7 @@ var propertyKeys = {
1143
1143
  property_aiGenerated: "@aiGenerated",
1144
1144
  property_allowedBit: "@allowedBit",
1145
1145
  property_allowPrint: "@allowPrint",
1146
+ property_allowPrintEnforceSpaceConfiguration: "@allowPrintEnforceSpaceConfiguration",
1146
1147
  property_allowSubtitles: "@allowSubtitles",
1147
1148
  property_alt: "@alt",
1148
1149
  property_altLangTag: "@altLangTag",
@@ -1277,6 +1278,7 @@ var propertyKeys = {
1277
1278
  property_location: "@location",
1278
1279
  property_machineTranslated: "@machineTranslated",
1279
1280
  property_translationOf: "@translationOf",
1281
+ property_translationOfBook: "@translationOfBook",
1280
1282
  property_spansPageBreak: "@spansPageBreak",
1281
1283
  property_mailingList: "@mailingList",
1282
1284
  property_mark: "@mark",
@@ -2461,27 +2463,6 @@ var CARDSETS = {
2461
2463
  ]
2462
2464
  },
2463
2465
  [CardSetConfigKey.table]: {
2464
- variants: [
2465
- // Side 1
2466
- [
2467
- // Variant 1..N
2468
- {
2469
- tags: [
2470
- {
2471
- key: ConfigKey.group_standardItemLeadInstructionHint,
2472
- description: "Standard tags for lead, instruction, and hint."
2473
- },
2474
- {
2475
- key: ConfigKey.tag_title,
2476
- description: "Title of the table."
2477
- }
2478
- ],
2479
- repeatCount: Count.infinity
2480
- }
2481
- ]
2482
- ]
2483
- },
2484
- [CardSetConfigKey.tableExtended]: {
2485
2466
  variants: [
2486
2467
  // Side 1
2487
2468
  [
@@ -3415,6 +3396,11 @@ var GROUPS = {
3415
3396
  format: TagFormat.plainText,
3416
3397
  maxCount: Count.infinity
3417
3398
  },
3399
+ {
3400
+ key: ConfigKey.property_translationOfBook,
3401
+ description: "External Id of the translated book",
3402
+ format: TagFormat.plainText
3403
+ },
3418
3404
  {
3419
3405
  key: ConfigKey.property_duration,
3420
3406
  description: "The duration of the book",
@@ -3441,6 +3427,12 @@ var GROUPS = {
3441
3427
  format: TagFormat.boolean,
3442
3428
  defaultValue: "false"
3443
3429
  },
3430
+ {
3431
+ key: ConfigKey.property_allowPrintEnforceSpaceConfiguration,
3432
+ description: "If true, enforces space configuration for printing regardless of the allowPrint setting",
3433
+ format: TagFormat.boolean,
3434
+ defaultValue: "false"
3435
+ },
3444
3436
  {
3445
3437
  key: ConfigKey.property_hasPrintRestriction,
3446
3438
  description: "If true, the book has print restrictions",
@@ -7836,15 +7828,35 @@ var BITS = {
7836
7828
  },
7837
7829
  [BitType.tableImage]: {
7838
7830
  since: "1.5.15",
7839
- baseBitType: BitType.image,
7831
+ baseBitType: BitType.table,
7840
7832
  description: "Table image bit, used to create images in tables in articles or books",
7841
7833
  tags: [
7842
7834
  {
7843
7835
  key: ConfigKey.property_caption,
7844
7836
  description: "Caption for the table image, used to provide a description for the image",
7845
7837
  format: TagFormat.bitmarkText
7838
+ },
7839
+ {
7840
+ key: ConfigKey.resource_backgroundWallpaper,
7841
+ description: "Background wallpaper for the image, used to set a background for the image",
7842
+ chain: [
7843
+ {
7844
+ key: ConfigKey.group_resourceImageCommon,
7845
+ description: "Common resource image tags for images"
7846
+ }
7847
+ ]
7848
+ },
7849
+ {
7850
+ key: ConfigKey.group_resourceBitTags,
7851
+ description: "Resource bit tags for images, used to define additional properties for images"
7852
+ },
7853
+ {
7854
+ key: ConfigKey.group_resourceImage,
7855
+ description: "Resource image tags for images, used to attach images to the bit",
7856
+ minCount: 1
7846
7857
  }
7847
- ]
7858
+ ],
7859
+ resourceAttachmentAllowed: false
7848
7860
  },
7849
7861
  [BitType.tableImageAlt]: {
7850
7862
  since: "1.16.0",
@@ -9364,8 +9376,7 @@ var BITS = {
9364
9376
  [BitType.tableExtended]: {
9365
9377
  since: "4.14.0",
9366
9378
  baseBitType: BitType.table,
9367
- description: "Extended table bit, used to create complex tables with all HTML table features",
9368
- cardSet: CardSetConfigKey.tableExtended
9379
+ description: "Extended table bit, used to create complex tables with all HTML table features"
9369
9380
  },
9370
9381
  [BitType.tableAlt]: {
9371
9382
  since: "1.16.0",
@@ -10389,7 +10400,7 @@ var instance2 = new Config();
10389
10400
  // src/generated/package_info.ts
10390
10401
  var PACKAGE_INFO = {
10391
10402
  "name": "@gmb/bitmark-parser-generator",
10392
- "version": "5.8.0",
10403
+ "version": "5.9.1",
10393
10404
  "author": "Get More Brain Ltd",
10394
10405
  "license": "ISC",
10395
10406
  "description": "A bitmark parser and generator using Peggy.js"
@@ -11253,6 +11264,8 @@ var NodeType = {
11253
11264
  refPublisher: "refPublisher",
11254
11265
  relatedBook: "relatedBook",
11255
11266
  relatedBookValue: "relatedBookValue",
11267
+ translationOfBook: "translationOfBook",
11268
+ translationOfBookValue: "translationOfBookValue",
11256
11269
  releaseDate: "releaseDate",
11257
11270
  releaseDateValue: "releaseDateValue",
11258
11271
  releaseKind: "releaseKind",
@@ -11986,7 +11999,7 @@ function normalizeTableFormat(bitType, table) {
11986
11999
  delete t.columns;
11987
12000
  delete t.data;
11988
12001
  }
11989
- const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended);
12002
+ const isExtended = instance2.isOfBitType(bitType, BitType.tableExtended) || instance2.isOfBitType(bitType, BitType.tableImage);
11990
12003
  if (isExtended && isTableBasicFormat(table)) {
11991
12004
  return convertBasicToExtendedTableFormat(table);
11992
12005
  }
@@ -24368,6 +24381,12 @@ var Builder = class extends BaseBuilder {
24368
24381
  data.relatedBook,
24369
24382
  options
24370
24383
  ),
24384
+ translationOfBook: this.toAstProperty(
24385
+ bitType,
24386
+ ConfigKey.property_translationOfBook,
24387
+ data.translationOfBook,
24388
+ options
24389
+ ),
24371
24390
  author: this.toAstProperty(bitType, ConfigKey.property_author, data.author, options),
24372
24391
  subject: this.toAstProperty(bitType, ConfigKey.property_subject, data.subject, options),
24373
24392
  date: this.toAstProperty(bitType, ConfigKey.property_date, data.date, options),
@@ -24944,6 +24963,12 @@ var Builder = class extends BaseBuilder {
24944
24963
  data.allowPrint,
24945
24964
  options
24946
24965
  ),
24966
+ allowPrintEnforceSpaceConfiguration: this.toAstProperty(
24967
+ bitType,
24968
+ ConfigKey.property_allowPrintEnforceSpaceConfiguration,
24969
+ data.allowPrintEnforceSpaceConfiguration,
24970
+ options
24971
+ ),
24947
24972
  printParentChapterLevel: this.toAstProperty(
24948
24973
  bitType,
24949
24974
  ConfigKey.property_printParentChapterLevel,
@@ -30591,7 +30616,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30591
30616
  if (bitJson.isTracked == null) bitJson.isTracked = true;
30592
30617
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
30593
30618
  }
30594
- if (instance2.isOfBitType(bitType, BitType.table)) {
30619
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
30595
30620
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
30596
30621
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
30597
30622
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -30606,6 +30631,11 @@ var JsonGenerator = class extends AstWalkerGenerator {
30606
30631
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
30607
30632
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
30608
30633
  }
30634
+ if (instance2.isOfBitType(bitType, BitType.tableImage)) {
30635
+ if (this.tableIsEmpty(bitJson.table)) {
30636
+ delete bitJson.table;
30637
+ }
30638
+ }
30609
30639
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
30610
30640
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
30611
30641
  if (bitJson.refBookTitle == null) bitJson.refBookTitle = "";
@@ -30746,6 +30776,19 @@ var JsonGenerator = class extends AstWalkerGenerator {
30746
30776
  }
30747
30777
  return bitJson;
30748
30778
  }
30779
+ tableIsEmpty(table) {
30780
+ if (!table) return true;
30781
+ if (Object.keys(table).length === 0) return true;
30782
+ const tableStandard = table;
30783
+ if (tableStandard.columns?.length === 0 && tableStandard.data?.length) {
30784
+ return true;
30785
+ }
30786
+ const tableExtended = table;
30787
+ if (tableExtended.header?.rows.length === 0 && tableExtended.body?.rows.length === 0 && tableExtended.footer?.rows.length === 0) {
30788
+ return true;
30789
+ }
30790
+ return false;
30791
+ }
30749
30792
  /**
30750
30793
  * Convert any bitmark texts to strings.
30751
30794
  */