@gmb/bitmark-parser-generator 5.18.0 → 5.20.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/cli/main.js CHANGED
@@ -267,6 +267,7 @@ var BitType = {
267
267
  extractorPageWithBlocks: "extractor-page-with-blocks",
268
268
  extractorPageWithBlocksCollapsible: "extractor-page-with-blocks-collapsible",
269
269
  extractorRepeatedText: "extractor-repeated-text",
270
+ extractorRule: "extractor-rule",
270
271
  extractorTheme: "extractor-theme",
271
272
  featured: "featured",
272
273
  feedback: "feedback",
@@ -759,8 +760,6 @@ var AbstractTagConfig = class {
759
760
  chain;
760
761
  jsonKey;
761
762
  // If the json key is different from the tag
762
- secondaryJsonKey;
763
- // Heading card alternate path
764
763
  deprecated;
765
764
  // Deprecated version
766
765
  constructor(params) {
@@ -771,7 +770,6 @@ var AbstractTagConfig = class {
771
770
  this.minCount = params.minCount;
772
771
  this.chain = params.chain;
773
772
  this.jsonKey = params.jsonKey;
774
- this.secondaryJsonKey = params.secondaryJsonKey;
775
773
  this.deprecated = params.deprecated;
776
774
  }
777
775
  };
@@ -934,10 +932,12 @@ ${tag.toString(opts)}`;
934
932
  var CardSideConfig = class {
935
933
  name;
936
934
  repeat;
935
+ jsonKey;
937
936
  variants;
938
- constructor(name, repeat, variants) {
937
+ constructor(name, repeat, variants, jsonKey) {
939
938
  this.name = name;
940
939
  this.repeat = repeat;
940
+ this.jsonKey = jsonKey;
941
941
  this.variants = variants;
942
942
  }
943
943
  toString(options) {
@@ -961,7 +961,6 @@ var CardSideConfig = class {
961
961
  var CardSetConfig = class {
962
962
  configKey;
963
963
  jsonKey;
964
- itemType;
965
964
  sections;
966
965
  sides;
967
966
  // Legacy accessor — provides the same shape as the old `variants: CardVariantConfig[][]`
@@ -969,10 +968,9 @@ var CardSetConfig = class {
969
968
  get variants() {
970
969
  return this.sides.map((side) => side.variants);
971
970
  }
972
- constructor(configKey, jsonKey, itemType, sections, sides) {
971
+ constructor(configKey, jsonKey, sections, sides) {
973
972
  this.configKey = configKey;
974
973
  this.jsonKey = jsonKey;
975
- this.itemType = itemType;
976
974
  this.sections = sections;
977
975
  this.sides = sides;
978
976
  }
@@ -982,8 +980,6 @@ var CardSetConfig = class {
982
980
  s += `[CardSet: ${this.configKey}]`;
983
981
  s += `
984
982
  jsonKey: ${this.jsonKey}`;
985
- s += `
986
- itemType: ${this.itemType}`;
987
983
  for (const side of this.sides) {
988
984
  s += `
989
985
  ${side.toString(opts)}`;
@@ -1105,6 +1101,7 @@ ${this.cardSet.toString(opts)}`;
1105
1101
  };
1106
1102
  var groupKeys = {
1107
1103
  group_standardAllBits: "group_standardAllBits",
1104
+ group_standardItemLead: "group_standardItemLead",
1108
1105
  group_standardItemLeadInstructionHint: "group_standardItemLeadInstructionHint",
1109
1106
  group_standardTags: "group_standardTags",
1110
1107
  group_imageSource: "group_imageSource",
@@ -1185,6 +1182,7 @@ var propertyKeys = {
1185
1182
  property_bot: "@bot",
1186
1183
  property_bubbleTag: "@bubbleTag",
1187
1184
  property_extractorTag: "@extractorTag",
1185
+ property_extractorInternal: "@extractorInternal",
1188
1186
  property_buttonCaption: "@buttonCaption",
1189
1187
  property_callToActionUrl: "@callToActionUrl",
1190
1188
  property_caption: "@caption",
@@ -1399,6 +1397,7 @@ var propertyKeys = {
1399
1397
  property_subject: "@subject",
1400
1398
  property_subtype: "@subtype",
1401
1399
  property_tableAutoWidth: "@tableAutoWidth",
1400
+ property_tableColWidth: "@tableColWidth",
1402
1401
  property_tableColumnMinWidth: "@tableColumnMinWidth",
1403
1402
  property_tableFixedHeader: "@tableFixedHeader",
1404
1403
  property_tableHeaderWhitespaceNoWrap: "@tableHeaderWhitespaceNoWrap",
@@ -2215,7 +2214,7 @@ var CARDSETS = {
2215
2214
  {
2216
2215
  key: ConfigKey.tag_title,
2217
2216
  description: "Title of the definition.",
2218
- secondaryJsonKey: "heading.forKeys"
2217
+ jsonKey: "^heading.forKeys"
2219
2218
  },
2220
2219
  {
2221
2220
  key: ConfigKey.group_resourceIcon,
@@ -2239,7 +2238,7 @@ var CARDSETS = {
2239
2238
  {
2240
2239
  key: ConfigKey.tag_title,
2241
2240
  description: "Title of the definition.",
2242
- secondaryJsonKey: "heading.forValues"
2241
+ jsonKey: "^heading.forValues"
2243
2242
  },
2244
2243
  {
2245
2244
  key: ConfigKey.group_resourceIcon,
@@ -2289,7 +2288,7 @@ var CARDSETS = {
2289
2288
  {
2290
2289
  key: ConfigKey.tag_title,
2291
2290
  description: "Title of the match pair.",
2292
- secondaryJsonKey: "heading.forKeys"
2291
+ jsonKey: "^heading.forKeys"
2293
2292
  },
2294
2293
  {
2295
2294
  key: ConfigKey.property_isCaseSensitive,
@@ -2324,7 +2323,7 @@ var CARDSETS = {
2324
2323
  {
2325
2324
  key: ConfigKey.tag_title,
2326
2325
  description: "Title of the match pair.",
2327
- secondaryJsonKey: "heading.forValues"
2326
+ jsonKey: "^heading.forValues"
2328
2327
  },
2329
2328
  {
2330
2329
  key: ConfigKey.property_isCaseSensitive,
@@ -2357,7 +2356,7 @@ var CARDSETS = {
2357
2356
  {
2358
2357
  key: ConfigKey.tag_title,
2359
2358
  description: "Title of the audio match pair.",
2360
- secondaryJsonKey: "heading.forKeys"
2359
+ jsonKey: "^heading.forKeys"
2361
2360
  },
2362
2361
  {
2363
2362
  key: ConfigKey.resource_audio,
@@ -2382,7 +2381,7 @@ var CARDSETS = {
2382
2381
  {
2383
2382
  key: ConfigKey.tag_title,
2384
2383
  description: "Title of the audio match pair.",
2385
- secondaryJsonKey: "heading.forValues"
2384
+ jsonKey: "^heading.forValues"
2386
2385
  },
2387
2386
  {
2388
2387
  key: ConfigKey.resource_audio,
@@ -2414,7 +2413,7 @@ var CARDSETS = {
2414
2413
  {
2415
2414
  key: ConfigKey.tag_title,
2416
2415
  description: "Title of the image match pair.",
2417
- secondaryJsonKey: "heading.forKeys"
2416
+ jsonKey: "^heading.forKeys"
2418
2417
  },
2419
2418
  {
2420
2419
  key: ConfigKey.resource_image,
@@ -2439,7 +2438,7 @@ var CARDSETS = {
2439
2438
  {
2440
2439
  key: ConfigKey.tag_title,
2441
2440
  description: "Title of the image match pair.",
2442
- secondaryJsonKey: "heading.forValues"
2441
+ jsonKey: "^heading.forValues"
2443
2442
  },
2444
2443
  {
2445
2444
  key: ConfigKey.resource_image,
@@ -2476,7 +2475,7 @@ var CARDSETS = {
2476
2475
  {
2477
2476
  key: ConfigKey.tag_title,
2478
2477
  description: "Title of the match matrix.",
2479
- secondaryJsonKey: "heading.forKeys"
2478
+ jsonKey: "^heading.forKeys"
2480
2479
  },
2481
2480
  {
2482
2481
  key: ConfigKey.property_isCaseSensitive,
@@ -2506,7 +2505,7 @@ var CARDSETS = {
2506
2505
  {
2507
2506
  key: ConfigKey.tag_title,
2508
2507
  description: "Title of the match matrix.",
2509
- secondaryJsonKey: "heading.forValues"
2508
+ jsonKey: "^heading.forValues"
2510
2509
  },
2511
2510
  {
2512
2511
  key: ConfigKey.property_isCaseSensitive,
@@ -2535,11 +2534,13 @@ var CARDSETS = {
2535
2534
  {
2536
2535
  key: ConfigKey.tag_true,
2537
2536
  description: "Tag for true statements.",
2537
+ jsonKey: "statement|set(isCorrect=true)",
2538
2538
  maxCount: 1
2539
2539
  },
2540
2540
  {
2541
2541
  key: ConfigKey.tag_false,
2542
2542
  description: "Tag for false statements.",
2543
+ jsonKey: "statement|set(isCorrect=false)",
2543
2544
  maxCount: 1
2544
2545
  },
2545
2546
  {
@@ -2603,7 +2604,7 @@ var CARDSETS = {
2603
2604
  {
2604
2605
  key: ConfigKey.tag_title,
2605
2606
  description: "Title of the feedback.",
2606
- secondaryJsonKey: "heading.forKeys"
2607
+ jsonKey: "^heading.forKeys"
2607
2608
  }
2608
2609
  ],
2609
2610
  bodyAllowed: false
@@ -2633,7 +2634,7 @@ var CARDSETS = {
2633
2634
  {
2634
2635
  key: ConfigKey.tag_title,
2635
2636
  description: "Title of the feedback.",
2636
- secondaryJsonKey: "heading.forValues"
2637
+ jsonKey: "^heading.forValues"
2637
2638
  }
2638
2639
  ],
2639
2640
  bodyAllowed: true
@@ -2723,7 +2724,6 @@ var CARDSETS = {
2723
2724
  //
2724
2725
  [CardSetConfigKey.table]: {
2725
2726
  jsonKey: "table.data",
2726
- itemType: "array",
2727
2727
  sides: [
2728
2728
  {
2729
2729
  name: "cell",
@@ -2738,8 +2738,8 @@ var CARDSETS = {
2738
2738
  },
2739
2739
  {
2740
2740
  key: ConfigKey.tag_title,
2741
- description: "Title of the table.",
2742
- secondaryJsonKey: "table.columns[]"
2741
+ jsonKey: "^table.columns[]",
2742
+ description: "Title of the table."
2743
2743
  },
2744
2744
  {
2745
2745
  key: ConfigKey.property_tableCellType,
@@ -2760,6 +2760,11 @@ var CARDSETS = {
2760
2760
  key: ConfigKey.property_tableScope,
2761
2761
  description: "Scope attribute for header cells.",
2762
2762
  format: TagFormat.plainText
2763
+ },
2764
+ {
2765
+ key: ConfigKey.property_tableColWidth,
2766
+ description: "Width for the column.",
2767
+ format: TagFormat.number
2763
2768
  }
2764
2769
  ],
2765
2770
  repeatCount: Count.infinity
@@ -2774,14 +2779,15 @@ var CARDSETS = {
2774
2779
  [CardSetConfigKey.tableExtended]: {
2775
2780
  jsonKey: null,
2776
2781
  sections: {
2777
- default: { jsonKey: "tableExtended.body.rows" },
2778
- "table-header": { jsonKey: "tableExtended.header.rows" },
2779
- "table-footer": { jsonKey: "tableExtended.footer.rows" }
2782
+ "table-header": { jsonKey: "table.header.rows", sideJsonKey: "cells[{s}]|set(title=true)" },
2783
+ "table-body": { jsonKey: "table.body.rows", isDefault: true },
2784
+ "table-footer": { jsonKey: "table.footer.rows", sideJsonKey: "cells[{s}]|set(title=true)" }
2780
2785
  },
2781
2786
  sides: [
2782
2787
  {
2783
2788
  name: "cell",
2784
2789
  repeat: true,
2790
+ jsonKey: "cells[{s}]",
2785
2791
  variants: [
2786
2792
  {
2787
2793
  jsonKey: "content",
@@ -2792,27 +2798,37 @@ var CARDSETS = {
2792
2798
  },
2793
2799
  {
2794
2800
  key: ConfigKey.tag_title,
2801
+ jsonKey: ".",
2795
2802
  description: "Title of the table cell."
2796
2803
  },
2797
2804
  {
2798
2805
  key: ConfigKey.property_tableCellType,
2806
+ jsonKey: "title|bool(th)",
2799
2807
  description: "Table cell type (th/td).",
2800
2808
  format: TagFormat.plainText
2801
2809
  },
2802
2810
  {
2803
2811
  key: ConfigKey.property_tableRowSpan,
2812
+ jsonKey: "rowspan",
2804
2813
  description: "Number of rows the cell spans.",
2805
2814
  format: TagFormat.number
2806
2815
  },
2807
2816
  {
2808
2817
  key: ConfigKey.property_tableColSpan,
2818
+ jsonKey: "colspan",
2809
2819
  description: "Number of columns the cell spans.",
2810
2820
  format: TagFormat.number
2811
2821
  },
2812
2822
  {
2813
2823
  key: ConfigKey.property_tableScope,
2824
+ jsonKey: "scope",
2814
2825
  description: "Scope attribute for header cells.",
2815
2826
  format: TagFormat.plainText
2827
+ },
2828
+ {
2829
+ key: ConfigKey.property_tableColWidth,
2830
+ description: "Width for the column.",
2831
+ format: TagFormat.number
2816
2832
  }
2817
2833
  ],
2818
2834
  repeatCount: Count.infinity
@@ -2826,7 +2842,6 @@ var CARDSETS = {
2826
2842
  //
2827
2843
  [CardSetConfigKey.pronunciationTable]: {
2828
2844
  jsonKey: "pronunciationTable.data",
2829
- itemType: "array",
2830
2845
  sides: [
2831
2846
  {
2832
2847
  name: "cell",
@@ -2873,15 +2888,8 @@ var CARDSETS = {
2873
2888
  format: TagFormat.plainText
2874
2889
  },
2875
2890
  {
2876
- key: ConfigKey.tag_item,
2877
- description: "The item for the bot action response.",
2878
- chain: [
2879
- {
2880
- key: ConfigKey.tag_item,
2881
- description: "The lead, page number, source page number, and margin number.",
2882
- maxCount: 4
2883
- }
2884
- ]
2891
+ key: ConfigKey.group_standardItemLead,
2892
+ description: "Item, lead, page number, and margin number for the bot action response."
2885
2893
  },
2886
2894
  {
2887
2895
  key: ConfigKey.tag_instruction,
@@ -2968,19 +2976,20 @@ var CARDSETS = {
2968
2976
  description: "Title of the ingredient."
2969
2977
  },
2970
2978
  {
2971
- key: ConfigKey.group_trueFalse,
2972
- description: "Group for true/false properties of the ingredient."
2979
+ key: ConfigKey.tag_true,
2980
+ description: "Checked state for the ingredient.",
2981
+ jsonKey: "ingredient|set(checked=true)",
2982
+ maxCount: 1
2973
2983
  },
2974
2984
  {
2975
- key: ConfigKey.tag_item,
2976
- description: "The item for the ingredient.",
2977
- chain: [
2978
- {
2979
- key: ConfigKey.tag_item,
2980
- description: "Lead, page number, source page number, and margin number.",
2981
- maxCount: 4
2982
- }
2983
- ]
2985
+ key: ConfigKey.tag_false,
2986
+ description: "Unchecked state for the ingredient.",
2987
+ jsonKey: "ingredient|set(checked=false)",
2988
+ maxCount: 1
2989
+ },
2990
+ {
2991
+ key: ConfigKey.group_standardItemLead,
2992
+ description: "Item, lead, page number, and margin number for the ingredient."
2984
2993
  },
2985
2994
  {
2986
2995
  key: ConfigKey.tag_instruction,
@@ -3119,8 +3128,7 @@ var GROUPS = {
3119
3128
  {
3120
3129
  key: ConfigKey.property_validationDate,
3121
3130
  description: "The date when the bit was validated",
3122
- format: TagFormat.plainText,
3123
- defaultValue: ""
3131
+ format: TagFormat.plainText
3124
3132
  },
3125
3133
  {
3126
3134
  key: ConfigKey.property_aiGenerated,
@@ -3265,6 +3273,7 @@ var GROUPS = {
3265
3273
  },
3266
3274
  {
3267
3275
  key: ConfigKey.property_groupTag,
3276
+ jsonKey: "groupTag.name",
3268
3277
  description: "The group tag(s) for the bit",
3269
3278
  format: TagFormat.plainText,
3270
3279
  maxCount: Count.infinity,
@@ -3295,6 +3304,12 @@ var GROUPS = {
3295
3304
  format: TagFormat.plainText,
3296
3305
  maxCount: Count.infinity
3297
3306
  },
3307
+ {
3308
+ key: ConfigKey.property_extractorInternal,
3309
+ description: "Internal metadata used by the extractor for processing purposes",
3310
+ format: TagFormat.plainText,
3311
+ maxCount: Count.infinity
3312
+ },
3298
3313
  {
3299
3314
  key: ConfigKey.property_levelCEFRp,
3300
3315
  description: "The CEFRp level for the bit",
@@ -3361,20 +3376,48 @@ var GROUPS = {
3361
3376
  }
3362
3377
  ]
3363
3378
  },
3364
- [ConfigKey.group_standardItemLeadInstructionHint]: {
3379
+ [ConfigKey.group_standardItemLead]: {
3365
3380
  type: GroupConfigType.standard,
3366
- description: "Standard group for item, lead, page number, source page number, margin number, instruction and hint tags",
3381
+ description: "Standard group for item, lead, page number, and margin number tags",
3367
3382
  tags: [
3368
3383
  {
3369
3384
  key: ConfigKey.tag_item,
3385
+ jsonKey: "item",
3370
3386
  description: "The item for the bit",
3371
3387
  chain: [
3372
3388
  {
3373
3389
  key: ConfigKey.tag_item,
3374
- description: "The lead, page number, source page number, and margin number for the bit",
3375
- maxCount: 4
3390
+ jsonKey: "lead",
3391
+ description: "The lead for the bit",
3392
+ maxCount: 1,
3393
+ chain: [
3394
+ {
3395
+ key: ConfigKey.tag_item,
3396
+ jsonKey: "pageNumber",
3397
+ description: "The page number for the bit",
3398
+ maxCount: 1,
3399
+ chain: [
3400
+ {
3401
+ key: ConfigKey.tag_item,
3402
+ jsonKey: "marginNumber",
3403
+ description: "The margin number for the bit",
3404
+ maxCount: 1
3405
+ }
3406
+ ]
3407
+ }
3408
+ ]
3376
3409
  }
3377
3410
  ]
3411
+ }
3412
+ ]
3413
+ },
3414
+ [ConfigKey.group_standardItemLeadInstructionHint]: {
3415
+ type: GroupConfigType.standard,
3416
+ description: "Standard group for item, lead, page number, margin number, instruction and hint tags",
3417
+ tags: [
3418
+ {
3419
+ key: ConfigKey.group_standardItemLead,
3420
+ description: "Item, lead, page number, and margin number tags"
3378
3421
  },
3379
3422
  {
3380
3423
  key: ConfigKey.tag_instruction,
@@ -3413,6 +3456,7 @@ var GROUPS = {
3413
3456
  tags: [
3414
3457
  {
3415
3458
  key: ConfigKey.property_imageSource,
3459
+ jsonKey: "imageSource.url",
3416
3460
  description: "The source of an image",
3417
3461
  format: TagFormat.plainText,
3418
3462
  chain: [
@@ -3446,6 +3490,7 @@ var GROUPS = {
3446
3490
  tags: [
3447
3491
  {
3448
3492
  key: ConfigKey.property_technicalTerm,
3493
+ jsonKey: "technicalTerm.technicalTerm",
3449
3494
  description: "The technical term",
3450
3495
  format: TagFormat.plainText,
3451
3496
  chain: [
@@ -3464,6 +3509,7 @@ var GROUPS = {
3464
3509
  tags: [
3465
3510
  {
3466
3511
  key: ConfigKey.property_person,
3512
+ jsonKey: "person.name",
3467
3513
  description: "A person",
3468
3514
  format: TagFormat.plainText,
3469
3515
  chain: [
@@ -3481,6 +3527,7 @@ var GROUPS = {
3481
3527
  {
3482
3528
  // Deprecated (parter renamed to person)
3483
3529
  key: ConfigKey.property_partner,
3530
+ jsonKey: "partner.name",
3484
3531
  description: "A partner",
3485
3532
  format: TagFormat.plainText,
3486
3533
  chain: [
@@ -3508,6 +3555,7 @@ var GROUPS = {
3508
3555
  chain: [
3509
3556
  {
3510
3557
  key: ConfigKey.tag_gap,
3558
+ jsonKey: "solutions[]",
3511
3559
  description: "Alternative values for the gaps in the content",
3512
3560
  maxCount: Count.infinity
3513
3561
  },
@@ -3517,13 +3565,16 @@ var GROUPS = {
3517
3565
  },
3518
3566
  {
3519
3567
  key: ConfigKey.property_example,
3568
+ jsonKey: "example",
3520
3569
  description: "An example for the gap",
3521
3570
  format: TagFormat.plainText
3522
3571
  },
3523
3572
  {
3524
3573
  key: ConfigKey.property_isCaseSensitive,
3574
+ jsonKey: "isCaseSensitive",
3525
3575
  description: "If true, the gap text is case sensitive",
3526
- format: TagFormat.boolean
3576
+ format: TagFormat.boolean,
3577
+ defaultValue: "true"
3527
3578
  }
3528
3579
  ]
3529
3580
  }
@@ -3540,11 +3591,13 @@ var GROUPS = {
3540
3591
  chain: [
3541
3592
  {
3542
3593
  key: ConfigKey.tag_true,
3594
+ jsonKey: "choices[]|set(isCorrect=true)",
3543
3595
  description: "True values for a true/false statement/question",
3544
3596
  maxCount: Count.infinity
3545
3597
  },
3546
3598
  {
3547
3599
  key: ConfigKey.tag_false,
3600
+ jsonKey: "choices[]|set(isCorrect=false)",
3548
3601
  description: "False values for a true/false statement/question",
3549
3602
  maxCount: Count.infinity
3550
3603
  },
@@ -3554,6 +3607,7 @@ var GROUPS = {
3554
3607
  },
3555
3608
  {
3556
3609
  key: ConfigKey.property_example,
3610
+ jsonKey: "example",
3557
3611
  description: "An example for the true/false statement/question",
3558
3612
  format: TagFormat.plainText
3559
3613
  }
@@ -3566,11 +3620,13 @@ var GROUPS = {
3566
3620
  chain: [
3567
3621
  {
3568
3622
  key: ConfigKey.tag_true,
3623
+ jsonKey: "choices[]|set(isCorrect=true)",
3569
3624
  description: "True values for a true/false statement/question",
3570
3625
  maxCount: Count.infinity
3571
3626
  },
3572
3627
  {
3573
3628
  key: ConfigKey.tag_false,
3629
+ jsonKey: "choices[]|set(isCorrect=false)",
3574
3630
  description: "False values for a true/false statement/question",
3575
3631
  maxCount: Count.infinity
3576
3632
  },
@@ -3580,6 +3636,7 @@ var GROUPS = {
3580
3636
  },
3581
3637
  {
3582
3638
  key: ConfigKey.property_example,
3639
+ jsonKey: "example",
3583
3640
  description: "An example for the true/false statement/question",
3584
3641
  format: TagFormat.plainText
3585
3642
  }
@@ -3593,6 +3650,7 @@ var GROUPS = {
3593
3650
  tags: [
3594
3651
  {
3595
3652
  key: ConfigKey.property_mark,
3653
+ jsonKey: "marks.mark",
3596
3654
  description: "The mark configuration",
3597
3655
  format: TagFormat.plainText,
3598
3656
  maxCount: Count.infinity,
@@ -3622,11 +3680,13 @@ var GROUPS = {
3622
3680
  chain: [
3623
3681
  {
3624
3682
  key: ConfigKey.property_mark,
3683
+ jsonKey: "mark",
3625
3684
  description: "The mark configuration",
3626
3685
  format: TagFormat.plainText
3627
3686
  },
3628
3687
  {
3629
3688
  key: ConfigKey.property_example,
3689
+ jsonKey: "example",
3630
3690
  description: "An example for the marked content",
3631
3691
  format: TagFormat.plainText
3632
3692
  }
@@ -3797,7 +3857,8 @@ var GROUPS = {
3797
3857
  {
3798
3858
  key: ConfigKey.property_maxTocChapterLevel,
3799
3859
  description: "The maximum table of contents chapter level",
3800
- format: TagFormat.number
3860
+ format: TagFormat.number,
3861
+ defaultValue: "-1"
3801
3862
  },
3802
3863
  {
3803
3864
  key: ConfigKey.property_sourceDocument,
@@ -3879,12 +3940,14 @@ var GROUPS = {
3879
3940
  {
3880
3941
  key: ConfigKey.property_isTracked,
3881
3942
  description: "If true, the learning path is tracked",
3882
- format: TagFormat.boolean
3943
+ format: TagFormat.boolean,
3944
+ defaultValue: "true"
3883
3945
  },
3884
3946
  {
3885
3947
  key: ConfigKey.property_isInfoOnly,
3886
3948
  description: "If true, the learning path is info only",
3887
- format: TagFormat.boolean
3949
+ format: TagFormat.boolean,
3950
+ defaultValue: "false"
3888
3951
  },
3889
3952
  {
3890
3953
  key: ConfigKey.property_deeplink,
@@ -4228,6 +4291,7 @@ var GROUPS = {
4228
4291
  },
4229
4292
  {
4230
4293
  key: ConfigKey.property_posterImage,
4294
+ jsonKey: "posterImage.src",
4231
4295
  description: "The poster image for the video",
4232
4296
  format: TagFormat.plainText,
4233
4297
  chain: [
@@ -4753,27 +4817,24 @@ var ConfigHydrator = class {
4753
4817
  const v = this.hydrateCardVariantConfig(_variant);
4754
4818
  variantsOfSide.push(v);
4755
4819
  }
4756
- const sideConfig = new CardSideConfig(_side.name, _side.repeat ?? false, variantsOfSide);
4820
+ const sideConfig = new CardSideConfig(
4821
+ _side.name,
4822
+ _side.repeat ?? false,
4823
+ variantsOfSide,
4824
+ _side.jsonKey
4825
+ );
4757
4826
  sides.push(sideConfig);
4758
4827
  }
4759
4828
  const cardSetConfig = new CardSetConfig(
4760
4829
  _cardSet,
4761
4830
  _cardSetConfig.jsonKey,
4762
- _cardSetConfig.itemType ?? "object",
4763
4831
  _cardSetConfig.sections,
4764
4832
  sides
4765
4833
  );
4766
4834
  return cardSetConfig;
4767
4835
  }
4768
4836
  hydrateTagConfig(_tag) {
4769
- const {
4770
- key: _configKey,
4771
- maxCount,
4772
- minCount,
4773
- chain: _chain,
4774
- secondaryJsonKey,
4775
- deprecated
4776
- } = _tag;
4837
+ const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
4777
4838
  const configKey = Enum(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4778
4839
  if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
4779
4840
  const tag = Enum(Tag).fromValue(configKey);
@@ -4788,7 +4849,6 @@ var ConfigHydrator = class {
4788
4849
  maxCount: maxCount ?? MAX_COUNT_DEFAULT,
4789
4850
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4790
4851
  chain,
4791
- secondaryJsonKey,
4792
4852
  deprecated
4793
4853
  });
4794
4854
  return {
@@ -4807,8 +4867,7 @@ var ConfigHydrator = class {
4807
4867
  format,
4808
4868
  values,
4809
4869
  defaultValue,
4810
- jsonKey,
4811
- secondaryJsonKey
4870
+ jsonKey
4812
4871
  } = _tag;
4813
4872
  const configKey = Enum(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4814
4873
  if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
@@ -4824,7 +4883,6 @@ var ConfigHydrator = class {
4824
4883
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4825
4884
  chain,
4826
4885
  jsonKey,
4827
- secondaryJsonKey,
4828
4886
  format,
4829
4887
  values,
4830
4888
  defaultValue,
@@ -4837,15 +4895,7 @@ var ConfigHydrator = class {
4837
4895
  };
4838
4896
  }
4839
4897
  hydrateResourceTagConfig(_tag) {
4840
- const {
4841
- key: _configKey,
4842
- maxCount,
4843
- minCount,
4844
- chain: _chain,
4845
- deprecated,
4846
- jsonKey,
4847
- secondaryJsonKey
4848
- } = _tag;
4898
+ const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
4849
4899
  const configKey = Enum(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4850
4900
  if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
4851
4901
  const tag = _configKey.substring(1);
@@ -4860,7 +4910,6 @@ var ConfigHydrator = class {
4860
4910
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4861
4911
  chain,
4862
4912
  jsonKey,
4863
- secondaryJsonKey,
4864
4913
  deprecated
4865
4914
  });
4866
4915
  return {
@@ -6161,7 +6210,8 @@ var BITS = {
6161
6210
  {
6162
6211
  key: ConfigKey.property_isCaseSensitive,
6163
6212
  description: "If the cloze answers are case sensitive",
6164
- format: TagFormat.boolean
6213
+ format: TagFormat.boolean,
6214
+ defaultValue: "true"
6165
6215
  },
6166
6216
  {
6167
6217
  key: ConfigKey.property_quizCountItems,
@@ -6607,6 +6657,7 @@ var BITS = {
6607
6657
  },
6608
6658
  {
6609
6659
  key: ConfigKey.property_servings,
6660
+ jsonKey: "servings.servings",
6610
6661
  description: "The number of servings for the ingredients",
6611
6662
  format: TagFormat.number,
6612
6663
  chain: [
@@ -7794,6 +7845,24 @@ var BITS = {
7794
7845
  baseBitType: BitType.article,
7795
7846
  description: "Extractor repeated text bit, used to define repeated text in extractor pages"
7796
7847
  },
7848
+ [BitType.extractorRule]: {
7849
+ since: "5.17.0",
7850
+ baseBitType: BitType._standard,
7851
+ description: "Extractor rule bit, used to define extraction rules with reference images and instructions",
7852
+ tags: [
7853
+ {
7854
+ key: ConfigKey.group_resourceBitTags,
7855
+ description: "Resource bit tags for extraction rule images"
7856
+ },
7857
+ {
7858
+ key: ConfigKey.group_resourceImage,
7859
+ description: "Resource image tags for the rule reference image",
7860
+ minCount: 1
7861
+ }
7862
+ ],
7863
+ resourceAttachmentAllowed: false,
7864
+ textFormatDefault: TextFormat.plainText
7865
+ },
7797
7866
  [BitType.extractorPageNumber]: {
7798
7867
  since: "1.5.21",
7799
7868
  baseBitType: BitType.article,
@@ -8844,7 +8913,8 @@ var BITS = {
8844
8913
  {
8845
8914
  key: ConfigKey.property_isCaseSensitive,
8846
8915
  description: "Case sensitivity for matching pairs, used to define if matches are case-sensitive",
8847
- format: TagFormat.boolean
8916
+ format: TagFormat.boolean,
8917
+ defaultValue: "true"
8848
8918
  }
8849
8919
  ],
8850
8920
  cardSet: CardSetConfigKey.matchPairs
@@ -9294,7 +9364,8 @@ var BITS = {
9294
9364
  {
9295
9365
  key: ConfigKey.property_platformBrandTarget,
9296
9366
  description: 'The platform brand target (typically "light", "dark" or "none")',
9297
- format: TagFormat.plainText
9367
+ format: TagFormat.plainText,
9368
+ defaultValue: "none"
9298
9369
  }
9299
9370
  ]
9300
9371
  },
@@ -9317,7 +9388,8 @@ var BITS = {
9317
9388
  {
9318
9389
  key: ConfigKey.property_platformLogoMaxHeight,
9319
9390
  description: "Maximum height for the platform logo",
9320
- format: TagFormat.number
9391
+ format: TagFormat.number,
9392
+ defaultValue: "40"
9321
9393
  },
9322
9394
  {
9323
9395
  key: ConfigKey.group_platformStylesCommon,
@@ -9490,7 +9562,8 @@ var BITS = {
9490
9562
  {
9491
9563
  key: ConfigKey.property_resolved,
9492
9564
  description: "Resolved status for the review note, used to indicate if the note is resolved",
9493
- format: TagFormat.boolean
9565
+ format: TagFormat.boolean,
9566
+ defaultValue: "false"
9494
9567
  },
9495
9568
  {
9496
9569
  key: ConfigKey.property_resolvedDate,
@@ -9677,6 +9750,7 @@ var BITS = {
9677
9750
  tags: [
9678
9751
  {
9679
9752
  key: ConfigKey.property_ratingLevelStart,
9753
+ jsonKey: "ratingLevelStart.level",
9680
9754
  description: "Start level for the rating survey, used to define the lowest rating",
9681
9755
  format: TagFormat.number,
9682
9756
  chain: [
@@ -9689,6 +9763,7 @@ var BITS = {
9689
9763
  },
9690
9764
  {
9691
9765
  key: ConfigKey.property_ratingLevelEnd,
9766
+ jsonKey: "ratingLevelEnd.level",
9692
9767
  description: "End level for the rating survey, used to define the highest rating",
9693
9768
  format: TagFormat.number,
9694
9769
  chain: [
@@ -9757,28 +9832,32 @@ var BITS = {
9757
9832
  {
9758
9833
  key: ConfigKey.property_tableFixedHeader,
9759
9834
  description: "Fixed header for the table, used to keep the header visible while scrolling",
9760
- format: TagFormat.boolean
9835
+ format: TagFormat.boolean,
9836
+ defaultValue: "false"
9761
9837
  },
9762
9838
  {
9763
9839
  key: ConfigKey.property_tableHeaderWhitespaceNoWrap,
9764
9840
  description: "No wrap for table header whitespace, used to prevent header text wrapping",
9765
- format: TagFormat.boolean
9766
- // defaultValue: 'false',
9841
+ format: TagFormat.boolean,
9842
+ defaultValue: "false"
9767
9843
  },
9768
9844
  {
9769
9845
  key: ConfigKey.property_tableSearch,
9770
9846
  description: "Search functionality for the table, used to enable searching within the table",
9771
- format: TagFormat.boolean
9847
+ format: TagFormat.boolean,
9848
+ defaultValue: "false"
9772
9849
  },
9773
9850
  {
9774
9851
  key: ConfigKey.property_tableSort,
9775
9852
  description: "Sorting functionality for the table, used to enable sorting of table columns",
9776
- format: TagFormat.boolean
9853
+ format: TagFormat.boolean,
9854
+ defaultValue: "false"
9777
9855
  },
9778
9856
  {
9779
9857
  key: ConfigKey.property_tablePagination,
9780
9858
  description: "Pagination for the table, used to limit the number of rows displayed at once",
9781
- format: TagFormat.boolean
9859
+ format: TagFormat.boolean,
9860
+ defaultValue: "false"
9782
9861
  },
9783
9862
  {
9784
9863
  key: ConfigKey.property_tablePaginationLimit,
@@ -9795,24 +9874,26 @@ var BITS = {
9795
9874
  {
9796
9875
  key: ConfigKey.property_tableWhitespaceNoWrap,
9797
9876
  description: "No wrap for table whitespace, used to prevent text wrapping in table cells",
9798
- format: TagFormat.boolean
9799
- // defaultValue: 'false',
9877
+ format: TagFormat.boolean,
9878
+ defaultValue: "false"
9800
9879
  },
9801
9880
  {
9802
9881
  key: ConfigKey.property_tableAutoWidth,
9803
9882
  description: "Auto width for table columns, used to automatically adjust column widths",
9804
- format: TagFormat.boolean
9805
- // defaultValue: 'true',
9883
+ format: TagFormat.boolean,
9884
+ defaultValue: "true"
9806
9885
  },
9807
9886
  {
9808
9887
  key: ConfigKey.property_tableResizableColumns,
9809
9888
  description: "Resizable columns for the table, used to allow users to resize table columns",
9810
- format: TagFormat.boolean
9889
+ format: TagFormat.boolean,
9890
+ defaultValue: "false"
9811
9891
  },
9812
9892
  {
9813
9893
  key: ConfigKey.property_tableColumnMinWidth,
9814
9894
  description: "Minimum width for table columns, used to define the minimum width of columns",
9815
- format: TagFormat.number
9895
+ format: TagFormat.number,
9896
+ defaultValue: "0"
9816
9897
  }
9817
9898
  ],
9818
9899
  cardSet: CardSetConfigKey.table
@@ -9820,7 +9901,8 @@ var BITS = {
9820
9901
  [BitType.tableExtended]: {
9821
9902
  since: "4.14.0",
9822
9903
  baseBitType: BitType.table,
9823
- description: "Extended table bit, used to create complex tables with all HTML table features"
9904
+ description: "Extended table bit, used to create complex tables with all HTML table features",
9905
+ cardSet: CardSetConfigKey.tableExtended
9824
9906
  },
9825
9907
  [BitType.tableExtendedImage]: {
9826
9908
  since: "5.13.0",
@@ -10786,7 +10868,6 @@ var Config = class {
10786
10868
  maxCount: 1,
10787
10869
  chain: tag.chain,
10788
10870
  jsonKey: tag.jsonKey,
10789
- secondaryJsonKey: tag.secondaryJsonKey,
10790
10871
  deprecated: tag.deprecated
10791
10872
  });
10792
10873
  finalResourceTags[k] = newTag;
@@ -10891,7 +10972,7 @@ var instance2 = new Config();
10891
10972
  // src/generated/package_info.ts
10892
10973
  var PACKAGE_INFO = {
10893
10974
  "name": "@gmb/bitmark-parser-generator",
10894
- "version": "5.18.0",
10975
+ "version": "5.20.0",
10895
10976
  "license": "ISC"};
10896
10977
  var Environment = {
10897
10978
  unknown: "",
@@ -11420,6 +11501,8 @@ var NodeType = {
11420
11501
  extractorExtractionTimestampValue: "extractorExtractionTimestampValue",
11421
11502
  extractorTag: "extractorTag",
11422
11503
  extractorTagValue: "extractorTagValue",
11504
+ extractorInternal: "extractorInternal",
11505
+ extractorInternalValue: "extractorInternalValue",
11423
11506
  extraProperties: "extraProperties",
11424
11507
  feedback: "feedback",
11425
11508
  feedbackEngine: "feedbackEngine",
@@ -11825,6 +11908,8 @@ var NodeType = {
11825
11908
  table: "table",
11826
11909
  tableAutoWidth: "tableAutoWidth",
11827
11910
  tableAutoWidthValue: "tableAutoWidthValue",
11911
+ tableColWidth: "tableColWidth",
11912
+ tableColWidthValue: "tableColWidthValue",
11828
11913
  tableColumnMinWidth: "tableColumnMinWidth",
11829
11914
  tableColumnMinWidthValue: "tableColumnMinWidthValue",
11830
11915
  tableFixedHeader: "tableFixedHeader",
@@ -24633,6 +24718,12 @@ var Builder = class extends BaseBuilder {
24633
24718
  data.extractorTag,
24634
24719
  options
24635
24720
  ),
24721
+ extractorInternal: this.toAstProperty(
24722
+ bitType,
24723
+ ConfigKey.property_extractorInternal,
24724
+ data.extractorInternal,
24725
+ options
24726
+ ),
24636
24727
  levelCEFRp: this.toAstProperty(
24637
24728
  bitType,
24638
24729
  ConfigKey.property_levelCEFRp,
@@ -26120,6 +26211,7 @@ var Builder = class extends BaseBuilder {
26120
26211
  if (cell.rowspan != null) tableCell.rowspan = cell.rowspan;
26121
26212
  if (cell.colspan != null) tableCell.colspan = cell.colspan;
26122
26213
  if (cell.scope) tableCell.scope = cell.scope;
26214
+ if (cell.colwidth != null) tableCell.colwidth = cell.colwidth;
26123
26215
  return tableCell;
26124
26216
  });
26125
26217
  return {
@@ -28399,6 +28491,10 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28399
28491
  this.writeTableCellProperty("tableScope", cell.scope);
28400
28492
  this.writeNL();
28401
28493
  }
28494
+ if (cell.colwidth && cell.colwidth > 0) {
28495
+ this.writeTableCellProperty("tableColWidth", cell.colwidth);
28496
+ this.writeNL();
28497
+ }
28402
28498
  const content = cell.content ?? instance3.EMPTY_STRING;
28403
28499
  this.writeTextOrValue(content, this.textFormat, TextLocation.body);
28404
28500
  }
@@ -30952,7 +31048,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
30952
31048
  if (bitJson.isTracked == null) bitJson.isTracked = true;
30953
31049
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
30954
31050
  }
30955
- if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
31051
+ const tableImageHasTable = instance2.isOfBitType(bitType, BitType.tableImage) && !this.tableIsEmpty(bitJson.table);
31052
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage) || tableImageHasTable) {
30956
31053
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
30957
31054
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
30958
31055
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -30967,10 +31064,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
30967
31064
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
30968
31065
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
30969
31066
  }
30970
- if (instance2.isOfBitType(bitType, BitType.tableImage)) {
30971
- if (this.tableIsEmpty(bitJson.table)) {
30972
- delete bitJson.table;
30973
- }
31067
+ if (instance2.isOfBitType(bitType, BitType.tableImage) && !tableImageHasTable) {
31068
+ delete bitJson.table;
30974
31069
  }
30975
31070
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
30976
31071
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
@@ -33714,11 +33809,19 @@ function parseTable(context, _bitType, cardSet) {
33714
33809
  const rowSpanRaw = tags2.tableRowSpan ?? readExtraProperty(tags2.extraProperties, "tableRowSpan");
33715
33810
  const colSpanRaw = tags2.tableColSpan ?? readExtraProperty(tags2.extraProperties, "tableColSpan");
33716
33811
  const scopeRaw = tags2.tableScope ?? readExtraProperty(tags2.extraProperties, "tableScope");
33717
- cleanupExtraProperties(tags2, ["tableCellType", "tableRowSpan", "tableColSpan", "tableScope"]);
33812
+ const colWidthRaw = tags2.tableColWidth ?? readExtraProperty(tags2.extraProperties, "tableColWidth");
33813
+ cleanupExtraProperties(tags2, [
33814
+ "tableCellType",
33815
+ "tableRowSpan",
33816
+ "tableColSpan",
33817
+ "tableScope",
33818
+ "tableColWidth"
33819
+ ]);
33718
33820
  const cellType = normalizeCellType(cellTypeRaw, section);
33719
33821
  const rowspan = normalizeSpan(rowSpanRaw, "rowspan");
33720
33822
  const colspan = normalizeSpan(colSpanRaw, "colspan");
33721
33823
  const scope = normalizeScope(scopeRaw);
33824
+ const colwidth = instance6.asNumber(colWidthRaw) ?? 0;
33722
33825
  const cell = {
33723
33826
  content
33724
33827
  };
@@ -33726,6 +33829,7 @@ function parseTable(context, _bitType, cardSet) {
33726
33829
  if (rowspan > 1) cell.rowspan = rowspan;
33727
33830
  if (colspan > 1) cell.colspan = colspan;
33728
33831
  if (scope) cell.scope = scope;
33832
+ if (colwidth > 0) cell.colwidth = colwidth;
33729
33833
  return cell;
33730
33834
  };
33731
33835
  const resolveSectionQualifier = (card) => {
@@ -34105,6 +34209,15 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
34105
34209
  }
34106
34210
 
34107
34211
  // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
34212
+ function flattenChainContent(content) {
34213
+ const result = [content];
34214
+ if (content.chain) {
34215
+ for (const child of content.chain) {
34216
+ result.push(...flattenChainContent(child));
34217
+ }
34218
+ }
34219
+ return result;
34220
+ }
34108
34221
  function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
34109
34222
  if (contentDepth === ContentDepth.Chain) {
34110
34223
  itemLeadTagContentProcessor(context, contentDepth, tagsConfig, content, target);
@@ -34115,7 +34228,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
34115
34228
  function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
34116
34229
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
34117
34230
  const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Enum(Tag).fromValue(content.type));
34118
- const chainContent = [content, ...content.chain ?? []];
34231
+ const chainContent = flattenChainContent(content);
34119
34232
  const chainTags = context.bitContentProcessor(
34120
34233
  ContentDepth.Chain,
34121
34234
  itemLeadConfig?.chain,
@@ -34658,7 +34771,6 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
34658
34771
  minCount: 1,
34659
34772
  chain: void 0,
34660
34773
  jsonKey: void 0,
34661
- secondaryJsonKey: void 0,
34662
34774
  format: TagFormat.bitmarkText,
34663
34775
  values: void 0,
34664
34776
  defaultValue: void 0,
@@ -39592,7 +39704,6 @@ var normalizeCardKey = (cardSetKey) => stringUtils.camelToKebab(cardSetKey);
39592
39704
  var ConfigBuilder = class {
39593
39705
  build(options) {
39594
39706
  const opts = Object.assign({}, options);
39595
- this.buildFlat(opts);
39596
39707
  const bitConfigs = [];
39597
39708
  const groupConfigs = [];
39598
39709
  const bitGroupConfigKeys = /* @__PURE__ */ new Set();
@@ -39663,7 +39774,7 @@ var ConfigBuilder = class {
39663
39774
  const keyToJsonKey = (key, tagNameChain) => {
39664
39775
  let jsonKey = key;
39665
39776
  if (key === "%") {
39666
- jsonKey = "item_todo";
39777
+ jsonKey = "item";
39667
39778
  } else if (key === "!") {
39668
39779
  jsonKey = "instruction";
39669
39780
  } else if (key === "?") {
@@ -39679,13 +39790,13 @@ var ConfigBuilder = class {
39679
39790
  } else if (key === "$") {
39680
39791
  jsonKey = "sampleSolution";
39681
39792
  } else if (key === "+") {
39682
- jsonKey = "true_todo";
39793
+ jsonKey = "choices[]|set(isCorrect=true)";
39683
39794
  } else if (key === "-") {
39684
- jsonKey = "false_todo";
39795
+ jsonKey = "choices[]|set(isCorrect=false)";
39685
39796
  } else if (key === "_") {
39686
- jsonKey = "gap_todo";
39797
+ jsonKey = "solutions[]";
39687
39798
  } else if (key === "=") {
39688
- jsonKey = "mark_todo";
39799
+ jsonKey = "solution";
39689
39800
  } else if (key.startsWith("@")) {
39690
39801
  jsonKey = key.substring(1);
39691
39802
  } else if (key.startsWith("&")) {
@@ -39736,7 +39847,7 @@ var ConfigBuilder = class {
39736
39847
  if (Array.isArray(tag.chain) && tag.chain.length > 0) {
39737
39848
  const chainTags = [];
39738
39849
  for (const [_tagKey, chainTag] of tag.chain.entries()) {
39739
- chainTags.push(...processTagEntries(chainTag, [...tagNameChain, jsonKey]));
39850
+ chainTags.push(...processTagEntries(chainTag, []));
39740
39851
  }
39741
39852
  chain = chainTags;
39742
39853
  }
@@ -39744,10 +39855,8 @@ var ConfigBuilder = class {
39744
39855
  type: "tag",
39745
39856
  key: tagName,
39746
39857
  jsonKey,
39747
- ...tag.secondaryJsonKey ? { secondaryJsonKey: tag.secondaryJsonKey } : {},
39748
39858
  format,
39749
- default: null,
39750
- alwaysInclude: false,
39859
+ default: tag.defaultValue ?? null,
39751
39860
  min: tag.minCount == null ? 0 : tag.minCount,
39752
39861
  max: tag.maxCount == null ? 1 : tag.maxCount,
39753
39862
  description: tag.description ?? "",
@@ -39781,22 +39890,51 @@ var ConfigBuilder = class {
39781
39890
  ...variant.jsonKey !== void 0 ? { jsonKey: variant.jsonKey } : {},
39782
39891
  tags: variantTags,
39783
39892
  repeatCount: variant.repeatCount ?? 1,
39784
- bodyAllowed: variant.bodyAllowed ?? true,
39785
- bodyRequired: variant.bodyRequired ?? false
39893
+ ...variant.bodyRequired ? { bodyRequired: true } : {},
39894
+ ...variant.bodyAllowed === false ? { bodyForbidden: true } : {}
39786
39895
  };
39787
39896
  });
39788
39897
  return {
39789
39898
  name: side.name,
39790
39899
  ...side.repeat ? { repeat: side.repeat } : {},
39900
+ ...side.jsonKey != null ? { jsonKey: side.jsonKey } : {},
39791
39901
  variants
39792
39902
  };
39793
39903
  });
39904
+ if (cardSetConfig.sections) {
39905
+ const cards = Object.entries(cardSetConfig.sections).map(([sectionName, section]) => {
39906
+ let cardSides = section.sideJsonKey ? sides.map((s) => ({ ...s, jsonKey: section.sideJsonKey })) : sides;
39907
+ if (normalizedKey === "table-extended" && sectionName !== "table-header") {
39908
+ cardSides = JSON.parse(JSON.stringify(cardSides));
39909
+ for (const side of cardSides) {
39910
+ for (const variant of side.variants) {
39911
+ for (const tag of variant.tags) {
39912
+ if (tag.type === "tag" && tag.key === "#" && tag.jsonKey === ".") {
39913
+ tag.jsonKey = "^table.header.rows.cells[{s}].content";
39914
+ }
39915
+ }
39916
+ }
39917
+ }
39918
+ }
39919
+ return {
39920
+ name: sectionName,
39921
+ ...section.isDefault ? { isDefault: true } : {},
39922
+ jsonKey: section.jsonKey,
39923
+ sides: cardSides
39924
+ };
39925
+ });
39926
+ return { name: normalizedKey, cards };
39927
+ }
39794
39928
  return {
39795
- key: normalizedKey,
39796
- jsonKey: cardSetConfig.jsonKey,
39797
- ...cardSetConfig.itemType && cardSetConfig.itemType !== "object" ? { itemType: cardSetConfig.itemType } : {},
39798
- ...cardSetConfig.sections ? { sections: cardSetConfig.sections } : {},
39799
- sides
39929
+ name: normalizedKey,
39930
+ cards: [
39931
+ {
39932
+ name: "default",
39933
+ isDefault: true,
39934
+ jsonKey: cardSetConfig.jsonKey,
39935
+ sides
39936
+ }
39937
+ ]
39800
39938
  };
39801
39939
  };
39802
39940
  for (const bt of bitGroupConfigKeys) {
@@ -39863,8 +40001,13 @@ var ConfigBuilder = class {
39863
40001
  }
39864
40002
  }
39865
40003
  let cardRef;
39866
- if (b.cardSet && CARDSETS[b.cardSet]) {
39867
- cardRef = normalizeCardKey(b.cardSet);
40004
+ let current = b;
40005
+ while (current) {
40006
+ if (current.cardSet && CARDSETS[current.cardSet]) {
40007
+ cardRef = normalizeCardKey(current.cardSet);
40008
+ break;
40009
+ }
40010
+ current = current.baseBitType ? BITS[current.baseBitType] : void 0;
39868
40011
  }
39869
40012
  const bitJson = {
39870
40013
  name: b.bitType,
@@ -39878,10 +40021,10 @@ var ConfigBuilder = class {
39878
40021
  }
39879
40022
  ],
39880
40023
  format: resolvedBitConfig.textFormatDefault ?? "bitmark--",
39881
- bodyAllowed: resolvedBitConfig.bodyAllowed ?? true,
39882
40024
  bodyRequired: resolvedBitConfig.bodyRequired ?? false,
39883
- footerAllowed: resolvedBitConfig.footerAllowed ?? true,
40025
+ bodyForbidden: !(resolvedBitConfig.bodyAllowed ?? true),
39884
40026
  footerRequired: resolvedBitConfig.footerRequired ?? false,
40027
+ footerForbidden: !(resolvedBitConfig.footerAllowed ?? true),
39885
40028
  resourceAttachmentAllowed: resolvedBitConfig.resourceAttachmentAllowed ?? true,
39886
40029
  tags: tags2,
39887
40030
  ...cardRef ? { card: cardRef } : {}
@@ -39955,7 +40098,7 @@ var ConfigBuilder = class {
39955
40098
  for (const cardSetKey of Object.keys(CARDSETS)) {
39956
40099
  const cardJson = serializeCardSet(cardSetKey);
39957
40100
  if (!cardJson) continue;
39958
- const output = path3.join(outputFolderCards, `${cardJson.key}.jsonc`);
40101
+ const output = path3.join(outputFolderCards, `${cardJson.name}.jsonc`);
39959
40102
  const str = JSON.stringify(cardJson, null, 2);
39960
40103
  fileWrites.push(fs3.writeFile(output, str));
39961
40104
  }
@@ -40122,22 +40265,26 @@ var ConfigBuilder = class {
40122
40265
  if (config.key && config.key !== expectedKey) {
40123
40266
  errors.push(`Card key mismatch in cards/${file}: expected '${expectedKey}'`);
40124
40267
  }
40125
- if (Array.isArray(config.sides)) {
40126
- config.sides.forEach((side, sideIdx) => {
40127
- const variants = side.variants;
40128
- if (Array.isArray(variants)) {
40129
- variants.forEach((variant, variantIdx) => {
40130
- const variantTags = variant.tags;
40131
- if (Array.isArray(variantTags)) {
40132
- checkTags(
40133
- variantTags,
40134
- `cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
40135
- 10
40136
- );
40268
+ if (Array.isArray(config.cards)) {
40269
+ for (const cardNode of config.cards) {
40270
+ if (cardNode && Array.isArray(cardNode.sides)) {
40271
+ cardNode.sides.forEach((side, sideIdx) => {
40272
+ const variants = side.variants;
40273
+ if (Array.isArray(variants)) {
40274
+ variants.forEach((variant, variantIdx) => {
40275
+ const variantTags = variant.tags;
40276
+ if (Array.isArray(variantTags)) {
40277
+ checkTags(
40278
+ variantTags,
40279
+ `cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
40280
+ 10
40281
+ );
40282
+ }
40283
+ });
40137
40284
  }
40138
40285
  });
40139
40286
  }
40140
- });
40287
+ }
40141
40288
  }
40142
40289
  } catch (err) {
40143
40290
  errors.push(`Failed to parse cards/${file}: ${err}`);
@@ -40146,128 +40293,6 @@ var ConfigBuilder = class {
40146
40293
  }
40147
40294
  return errors;
40148
40295
  }
40149
- // Build flat bit configs
40150
- buildFlat(options) {
40151
- const opts = Object.assign({}, options);
40152
- const bitConfigs = [];
40153
- for (const bt of Enum(BitType).values()) {
40154
- const bitType = instance2.getBitType(bt);
40155
- const bitConfig = instance2.getBitConfig(bitType);
40156
- if (bitConfig) bitConfigs.push(bitConfig);
40157
- }
40158
- const outputFolder = opts.outputDir ?? "assets/config";
40159
- const outputFolderBits = path3.join(outputFolder, "bits_flat");
40160
- fs3.ensureDirSync(outputFolderBits);
40161
- const existingFiles = fs3.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
40162
- for (const file of existingFiles) {
40163
- fs3.removeSync(path3.join(outputFolderBits, file));
40164
- }
40165
- const processTagEntries = (tag) => {
40166
- const tags2 = [];
40167
- let tagName = tag.key;
40168
- const tagType = typeFromConfigKey(tag.key);
40169
- let format = "";
40170
- let chain = void 0;
40171
- if (tagType === BitTagConfigKeyType.tag) {
40172
- tagName = tag.name;
40173
- format = "bitmark--";
40174
- } else if (tagType === BitTagConfigKeyType.property) {
40175
- tagName = tag.key;
40176
- if (tag.format === TagFormat.plainText) {
40177
- format = "string";
40178
- } else if (tag.format === TagFormat.boolean) {
40179
- format = "bool";
40180
- } else if (tag.format === TagFormat.bitmarkText) {
40181
- format = "bitmark";
40182
- } else if (tag.format === TagFormat.number) {
40183
- format = "number";
40184
- }
40185
- } else if (tagType === BitTagConfigKeyType.resource) {
40186
- format = "string";
40187
- } else if (tagType === BitTagConfigKeyType.group) {
40188
- let k = tag.key;
40189
- if (k.startsWith("group_")) k = k.substring(6);
40190
- k = /*'_' +*/
40191
- stringUtils.camelToKebab(k);
40192
- tags2.push({
40193
- type: "group",
40194
- key: k
40195
- });
40196
- return tags2;
40197
- }
40198
- if (Array.isArray(tag.chain) && tag.chain.length > 0) {
40199
- const chainTags = [];
40200
- for (const [_tagKey, chainTag] of tag.chain.entries()) {
40201
- chainTags.push(...processTagEntries(chainTag));
40202
- }
40203
- chain = chainTags;
40204
- }
40205
- const t = {
40206
- key: tagName,
40207
- format,
40208
- default: null,
40209
- alwaysInclude: false,
40210
- min: tag.minCount == null ? 0 : tag.minCount,
40211
- max: tag.maxCount == null ? 1 : tag.maxCount,
40212
- description: tag.description ?? "",
40213
- chain
40214
- // raw: {
40215
- // ...tag,
40216
- // },
40217
- };
40218
- tags2.push(t);
40219
- return tags2;
40220
- };
40221
- for (const b of bitConfigs) {
40222
- const tags2 = [];
40223
- const tagEntriesTypeOrder = [
40224
- BitTagConfigKeyType.tag,
40225
- BitTagConfigKeyType.property,
40226
- BitTagConfigKeyType.resource,
40227
- BitTagConfigKeyType.group,
40228
- BitTagConfigKeyType.unknown
40229
- ];
40230
- const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
40231
- const tagA = a[1];
40232
- const tagB = b2[1];
40233
- const typeA = typeFromConfigKey(tagA.configKey);
40234
- const typeB = typeFromConfigKey(tagB.configKey);
40235
- const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
40236
- return typeOrder;
40237
- });
40238
- for (const [_tagKey, tag] of tagEntries) {
40239
- tags2.push(...processTagEntries(tag));
40240
- }
40241
- let cardRef;
40242
- const cardSetKey = b.cardSet?.configKey;
40243
- if (cardSetKey && CARDSETS[cardSetKey]) {
40244
- cardRef = normalizeCardKey(cardSetKey);
40245
- }
40246
- const bitJson = {
40247
- name: b.bitType,
40248
- description: "",
40249
- since: b.since,
40250
- deprecated: b.deprecated,
40251
- history: [
40252
- {
40253
- version: b.since,
40254
- changes: ["Initial version"]
40255
- }
40256
- ],
40257
- format: b.textFormatDefault ?? "bitmark--",
40258
- bodyAllowed: b.bodyAllowed ?? true,
40259
- bodyRequired: b.bodyRequired ?? false,
40260
- footerAllowed: b.footerAllowed ?? true,
40261
- footerRequired: b.footerRequired ?? false,
40262
- resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
40263
- tags: tags2,
40264
- ...cardRef ? { card: cardRef } : {}
40265
- };
40266
- const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
40267
- const str = JSON.stringify(bitJson, null, 2);
40268
- fs3.writeFileSync(output, str);
40269
- }
40270
- }
40271
40296
  };
40272
40297
 
40273
40298
  // src/BitmarkParserGenerator.ts