@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/index.cjs CHANGED
@@ -329,6 +329,7 @@ var BitType = {
329
329
  extractorPageWithBlocks: "extractor-page-with-blocks",
330
330
  extractorPageWithBlocksCollapsible: "extractor-page-with-blocks-collapsible",
331
331
  extractorRepeatedText: "extractor-repeated-text",
332
+ extractorRule: "extractor-rule",
332
333
  extractorTheme: "extractor-theme",
333
334
  featured: "featured",
334
335
  feedback: "feedback",
@@ -849,8 +850,6 @@ var AbstractTagConfig = class {
849
850
  __publicField(this, "chain");
850
851
  __publicField(this, "jsonKey");
851
852
  // If the json key is different from the tag
852
- __publicField(this, "secondaryJsonKey");
853
- // Heading card alternate path
854
853
  __publicField(this, "deprecated");
855
854
  this.type = params.type;
856
855
  this.configKey = params.configKey;
@@ -859,7 +858,6 @@ var AbstractTagConfig = class {
859
858
  this.minCount = params.minCount;
860
859
  this.chain = params.chain;
861
860
  this.jsonKey = params.jsonKey;
862
- this.secondaryJsonKey = params.secondaryJsonKey;
863
861
  this.deprecated = params.deprecated;
864
862
  }
865
863
  };
@@ -1020,12 +1018,14 @@ ${tag.toString(opts)}`;
1020
1018
 
1021
1019
  // src/model/config/CardSideConfig.ts
1022
1020
  var CardSideConfig = class {
1023
- constructor(name, repeat, variants) {
1021
+ constructor(name, repeat, variants, jsonKey) {
1024
1022
  __publicField(this, "name");
1025
1023
  __publicField(this, "repeat");
1024
+ __publicField(this, "jsonKey");
1026
1025
  __publicField(this, "variants");
1027
1026
  this.name = name;
1028
1027
  this.repeat = repeat;
1028
+ this.jsonKey = jsonKey;
1029
1029
  this.variants = variants;
1030
1030
  }
1031
1031
  toString(options) {
@@ -1047,15 +1047,13 @@ var CardSideConfig = class {
1047
1047
 
1048
1048
  // src/model/config/CardSetConfig.ts
1049
1049
  var CardSetConfig = class {
1050
- constructor(configKey, jsonKey, itemType, sections, sides) {
1050
+ constructor(configKey, jsonKey, sections, sides) {
1051
1051
  __publicField(this, "configKey");
1052
1052
  __publicField(this, "jsonKey");
1053
- __publicField(this, "itemType");
1054
1053
  __publicField(this, "sections");
1055
1054
  __publicField(this, "sides");
1056
1055
  this.configKey = configKey;
1057
1056
  this.jsonKey = jsonKey;
1058
- this.itemType = itemType;
1059
1057
  this.sections = sections;
1060
1058
  this.sides = sides;
1061
1059
  }
@@ -1070,8 +1068,6 @@ var CardSetConfig = class {
1070
1068
  s += `[CardSet: ${this.configKey}]`;
1071
1069
  s += `
1072
1070
  jsonKey: ${this.jsonKey}`;
1073
- s += `
1074
- itemType: ${this.itemType}`;
1075
1071
  for (const side of this.sides) {
1076
1072
  s += `
1077
1073
  ${side.toString(opts)}`;
@@ -1199,6 +1195,7 @@ var import_superenum14 = require("@ncoderz/superenum");
1199
1195
  var import_superenum10 = require("@ncoderz/superenum");
1200
1196
  var groupKeys = {
1201
1197
  group_standardAllBits: "group_standardAllBits",
1198
+ group_standardItemLead: "group_standardItemLead",
1202
1199
  group_standardItemLeadInstructionHint: "group_standardItemLeadInstructionHint",
1203
1200
  group_standardTags: "group_standardTags",
1204
1201
  group_imageSource: "group_imageSource",
@@ -1282,6 +1279,7 @@ var propertyKeys = {
1282
1279
  property_bot: "@bot",
1283
1280
  property_bubbleTag: "@bubbleTag",
1284
1281
  property_extractorTag: "@extractorTag",
1282
+ property_extractorInternal: "@extractorInternal",
1285
1283
  property_buttonCaption: "@buttonCaption",
1286
1284
  property_callToActionUrl: "@callToActionUrl",
1287
1285
  property_caption: "@caption",
@@ -1496,6 +1494,7 @@ var propertyKeys = {
1496
1494
  property_subject: "@subject",
1497
1495
  property_subtype: "@subtype",
1498
1496
  property_tableAutoWidth: "@tableAutoWidth",
1497
+ property_tableColWidth: "@tableColWidth",
1499
1498
  property_tableColumnMinWidth: "@tableColumnMinWidth",
1500
1499
  property_tableFixedHeader: "@tableFixedHeader",
1501
1500
  property_tableHeaderWhitespaceNoWrap: "@tableHeaderWhitespaceNoWrap",
@@ -2321,7 +2320,7 @@ var CARDSETS = {
2321
2320
  {
2322
2321
  key: ConfigKey.tag_title,
2323
2322
  description: "Title of the definition.",
2324
- secondaryJsonKey: "heading.forKeys"
2323
+ jsonKey: "^heading.forKeys"
2325
2324
  },
2326
2325
  {
2327
2326
  key: ConfigKey.group_resourceIcon,
@@ -2345,7 +2344,7 @@ var CARDSETS = {
2345
2344
  {
2346
2345
  key: ConfigKey.tag_title,
2347
2346
  description: "Title of the definition.",
2348
- secondaryJsonKey: "heading.forValues"
2347
+ jsonKey: "^heading.forValues"
2349
2348
  },
2350
2349
  {
2351
2350
  key: ConfigKey.group_resourceIcon,
@@ -2395,7 +2394,7 @@ var CARDSETS = {
2395
2394
  {
2396
2395
  key: ConfigKey.tag_title,
2397
2396
  description: "Title of the match pair.",
2398
- secondaryJsonKey: "heading.forKeys"
2397
+ jsonKey: "^heading.forKeys"
2399
2398
  },
2400
2399
  {
2401
2400
  key: ConfigKey.property_isCaseSensitive,
@@ -2430,7 +2429,7 @@ var CARDSETS = {
2430
2429
  {
2431
2430
  key: ConfigKey.tag_title,
2432
2431
  description: "Title of the match pair.",
2433
- secondaryJsonKey: "heading.forValues"
2432
+ jsonKey: "^heading.forValues"
2434
2433
  },
2435
2434
  {
2436
2435
  key: ConfigKey.property_isCaseSensitive,
@@ -2463,7 +2462,7 @@ var CARDSETS = {
2463
2462
  {
2464
2463
  key: ConfigKey.tag_title,
2465
2464
  description: "Title of the audio match pair.",
2466
- secondaryJsonKey: "heading.forKeys"
2465
+ jsonKey: "^heading.forKeys"
2467
2466
  },
2468
2467
  {
2469
2468
  key: ConfigKey.resource_audio,
@@ -2488,7 +2487,7 @@ var CARDSETS = {
2488
2487
  {
2489
2488
  key: ConfigKey.tag_title,
2490
2489
  description: "Title of the audio match pair.",
2491
- secondaryJsonKey: "heading.forValues"
2490
+ jsonKey: "^heading.forValues"
2492
2491
  },
2493
2492
  {
2494
2493
  key: ConfigKey.resource_audio,
@@ -2520,7 +2519,7 @@ var CARDSETS = {
2520
2519
  {
2521
2520
  key: ConfigKey.tag_title,
2522
2521
  description: "Title of the image match pair.",
2523
- secondaryJsonKey: "heading.forKeys"
2522
+ jsonKey: "^heading.forKeys"
2524
2523
  },
2525
2524
  {
2526
2525
  key: ConfigKey.resource_image,
@@ -2545,7 +2544,7 @@ var CARDSETS = {
2545
2544
  {
2546
2545
  key: ConfigKey.tag_title,
2547
2546
  description: "Title of the image match pair.",
2548
- secondaryJsonKey: "heading.forValues"
2547
+ jsonKey: "^heading.forValues"
2549
2548
  },
2550
2549
  {
2551
2550
  key: ConfigKey.resource_image,
@@ -2582,7 +2581,7 @@ var CARDSETS = {
2582
2581
  {
2583
2582
  key: ConfigKey.tag_title,
2584
2583
  description: "Title of the match matrix.",
2585
- secondaryJsonKey: "heading.forKeys"
2584
+ jsonKey: "^heading.forKeys"
2586
2585
  },
2587
2586
  {
2588
2587
  key: ConfigKey.property_isCaseSensitive,
@@ -2612,7 +2611,7 @@ var CARDSETS = {
2612
2611
  {
2613
2612
  key: ConfigKey.tag_title,
2614
2613
  description: "Title of the match matrix.",
2615
- secondaryJsonKey: "heading.forValues"
2614
+ jsonKey: "^heading.forValues"
2616
2615
  },
2617
2616
  {
2618
2617
  key: ConfigKey.property_isCaseSensitive,
@@ -2641,11 +2640,13 @@ var CARDSETS = {
2641
2640
  {
2642
2641
  key: ConfigKey.tag_true,
2643
2642
  description: "Tag for true statements.",
2643
+ jsonKey: "statement|set(isCorrect=true)",
2644
2644
  maxCount: 1
2645
2645
  },
2646
2646
  {
2647
2647
  key: ConfigKey.tag_false,
2648
2648
  description: "Tag for false statements.",
2649
+ jsonKey: "statement|set(isCorrect=false)",
2649
2650
  maxCount: 1
2650
2651
  },
2651
2652
  {
@@ -2709,7 +2710,7 @@ var CARDSETS = {
2709
2710
  {
2710
2711
  key: ConfigKey.tag_title,
2711
2712
  description: "Title of the feedback.",
2712
- secondaryJsonKey: "heading.forKeys"
2713
+ jsonKey: "^heading.forKeys"
2713
2714
  }
2714
2715
  ],
2715
2716
  bodyAllowed: false
@@ -2739,7 +2740,7 @@ var CARDSETS = {
2739
2740
  {
2740
2741
  key: ConfigKey.tag_title,
2741
2742
  description: "Title of the feedback.",
2742
- secondaryJsonKey: "heading.forValues"
2743
+ jsonKey: "^heading.forValues"
2743
2744
  }
2744
2745
  ],
2745
2746
  bodyAllowed: true
@@ -2829,7 +2830,6 @@ var CARDSETS = {
2829
2830
  //
2830
2831
  [CardSetConfigKey.table]: {
2831
2832
  jsonKey: "table.data",
2832
- itemType: "array",
2833
2833
  sides: [
2834
2834
  {
2835
2835
  name: "cell",
@@ -2844,8 +2844,8 @@ var CARDSETS = {
2844
2844
  },
2845
2845
  {
2846
2846
  key: ConfigKey.tag_title,
2847
- description: "Title of the table.",
2848
- secondaryJsonKey: "table.columns[]"
2847
+ jsonKey: "^table.columns[]",
2848
+ description: "Title of the table."
2849
2849
  },
2850
2850
  {
2851
2851
  key: ConfigKey.property_tableCellType,
@@ -2866,6 +2866,11 @@ var CARDSETS = {
2866
2866
  key: ConfigKey.property_tableScope,
2867
2867
  description: "Scope attribute for header cells.",
2868
2868
  format: TagFormat.plainText
2869
+ },
2870
+ {
2871
+ key: ConfigKey.property_tableColWidth,
2872
+ description: "Width for the column.",
2873
+ format: TagFormat.number
2869
2874
  }
2870
2875
  ],
2871
2876
  repeatCount: Count.infinity
@@ -2880,14 +2885,15 @@ var CARDSETS = {
2880
2885
  [CardSetConfigKey.tableExtended]: {
2881
2886
  jsonKey: null,
2882
2887
  sections: {
2883
- default: { jsonKey: "tableExtended.body.rows" },
2884
- "table-header": { jsonKey: "tableExtended.header.rows" },
2885
- "table-footer": { jsonKey: "tableExtended.footer.rows" }
2888
+ "table-header": { jsonKey: "table.header.rows", sideJsonKey: "cells[{s}]|set(title=true)" },
2889
+ "table-body": { jsonKey: "table.body.rows", isDefault: true },
2890
+ "table-footer": { jsonKey: "table.footer.rows", sideJsonKey: "cells[{s}]|set(title=true)" }
2886
2891
  },
2887
2892
  sides: [
2888
2893
  {
2889
2894
  name: "cell",
2890
2895
  repeat: true,
2896
+ jsonKey: "cells[{s}]",
2891
2897
  variants: [
2892
2898
  {
2893
2899
  jsonKey: "content",
@@ -2898,27 +2904,37 @@ var CARDSETS = {
2898
2904
  },
2899
2905
  {
2900
2906
  key: ConfigKey.tag_title,
2907
+ jsonKey: ".",
2901
2908
  description: "Title of the table cell."
2902
2909
  },
2903
2910
  {
2904
2911
  key: ConfigKey.property_tableCellType,
2912
+ jsonKey: "title|bool(th)",
2905
2913
  description: "Table cell type (th/td).",
2906
2914
  format: TagFormat.plainText
2907
2915
  },
2908
2916
  {
2909
2917
  key: ConfigKey.property_tableRowSpan,
2918
+ jsonKey: "rowspan",
2910
2919
  description: "Number of rows the cell spans.",
2911
2920
  format: TagFormat.number
2912
2921
  },
2913
2922
  {
2914
2923
  key: ConfigKey.property_tableColSpan,
2924
+ jsonKey: "colspan",
2915
2925
  description: "Number of columns the cell spans.",
2916
2926
  format: TagFormat.number
2917
2927
  },
2918
2928
  {
2919
2929
  key: ConfigKey.property_tableScope,
2930
+ jsonKey: "scope",
2920
2931
  description: "Scope attribute for header cells.",
2921
2932
  format: TagFormat.plainText
2933
+ },
2934
+ {
2935
+ key: ConfigKey.property_tableColWidth,
2936
+ description: "Width for the column.",
2937
+ format: TagFormat.number
2922
2938
  }
2923
2939
  ],
2924
2940
  repeatCount: Count.infinity
@@ -2932,7 +2948,6 @@ var CARDSETS = {
2932
2948
  //
2933
2949
  [CardSetConfigKey.pronunciationTable]: {
2934
2950
  jsonKey: "pronunciationTable.data",
2935
- itemType: "array",
2936
2951
  sides: [
2937
2952
  {
2938
2953
  name: "cell",
@@ -2979,15 +2994,8 @@ var CARDSETS = {
2979
2994
  format: TagFormat.plainText
2980
2995
  },
2981
2996
  {
2982
- key: ConfigKey.tag_item,
2983
- description: "The item for the bot action response.",
2984
- chain: [
2985
- {
2986
- key: ConfigKey.tag_item,
2987
- description: "The lead, page number, source page number, and margin number.",
2988
- maxCount: 4
2989
- }
2990
- ]
2997
+ key: ConfigKey.group_standardItemLead,
2998
+ description: "Item, lead, page number, and margin number for the bot action response."
2991
2999
  },
2992
3000
  {
2993
3001
  key: ConfigKey.tag_instruction,
@@ -3074,19 +3082,20 @@ var CARDSETS = {
3074
3082
  description: "Title of the ingredient."
3075
3083
  },
3076
3084
  {
3077
- key: ConfigKey.group_trueFalse,
3078
- description: "Group for true/false properties of the ingredient."
3085
+ key: ConfigKey.tag_true,
3086
+ description: "Checked state for the ingredient.",
3087
+ jsonKey: "ingredient|set(checked=true)",
3088
+ maxCount: 1
3079
3089
  },
3080
3090
  {
3081
- key: ConfigKey.tag_item,
3082
- description: "The item for the ingredient.",
3083
- chain: [
3084
- {
3085
- key: ConfigKey.tag_item,
3086
- description: "Lead, page number, source page number, and margin number.",
3087
- maxCount: 4
3088
- }
3089
- ]
3091
+ key: ConfigKey.tag_false,
3092
+ description: "Unchecked state for the ingredient.",
3093
+ jsonKey: "ingredient|set(checked=false)",
3094
+ maxCount: 1
3095
+ },
3096
+ {
3097
+ key: ConfigKey.group_standardItemLead,
3098
+ description: "Item, lead, page number, and margin number for the ingredient."
3090
3099
  },
3091
3100
  {
3092
3101
  key: ConfigKey.tag_instruction,
@@ -3225,8 +3234,7 @@ var GROUPS = {
3225
3234
  {
3226
3235
  key: ConfigKey.property_validationDate,
3227
3236
  description: "The date when the bit was validated",
3228
- format: TagFormat.plainText,
3229
- defaultValue: ""
3237
+ format: TagFormat.plainText
3230
3238
  },
3231
3239
  {
3232
3240
  key: ConfigKey.property_aiGenerated,
@@ -3371,6 +3379,7 @@ var GROUPS = {
3371
3379
  },
3372
3380
  {
3373
3381
  key: ConfigKey.property_groupTag,
3382
+ jsonKey: "groupTag.name",
3374
3383
  description: "The group tag(s) for the bit",
3375
3384
  format: TagFormat.plainText,
3376
3385
  maxCount: Count.infinity,
@@ -3401,6 +3410,12 @@ var GROUPS = {
3401
3410
  format: TagFormat.plainText,
3402
3411
  maxCount: Count.infinity
3403
3412
  },
3413
+ {
3414
+ key: ConfigKey.property_extractorInternal,
3415
+ description: "Internal metadata used by the extractor for processing purposes",
3416
+ format: TagFormat.plainText,
3417
+ maxCount: Count.infinity
3418
+ },
3404
3419
  {
3405
3420
  key: ConfigKey.property_levelCEFRp,
3406
3421
  description: "The CEFRp level for the bit",
@@ -3467,20 +3482,48 @@ var GROUPS = {
3467
3482
  }
3468
3483
  ]
3469
3484
  },
3470
- [ConfigKey.group_standardItemLeadInstructionHint]: {
3485
+ [ConfigKey.group_standardItemLead]: {
3471
3486
  type: GroupConfigType.standard,
3472
- description: "Standard group for item, lead, page number, source page number, margin number, instruction and hint tags",
3487
+ description: "Standard group for item, lead, page number, and margin number tags",
3473
3488
  tags: [
3474
3489
  {
3475
3490
  key: ConfigKey.tag_item,
3491
+ jsonKey: "item",
3476
3492
  description: "The item for the bit",
3477
3493
  chain: [
3478
3494
  {
3479
3495
  key: ConfigKey.tag_item,
3480
- description: "The lead, page number, source page number, and margin number for the bit",
3481
- maxCount: 4
3496
+ jsonKey: "lead",
3497
+ description: "The lead for the bit",
3498
+ maxCount: 1,
3499
+ chain: [
3500
+ {
3501
+ key: ConfigKey.tag_item,
3502
+ jsonKey: "pageNumber",
3503
+ description: "The page number for the bit",
3504
+ maxCount: 1,
3505
+ chain: [
3506
+ {
3507
+ key: ConfigKey.tag_item,
3508
+ jsonKey: "marginNumber",
3509
+ description: "The margin number for the bit",
3510
+ maxCount: 1
3511
+ }
3512
+ ]
3513
+ }
3514
+ ]
3482
3515
  }
3483
3516
  ]
3517
+ }
3518
+ ]
3519
+ },
3520
+ [ConfigKey.group_standardItemLeadInstructionHint]: {
3521
+ type: GroupConfigType.standard,
3522
+ description: "Standard group for item, lead, page number, margin number, instruction and hint tags",
3523
+ tags: [
3524
+ {
3525
+ key: ConfigKey.group_standardItemLead,
3526
+ description: "Item, lead, page number, and margin number tags"
3484
3527
  },
3485
3528
  {
3486
3529
  key: ConfigKey.tag_instruction,
@@ -3519,6 +3562,7 @@ var GROUPS = {
3519
3562
  tags: [
3520
3563
  {
3521
3564
  key: ConfigKey.property_imageSource,
3565
+ jsonKey: "imageSource.url",
3522
3566
  description: "The source of an image",
3523
3567
  format: TagFormat.plainText,
3524
3568
  chain: [
@@ -3552,6 +3596,7 @@ var GROUPS = {
3552
3596
  tags: [
3553
3597
  {
3554
3598
  key: ConfigKey.property_technicalTerm,
3599
+ jsonKey: "technicalTerm.technicalTerm",
3555
3600
  description: "The technical term",
3556
3601
  format: TagFormat.plainText,
3557
3602
  chain: [
@@ -3570,6 +3615,7 @@ var GROUPS = {
3570
3615
  tags: [
3571
3616
  {
3572
3617
  key: ConfigKey.property_person,
3618
+ jsonKey: "person.name",
3573
3619
  description: "A person",
3574
3620
  format: TagFormat.plainText,
3575
3621
  chain: [
@@ -3587,6 +3633,7 @@ var GROUPS = {
3587
3633
  {
3588
3634
  // Deprecated (parter renamed to person)
3589
3635
  key: ConfigKey.property_partner,
3636
+ jsonKey: "partner.name",
3590
3637
  description: "A partner",
3591
3638
  format: TagFormat.plainText,
3592
3639
  chain: [
@@ -3614,6 +3661,7 @@ var GROUPS = {
3614
3661
  chain: [
3615
3662
  {
3616
3663
  key: ConfigKey.tag_gap,
3664
+ jsonKey: "solutions[]",
3617
3665
  description: "Alternative values for the gaps in the content",
3618
3666
  maxCount: Count.infinity
3619
3667
  },
@@ -3623,13 +3671,16 @@ var GROUPS = {
3623
3671
  },
3624
3672
  {
3625
3673
  key: ConfigKey.property_example,
3674
+ jsonKey: "example",
3626
3675
  description: "An example for the gap",
3627
3676
  format: TagFormat.plainText
3628
3677
  },
3629
3678
  {
3630
3679
  key: ConfigKey.property_isCaseSensitive,
3680
+ jsonKey: "isCaseSensitive",
3631
3681
  description: "If true, the gap text is case sensitive",
3632
- format: TagFormat.boolean
3682
+ format: TagFormat.boolean,
3683
+ defaultValue: "true"
3633
3684
  }
3634
3685
  ]
3635
3686
  }
@@ -3646,11 +3697,13 @@ var GROUPS = {
3646
3697
  chain: [
3647
3698
  {
3648
3699
  key: ConfigKey.tag_true,
3700
+ jsonKey: "choices[]|set(isCorrect=true)",
3649
3701
  description: "True values for a true/false statement/question",
3650
3702
  maxCount: Count.infinity
3651
3703
  },
3652
3704
  {
3653
3705
  key: ConfigKey.tag_false,
3706
+ jsonKey: "choices[]|set(isCorrect=false)",
3654
3707
  description: "False values for a true/false statement/question",
3655
3708
  maxCount: Count.infinity
3656
3709
  },
@@ -3660,6 +3713,7 @@ var GROUPS = {
3660
3713
  },
3661
3714
  {
3662
3715
  key: ConfigKey.property_example,
3716
+ jsonKey: "example",
3663
3717
  description: "An example for the true/false statement/question",
3664
3718
  format: TagFormat.plainText
3665
3719
  }
@@ -3672,11 +3726,13 @@ var GROUPS = {
3672
3726
  chain: [
3673
3727
  {
3674
3728
  key: ConfigKey.tag_true,
3729
+ jsonKey: "choices[]|set(isCorrect=true)",
3675
3730
  description: "True values for a true/false statement/question",
3676
3731
  maxCount: Count.infinity
3677
3732
  },
3678
3733
  {
3679
3734
  key: ConfigKey.tag_false,
3735
+ jsonKey: "choices[]|set(isCorrect=false)",
3680
3736
  description: "False values for a true/false statement/question",
3681
3737
  maxCount: Count.infinity
3682
3738
  },
@@ -3686,6 +3742,7 @@ var GROUPS = {
3686
3742
  },
3687
3743
  {
3688
3744
  key: ConfigKey.property_example,
3745
+ jsonKey: "example",
3689
3746
  description: "An example for the true/false statement/question",
3690
3747
  format: TagFormat.plainText
3691
3748
  }
@@ -3699,6 +3756,7 @@ var GROUPS = {
3699
3756
  tags: [
3700
3757
  {
3701
3758
  key: ConfigKey.property_mark,
3759
+ jsonKey: "marks.mark",
3702
3760
  description: "The mark configuration",
3703
3761
  format: TagFormat.plainText,
3704
3762
  maxCount: Count.infinity,
@@ -3728,11 +3786,13 @@ var GROUPS = {
3728
3786
  chain: [
3729
3787
  {
3730
3788
  key: ConfigKey.property_mark,
3789
+ jsonKey: "mark",
3731
3790
  description: "The mark configuration",
3732
3791
  format: TagFormat.plainText
3733
3792
  },
3734
3793
  {
3735
3794
  key: ConfigKey.property_example,
3795
+ jsonKey: "example",
3736
3796
  description: "An example for the marked content",
3737
3797
  format: TagFormat.plainText
3738
3798
  }
@@ -3903,7 +3963,8 @@ var GROUPS = {
3903
3963
  {
3904
3964
  key: ConfigKey.property_maxTocChapterLevel,
3905
3965
  description: "The maximum table of contents chapter level",
3906
- format: TagFormat.number
3966
+ format: TagFormat.number,
3967
+ defaultValue: "-1"
3907
3968
  },
3908
3969
  {
3909
3970
  key: ConfigKey.property_sourceDocument,
@@ -3985,12 +4046,14 @@ var GROUPS = {
3985
4046
  {
3986
4047
  key: ConfigKey.property_isTracked,
3987
4048
  description: "If true, the learning path is tracked",
3988
- format: TagFormat.boolean
4049
+ format: TagFormat.boolean,
4050
+ defaultValue: "true"
3989
4051
  },
3990
4052
  {
3991
4053
  key: ConfigKey.property_isInfoOnly,
3992
4054
  description: "If true, the learning path is info only",
3993
- format: TagFormat.boolean
4055
+ format: TagFormat.boolean,
4056
+ defaultValue: "false"
3994
4057
  },
3995
4058
  {
3996
4059
  key: ConfigKey.property_deeplink,
@@ -4334,6 +4397,7 @@ var GROUPS = {
4334
4397
  },
4335
4398
  {
4336
4399
  key: ConfigKey.property_posterImage,
4400
+ jsonKey: "posterImage.src",
4337
4401
  description: "The poster image for the video",
4338
4402
  format: TagFormat.plainText,
4339
4403
  chain: [
@@ -4859,27 +4923,24 @@ var ConfigHydrator = class {
4859
4923
  const v = this.hydrateCardVariantConfig(_variant);
4860
4924
  variantsOfSide.push(v);
4861
4925
  }
4862
- const sideConfig = new CardSideConfig(_side.name, _side.repeat ?? false, variantsOfSide);
4926
+ const sideConfig = new CardSideConfig(
4927
+ _side.name,
4928
+ _side.repeat ?? false,
4929
+ variantsOfSide,
4930
+ _side.jsonKey
4931
+ );
4863
4932
  sides.push(sideConfig);
4864
4933
  }
4865
4934
  const cardSetConfig = new CardSetConfig(
4866
4935
  _cardSet,
4867
4936
  _cardSetConfig.jsonKey,
4868
- _cardSetConfig.itemType ?? "object",
4869
4937
  _cardSetConfig.sections,
4870
4938
  sides
4871
4939
  );
4872
4940
  return cardSetConfig;
4873
4941
  }
4874
4942
  hydrateTagConfig(_tag) {
4875
- const {
4876
- key: _configKey,
4877
- maxCount,
4878
- minCount,
4879
- chain: _chain,
4880
- secondaryJsonKey,
4881
- deprecated
4882
- } = _tag;
4943
+ const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
4883
4944
  const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4884
4945
  if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
4885
4946
  const tag = (0, import_superenum15.Enum)(Tag).fromValue(configKey);
@@ -4894,7 +4955,6 @@ var ConfigHydrator = class {
4894
4955
  maxCount: maxCount ?? MAX_COUNT_DEFAULT,
4895
4956
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4896
4957
  chain,
4897
- secondaryJsonKey,
4898
4958
  deprecated
4899
4959
  });
4900
4960
  return {
@@ -4913,8 +4973,7 @@ var ConfigHydrator = class {
4913
4973
  format,
4914
4974
  values,
4915
4975
  defaultValue,
4916
- jsonKey,
4917
- secondaryJsonKey
4976
+ jsonKey
4918
4977
  } = _tag;
4919
4978
  const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4920
4979
  if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
@@ -4930,7 +4989,6 @@ var ConfigHydrator = class {
4930
4989
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4931
4990
  chain,
4932
4991
  jsonKey,
4933
- secondaryJsonKey,
4934
4992
  format,
4935
4993
  values,
4936
4994
  defaultValue,
@@ -4943,15 +5001,7 @@ var ConfigHydrator = class {
4943
5001
  };
4944
5002
  }
4945
5003
  hydrateResourceTagConfig(_tag) {
4946
- const {
4947
- key: _configKey,
4948
- maxCount,
4949
- minCount,
4950
- chain: _chain,
4951
- deprecated,
4952
- jsonKey,
4953
- secondaryJsonKey
4954
- } = _tag;
5004
+ const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
4955
5005
  const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4956
5006
  if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
4957
5007
  const tag = _configKey.substring(1);
@@ -4966,7 +5016,6 @@ var ConfigHydrator = class {
4966
5016
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4967
5017
  chain,
4968
5018
  jsonKey,
4969
- secondaryJsonKey,
4970
5019
  deprecated
4971
5020
  });
4972
5021
  return {
@@ -6267,7 +6316,8 @@ var BITS = {
6267
6316
  {
6268
6317
  key: ConfigKey.property_isCaseSensitive,
6269
6318
  description: "If the cloze answers are case sensitive",
6270
- format: TagFormat.boolean
6319
+ format: TagFormat.boolean,
6320
+ defaultValue: "true"
6271
6321
  },
6272
6322
  {
6273
6323
  key: ConfigKey.property_quizCountItems,
@@ -6713,6 +6763,7 @@ var BITS = {
6713
6763
  },
6714
6764
  {
6715
6765
  key: ConfigKey.property_servings,
6766
+ jsonKey: "servings.servings",
6716
6767
  description: "The number of servings for the ingredients",
6717
6768
  format: TagFormat.number,
6718
6769
  chain: [
@@ -7900,6 +7951,24 @@ var BITS = {
7900
7951
  baseBitType: BitType.article,
7901
7952
  description: "Extractor repeated text bit, used to define repeated text in extractor pages"
7902
7953
  },
7954
+ [BitType.extractorRule]: {
7955
+ since: "5.17.0",
7956
+ baseBitType: BitType._standard,
7957
+ description: "Extractor rule bit, used to define extraction rules with reference images and instructions",
7958
+ tags: [
7959
+ {
7960
+ key: ConfigKey.group_resourceBitTags,
7961
+ description: "Resource bit tags for extraction rule images"
7962
+ },
7963
+ {
7964
+ key: ConfigKey.group_resourceImage,
7965
+ description: "Resource image tags for the rule reference image",
7966
+ minCount: 1
7967
+ }
7968
+ ],
7969
+ resourceAttachmentAllowed: false,
7970
+ textFormatDefault: TextFormat.plainText
7971
+ },
7903
7972
  [BitType.extractorPageNumber]: {
7904
7973
  since: "1.5.21",
7905
7974
  baseBitType: BitType.article,
@@ -8950,7 +9019,8 @@ var BITS = {
8950
9019
  {
8951
9020
  key: ConfigKey.property_isCaseSensitive,
8952
9021
  description: "Case sensitivity for matching pairs, used to define if matches are case-sensitive",
8953
- format: TagFormat.boolean
9022
+ format: TagFormat.boolean,
9023
+ defaultValue: "true"
8954
9024
  }
8955
9025
  ],
8956
9026
  cardSet: CardSetConfigKey.matchPairs
@@ -9400,7 +9470,8 @@ var BITS = {
9400
9470
  {
9401
9471
  key: ConfigKey.property_platformBrandTarget,
9402
9472
  description: 'The platform brand target (typically "light", "dark" or "none")',
9403
- format: TagFormat.plainText
9473
+ format: TagFormat.plainText,
9474
+ defaultValue: "none"
9404
9475
  }
9405
9476
  ]
9406
9477
  },
@@ -9423,7 +9494,8 @@ var BITS = {
9423
9494
  {
9424
9495
  key: ConfigKey.property_platformLogoMaxHeight,
9425
9496
  description: "Maximum height for the platform logo",
9426
- format: TagFormat.number
9497
+ format: TagFormat.number,
9498
+ defaultValue: "40"
9427
9499
  },
9428
9500
  {
9429
9501
  key: ConfigKey.group_platformStylesCommon,
@@ -9596,7 +9668,8 @@ var BITS = {
9596
9668
  {
9597
9669
  key: ConfigKey.property_resolved,
9598
9670
  description: "Resolved status for the review note, used to indicate if the note is resolved",
9599
- format: TagFormat.boolean
9671
+ format: TagFormat.boolean,
9672
+ defaultValue: "false"
9600
9673
  },
9601
9674
  {
9602
9675
  key: ConfigKey.property_resolvedDate,
@@ -9783,6 +9856,7 @@ var BITS = {
9783
9856
  tags: [
9784
9857
  {
9785
9858
  key: ConfigKey.property_ratingLevelStart,
9859
+ jsonKey: "ratingLevelStart.level",
9786
9860
  description: "Start level for the rating survey, used to define the lowest rating",
9787
9861
  format: TagFormat.number,
9788
9862
  chain: [
@@ -9795,6 +9869,7 @@ var BITS = {
9795
9869
  },
9796
9870
  {
9797
9871
  key: ConfigKey.property_ratingLevelEnd,
9872
+ jsonKey: "ratingLevelEnd.level",
9798
9873
  description: "End level for the rating survey, used to define the highest rating",
9799
9874
  format: TagFormat.number,
9800
9875
  chain: [
@@ -9863,28 +9938,32 @@ var BITS = {
9863
9938
  {
9864
9939
  key: ConfigKey.property_tableFixedHeader,
9865
9940
  description: "Fixed header for the table, used to keep the header visible while scrolling",
9866
- format: TagFormat.boolean
9941
+ format: TagFormat.boolean,
9942
+ defaultValue: "false"
9867
9943
  },
9868
9944
  {
9869
9945
  key: ConfigKey.property_tableHeaderWhitespaceNoWrap,
9870
9946
  description: "No wrap for table header whitespace, used to prevent header text wrapping",
9871
- format: TagFormat.boolean
9872
- // defaultValue: 'false',
9947
+ format: TagFormat.boolean,
9948
+ defaultValue: "false"
9873
9949
  },
9874
9950
  {
9875
9951
  key: ConfigKey.property_tableSearch,
9876
9952
  description: "Search functionality for the table, used to enable searching within the table",
9877
- format: TagFormat.boolean
9953
+ format: TagFormat.boolean,
9954
+ defaultValue: "false"
9878
9955
  },
9879
9956
  {
9880
9957
  key: ConfigKey.property_tableSort,
9881
9958
  description: "Sorting functionality for the table, used to enable sorting of table columns",
9882
- format: TagFormat.boolean
9959
+ format: TagFormat.boolean,
9960
+ defaultValue: "false"
9883
9961
  },
9884
9962
  {
9885
9963
  key: ConfigKey.property_tablePagination,
9886
9964
  description: "Pagination for the table, used to limit the number of rows displayed at once",
9887
- format: TagFormat.boolean
9965
+ format: TagFormat.boolean,
9966
+ defaultValue: "false"
9888
9967
  },
9889
9968
  {
9890
9969
  key: ConfigKey.property_tablePaginationLimit,
@@ -9901,24 +9980,26 @@ var BITS = {
9901
9980
  {
9902
9981
  key: ConfigKey.property_tableWhitespaceNoWrap,
9903
9982
  description: "No wrap for table whitespace, used to prevent text wrapping in table cells",
9904
- format: TagFormat.boolean
9905
- // defaultValue: 'false',
9983
+ format: TagFormat.boolean,
9984
+ defaultValue: "false"
9906
9985
  },
9907
9986
  {
9908
9987
  key: ConfigKey.property_tableAutoWidth,
9909
9988
  description: "Auto width for table columns, used to automatically adjust column widths",
9910
- format: TagFormat.boolean
9911
- // defaultValue: 'true',
9989
+ format: TagFormat.boolean,
9990
+ defaultValue: "true"
9912
9991
  },
9913
9992
  {
9914
9993
  key: ConfigKey.property_tableResizableColumns,
9915
9994
  description: "Resizable columns for the table, used to allow users to resize table columns",
9916
- format: TagFormat.boolean
9995
+ format: TagFormat.boolean,
9996
+ defaultValue: "false"
9917
9997
  },
9918
9998
  {
9919
9999
  key: ConfigKey.property_tableColumnMinWidth,
9920
10000
  description: "Minimum width for table columns, used to define the minimum width of columns",
9921
- format: TagFormat.number
10001
+ format: TagFormat.number,
10002
+ defaultValue: "0"
9922
10003
  }
9923
10004
  ],
9924
10005
  cardSet: CardSetConfigKey.table
@@ -9926,7 +10007,8 @@ var BITS = {
9926
10007
  [BitType.tableExtended]: {
9927
10008
  since: "4.14.0",
9928
10009
  baseBitType: BitType.table,
9929
- description: "Extended table bit, used to create complex tables with all HTML table features"
10010
+ description: "Extended table bit, used to create complex tables with all HTML table features",
10011
+ cardSet: CardSetConfigKey.tableExtended
9930
10012
  },
9931
10013
  [BitType.tableExtendedImage]: {
9932
10014
  since: "5.13.0",
@@ -10892,7 +10974,6 @@ var Config = class {
10892
10974
  maxCount: 1,
10893
10975
  chain: tag.chain,
10894
10976
  jsonKey: tag.jsonKey,
10895
- secondaryJsonKey: tag.secondaryJsonKey,
10896
10977
  deprecated: tag.deprecated
10897
10978
  });
10898
10979
  finalResourceTags[k] = newTag;
@@ -10997,7 +11078,7 @@ var instance2 = new Config();
10997
11078
  // src/generated/package_info.ts
10998
11079
  var PACKAGE_INFO = {
10999
11080
  "name": "@gmb/bitmark-parser-generator",
11000
- "version": "5.18.0",
11081
+ "version": "5.20.0",
11001
11082
  "author": "Get More Brain Ltd",
11002
11083
  "license": "ISC",
11003
11084
  "description": "A bitmark parser and generator using Peggy.js"
@@ -11558,6 +11639,8 @@ var NodeType = {
11558
11639
  extractorExtractionTimestampValue: "extractorExtractionTimestampValue",
11559
11640
  extractorTag: "extractorTag",
11560
11641
  extractorTagValue: "extractorTagValue",
11642
+ extractorInternal: "extractorInternal",
11643
+ extractorInternalValue: "extractorInternalValue",
11561
11644
  extraProperties: "extraProperties",
11562
11645
  feedback: "feedback",
11563
11646
  feedbackEngine: "feedbackEngine",
@@ -11963,6 +12046,8 @@ var NodeType = {
11963
12046
  table: "table",
11964
12047
  tableAutoWidth: "tableAutoWidth",
11965
12048
  tableAutoWidthValue: "tableAutoWidthValue",
12049
+ tableColWidth: "tableColWidth",
12050
+ tableColWidthValue: "tableColWidthValue",
11966
12051
  tableColumnMinWidth: "tableColumnMinWidth",
11967
12052
  tableColumnMinWidthValue: "tableColumnMinWidthValue",
11968
12053
  tableFixedHeader: "tableFixedHeader",
@@ -24955,6 +25040,12 @@ var Builder = class extends BaseBuilder {
24955
25040
  data.extractorTag,
24956
25041
  options
24957
25042
  ),
25043
+ extractorInternal: this.toAstProperty(
25044
+ bitType,
25045
+ ConfigKey.property_extractorInternal,
25046
+ data.extractorInternal,
25047
+ options
25048
+ ),
24958
25049
  levelCEFRp: this.toAstProperty(
24959
25050
  bitType,
24960
25051
  ConfigKey.property_levelCEFRp,
@@ -26442,6 +26533,7 @@ var Builder = class extends BaseBuilder {
26442
26533
  if (cell.rowspan != null) tableCell.rowspan = cell.rowspan;
26443
26534
  if (cell.colspan != null) tableCell.colspan = cell.colspan;
26444
26535
  if (cell.scope) tableCell.scope = cell.scope;
26536
+ if (cell.colwidth != null) tableCell.colwidth = cell.colwidth;
26445
26537
  return tableCell;
26446
26538
  });
26447
26539
  return {
@@ -28737,6 +28829,10 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28737
28829
  this.writeTableCellProperty("tableScope", cell.scope);
28738
28830
  this.writeNL();
28739
28831
  }
28832
+ if (cell.colwidth && cell.colwidth > 0) {
28833
+ this.writeTableCellProperty("tableColWidth", cell.colwidth);
28834
+ this.writeNL();
28835
+ }
28740
28836
  const content = cell.content ?? instance3.EMPTY_STRING;
28741
28837
  this.writeTextOrValue(content, this.textFormat, TextLocation.body);
28742
28838
  }
@@ -31299,7 +31395,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
31299
31395
  if (bitJson.isTracked == null) bitJson.isTracked = true;
31300
31396
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
31301
31397
  }
31302
- if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
31398
+ const tableImageHasTable = instance2.isOfBitType(bitType, BitType.tableImage) && !this.tableIsEmpty(bitJson.table);
31399
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage) || tableImageHasTable) {
31303
31400
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
31304
31401
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
31305
31402
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -31314,10 +31411,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
31314
31411
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
31315
31412
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
31316
31413
  }
31317
- if (instance2.isOfBitType(bitType, BitType.tableImage)) {
31318
- if (this.tableIsEmpty(bitJson.table)) {
31319
- delete bitJson.table;
31320
- }
31414
+ if (instance2.isOfBitType(bitType, BitType.tableImage) && !tableImageHasTable) {
31415
+ delete bitJson.table;
31321
31416
  }
31322
31417
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
31323
31418
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
@@ -34135,11 +34230,19 @@ function parseTable(context, _bitType, cardSet) {
34135
34230
  const rowSpanRaw = tags2.tableRowSpan ?? readExtraProperty(tags2.extraProperties, "tableRowSpan");
34136
34231
  const colSpanRaw = tags2.tableColSpan ?? readExtraProperty(tags2.extraProperties, "tableColSpan");
34137
34232
  const scopeRaw = tags2.tableScope ?? readExtraProperty(tags2.extraProperties, "tableScope");
34138
- cleanupExtraProperties(tags2, ["tableCellType", "tableRowSpan", "tableColSpan", "tableScope"]);
34233
+ const colWidthRaw = tags2.tableColWidth ?? readExtraProperty(tags2.extraProperties, "tableColWidth");
34234
+ cleanupExtraProperties(tags2, [
34235
+ "tableCellType",
34236
+ "tableRowSpan",
34237
+ "tableColSpan",
34238
+ "tableScope",
34239
+ "tableColWidth"
34240
+ ]);
34139
34241
  const cellType = normalizeCellType(cellTypeRaw, section);
34140
34242
  const rowspan = normalizeSpan(rowSpanRaw, "rowspan");
34141
34243
  const colspan = normalizeSpan(colSpanRaw, "colspan");
34142
34244
  const scope = normalizeScope(scopeRaw);
34245
+ const colwidth = instance6.asNumber(colWidthRaw) ?? 0;
34143
34246
  const cell = {
34144
34247
  content
34145
34248
  };
@@ -34147,6 +34250,7 @@ function parseTable(context, _bitType, cardSet) {
34147
34250
  if (rowspan > 1) cell.rowspan = rowspan;
34148
34251
  if (colspan > 1) cell.colspan = colspan;
34149
34252
  if (scope) cell.scope = scope;
34253
+ if (colwidth > 0) cell.colwidth = colwidth;
34150
34254
  return cell;
34151
34255
  };
34152
34256
  const resolveSectionQualifier = (card) => {
@@ -34533,6 +34637,15 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
34533
34637
  }
34534
34638
 
34535
34639
  // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
34640
+ function flattenChainContent(content) {
34641
+ const result = [content];
34642
+ if (content.chain) {
34643
+ for (const child of content.chain) {
34644
+ result.push(...flattenChainContent(child));
34645
+ }
34646
+ }
34647
+ return result;
34648
+ }
34536
34649
  function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
34537
34650
  if (contentDepth === ContentDepth.Chain) {
34538
34651
  itemLeadTagContentProcessor(context, contentDepth, tagsConfig, content, target);
@@ -34543,7 +34656,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
34543
34656
  function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
34544
34657
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
34545
34658
  const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum43.Enum)(Tag).fromValue(content.type));
34546
- const chainContent = [content, ...content.chain ?? []];
34659
+ const chainContent = flattenChainContent(content);
34547
34660
  const chainTags = context.bitContentProcessor(
34548
34661
  ContentDepth.Chain,
34549
34662
  itemLeadConfig?.chain,
@@ -35100,7 +35213,6 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
35100
35213
  minCount: 1,
35101
35214
  chain: void 0,
35102
35215
  jsonKey: void 0,
35103
- secondaryJsonKey: void 0,
35104
35216
  format: TagFormat.bitmarkText,
35105
35217
  values: void 0,
35106
35218
  defaultValue: void 0,
@@ -40107,7 +40219,6 @@ var normalizeCardKey = (cardSetKey) => stringUtils.camelToKebab(cardSetKey);
40107
40219
  var ConfigBuilder = class {
40108
40220
  build(options) {
40109
40221
  const opts = Object.assign({}, options);
40110
- this.buildFlat(opts);
40111
40222
  const bitConfigs = [];
40112
40223
  const groupConfigs = [];
40113
40224
  const bitGroupConfigKeys = /* @__PURE__ */ new Set();
@@ -40178,7 +40289,7 @@ var ConfigBuilder = class {
40178
40289
  const keyToJsonKey = (key, tagNameChain) => {
40179
40290
  let jsonKey = key;
40180
40291
  if (key === "%") {
40181
- jsonKey = "item_todo";
40292
+ jsonKey = "item";
40182
40293
  } else if (key === "!") {
40183
40294
  jsonKey = "instruction";
40184
40295
  } else if (key === "?") {
@@ -40194,13 +40305,13 @@ var ConfigBuilder = class {
40194
40305
  } else if (key === "$") {
40195
40306
  jsonKey = "sampleSolution";
40196
40307
  } else if (key === "+") {
40197
- jsonKey = "true_todo";
40308
+ jsonKey = "choices[]|set(isCorrect=true)";
40198
40309
  } else if (key === "-") {
40199
- jsonKey = "false_todo";
40310
+ jsonKey = "choices[]|set(isCorrect=false)";
40200
40311
  } else if (key === "_") {
40201
- jsonKey = "gap_todo";
40312
+ jsonKey = "solutions[]";
40202
40313
  } else if (key === "=") {
40203
- jsonKey = "mark_todo";
40314
+ jsonKey = "solution";
40204
40315
  } else if (key.startsWith("@")) {
40205
40316
  jsonKey = key.substring(1);
40206
40317
  } else if (key.startsWith("&")) {
@@ -40251,7 +40362,7 @@ var ConfigBuilder = class {
40251
40362
  if (Array.isArray(tag.chain) && tag.chain.length > 0) {
40252
40363
  const chainTags = [];
40253
40364
  for (const [_tagKey, chainTag] of tag.chain.entries()) {
40254
- chainTags.push(...processTagEntries(chainTag, [...tagNameChain, jsonKey]));
40365
+ chainTags.push(...processTagEntries(chainTag, []));
40255
40366
  }
40256
40367
  chain = chainTags;
40257
40368
  }
@@ -40259,10 +40370,8 @@ var ConfigBuilder = class {
40259
40370
  type: "tag",
40260
40371
  key: tagName,
40261
40372
  jsonKey,
40262
- ...tag.secondaryJsonKey ? { secondaryJsonKey: tag.secondaryJsonKey } : {},
40263
40373
  format,
40264
- default: null,
40265
- alwaysInclude: false,
40374
+ default: tag.defaultValue ?? null,
40266
40375
  min: tag.minCount == null ? 0 : tag.minCount,
40267
40376
  max: tag.maxCount == null ? 1 : tag.maxCount,
40268
40377
  description: tag.description ?? "",
@@ -40296,22 +40405,51 @@ var ConfigBuilder = class {
40296
40405
  ...variant.jsonKey !== void 0 ? { jsonKey: variant.jsonKey } : {},
40297
40406
  tags: variantTags,
40298
40407
  repeatCount: variant.repeatCount ?? 1,
40299
- bodyAllowed: variant.bodyAllowed ?? true,
40300
- bodyRequired: variant.bodyRequired ?? false
40408
+ ...variant.bodyRequired ? { bodyRequired: true } : {},
40409
+ ...variant.bodyAllowed === false ? { bodyForbidden: true } : {}
40301
40410
  };
40302
40411
  });
40303
40412
  return {
40304
40413
  name: side.name,
40305
40414
  ...side.repeat ? { repeat: side.repeat } : {},
40415
+ ...side.jsonKey != null ? { jsonKey: side.jsonKey } : {},
40306
40416
  variants
40307
40417
  };
40308
40418
  });
40419
+ if (cardSetConfig.sections) {
40420
+ const cards = Object.entries(cardSetConfig.sections).map(([sectionName, section]) => {
40421
+ let cardSides = section.sideJsonKey ? sides.map((s) => ({ ...s, jsonKey: section.sideJsonKey })) : sides;
40422
+ if (normalizedKey === "table-extended" && sectionName !== "table-header") {
40423
+ cardSides = JSON.parse(JSON.stringify(cardSides));
40424
+ for (const side of cardSides) {
40425
+ for (const variant of side.variants) {
40426
+ for (const tag of variant.tags) {
40427
+ if (tag.type === "tag" && tag.key === "#" && tag.jsonKey === ".") {
40428
+ tag.jsonKey = "^table.header.rows.cells[{s}].content";
40429
+ }
40430
+ }
40431
+ }
40432
+ }
40433
+ }
40434
+ return {
40435
+ name: sectionName,
40436
+ ...section.isDefault ? { isDefault: true } : {},
40437
+ jsonKey: section.jsonKey,
40438
+ sides: cardSides
40439
+ };
40440
+ });
40441
+ return { name: normalizedKey, cards };
40442
+ }
40309
40443
  return {
40310
- key: normalizedKey,
40311
- jsonKey: cardSetConfig.jsonKey,
40312
- ...cardSetConfig.itemType && cardSetConfig.itemType !== "object" ? { itemType: cardSetConfig.itemType } : {},
40313
- ...cardSetConfig.sections ? { sections: cardSetConfig.sections } : {},
40314
- sides
40444
+ name: normalizedKey,
40445
+ cards: [
40446
+ {
40447
+ name: "default",
40448
+ isDefault: true,
40449
+ jsonKey: cardSetConfig.jsonKey,
40450
+ sides
40451
+ }
40452
+ ]
40315
40453
  };
40316
40454
  };
40317
40455
  for (const bt of bitGroupConfigKeys) {
@@ -40378,8 +40516,13 @@ var ConfigBuilder = class {
40378
40516
  }
40379
40517
  }
40380
40518
  let cardRef;
40381
- if (b.cardSet && CARDSETS[b.cardSet]) {
40382
- cardRef = normalizeCardKey(b.cardSet);
40519
+ let current = b;
40520
+ while (current) {
40521
+ if (current.cardSet && CARDSETS[current.cardSet]) {
40522
+ cardRef = normalizeCardKey(current.cardSet);
40523
+ break;
40524
+ }
40525
+ current = current.baseBitType ? BITS[current.baseBitType] : void 0;
40383
40526
  }
40384
40527
  const bitJson = {
40385
40528
  name: b.bitType,
@@ -40393,10 +40536,10 @@ var ConfigBuilder = class {
40393
40536
  }
40394
40537
  ],
40395
40538
  format: resolvedBitConfig.textFormatDefault ?? "bitmark--",
40396
- bodyAllowed: resolvedBitConfig.bodyAllowed ?? true,
40397
40539
  bodyRequired: resolvedBitConfig.bodyRequired ?? false,
40398
- footerAllowed: resolvedBitConfig.footerAllowed ?? true,
40540
+ bodyForbidden: !(resolvedBitConfig.bodyAllowed ?? true),
40399
40541
  footerRequired: resolvedBitConfig.footerRequired ?? false,
40542
+ footerForbidden: !(resolvedBitConfig.footerAllowed ?? true),
40400
40543
  resourceAttachmentAllowed: resolvedBitConfig.resourceAttachmentAllowed ?? true,
40401
40544
  tags: tags2,
40402
40545
  ...cardRef ? { card: cardRef } : {}
@@ -40470,7 +40613,7 @@ var ConfigBuilder = class {
40470
40613
  for (const cardSetKey of Object.keys(CARDSETS)) {
40471
40614
  const cardJson = serializeCardSet(cardSetKey);
40472
40615
  if (!cardJson) continue;
40473
- const output = import_node_path3.default.join(outputFolderCards, `${cardJson.key}.jsonc`);
40616
+ const output = import_node_path3.default.join(outputFolderCards, `${cardJson.name}.jsonc`);
40474
40617
  const str = JSON.stringify(cardJson, null, 2);
40475
40618
  fileWrites.push(import_fs_extra3.default.writeFile(output, str));
40476
40619
  }
@@ -40637,22 +40780,26 @@ var ConfigBuilder = class {
40637
40780
  if (config.key && config.key !== expectedKey) {
40638
40781
  errors.push(`Card key mismatch in cards/${file}: expected '${expectedKey}'`);
40639
40782
  }
40640
- if (Array.isArray(config.sides)) {
40641
- config.sides.forEach((side, sideIdx) => {
40642
- const variants = side.variants;
40643
- if (Array.isArray(variants)) {
40644
- variants.forEach((variant, variantIdx) => {
40645
- const variantTags = variant.tags;
40646
- if (Array.isArray(variantTags)) {
40647
- checkTags(
40648
- variantTags,
40649
- `cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
40650
- 10
40651
- );
40783
+ if (Array.isArray(config.cards)) {
40784
+ for (const cardNode of config.cards) {
40785
+ if (cardNode && Array.isArray(cardNode.sides)) {
40786
+ cardNode.sides.forEach((side, sideIdx) => {
40787
+ const variants = side.variants;
40788
+ if (Array.isArray(variants)) {
40789
+ variants.forEach((variant, variantIdx) => {
40790
+ const variantTags = variant.tags;
40791
+ if (Array.isArray(variantTags)) {
40792
+ checkTags(
40793
+ variantTags,
40794
+ `cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
40795
+ 10
40796
+ );
40797
+ }
40798
+ });
40652
40799
  }
40653
40800
  });
40654
40801
  }
40655
- });
40802
+ }
40656
40803
  }
40657
40804
  } catch (err) {
40658
40805
  errors.push(`Failed to parse cards/${file}: ${err}`);
@@ -40661,128 +40808,6 @@ var ConfigBuilder = class {
40661
40808
  }
40662
40809
  return errors;
40663
40810
  }
40664
- // Build flat bit configs
40665
- buildFlat(options) {
40666
- const opts = Object.assign({}, options);
40667
- const bitConfigs = [];
40668
- for (const bt of (0, import_superenum50.Enum)(BitType).values()) {
40669
- const bitType = instance2.getBitType(bt);
40670
- const bitConfig = instance2.getBitConfig(bitType);
40671
- if (bitConfig) bitConfigs.push(bitConfig);
40672
- }
40673
- const outputFolder = opts.outputDir ?? "assets/config";
40674
- const outputFolderBits = import_node_path3.default.join(outputFolder, "bits_flat");
40675
- import_fs_extra3.default.ensureDirSync(outputFolderBits);
40676
- const existingFiles = import_fs_extra3.default.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
40677
- for (const file of existingFiles) {
40678
- import_fs_extra3.default.removeSync(import_node_path3.default.join(outputFolderBits, file));
40679
- }
40680
- const processTagEntries = (tag) => {
40681
- const tags2 = [];
40682
- let tagName = tag.key;
40683
- const tagType = typeFromConfigKey(tag.key);
40684
- let format = "";
40685
- let chain = void 0;
40686
- if (tagType === BitTagConfigKeyType.tag) {
40687
- tagName = tag.name;
40688
- format = "bitmark--";
40689
- } else if (tagType === BitTagConfigKeyType.property) {
40690
- tagName = tag.key;
40691
- if (tag.format === TagFormat.plainText) {
40692
- format = "string";
40693
- } else if (tag.format === TagFormat.boolean) {
40694
- format = "bool";
40695
- } else if (tag.format === TagFormat.bitmarkText) {
40696
- format = "bitmark";
40697
- } else if (tag.format === TagFormat.number) {
40698
- format = "number";
40699
- }
40700
- } else if (tagType === BitTagConfigKeyType.resource) {
40701
- format = "string";
40702
- } else if (tagType === BitTagConfigKeyType.group) {
40703
- let k = tag.key;
40704
- if (k.startsWith("group_")) k = k.substring(6);
40705
- k = /*'_' +*/
40706
- stringUtils.camelToKebab(k);
40707
- tags2.push({
40708
- type: "group",
40709
- key: k
40710
- });
40711
- return tags2;
40712
- }
40713
- if (Array.isArray(tag.chain) && tag.chain.length > 0) {
40714
- const chainTags = [];
40715
- for (const [_tagKey, chainTag] of tag.chain.entries()) {
40716
- chainTags.push(...processTagEntries(chainTag));
40717
- }
40718
- chain = chainTags;
40719
- }
40720
- const t = {
40721
- key: tagName,
40722
- format,
40723
- default: null,
40724
- alwaysInclude: false,
40725
- min: tag.minCount == null ? 0 : tag.minCount,
40726
- max: tag.maxCount == null ? 1 : tag.maxCount,
40727
- description: tag.description ?? "",
40728
- chain
40729
- // raw: {
40730
- // ...tag,
40731
- // },
40732
- };
40733
- tags2.push(t);
40734
- return tags2;
40735
- };
40736
- for (const b of bitConfigs) {
40737
- const tags2 = [];
40738
- const tagEntriesTypeOrder = [
40739
- BitTagConfigKeyType.tag,
40740
- BitTagConfigKeyType.property,
40741
- BitTagConfigKeyType.resource,
40742
- BitTagConfigKeyType.group,
40743
- BitTagConfigKeyType.unknown
40744
- ];
40745
- const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
40746
- const tagA = a[1];
40747
- const tagB = b2[1];
40748
- const typeA = typeFromConfigKey(tagA.configKey);
40749
- const typeB = typeFromConfigKey(tagB.configKey);
40750
- const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
40751
- return typeOrder;
40752
- });
40753
- for (const [_tagKey, tag] of tagEntries) {
40754
- tags2.push(...processTagEntries(tag));
40755
- }
40756
- let cardRef;
40757
- const cardSetKey = b.cardSet?.configKey;
40758
- if (cardSetKey && CARDSETS[cardSetKey]) {
40759
- cardRef = normalizeCardKey(cardSetKey);
40760
- }
40761
- const bitJson = {
40762
- name: b.bitType,
40763
- description: "",
40764
- since: b.since,
40765
- deprecated: b.deprecated,
40766
- history: [
40767
- {
40768
- version: b.since,
40769
- changes: ["Initial version"]
40770
- }
40771
- ],
40772
- format: b.textFormatDefault ?? "bitmark--",
40773
- bodyAllowed: b.bodyAllowed ?? true,
40774
- bodyRequired: b.bodyRequired ?? false,
40775
- footerAllowed: b.footerAllowed ?? true,
40776
- footerRequired: b.footerRequired ?? false,
40777
- resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
40778
- tags: tags2,
40779
- ...cardRef ? { card: cardRef } : {}
40780
- };
40781
- const output = import_node_path3.default.join(outputFolderBits, `${b.bitType}.jsonc`);
40782
- const str = JSON.stringify(bitJson, null, 2);
40783
- import_fs_extra3.default.writeFileSync(output, str);
40784
- }
40785
- }
40786
40811
  };
40787
40812
 
40788
40813
  // src/BitmarkParserGenerator.ts