@gmb/bitmark-parser-generator 5.19.0 → 5.21.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.js CHANGED
@@ -788,8 +788,6 @@ var AbstractTagConfig = class {
788
788
  __publicField(this, "chain");
789
789
  __publicField(this, "jsonKey");
790
790
  // If the json key is different from the tag
791
- __publicField(this, "secondaryJsonKey");
792
- // Heading card alternate path
793
791
  __publicField(this, "deprecated");
794
792
  this.type = params.type;
795
793
  this.configKey = params.configKey;
@@ -798,7 +796,6 @@ var AbstractTagConfig = class {
798
796
  this.minCount = params.minCount;
799
797
  this.chain = params.chain;
800
798
  this.jsonKey = params.jsonKey;
801
- this.secondaryJsonKey = params.secondaryJsonKey;
802
799
  this.deprecated = params.deprecated;
803
800
  }
804
801
  };
@@ -959,12 +956,14 @@ ${tag.toString(opts)}`;
959
956
 
960
957
  // src/model/config/CardSideConfig.ts
961
958
  var CardSideConfig = class {
962
- constructor(name, repeat, variants) {
959
+ constructor(name, repeat, variants, jsonKey) {
963
960
  __publicField(this, "name");
964
961
  __publicField(this, "repeat");
962
+ __publicField(this, "jsonKey");
965
963
  __publicField(this, "variants");
966
964
  this.name = name;
967
965
  this.repeat = repeat;
966
+ this.jsonKey = jsonKey;
968
967
  this.variants = variants;
969
968
  }
970
969
  toString(options) {
@@ -986,15 +985,13 @@ var CardSideConfig = class {
986
985
 
987
986
  // src/model/config/CardSetConfig.ts
988
987
  var CardSetConfig = class {
989
- constructor(configKey, jsonKey, itemType, sections, sides) {
988
+ constructor(configKey, jsonKey, sections, sides) {
990
989
  __publicField(this, "configKey");
991
990
  __publicField(this, "jsonKey");
992
- __publicField(this, "itemType");
993
991
  __publicField(this, "sections");
994
992
  __publicField(this, "sides");
995
993
  this.configKey = configKey;
996
994
  this.jsonKey = jsonKey;
997
- this.itemType = itemType;
998
995
  this.sections = sections;
999
996
  this.sides = sides;
1000
997
  }
@@ -1009,8 +1006,6 @@ var CardSetConfig = class {
1009
1006
  s += `[CardSet: ${this.configKey}]`;
1010
1007
  s += `
1011
1008
  jsonKey: ${this.jsonKey}`;
1012
- s += `
1013
- itemType: ${this.itemType}`;
1014
1009
  for (const side of this.sides) {
1015
1010
  s += `
