@gmb/bitmark-parser-generator 5.39.0 → 5.40.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
@@ -81,6 +81,8 @@ var BitType = {
81
81
  // Used to indicate a bit is commented out
82
82
  _standard: "_standard",
83
83
  // Not to be used as a bit, but as a base for other bit types
84
+ _standardLight: "_standard-light",
85
+ // PLAN-021: lightweight base (minimal tag set), not to be used as a bit
84
86
  advertising: "advertising",
85
87
  advertisingAdvertorial: "advertising-advertorial",
86
88
  advertisingAdvertorialPage: "advertising-advertorial-page",
@@ -368,6 +370,7 @@ var BitType = {
368
370
  handInSystemMedia: "hand-in-system-media",
369
371
  handInVideo: "hand-in-video",
370
372
  handInVoice: "hand-in-voice",
373
+ h: "h",
371
374
  help: "help",
372
375
  helpAlt: "help-alt",
373
376
  highlightText: "highlight-text",
@@ -453,6 +456,7 @@ var BitType = {
453
456
  leWatchVideoEmbed: "le-watch-video-embed",
454
457
  lifeSkillSticker: "life-skill-sticker",
455
458
  list: "list",
459
+ listAlt: "list-alt",
456
460
  listItem: "list-item",
457
461
  mark: "mark",
458
462
  match: "match",
@@ -483,6 +487,8 @@ var BitType = {
483
487
  notebookArticle: "notebook-article",
484
488
  noteCollapsible: "note-collapsible",
485
489
  output: "output",
490
+ p: "p",
491
+ pAlt: "p-alt",
486
492
  page: "page",
487
493
  pageAcademy: "page-academy",
488
494
  pageArticle: "page-article",
@@ -605,6 +611,7 @@ var BitType = {
605
611
  smartStandardNoteNonNormativeCollapsible: "smart-standard-note-non-normative-collapsible",
606
612
  smartStandardNoteNormative: "smart-standard-note-normative",
607
613
  smartStandardNoteNormativeCollapsible: "smart-standard-note-normative-collapsible",
614
+ smartStandardP: "smart-standard-p",
608
615
  smartStandardRemarkLegend: "smart-standard-remark-legend",
609
616
  smartStandardRemarkLegendNonNormative: "smart-standard-remark-legend-non-normative",
610
617
  smartStandardRemarkLegendNormative: "smart-standard-remark-legend-normative",
@@ -1574,6 +1581,8 @@ var import_superenum12 = require("@ncoderz/superenum");
1574
1581
  var groupKeys = {
1575
1582
  group_accessibilityDecorative: "group_accessibilityDecorative",
1576
1583
  group_standardAllBits: "group_standardAllBits",
1584
+ group_standardExample: "group_standardExample",
1585
+ group_standardItem: "group_standardItem",
1577
1586
  group_standardItemLead: "group_standardItemLead",
1578
1587
  group_standardItemLeadInstructionHint: "group_standardItemLeadInstructionHint",
1579
1588
  group_standardInstructionHint: "group_standardInstructionHint",
@@ -5073,6 +5082,31 @@ var GROUPS = {
5073
5082
  }
5074
5083
  ]
5075
5084
  },
5085
+ [ConfigKey.group_standardExample]: {
5086
+ type: GroupConfigType.standard,
5087
+ description: "PLAN-021: Standard group for the bit-level example property only. Mirror of the group_standardTags property_example entry, used by the lightweight bits (_standardLight).",
5088
+ tags: [
5089
+ {
5090
+ key: ConfigKey.property_example,
5091
+ exportJsonKey: [{ "@keyonly": {} }, { "@absent": { isExample: true } }, { example: "$" }],
5092
+ description: "The example(s) for the bit",
5093
+ format: TagFormat.bitmarkText,
5094
+ nullable: true
5095
+ }
5096
+ ]
5097
+ },
5098
+ [ConfigKey.group_standardItem]: {
5099
+ type: GroupConfigType.standard,
5100
+ description: "PLAN-021: Standard group for the item tag ONLY (no lead/pageNumber/marginNumber chain). Used by the lightweight bits (_standardLight).",
5101
+ tags: [
5102
+ {
5103
+ key: ConfigKey.tag_item,
5104
+ jsonKey: "item",
5105
+ exportJsonKey: { item: "$" },
5106
+ description: "The item for the bit"
5107
+ }
5108
+ ]
5109
+ },
5076
5110
  [ConfigKey.group_standardItemLead]: {
5077
5111
  type: GroupConfigType.standard,
5078
5112
  description: "Standard group for item, lead, page number, and margin number tags",
@@ -7876,6 +7910,25 @@ var BITS = {
7876
7910
  }
7877
7911
  ]
7878
7912
  },
7913
+ [BitType._standardLight]: {
7914
+ since: "5.40.0",
7915
+ description: "PLAN-021: Lightweight standard base bit with a minimal tag set (item + example only \u2014 no instruction/hint/lead, no resource attachments), used as a base for other bits, should not be used directly",
7916
+ resourceAttachmentAllowed: false,
7917
+ tags: [
7918
+ {
7919
+ key: ConfigKey.group_standardAllBits,
7920
+ description: "Standard tags for all bits"
7921
+ },
7922
+ {
7923
+ key: ConfigKey.group_standardItem,
7924
+ description: "The item tag (no lead/pageNumber/marginNumber chain)"
7925
+ },
7926
+ {
7927
+ key: ConfigKey.group_standardExample,
7928
+ description: "The bit-level example property"
7929
+ }
7930
+ ]
7931
+ },
7879
7932
  [BitType.appFlashcards]: {
7880
7933
  since: "1.3.0",
7881
7934
  title: "Flashcards",
@@ -10703,6 +10756,23 @@ var BITS = {
10703
10756
  baseBitType: BitType.article,
10704
10757
  description: "Glossary term bit, used to define glossary terms in articles or books"
10705
10758
  },
10759
+ [BitType.h]: {
10760
+ since: "5.40.0",
10761
+ title: "Heading",
10762
+ bitGroups: [BitGroup.static],
10763
+ baseBitType: BitType._standardLight,
10764
+ description: "Lightweight heading bit with chapter-style title levels 1-7; title/level + item only \u2014 no body, no footer",
10765
+ bodyAllowed: false,
10766
+ footerAllowed: false,
10767
+ tags: [
10768
+ {
10769
+ key: ConfigKey.tag_title,
10770
+ description: "The title of the heading",
10771
+ jsonKey: "title|setMulti(level)",
10772
+ exportJsonKey: { title: "$", level: "$level" }
10773
+ }
10774
+ ]
10775
+ },
10706
10776
  [BitType.help]: {
10707
10777
  since: "1.3.0",
10708
10778
  title: "Help",
@@ -10889,13 +10959,22 @@ var BITS = {
10889
10959
  since: "1.22.0",
10890
10960
  title: "List",
10891
10961
  bitGroups: [BitGroup.static],
10892
- baseBitType: BitType.article,
10962
+ // PLAN-021: rebased from article onto the lightweight base
10963
+ baseBitType: BitType._standardLight,
10893
10964
  description: "List bit, used to create lists in articles or books"
10894
10965
  },
10966
+ [BitType.listAlt]: {
10967
+ since: "5.40.0",
10968
+ title: "List Alt",
10969
+ bitGroups: [BitGroup.static],
10970
+ baseBitType: BitType.list,
10971
+ description: "Lightweight list bit (alternative), based on list"
10972
+ },
10895
10973
  [BitType.standardList]: {
10896
10974
  since: "1.22.0",
10897
10975
  bitGroups: [BitGroup.static],
10898
- baseBitType: BitType.article,
10976
+ // PLAN-021: re-rooted from article onto the lightweight list
10977
+ baseBitType: BitType.list,
10899
10978
  description: "Standard list bit, used to create standard lists in articles or books"
10900
10979
  },
10901
10980
  [BitType.smartStandardList]: {
@@ -10911,6 +10990,13 @@ var BITS = {
10911
10990
  "xml-niso-iec": { "@el": "ref-list", "@attr": { id: "$customerId" }, "\u25BC": "$anchor" }
10912
10991
  }
10913
10992
  },
10993
+ [BitType.smartStandardP]: {
10994
+ since: "5.40.0",
10995
+ title: "Smart Standard Paragraph",
10996
+ bitGroups: [BitGroup.static],
10997
+ baseBitType: BitType.p,
10998
+ description: "Smart standard paragraph bit, based on p"
10999
+ },
10914
11000
  [BitType.smartStandardListCollapsible]: {
10915
11001
  since: "1.28.0",
10916
11002
  deprecated: "5.37.0",
@@ -13492,7 +13578,8 @@ var BITS = {
13492
13578
  [BitType.listItem]: {
13493
13579
  since: "1.22.0",
13494
13580
  bitGroups: [BitGroup.static],
13495
- baseBitType: BitType.article,
13581
+ // PLAN-021: rebased from article onto the lightweight base
13582
+ baseBitType: BitType._standardLight,
13496
13583
  description: "List item bit, used to create list items in articles or books",
13497
13584
  tags: [
13498
13585
  {
@@ -13897,6 +13984,20 @@ var BITS = {
13897
13984
  baseBitType: BitType.multipleResponse,
13898
13985
  description: "Coach self-reflection multiple response bit, used for self-reflection in coaching"
13899
13986
  },
13987
+ [BitType.p]: {
13988
+ since: "5.40.0",
13989
+ title: "Paragraph",
13990
+ bitGroups: [BitGroup.static],
13991
+ baseBitType: BitType._standardLight,
13992
+ description: "Lightweight paragraph bit with a minimal tag set"
13993
+ },
13994
+ [BitType.pAlt]: {
13995
+ since: "5.40.0",
13996
+ title: "Paragraph Alt",
13997
+ bitGroups: [BitGroup.static],
13998
+ baseBitType: BitType.p,
13999
+ description: "Lightweight paragraph bit (alternative), based on p"
14000
+ },
13900
14001
  [BitType.page]: {
13901
14002
  since: "1.3.0",
13902
14003
  title: "Page",
@@ -16627,7 +16728,7 @@ var instance2 = new Config();
16627
16728
  // src/generated/package_info.ts
16628
16729
  var PACKAGE_INFO = {
16629
16730
  "name": "@gmb/bitmark-parser-generator",
16630
- "version": "5.39.0",
16731
+ "version": "5.40.0",
16631
16732
  "author": "Get More Brain Ltd",
16632
16733
  "license": "ISC",
16633
16734
  "description": "A bitmark parser and generator using Peggy.js"
@@ -35548,7 +35649,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
35548
35649
  leaf_level(node, route) {
35549
35650
  const parent = this.getParentNode(route);
35550
35651
  if (parent?.key !== NodeType.bitsValue) return true;
35551
- if (!instance2.isOfBitType(this.bitType, [BitType.chapter])) return true;
35652
+ if (!instance2.isOfBitType(this.bitType, [BitType.chapter, BitType.h])) return true;
35552
35653
  const level = node.value;
35553
35654
  const bit = parent?.value;
35554
35655
  if (level > 0 && bit.title == null) {
@@ -42091,15 +42192,23 @@ function titleTagContentProcessor(context, _contentDepth, _tagsConfig, content,
42091
42192
  titleString: titleText ?? ""
42092
42193
  };
42093
42194
  }
42094
- function buildTitles(_context, bitType, title) {
42195
+ var H_TITLE_LEVEL_MAX = 7;
42196
+ function buildTitles(context, bitType, title) {
42095
42197
  title = title ?? [];
42096
- if (instance2.isOfBitType(bitType, BitType.chapter)) {
42198
+ if (instance2.isOfBitType(bitType, [BitType.chapter, BitType.h])) {
42097
42199
  let t;
42098
42200
  if (title.length > 0) t = title[title.length - 1];
42201
+ let level = title.length > 0 ? title.length - 1 : void 0;
42202
+ if (level != null && level > H_TITLE_LEVEL_MAX && instance2.isOfBitType(bitType, BitType.h)) {
42203
+ context.addWarning(
42204
+ `Title level of ${level} too high, setting to max value of ${H_TITLE_LEVEL_MAX}`
42205
+ );
42206
+ level = H_TITLE_LEVEL_MAX;
42207
+ }
42099
42208
  return {
42100
42209
  title: t?.titleAst ?? [],
42101
42210
  titleString: t?.titleString ?? "",
42102
- level: title.length > 0 ? title.length - 1 : void 0
42211
+ level
42103
42212
  };
42104
42213
  } else {
42105
42214
  if (Array.isArray(title)) {