1016
1011
  ${side.toString(opts)}`;
@@ -1138,6 +1133,7 @@ import { Enum } from "@ncoderz/superenum";
1138
1133
  import "@ncoderz/superenum";
1139
1134
  var groupKeys = {
1140
1135
  group_standardAllBits: "group_standardAllBits",
1136
+ group_standardItemLead: "group_standardItemLead",
1141
1137
  group_standardItemLeadInstructionHint: "group_standardItemLeadInstructionHint",
1142
1138
  group_standardTags: "group_standardTags",
1143
1139
  group_imageSource: "group_imageSource",
@@ -1221,6 +1217,7 @@ var propertyKeys = {
1221
1217
  property_bot: "@bot",
1222
1218
  property_bubbleTag: "@bubbleTag",
1223
1219
  property_extractorTag: "@extractorTag",
1220
+ property_extractorInternal: "@extractorInternal",
1224
1221
  property_buttonCaption: "@buttonCaption",
1225
1222
  property_callToActionUrl: "@callToActionUrl",
1226
1223
  property_caption: "@caption",
@@ -1435,6 +1432,7 @@ var propertyKeys = {
1435
1432
  property_subject: "@subject",
1436
1433
  property_subtype: "@subtype",
1437
1434
  property_tableAutoWidth: "@tableAutoWidth",
1435
+ property_tableColWidth: "@tableColWidth",
1438
1436
  property_tableColumnMinWidth: "@tableColumnMinWidth",
1439
1437
  property_tableFixedHeader: "@tableFixedHeader",
1440
1438
  property_tableHeaderWhitespaceNoWrap: "@tableHeaderWhitespaceNoWrap",
@@ -2260,7 +2258,7 @@ var CARDSETS = {
2260
2258
  {
2261
2259
  key: ConfigKey.tag_title,
2262
2260
  description: "Title of the definition.",
2263
- secondaryJsonKey: "heading.forKeys"
2261
+ jsonKey: "^heading.forKeys"
2264
2262
  },
2265
2263
  {
2266
2264
  key: ConfigKey.group_resourceIcon,
@@ -2284,7 +2282,7 @@ var CARDSETS = {
2284
2282
  {
2285
2283
  key: ConfigKey.tag_title,
2286
2284
  description: "Title of the definition.",
2287
- secondaryJsonKey: "heading.forValues"
2285
+ jsonKey: "^heading.forValues"
2288
2286
  },
2289
2287
  {
2290
2288
  key: ConfigKey.group_resourceIcon,
@@ -2334,7 +2332,7 @@ var CARDSETS = {
2334
2332
  {
2335
2333
  key: ConfigKey.tag_title,
2336
2334
  description: "Title of the match pair.",
2337
- secondaryJsonKey: "heading.forKeys"
2335
+ jsonKey: "^heading.forKeys"
2338
2336
  },
2339
2337
  {
2340
2338
  key: ConfigKey.property_isCaseSensitive,
@@ -2369,7 +2367,7 @@ var CARDSETS = {
2369
2367
  {
2370
2368
  key: ConfigKey.tag_title,
2371
2369
  description: "Title of the match pair.",
2372
- secondaryJsonKey: "heading.forValues"
2370
+ jsonKey: "^heading.forValues"
2373
2371
  },
2374
2372
  {
2375
2373
  key: ConfigKey.property_isCaseSensitive,
@@ -2402,7 +2400,7 @@ var CARDSETS = {
2402
2400
  {
2403
2401
  key: ConfigKey.tag_title,
2404
2402
  description: "Title of the audio match pair.",
2405
- secondaryJsonKey: "heading.forKeys"
2403
+ jsonKey: "^heading.forKeys"
2406
2404
  },
2407
2405
  {
2408
2406
  key: ConfigKey.resource_audio,
@@ -2427,7 +2425,7 @@ var CARDSETS = {
2427
2425
  {
2428
2426
  key: ConfigKey.tag_title,
2429
2427
  description: "Title of the audio match pair.",
2430
- secondaryJsonKey: "heading.forValues"
2428
+ jsonKey: "^heading.forValues"
2431
2429
  },
2432
2430
  {
2433
2431
  key: ConfigKey.resource_audio,
@@ -2459,7 +2457,7 @@ var CARDSETS = {
2459
2457
  {
2460
2458
  key: ConfigKey.tag_title,
2461
2459
  description: "Title of the image match pair.",
2462
- secondaryJsonKey: "heading.forKeys"
2460
+ jsonKey: "^heading.forKeys"
2463
2461
  },
2464
2462
  {
2465
2463
  key: ConfigKey.resource_image,
@@ -2484,7 +2482,7 @@ var CARDSETS = {
2484
2482
  {
2485
2483
  key: ConfigKey.tag_title,
2486
2484
  description: "Title of the image match pair.",
2487
- secondaryJsonKey: "heading.forValues"
2485
+ jsonKey: "^heading.forValues"
2488
2486
  },
2489
2487
  {
2490
2488
  key: ConfigKey.resource_image,
@@ -2521,7 +2519,7 @@ var CARDSETS = {
2521
2519
  {
2522
2520
  key: ConfigKey.tag_title,
2523
2521
  description: "Title of the match matrix.",
2524
- secondaryJsonKey: "heading.forKeys"
2522
+ jsonKey: "^heading.forKeys"
2525
2523
  },
2526
2524
  {
2527
2525
  key: ConfigKey.property_isCaseSensitive,
@@ -2551,7 +2549,7 @@ var CARDSETS = {
2551
2549
  {
2552
2550
  key: ConfigKey.tag_title,
2553
2551
  description: "Title of the match matrix.",
2554
- secondaryJsonKey: "heading.forValues"
2552
+ jsonKey: "^heading.forValues"
2555
2553
  },
2556
2554
  {
2557
2555
  key: ConfigKey.property_isCaseSensitive,
@@ -2580,11 +2578,13 @@ var CARDSETS = {
2580
2578
  {
2581
2579
  key: ConfigKey.tag_true,
2582
2580
  description: "Tag for true statements.",
2581
+ jsonKey: "statement|set(isCorrect=true)",
2583
2582
  maxCount: 1
2584
2583
  },
2585
2584
  {
2586
2585
  key: ConfigKey.tag_false,
2587
2586
  description: "Tag for false statements.",
2587
+ jsonKey: "statement|set(isCorrect=false)",
2588
2588
  maxCount: 1
2589
2589
  },
2590
2590
  {
@@ -2648,7 +2648,7 @@ var CARDSETS = {
2648
2648
  {
2649
2649
  key: ConfigKey.tag_title,
2650
2650
  description: "Title of the feedback.",
2651
- secondaryJsonKey: "heading.forKeys"
2651
+ jsonKey: "^heading.forKeys"
2652
2652
  }
2653
2653
  ],
2654
2654
  bodyAllowed: false
@@ -2678,7 +2678,7 @@ var CARDSETS = {
2678
2678
  {
2679
2679
  key: ConfigKey.tag_title,
2680
2680
  description: "Title of the feedback.",
2681
- secondaryJsonKey: "heading.forValues"
2681
+ jsonKey: "^heading.forValues"
2682
2682
  }
2683
2683
  ],
2684
2684
  bodyAllowed: true
@@ -2768,7 +2768,6 @@ var CARDSETS = {
2768
2768
  //
2769
2769
  [CardSetConfigKey.table]: {
2770
2770
  jsonKey: "table.data",
2771
- itemType: "array",
2772
2771
  sides: [
2773
2772
  {
2774
2773
  name: "cell",
@@ -2783,8 +2782,8 @@ var CARDSETS = {
2783
2782
  },
2784
2783
  {
2785
2784
  key: ConfigKey.tag_title,
2786
- description: "Title of the table.",
2787
- secondaryJsonKey: "table.columns[]"
2785
+ jsonKey: "^table.columns[]",
2786
+ description: "Title of the table."
2788
2787
  },
2789
2788
  {
2790
2789
  key: ConfigKey.property_tableCellType,
@@ -2805,6 +2804,11 @@ var CARDSETS = {
2805
2804
  key: ConfigKey.property_tableScope,
2806
2805
  description: "Scope attribute for header cells.",
2807
2806
  format: TagFormat.plainText
2807
+ },
2808
+ {
2809
+ key: ConfigKey.property_tableColWidth,
2810
+ description: "Width for the column.",
2811
+ format: TagFormat.number
2808
2812
  }
2809
2813
  ],
2810
2814
  repeatCount: Count.infinity
@@ -2819,14 +2823,15 @@ var CARDSETS = {
2819
2823
  [CardSetConfigKey.tableExtended]: {
2820
2824
  jsonKey: null,
2821
2825
  sections: {
2822
- default: { jsonKey: "tableExtended.body.rows" },
2823
- "table-header": { jsonKey: "tableExtended.header.rows" },
2824
- "table-footer": { jsonKey: "tableExtended.footer.rows" }
2826
+ "table-header": { jsonKey: "table.header.rows", sideJsonKey: "cells[{s}]|set(title=true)" },
2827
+ "table-body": { jsonKey: "table.body.rows", isDefault: true },
2828
+ "table-footer": { jsonKey: "table.footer.rows", sideJsonKey: "cells[{s}]|set(title=true)" }
2825
2829
  },
2826
2830
  sides: [
2827
2831
  {
2828
2832
  name: "cell",
2829
2833
  repeat: true,
2834
+ jsonKey: "cells[{s}]",
2830
2835
  variants: [
2831
2836
  {
2832
2837
  jsonKey: "content",
@@ -2837,27 +2842,37 @@ var CARDSETS = {
2837
2842
  },
2838
2843
  {
2839
2844
  key: ConfigKey.tag_title,
2845
+ jsonKey: ".",
2840
2846
  description: "Title of the table cell."
2841
2847
  },
2842
2848
  {
2843
2849
  key: ConfigKey.property_tableCellType,
2850
+ jsonKey: "title|bool(th)",
2844
2851
  description: "Table cell type (th/td).",
2845
2852
  format: TagFormat.plainText
2846
2853
  },
2847
2854
  {
2848
2855
  key: ConfigKey.property_tableRowSpan,
2856
+ jsonKey: "rowspan",
2849
2857
  description: "Number of rows the cell spans.",
2850
2858
  format: TagFormat.number
2851
2859
  },
2852
2860
  {
2853
2861
  key: ConfigKey.property_tableColSpan,
2862
+ jsonKey: "colspan",
2854
2863
  description: "Number of columns the cell spans.",
2855
2864
  format: TagFormat.number
2856
2865
  },
2857
2866
  {
2858
2867
  key: ConfigKey.property_tableScope,
2868
+ jsonKey: "scope",
2859
2869
  description: "Scope attribute for header cells.",
2860
2870
  format: TagFormat.plainText
2871
+ },
2872
+ {
2873
+ key: ConfigKey.property_tableColWidth,
2874
+ description: "Width for the column.",
2875
+ format: TagFormat.number
2861
2876
  }
2862
2877
  ],
2863
2878
  repeatCount: Count.infinity
@@ -2871,7 +2886,6 @@ var CARDSETS = {
2871
2886
  //
2872
2887
  [CardSetConfigKey.pronunciationTable]: {
2873
2888
  jsonKey: "pronunciationTable.data",
2874
- itemType: "array",
2875
2889
  sides: [
2876
2890
  {
2877
2891
  name: "cell",
@@ -2918,15 +2932,8 @@ var CARDSETS = {
2918
2932
  format: TagFormat.plainText
2919
2933
  },
2920
2934
  {
2921
- key: ConfigKey.tag_item,
2922
- description: "The item for the bot action response.",
2923
- chain: [
2924
- {
2925
- key: ConfigKey.tag_item,
2926
- description: "The lead, page number, source page number, and margin number.",
2927
- maxCount: 4
2928
- }
2929
- ]
2935
+ key: ConfigKey.group_standardItemLead,
2936
+ description: "Item, lead, page number, and margin number for the bot action response."
2930
2937
  },
2931
2938
  {
2932
2939
  key: ConfigKey.tag_instruction,
@@ -3013,19 +3020,20 @@ var CARDSETS = {
3013
3020
  description: "Title of the ingredient."
3014
3021
  },
3015
3022
  {
3016
- key: ConfigKey.group_trueFalse,
3017
- description: "Group for true/false properties of the ingredient."
3023
+ key: ConfigKey.tag_true,
3024
+ description: "Checked state for the ingredient.",
3025
+ jsonKey: "ingredient|set(checked=true)",
3026
+ maxCount: 1
3018
3027
  },
3019
3028
  {
3020
- key: ConfigKey.tag_item,
3021
- description: "The item for the ingredient.",
3022
- chain: [
3023
- {
3024
- key: ConfigKey.tag_item,
3025
- description: "Lead, page number, source page number, and margin number.",
3026
- maxCount: 4
3027
- }
3028
- ]
3029
+ key: ConfigKey.tag_false,
3030
+ description: "Unchecked state for the ingredient.",
3031
+ jsonKey: "ingredient|set(checked=false)",
3032
+ maxCount: 1
3033
+ },
3034
+ {
3035
+ key: ConfigKey.group_standardItemLead,
3036
+ description: "Item, lead, page number, and margin number for the ingredient."
3029
3037
  },
3030
3038
  {
3031
3039
  key: ConfigKey.tag_instruction,
@@ -3164,8 +3172,7 @@ var GROUPS = {
3164
3172
  {
3165
3173
  key: ConfigKey.property_validationDate,
3166
3174
  description: "The date when the bit was validated",
3167
- format: TagFormat.plainText,
3168
- defaultValue: ""
3175
+ format: TagFormat.plainText
3169
3176
  },
3170
3177
  {
3171
3178
  key: ConfigKey.property_aiGenerated,
@@ -3310,6 +3317,7 @@ var GROUPS = {
3310
3317
  },
3311
3318
  {
3312
3319
  key: ConfigKey.property_groupTag,
3320
+ jsonKey: "groupTag.name",
3313
3321
  description: "The group tag(s) for the bit",
3314
3322
  format: TagFormat.plainText,
3315
3323
  maxCount: Count.infinity,
@@ -3340,6 +3348,12 @@ var GROUPS = {
3340
3348
  format: TagFormat.plainText,
3341
3349
  maxCount: Count.infinity
3342
3350
  },
3351
+ {
3352
+ key: ConfigKey.property_extractorInternal,
3353
+ description: "Internal metadata used by the extractor for processing purposes",
3354
+ format: TagFormat.plainText,
3355
+ maxCount: Count.infinity
3356
+ },
3343
3357
  {
3344
3358
  key: ConfigKey.property_levelCEFRp,
3345
3359
  description: "The CEFRp level for the bit",
@@ -3406,20 +3420,48 @@ var GROUPS = {
3406
3420
  }
3407
3421
  ]
3408
3422
  },
3409
- [ConfigKey.group_standardItemLeadInstructionHint]: {
3423
+ [ConfigKey.group_standardItemLead]: {
3410
3424
  type: GroupConfigType.standard,
3411
- description: "Standard group for item, lead, page number, source page number, margin number, instruction and hint tags",
3425
+ description: "Standard group for item, lead, page number, and margin number tags",
3412
3426
  tags: [
3413
3427
  {
3414
3428
  key: ConfigKey.tag_item,
3429
+ jsonKey: "item",
3415
3430
  description: "The item for the bit",
3416
3431
  chain: [
3417
3432
  {
3418
3433
  key: ConfigKey.tag_item,
3419
- description: "The lead, page number, source page number, and margin number for the bit",
3420
- maxCount: 4
3434
+ jsonKey: "lead",
3435
+ description: "The lead for the bit",
3436
+ maxCount: 1,
3437
+ chain: [
3438
+ {
3439
+ key: ConfigKey.tag_item,
3440
+ jsonKey: "pageNumber",
3441
+ description: "The page number for the bit",
3442
+ maxCount: 1,
3443
+ chain: [
3444
+ {
3445
+ key: ConfigKey.tag_item,
3446
+ jsonKey: "marginNumber",
3447
+ description: "The margin number for the bit",
3448
+ maxCount: 1
3449
+ }
3450
+ ]
3451
+ }
3452
+ ]
3421
3453
  }
3422
3454
  ]
3455
+ }
3456
+ ]
3457
+ },
3458
+ [ConfigKey.group_standardItemLeadInstructionHint]: {
3459
+ type: GroupConfigType.standard,
3460
+ description: "Standard group for item, lead, page number, margin number, instruction and hint tags",
3461
+ tags: [
3462
+ {
3463
+ key: ConfigKey.group_standardItemLead,
3464
+ description: "Item, lead, page number, and margin number tags"
3423
3465
  },
3424
3466
  {
3425
3467
  key: ConfigKey.tag_instruction,
@@ -3458,6 +3500,7 @@ var GROUPS = {
3458
3500
  tags: [
3459
3501
  {
3460
3502
  key: ConfigKey.property_imageSource,
3503
+ jsonKey: "imageSource.url",
3461
3504
  description: "The source of an image",
3462
3505
  format: TagFormat.plainText,
3463
3506
  chain: [
@@ -3491,6 +3534,7 @@ var GROUPS = {
3491
3534
  tags: [
3492
3535
  {
3493
3536
  key: ConfigKey.property_technicalTerm,
3537
+ jsonKey: "technicalTerm.technicalTerm",
3494
3538
  description: "The technical term",
3495
3539
  format: TagFormat.plainText,
3496
3540
  chain: [
@@ -3509,6 +3553,7 @@ var GROUPS = {
3509
3553
  tags: [
3510
3554
  {
3511
3555
  key: ConfigKey.property_person,
3556
+ jsonKey: "person.name",
3512
3557
  description: "A person",
3513
3558
  format: TagFormat.plainText,
3514
3559
  chain: [
@@ -3526,6 +3571,7 @@ var GROUPS = {
3526
3571
  {
3527
3572
  // Deprecated (parter renamed to person)
3528
3573
  key: ConfigKey.property_partner,
3574
+ jsonKey: "partner.name",
3529
3575
  description: "A partner",
3530
3576
  format: TagFormat.plainText,
3531
3577
  chain: [
@@ -3553,6 +3599,7 @@ var GROUPS = {
3553
3599
  chain: [
3554
3600
  {
3555
3601
  key: ConfigKey.tag_gap,
3602
+ jsonKey: "solutions[]",
3556
3603
  description: "Alternative values for the gaps in the content",
3557
3604
  maxCount: Count.infinity
3558
3605
  },
@@ -3562,13 +3609,16 @@ var GROUPS = {
3562
3609
  },
3563
3610
  {
3564
3611
  key: ConfigKey.property_example,
3612
+ jsonKey: "example",
3565
3613
  description: "An example for the gap",
3566
3614
  format: TagFormat.plainText
3567
3615
  },
3568
3616
  {
3569
3617
  key: ConfigKey.property_isCaseSensitive,
3618
+ jsonKey: "isCaseSensitive",
3570
3619
  description: "If true, the gap text is case sensitive",
3571
- format: TagFormat.boolean
3620
+ format: TagFormat.boolean,
3621
+ defaultValue: "true"
3572
3622
  }
3573
3623
  ]
3574
3624
  }
@@ -3585,11 +3635,13 @@ var GROUPS = {
3585
3635
  chain: [
3586
3636
  {
3587
3637
  key: ConfigKey.tag_true,
3638
+ jsonKey: "choices[]|set(isCorrect=true)",
3588
3639
  description: "True values for a true/false statement/question",
3589
3640
  maxCount: Count.infinity
3590
3641
  },
3591
3642
  {
3592
3643
  key: ConfigKey.tag_false,
3644
+ jsonKey: "choices[]|set(isCorrect=false)",
3593
3645
  description: "False values for a true/false statement/question",
3594
3646
  maxCount: Count.infinity
3595
3647
  },
@@ -3599,6 +3651,7 @@ var GROUPS = {
3599
3651
  },
3600
3652
  {
3601
3653
  key: ConfigKey.property_example,
3654
+ jsonKey: "example",
3602
3655
  description: "An example for the true/false statement/question",
3603
3656
  format: TagFormat.plainText
3604
3657
  }
@@ -3611,11 +3664,13 @@ var GROUPS = {
3611
3664
  chain: [
3612
3665
  {
3613
3666
  key: ConfigKey.tag_true,
3667
+ jsonKey: "choices[]|set(isCorrect=true)",
3614
3668
  description: "True values for a true/false statement/question",
3615
3669
  maxCount: Count.infinity
3616
3670
  },
3617
3671
  {
3618
3672
  key: ConfigKey.tag_false,
3673
+ jsonKey: "choices[]|set(isCorrect=false)",
3619
3674
  description: "False values for a true/false statement/question",
3620
3675
  maxCount: Count.infinity
3621
3676
  },
@@ -3625,6 +3680,7 @@ var GROUPS = {
3625
3680
  },
3626
3681
  {
3627
3682
  key: ConfigKey.property_example,
3683
+ jsonKey: "example",
3628
3684
  description: "An example for the true/false statement/question",
3629
3685
  format: TagFormat.plainText
3630
3686
  }
@@ -3638,6 +3694,7 @@ var GROUPS = {
3638
3694
  tags: [
3639
3695
  {
3640
3696
  key: ConfigKey.property_mark,
3697
+ jsonKey: "marks.mark",
3641
3698
  description: "The mark configuration",
3642
3699
  format: TagFormat.plainText,
3643
3700
  maxCount: Count.infinity,
@@ -3667,11 +3724,13 @@ var GROUPS = {
3667
3724
  chain: [
3668
3725
  {
3669
3726
  key: ConfigKey.property_mark,
3727
+ jsonKey: "mark",
3670
3728
  description: "The mark configuration",
3671
3729
  format: TagFormat.plainText
3672
3730
  },
3673
3731
  {
3674
3732
  key: ConfigKey.property_example,
3733
+ jsonKey: "example",
3675
3734
  description: "An example for the marked content",
3676
3735
  format: TagFormat.plainText
3677
3736
  }
@@ -3842,7 +3901,8 @@ var GROUPS = {
3842
3901
  {
3843
3902
  key: ConfigKey.property_maxTocChapterLevel,
3844
3903
  description: "The maximum table of contents chapter level",
3845
- format: TagFormat.number
3904
+ format: TagFormat.number,
3905
+ defaultValue: "-1"
3846
3906
  },
3847
3907
  {
3848
3908
  key: ConfigKey.property_sourceDocument,
@@ -3924,12 +3984,14 @@ var GROUPS = {
3924
3984
  {
3925
3985
  key: ConfigKey.property_isTracked,
3926
3986
  description: "If true, the learning path is tracked",
3927
- format: TagFormat.boolean
3987
+ format: TagFormat.boolean,
3988
+ defaultValue: "true"
3928
3989
  },
3929
3990
  {
3930
3991
  key: ConfigKey.property_isInfoOnly,
3931
3992
  description: "If true, the learning path is info only",
3932
- format: TagFormat.boolean
3993
+ format: TagFormat.boolean,
3994
+ defaultValue: "false"
3933
3995
  },
3934
3996
  {
3935
3997
  key: ConfigKey.property_deeplink,
@@ -4273,6 +4335,7 @@ var GROUPS = {
4273
4335
  },
4274
4336
  {
4275
4337
  key: ConfigKey.property_posterImage,
4338
+ jsonKey: "posterImage.src",
4276
4339
  description: "The poster image for the video",
4277
4340
  format: TagFormat.plainText,
4278
4341
  chain: [
@@ -4798,27 +4861,24 @@ var ConfigHydrator = class {
4798
4861
  const v = this.hydrateCardVariantConfig(_variant);
4799
4862
  variantsOfSide.push(v);
4800
4863
  }
4801
- const sideConfig = new CardSideConfig(_side.name, _side.repeat ?? false, variantsOfSide);
4864
+ const sideConfig = new CardSideConfig(
4865
+ _side.name,
4866
+ _side.repeat ?? false,
4867
+ variantsOfSide,
4868
+ _side.jsonKey
4869
+ );
4802
4870
  sides.push(sideConfig);
4803
4871
  }
4804
4872
  const cardSetConfig = new CardSetConfig(
4805
4873
  _cardSet,
4806
4874
  _cardSetConfig.jsonKey,
4807
- _cardSetConfig.itemType ?? "object",
4808
4875
  _cardSetConfig.sections,
4809
4876
  sides
4810
4877
  );
4811
4878
  return cardSetConfig;
4812
4879
  }
4813
4880
  hydrateTagConfig(_tag) {
4814
- const {
4815
- key: _configKey,
4816
- maxCount,
4817
- minCount,
4818
- chain: _chain,
4819
- secondaryJsonKey,
4820
- deprecated
4821
- } = _tag;
4881
+ const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
4822
4882
  const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4823
4883
  if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
4824
4884
  const tag = Enum2(Tag).fromValue(configKey);
@@ -4833,7 +4893,6 @@ var ConfigHydrator = class {
4833
4893
  maxCount: maxCount ?? MAX_COUNT_DEFAULT,
4834
4894
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4835
4895
  chain,
4836
- secondaryJsonKey,
4837
4896
  deprecated
4838
4897
  });
4839
4898
  return {
@@ -4852,8 +4911,7 @@ var ConfigHydrator = class {
4852
4911
  format,
4853
4912
  values,
4854
4913
  defaultValue,
4855
- jsonKey,
4856
- secondaryJsonKey
4914
+ jsonKey
4857
4915
  } = _tag;
4858
4916
  const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4859
4917
  if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
@@ -4869,7 +4927,6 @@ var ConfigHydrator = class {
4869
4927
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4870
4928
  chain,
4871
4929
  jsonKey,
4872
- secondaryJsonKey,
4873
4930
  format,
4874
4931
  values,
4875
4932
  defaultValue,
@@ -4882,15 +4939,7 @@ var ConfigHydrator = class {
4882
4939
  };
4883
4940
  }
4884
4941
  hydrateResourceTagConfig(_tag) {
4885
- const {
4886
- key: _configKey,
4887
- maxCount,
4888
- minCount,
4889
- chain: _chain,
4890
- deprecated,
4891
- jsonKey,
4892
- secondaryJsonKey
4893
- } = _tag;
4942
+ const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
4894
4943
  const configKey = Enum2(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
4895
4944
  if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
4896
4945
  const tag = _configKey.substring(1);
@@ -4905,7 +4954,6 @@ var ConfigHydrator = class {
4905
4954
  minCount: minCount ?? MIN_COUNT_DEFAULT,
4906
4955
  chain,
4907
4956
  jsonKey,
4908
- secondaryJsonKey,
4909
4957
  deprecated
4910
4958
  });
4911
4959
  return {
@@ -6206,7 +6254,8 @@ var BITS = {
6206
6254
  {
6207
6255
  key: ConfigKey.property_isCaseSensitive,
6208
6256
  description: "If the cloze answers are case sensitive",
6209
- format: TagFormat.boolean
6257
+ format: TagFormat.boolean,
6258
+ defaultValue: "true"
6210
6259
  },
6211
6260
  {
6212
6261
  key: ConfigKey.property_quizCountItems,
@@ -6652,6 +6701,7 @@ var BITS = {
6652
6701
  },
6653
6702
  {
6654
6703
  key: ConfigKey.property_servings,
6704
+ jsonKey: "servings.servings",
6655
6705
  description: "The number of servings for the ingredients",
6656
6706
  format: TagFormat.number,
6657
6707
  chain: [
@@ -8907,7 +8957,8 @@ var BITS = {
8907
8957
  {
8908
8958
  key: ConfigKey.property_isCaseSensitive,
8909
8959
  description: "Case sensitivity for matching pairs, used to define if matches are case-sensitive",
8910
- format: TagFormat.boolean
8960
+ format: TagFormat.boolean,
8961
+ defaultValue: "true"
8911
8962
  }
8912
8963
  ],
8913
8964
  cardSet: CardSetConfigKey.matchPairs
@@ -9357,7 +9408,8 @@ var BITS = {
9357
9408
  {
9358
9409
  key: ConfigKey.property_platformBrandTarget,
9359
9410
  description: 'The platform brand target (typically "light", "dark" or "none")',
9360
- format: TagFormat.plainText
9411
+ format: TagFormat.plainText,
9412
+ defaultValue: "none"
9361
9413
  }
9362
9414
  ]
9363
9415
  },
@@ -9380,7 +9432,8 @@ var BITS = {
9380
9432
  {
9381
9433
  key: ConfigKey.property_platformLogoMaxHeight,
9382
9434
  description: "Maximum height for the platform logo",
9383
- format: TagFormat.number
9435
+ format: TagFormat.number,
9436
+ defaultValue: "40"
9384
9437
  },
9385
9438
  {
9386
9439
  key: ConfigKey.group_platformStylesCommon,
@@ -9553,7 +9606,8 @@ var BITS = {
9553
9606
  {
9554
9607
  key: ConfigKey.property_resolved,
9555
9608
  description: "Resolved status for the review note, used to indicate if the note is resolved",
9556
- format: TagFormat.boolean
9609
+ format: TagFormat.boolean,
9610
+ defaultValue: "false"
9557
9611
  },
9558
9612
  {
9559
9613
  key: ConfigKey.property_resolvedDate,
@@ -9740,6 +9794,7 @@ var BITS = {
9740
9794
  tags: [
9741
9795
  {
9742
9796
  key: ConfigKey.property_ratingLevelStart,
9797
+ jsonKey: "ratingLevelStart.level",
9743
9798
  description: "Start level for the rating survey, used to define the lowest rating",
9744
9799
  format: TagFormat.number,
9745
9800
  chain: [
@@ -9752,6 +9807,7 @@ var BITS = {
9752
9807
  },
9753
9808
  {
9754
9809
  key: ConfigKey.property_ratingLevelEnd,
9810
+ jsonKey: "ratingLevelEnd.level",
9755
9811
  description: "End level for the rating survey, used to define the highest rating",
9756
9812
  format: TagFormat.number,
9757
9813
  chain: [
@@ -9820,28 +9876,32 @@ var BITS = {
9820
9876
  {
9821
9877
  key: ConfigKey.property_tableFixedHeader,
9822
9878
  description: "Fixed header for the table, used to keep the header visible while scrolling",
9823
- format: TagFormat.boolean
9879
+ format: TagFormat.boolean,
9880
+ defaultValue: "false"
9824
9881
  },
9825
9882
  {
9826
9883
  key: ConfigKey.property_tableHeaderWhitespaceNoWrap,
9827
9884
  description: "No wrap for table header whitespace, used to prevent header text wrapping",
9828
- format: TagFormat.boolean
9829
- // defaultValue: 'false',
9885
+ format: TagFormat.boolean,
9886
+ defaultValue: "false"
9830
9887
  },
9831
9888
  {
9832
9889
  key: ConfigKey.property_tableSearch,
9833
9890
  description: "Search functionality for the table, used to enable searching within the table",
9834
- format: TagFormat.boolean
9891
+ format: TagFormat.boolean,
9892
+ defaultValue: "false"
9835
9893
  },
9836
9894
  {
9837
9895
  key: ConfigKey.property_tableSort,
9838
9896
  description: "Sorting functionality for the table, used to enable sorting of table columns",
9839
- format: TagFormat.boolean
9897
+ format: TagFormat.boolean,
9898
+ defaultValue: "false"
9840
9899
  },
9841
9900
  {
9842
9901
  key: ConfigKey.property_tablePagination,
9843
9902
  description: "Pagination for the table, used to limit the number of rows displayed at once",
9844
- format: TagFormat.boolean
9903
+ format: TagFormat.boolean,
9904
+ defaultValue: "false"
9845
9905
  },
9846
9906
  {
9847
9907
  key: ConfigKey.property_tablePaginationLimit,
@@ -9858,24 +9918,26 @@ var BITS = {
9858
9918
  {
9859
9919
  key: ConfigKey.property_tableWhitespaceNoWrap,
9860
9920
  description: "No wrap for table whitespace, used to prevent text wrapping in table cells",
9861
- format: TagFormat.boolean
9862
- // defaultValue: 'false',
9921
+ format: TagFormat.boolean,
9922
+ defaultValue: "false"
9863
9923
  },
9864
9924
  {
9865
9925
  key: ConfigKey.property_tableAutoWidth,
9866
9926
  description: "Auto width for table columns, used to automatically adjust column widths",
9867
- format: TagFormat.boolean
9868
- // defaultValue: 'true',
9927
+ format: TagFormat.boolean,
9928
+ defaultValue: "true"
9869
9929
  },
9870
9930
  {
9871
9931
  key: ConfigKey.property_tableResizableColumns,
9872
9932
  description: "Resizable columns for the table, used to allow users to resize table columns",
9873
- format: TagFormat.boolean
9933
+ format: TagFormat.boolean,
9934
+ defaultValue: "false"
9874
9935
  },
9875
9936
  {
9876
9937
  key: ConfigKey.property_tableColumnMinWidth,
9877
9938
  description: "Minimum width for table columns, used to define the minimum width of columns",
9878
- format: TagFormat.number
9939
+ format: TagFormat.number,
9940
+ defaultValue: "0"
9879
9941
  }
9880
9942
  ],
9881
9943
  cardSet: CardSetConfigKey.table
@@ -9883,7 +9945,8 @@ var BITS = {
9883
9945
  [BitType.tableExtended]: {
9884
9946
  since: "4.14.0",
9885
9947
  baseBitType: BitType.table,
9886
- description: "Extended table bit, used to create complex tables with all HTML table features"
9948
+ description: "Extended table bit, used to create complex tables with all HTML table features",
9949
+ cardSet: CardSetConfigKey.tableExtended
9887
9950
  },
9888
9951
  [BitType.tableExtendedImage]: {
9889
9952
  since: "5.13.0",
@@ -10849,7 +10912,6 @@ var Config = class {
10849
10912
  maxCount: 1,
10850
10913
  chain: tag.chain,
10851
10914
  jsonKey: tag.jsonKey,
10852
- secondaryJsonKey: tag.secondaryJsonKey,
10853
10915
  deprecated: tag.deprecated
10854
10916
  });
10855
10917
  finalResourceTags[k] = newTag;
@@ -10954,7 +11016,7 @@ var instance2 = new Config();
10954
11016
  // src/generated/package_info.ts
10955
11017
  var PACKAGE_INFO = {
10956
11018
  "name": "@gmb/bitmark-parser-generator",
10957
- "version": "5.19.0",
11019
+ "version": "5.21.0",
10958
11020
  "author": "Get More Brain Ltd",
10959
11021
  "license": "ISC",
10960
11022
  "description": "A bitmark parser and generator using Peggy.js"
@@ -11515,6 +11577,8 @@ var NodeType = {
11515
11577
  extractorExtractionTimestampValue: "extractorExtractionTimestampValue",
11516
11578
  extractorTag: "extractorTag",
11517
11579
  extractorTagValue: "extractorTagValue",
11580
+ extractorInternal: "extractorInternal",
11581
+ extractorInternalValue: "extractorInternalValue",
11518
11582
  extraProperties: "extraProperties",
11519
11583
  feedback: "feedback",
11520
11584
  feedbackEngine: "feedbackEngine",
@@ -11920,6 +11984,8 @@ var NodeType = {
11920
11984
  table: "table",
11921
11985
  tableAutoWidth: "tableAutoWidth",
11922
11986
  tableAutoWidthValue: "tableAutoWidthValue",
11987
+ tableColWidth: "tableColWidth",
11988
+ tableColWidthValue: "tableColWidthValue",
11923
11989
  tableColumnMinWidth: "tableColumnMinWidth",
11924
11990
  tableColumnMinWidthValue: "tableColumnMinWidthValue",
11925
11991
  tableFixedHeader: "tableFixedHeader",
@@ -12705,6 +12771,31 @@ var AstWalkerGenerator = class {
12705
12771
  }
12706
12772
  return void 0;
12707
12773
  }
12774
+ getSiblingNodes(route) {
12775
+ const parentNode = this.getParentNode(route);
12776
+ if (!parentNode || !parentNode.value || !Array.isArray(parentNode.value)) {
12777
+ return {};
12778
+ }
12779
+ const siblings = parentNode.value;
12780
+ const index = siblings.findIndex((s) => s === route[route.length - 1]?.value);
12781
+ if (index === -1) {
12782
+ return {};
12783
+ }
12784
+ return {
12785
+ left: index > 0 ? siblings[index - 1] : void 0,
12786
+ right: index < siblings.length - 1 ? siblings[index + 1] : void 0
12787
+ };
12788
+ }
12789
+ isEmptyParagraph(node) {
12790
+ if (!node) return false;
12791
+ if (node.type !== TextNodeType.paragraph) return false;
12792
+ if (!node.content || !Array.isArray(node.content)) return true;
12793
+ for (const contentNode of node.content) {
12794
+ if (contentNode.type !== TextNodeType.text) return false;
12795
+ if (contentNode.text && contentNode.text.trim() !== "") return false;
12796
+ }
12797
+ return true;
12798
+ }
12708
12799
  };
12709
12800
 
12710
12801
  // src/generator/text/TextGenerator.ts
@@ -12830,7 +12921,6 @@ var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
12830
12921
  __publicField(this, "inParagraph", false);
12831
12922
  __publicField(this, "inHeading", false);
12832
12923
  __publicField(this, "inCodeBlock", false);
12833
- __publicField(this, "exitedCodeBlock", false);
12834
12924
  __publicField(this, "inBulletList", false);
12835
12925
  __publicField(this, "inInline", false);
12836
12926
  __publicField(this, "markDepth", 0);
@@ -12919,7 +13009,6 @@ var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
12919
13009
  this.inParagraph = false;
12920
13010
  this.inHeading = false;
12921
13011
  this.inCodeBlock = false;
12922
- this.exitedCodeBlock = false;
12923
13012
  this.inBulletList = false;
12924
13013
  this.inInline = false;
12925
13014
  this.markDepth = 0;
@@ -12985,7 +13074,7 @@ var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
12985
13074
  switch (node.type) {
12986
13075
  case TextNodeType.paragraph:
12987
13076
  this.inParagraph = true;
12988
- this.writeParagraph(node);
13077
+ this.writeParagraph(node, route);
12989
13078
  break;
12990
13079
  case TextNodeType.hardBreak:
12991
13080
  this.writeHardBreak(node);
@@ -13042,7 +13131,6 @@ var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
13042
13131
  return false;
13043
13132
  default:
13044
13133
  }
13045
- this.exitedCodeBlock = false;
13046
13134
  }
13047
13135
  handleBetweenNode(node, _left, _right, _route) {
13048
13136
  switch (node.type) {
@@ -13076,7 +13164,6 @@ var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
13076
13164
  this.writeNL();
13077
13165
  this.writeNL();
13078
13166
  this.inCodeBlock = false;
13079
- this.exitedCodeBlock = true;
13080
13167
  break;
13081
13168
  case TextNodeType.noBulletList:
13082
13169
  case TextNodeType.bulletList:
@@ -13440,21 +13527,19 @@ var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
13440
13527
  }
13441
13528
  }
13442
13529
  }
13443
- writeParagraph(node) {
13530
+ writeParagraph(node, route) {
13444
13531
  if (this.textFormat === TextFormat.bitmarkText) {
13445
13532
  if (this.inBulletList) return;
13446
- const nodeContentLength = node.content?.length ?? 0;
13447
- if (this.nodeIndex === 0) {
13448
- if (nodeContentLength === 1) {
13449
- const isTextNode = node.content?.[0].type === TextNodeType.text;
13450
- const text = node.content?.[0].text ?? "";
13451
- if (!isTextNode || text !== "") return;
13452
- }
13453
- if (nodeContentLength > 1) return;
13533
+ const siblingNodes = this.getSiblingNodes(route);
13534
+ const prevSiblingNodeType = siblingNodes.left?.type;
13535
+ const inBody = this.textLocation === TextLocation.body;
13536
+ const isEmptyParagraph = this.isEmptyParagraph(node);
13537
+ if (!inBody || !isEmptyParagraph && !(prevSiblingNodeType === TextNodeType.codeBlock || prevSiblingNodeType === TextNodeType.paragraph)) {
13538
+ return;
13454
13539
  }
13455
13540
  this.write("|");
13456
13541
  this.writeNL();
13457
- if (this.exitedCodeBlock) {
13542
+ if (prevSiblingNodeType === TextNodeType.codeBlock) {
13458
13543
  this.writeNL();
13459
13544
  }
13460
13545
  }
@@ -24912,6 +24997,12 @@ var Builder = class extends BaseBuilder {
24912
24997
  data.extractorTag,
24913
24998
  options
24914
24999
  ),
25000
+ extractorInternal: this.toAstProperty(
25001
+ bitType,
25002
+ ConfigKey.property_extractorInternal,
25003
+ data.extractorInternal,
25004
+ options
25005
+ ),
24915
25006
  levelCEFRp: this.toAstProperty(
24916
25007
  bitType,
24917
25008
  ConfigKey.property_levelCEFRp,
@@ -26399,6 +26490,7 @@ var Builder = class extends BaseBuilder {
26399
26490
  if (cell.rowspan != null) tableCell.rowspan = cell.rowspan;
26400
26491
  if (cell.colspan != null) tableCell.colspan = cell.colspan;
26401
26492
  if (cell.scope) tableCell.scope = cell.scope;
26493
+ if (cell.colwidth != null) tableCell.colwidth = cell.colwidth;
26402
26494
  return tableCell;
26403
26495
  });
26404
26496
  return {
@@ -28694,6 +28786,10 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
28694
28786
  this.writeTableCellProperty("tableScope", cell.scope);
28695
28787
  this.writeNL();
28696
28788
  }
28789
+ if (cell.colwidth && cell.colwidth > 0) {
28790
+ this.writeTableCellProperty("tableColWidth", cell.colwidth);
28791
+ this.writeNL();
28792
+ }
28697
28793
  const content = cell.content ?? instance3.EMPTY_STRING;
28698
28794
  this.writeTextOrValue(content, this.textFormat, TextLocation.body);
28699
28795
  }
@@ -31256,7 +31352,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
31256
31352
  if (bitJson.isTracked == null) bitJson.isTracked = true;
31257
31353
  if (bitJson.isInfoOnly == null) bitJson.isInfoOnly = false;
31258
31354
  }
31259
- if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage)) {
31355
+ const tableImageHasTable = instance2.isOfBitType(bitType, BitType.tableImage) && !this.tableIsEmpty(bitJson.table);
31356
+ if (instance2.isOfBitType(bitType, BitType.table) && !instance2.isOfBitType(bitType, BitType.tableImage) || tableImageHasTable) {
31260
31357
  if (bitJson.tableFixedHeader == null) bitJson.tableFixedHeader = false;
31261
31358
  if (bitJson.tableHeaderWhitespaceNoWrap == null) {
31262
31359
  bitJson.tableHeaderWhitespaceNoWrap = false;
@@ -31271,10 +31368,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
31271
31368
  if (bitJson.tableResizableColumns == null) bitJson.tableResizableColumns = false;
31272
31369
  if (bitJson.tableColumnMinWidth == null) bitJson.tableColumnMinWidth = 0;
31273
31370
  }
31274
- if (instance2.isOfBitType(bitType, BitType.tableImage)) {
31275
- if (this.tableIsEmpty(bitJson.table)) {
31276
- delete bitJson.table;
31277
- }
31371
+ if (instance2.isOfBitType(bitType, BitType.tableImage) && !tableImageHasTable) {
31372
+ delete bitJson.table;
31278
31373
  }
31279
31374
  if (instance2.isOfBitType(bitType, BitType.bookReference)) {
31280
31375
  if (bitJson.refAuthor == null) bitJson.refAuthor = [];
@@ -34092,11 +34187,19 @@ function parseTable(context, _bitType, cardSet) {
34092
34187
  const rowSpanRaw = tags2.tableRowSpan ?? readExtraProperty(tags2.extraProperties, "tableRowSpan");
34093
34188
  const colSpanRaw = tags2.tableColSpan ?? readExtraProperty(tags2.extraProperties, "tableColSpan");
34094
34189
  const scopeRaw = tags2.tableScope ?? readExtraProperty(tags2.extraProperties, "tableScope");
34095
- cleanupExtraProperties(tags2, ["tableCellType", "tableRowSpan", "tableColSpan", "tableScope"]);
34190
+ const colWidthRaw = tags2.tableColWidth ?? readExtraProperty(tags2.extraProperties, "tableColWidth");
34191
+ cleanupExtraProperties(tags2, [
34192
+ "tableCellType",
34193
+ "tableRowSpan",
34194
+ "tableColSpan",
34195
+ "tableScope",
34196
+ "tableColWidth"
34197
+ ]);
34096
34198
  const cellType = normalizeCellType(cellTypeRaw, section);
34097
34199
  const rowspan = normalizeSpan(rowSpanRaw, "rowspan");
34098
34200
  const colspan = normalizeSpan(colSpanRaw, "colspan");
34099
34201
  const scope = normalizeScope(scopeRaw);
34202
+ const colwidth = instance6.asNumber(colWidthRaw) ?? 0;
34100
34203
  const cell = {
34101
34204
  content
34102
34205
  };
@@ -34104,6 +34207,7 @@ function parseTable(context, _bitType, cardSet) {
34104
34207
  if (rowspan > 1) cell.rowspan = rowspan;
34105
34208
  if (colspan > 1) cell.colspan = colspan;
34106
34209
  if (scope) cell.scope = scope;
34210
+ if (colwidth > 0) cell.colwidth = colwidth;
34107
34211
  return cell;
34108
34212
  };
34109
34213
  const resolveSectionQualifier = (card) => {
@@ -34490,6 +34594,15 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
34490
34594
  }
34491
34595
 
34492
34596
  // src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
34597
+ function flattenChainContent(content) {
34598
+ const result = [content];
34599
+ if (content.chain) {
34600
+ for (const child of content.chain) {
34601
+ result.push(...flattenChainContent(child));
34602
+ }
34603
+ }
34604
+ return result;
34605
+ }
34493
34606
  function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
34494
34607
  if (contentDepth === ContentDepth.Chain) {
34495
34608
  itemLeadTagContentProcessor(context, contentDepth, tagsConfig, content, target);
@@ -34500,7 +34613,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
34500
34613
  function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
34501
34614
  if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
34502
34615
  const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Enum15(Tag).fromValue(content.type));
34503
- const chainContent = [content, ...content.chain ?? []];
34616
+ const chainContent = flattenChainContent(content);
34504
34617
  const chainTags = context.bitContentProcessor(
34505
34618
  ContentDepth.Chain,
34506
34619
  itemLeadConfig?.chain,
@@ -35057,7 +35170,6 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
35057
35170
  minCount: 1,
35058
35171
  chain: void 0,
35059
35172
  jsonKey: void 0,
35060
- secondaryJsonKey: void 0,
35061
35173
  format: TagFormat.bitmarkText,
35062
35174
  values: void 0,
35063
35175
  defaultValue: void 0,
@@ -40064,7 +40176,6 @@ var normalizeCardKey = (cardSetKey) => stringUtils.camelToKebab(cardSetKey);
40064
40176
  var ConfigBuilder = class {
40065
40177
  build(options) {
40066
40178
  const opts = Object.assign({}, options);
40067
- this.buildFlat(opts);
40068
40179
  const bitConfigs = [];
40069
40180
  const groupConfigs = [];
40070
40181
  const bitGroupConfigKeys = /* @__PURE__ */ new Set();
@@ -40135,7 +40246,7 @@ var ConfigBuilder = class {
40135
40246
  const keyToJsonKey = (key, tagNameChain) => {
40136
40247
  let jsonKey = key;
40137
40248
  if (key === "%") {
40138
- jsonKey = "item_todo";
40249
+ jsonKey = "item";
40139
40250
  } else if (key === "!") {
40140
40251
  jsonKey = "instruction";
40141
40252
  } else if (key === "?") {
@@ -40151,13 +40262,13 @@ var ConfigBuilder = class {
40151
40262
  } else if (key === "$") {
40152
40263
  jsonKey = "sampleSolution";
40153
40264
  } else if (key === "+") {
40154
- jsonKey = "true_todo";
40265
+ jsonKey = "choices[]|set(isCorrect=true)";
40155
40266
  } else if (key === "-") {
40156
- jsonKey = "false_todo";
40267
+ jsonKey = "choices[]|set(isCorrect=false)";
40157
40268
  } else if (key === "_") {
40158
- jsonKey = "gap_todo";
40269
+ jsonKey = "solutions[]";
40159
40270
  } else if (key === "=") {
40160
- jsonKey = "mark_todo";
40271
+ jsonKey = "solution";
40161
40272
  } else if (key.startsWith("@")) {
40162
40273
  jsonKey = key.substring(1);
40163
40274
  } else if (key.startsWith("&")) {
@@ -40208,7 +40319,7 @@ var ConfigBuilder = class {
40208
40319
  if (Array.isArray(tag.chain) && tag.chain.length > 0) {
40209
40320
  const chainTags = [];
40210
40321
  for (const [_tagKey, chainTag] of tag.chain.entries()) {
40211
- chainTags.push(...processTagEntries(chainTag, [...tagNameChain, jsonKey]));
40322
+ chainTags.push(...processTagEntries(chainTag, []));
40212
40323
  }
40213
40324
  chain = chainTags;
40214
40325
  }
@@ -40216,10 +40327,8 @@ var ConfigBuilder = class {
40216
40327
  type: "tag",
40217
40328
  key: tagName,
40218
40329
  jsonKey,
40219
- ...tag.secondaryJsonKey ? { secondaryJsonKey: tag.secondaryJsonKey } : {},
40220
40330
  format,
40221
- default: null,
40222
- alwaysInclude: false,
40331
+ default: tag.defaultValue ?? null,
40223
40332
  min: tag.minCount == null ? 0 : tag.minCount,
40224
40333
  max: tag.maxCount == null ? 1 : tag.maxCount,
40225
40334
  description: tag.description ?? "",
@@ -40253,22 +40362,51 @@ var ConfigBuilder = class {
40253
40362
  ...variant.jsonKey !== void 0 ? { jsonKey: variant.jsonKey } : {},
40254
40363
  tags: variantTags,
40255
40364
  repeatCount: variant.repeatCount ?? 1,
40256
- bodyAllowed: variant.bodyAllowed ?? true,
40257
- bodyRequired: variant.bodyRequired ?? false
40365
+ ...variant.bodyRequired ? { bodyRequired: true } : {},
40366
+ ...variant.bodyAllowed === false ? { bodyForbidden: true } : {}
40258
40367
  };
40259
40368
  });
40260
40369
  return {
40261
40370
  name: side.name,
40262
40371
  ...side.repeat ? { repeat: side.repeat } : {},
40372
+ ...side.jsonKey != null ? { jsonKey: side.jsonKey } : {},
40263
40373
  variants
40264
40374
  };
40265
40375
  });
40376
+ if (cardSetConfig.sections) {
40377
+ const cards = Object.entries(cardSetConfig.sections).map(([sectionName, section]) => {
40378
+ let cardSides = section.sideJsonKey ? sides.map((s) => ({ ...s, jsonKey: section.sideJsonKey })) : sides;
40379
+ if (normalizedKey === "table-extended" && sectionName !== "table-header") {
40380
+ cardSides = JSON.parse(JSON.stringify(cardSides));
40381
+ for (const side of cardSides) {
40382
+ for (const variant of side.variants) {
40383
+ for (const tag of variant.tags) {
40384
+ if (tag.type === "tag" && tag.key === "#" && tag.jsonKey === ".") {
40385
+ tag.jsonKey = "^table.header.rows.cells[{s}].content";
40386
+ }
40387
+ }
40388
+ }
40389
+ }
40390
+ }
40391
+ return {
40392
+ name: sectionName,
40393
+ ...section.isDefault ? { isDefault: true } : {},
40394
+ jsonKey: section.jsonKey,
40395
+ sides: cardSides
40396
+ };
40397
+ });
40398
+ return { name: normalizedKey, cards };
40399
+ }
40266
40400
  return {
40267
- key: normalizedKey,
40268
- jsonKey: cardSetConfig.jsonKey,
40269
- ...cardSetConfig.itemType && cardSetConfig.itemType !== "object" ? { itemType: cardSetConfig.itemType } : {},
40270
- ...cardSetConfig.sections ? { sections: cardSetConfig.sections } : {},
40271
- sides
40401
+ name: normalizedKey,
40402
+ cards: [
40403
+ {
40404
+ name: "default",
40405
+ isDefault: true,
40406
+ jsonKey: cardSetConfig.jsonKey,
40407
+ sides
40408
+ }
40409
+ ]
40272
40410
  };
40273
40411
  };
40274
40412
  for (const bt of bitGroupConfigKeys) {
@@ -40335,8 +40473,13 @@ var ConfigBuilder = class {
40335
40473
  }
40336
40474
  }
40337
40475
  let cardRef;
40338
- if (b.cardSet && CARDSETS[b.cardSet]) {
40339
- cardRef = normalizeCardKey(b.cardSet);
40476
+ let current = b;
40477
+ while (current) {
40478
+ if (current.cardSet && CARDSETS[current.cardSet]) {
40479
+ cardRef = normalizeCardKey(current.cardSet);
40480
+ break;
40481
+ }
40482
+ current = current.baseBitType ? BITS[current.baseBitType] : void 0;
40340
40483
  }
40341
40484
  const bitJson = {
40342
40485
  name: b.bitType,
@@ -40350,10 +40493,10 @@ var ConfigBuilder = class {
40350
40493
  }
40351
40494
  ],
40352
40495
  format: resolvedBitConfig.textFormatDefault ?? "bitmark--",
40353
- bodyAllowed: resolvedBitConfig.bodyAllowed ?? true,
40354
40496
  bodyRequired: resolvedBitConfig.bodyRequired ?? false,
40355
- footerAllowed: resolvedBitConfig.footerAllowed ?? true,
40497
+ bodyForbidden: !(resolvedBitConfig.bodyAllowed ?? true),
40356
40498
  footerRequired: resolvedBitConfig.footerRequired ?? false,
40499
+ footerForbidden: !(resolvedBitConfig.footerAllowed ?? true),
40357
40500
  resourceAttachmentAllowed: resolvedBitConfig.resourceAttachmentAllowed ?? true,
40358
40501
  tags: tags2,
40359
40502
  ...cardRef ? { card: cardRef } : {}
@@ -40427,7 +40570,7 @@ var ConfigBuilder = class {
40427
40570
  for (const cardSetKey of Object.keys(CARDSETS)) {
40428
40571
  const cardJson = serializeCardSet(cardSetKey);
40429
40572
  if (!cardJson) continue;
40430
- const output = path3.join(outputFolderCards, `${cardJson.key}.jsonc`);
40573
+ const output = path3.join(outputFolderCards, `${cardJson.name}.jsonc`);
40431
40574
  const str = JSON.stringify(cardJson, null, 2);
40432
40575
  fileWrites.push(fs3.writeFile(output, str));
40433
40576
  }
@@ -40594,22 +40737,26 @@ var ConfigBuilder = class {
40594
40737
  if (config.key && config.key !== expectedKey) {
40595
40738
  errors.push(`Card key mismatch in cards/${file}: expected '${expectedKey}'`);
40596
40739
  }
40597
- if (Array.isArray(config.sides)) {
40598
- config.sides.forEach((side, sideIdx) => {
40599
- const variants = side.variants;
40600
- if (Array.isArray(variants)) {
40601
- variants.forEach((variant, variantIdx) => {
40602
- const variantTags = variant.tags;
40603
- if (Array.isArray(variantTags)) {
40604
- checkTags(
40605
- variantTags,
40606
- `cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
40607
- 10
40608
- );
40740
+ if (Array.isArray(config.cards)) {
40741
+ for (const cardNode of config.cards) {
40742
+ if (cardNode && Array.isArray(cardNode.sides)) {
40743
+ cardNode.sides.forEach((side, sideIdx) => {
40744
+ const variants = side.variants;
40745
+ if (Array.isArray(variants)) {
40746
+ variants.forEach((variant, variantIdx) => {
40747
+ const variantTags = variant.tags;
40748
+ if (Array.isArray(variantTags)) {
40749
+ checkTags(
40750
+ variantTags,
40751
+ `cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
40752
+ 10
40753
+ );
40754
+ }
40755
+ });
40609
40756
  }
40610
40757
  });
40611
40758
  }
40612
- });
40759
+ }
40613
40760
  }
40614
40761
  } catch (err) {
40615
40762
  errors.push(`Failed to parse cards/${file}: ${err}`);
@@ -40618,128 +40765,6 @@ var ConfigBuilder = class {
40618
40765
  }
40619
40766
  return errors;
40620
40767
  }
40621
- // Build flat bit configs
40622
- buildFlat(options) {
40623
- const opts = Object.assign({}, options);
40624
- const bitConfigs = [];
40625
- for (const bt of Enum22(BitType).values()) {
40626
- const bitType = instance2.getBitType(bt);
40627
- const bitConfig = instance2.getBitConfig(bitType);
40628
- if (bitConfig) bitConfigs.push(bitConfig);
40629
- }
40630
- const outputFolder = opts.outputDir ?? "assets/config";
40631
- const outputFolderBits = path3.join(outputFolder, "bits_flat");
40632
- fs3.ensureDirSync(outputFolderBits);
40633
- const existingFiles = fs3.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
40634
- for (const file of existingFiles) {
40635
- fs3.removeSync(path3.join(outputFolderBits, file));
40636
- }
40637
- const processTagEntries = (tag) => {
40638
- const tags2 = [];
40639
- let tagName = tag.key;
40640
- const tagType = typeFromConfigKey(tag.key);
40641
- let format = "";
40642
- let chain = void 0;
40643
- if (tagType === BitTagConfigKeyType.tag) {
40644
- tagName = tag.name;
40645
- format = "bitmark--";
40646
- } else if (tagType === BitTagConfigKeyType.property) {
40647
- tagName = tag.key;
40648
- if (tag.format === TagFormat.plainText) {
40649
- format = "string";
40650
- } else if (tag.format === TagFormat.boolean) {
40651
- format = "bool";
40652
- } else if (tag.format === TagFormat.bitmarkText) {
40653
- format = "bitmark";
40654
- } else if (tag.format === TagFormat.number) {
40655
- format = "number";
40656
- }
40657
- } else if (tagType === BitTagConfigKeyType.resource) {
40658
- format = "string";
40659
- } else if (tagType === BitTagConfigKeyType.group) {
40660
- let k = tag.key;
40661
- if (k.startsWith("group_")) k = k.substring(6);
40662
- k = /*'_' +*/
40663
- stringUtils.camelToKebab(k);
40664
- tags2.push({
40665
- type: "group",
40666
- key: k
40667
- });
40668
- return tags2;
40669
- }
40670
- if (Array.isArray(tag.chain) && tag.chain.length > 0) {
40671
- const chainTags = [];
40672
- for (const [_tagKey, chainTag] of tag.chain.entries()) {
40673
- chainTags.push(...processTagEntries(chainTag));
40674
- }
40675
- chain = chainTags;
40676
- }
40677
- const t = {
40678
- key: tagName,
40679
- format,
40680
- default: null,
40681
- alwaysInclude: false,
40682
- min: tag.minCount == null ? 0 : tag.minCount,
40683
- max: tag.maxCount == null ? 1 : tag.maxCount,
40684
- description: tag.description ?? "",
40685
- chain
40686
- // raw: {
40687
- // ...tag,
40688
- // },
40689
- };
40690
- tags2.push(t);
40691
- return tags2;
40692
- };
40693
- for (const b of bitConfigs) {
40694
- const tags2 = [];
40695
- const tagEntriesTypeOrder = [
40696
- BitTagConfigKeyType.tag,
40697
- BitTagConfigKeyType.property,
40698
- BitTagConfigKeyType.resource,
40699
- BitTagConfigKeyType.group,
40700
- BitTagConfigKeyType.unknown
40701
- ];
40702
- const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
40703
- const tagA = a[1];
40704
- const tagB = b2[1];
40705
- const typeA = typeFromConfigKey(tagA.configKey);
40706
- const typeB = typeFromConfigKey(tagB.configKey);
40707
- const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
40708
- return typeOrder;
40709
- });
40710
- for (const [_tagKey, tag] of tagEntries) {
40711
- tags2.push(...processTagEntries(tag));
40712
- }
40713
- let cardRef;
40714
- const cardSetKey = b.cardSet?.configKey;
40715
- if (cardSetKey && CARDSETS[cardSetKey]) {
40716
- cardRef = normalizeCardKey(cardSetKey);
40717
- }
40718
- const bitJson = {
40719
- name: b.bitType,
40720
- description: "",
40721
- since: b.since,
40722
- deprecated: b.deprecated,
40723
- history: [
40724
- {
40725
- version: b.since,
40726
- changes: ["Initial version"]
40727
- }
40728
- ],
40729
- format: b.textFormatDefault ?? "bitmark--",
40730
- bodyAllowed: b.bodyAllowed ?? true,
40731
- bodyRequired: b.bodyRequired ?? false,
40732
- footerAllowed: b.footerAllowed ?? true,
40733
- footerRequired: b.footerRequired ?? false,
40734
- resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
40735
- tags: tags2,
40736
- ...cardRef ? { card: cardRef } : {}
40737
- };
40738
- const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
40739
- const str = JSON.stringify(bitJson, null, 2);
40740
- fs3.writeFileSync(output, str);
40741
- }
40742
- }
40743
40768
  };
40744
40769
 
40745
40770
  // src/BitmarkParserGenerator.ts