@gmb/bitmark-parser-generator 5.1.0 → 5.3.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.
@@ -270,6 +270,7 @@ var BitType = {
270
270
  flashcard1: "flashcard-1",
271
271
  focusImage: "focus-image",
272
272
  footNote: "foot-note",
273
+ formFreeText: "form-free-text",
273
274
  formula: "formula",
274
275
  gapText: "gap-text",
275
276
  gapTextInstructionGrouped: "gap-text-instruction-grouped",
@@ -282,6 +283,8 @@ var BitType = {
282
283
  handInFeedbackExpert: "hand-in-feedback-expert",
283
284
  handInFeedbackSelf: "hand-in-feedback-self",
284
285
  handInFile: "hand-in-file",
286
+ handInFreeText: "hand-in-free-text",
287
+ handInFreeTextExpert: "hand-in-free-text-expert",
285
288
  handInLocation: "hand-in-location",
286
289
  handInPhoto: "hand-in-photo",
287
290
  handInScan: "hand-in-scan",
@@ -594,6 +597,7 @@ var BitType = {
594
597
  trueFalse: "true-false",
595
598
  trueFalse1: "true-false-1",
596
599
  vendorAmcharts5Chart: "vendor-amcharts-5-chart",
600
+ vendorDatadogDashboard: "vendor-datadog-dashboard",
597
601
  vendorDatadogDashboardEmbed: "vendor-datadog-dashboard-embed",
598
602
  vendorFormbricksEmbed: "vendor-formbricks-embed",
599
603
  vendorFormbricksLink: "vendor-formbricks-link",
@@ -1233,6 +1237,7 @@ var propertyKeys = {
1233
1237
  property_internalComment: "@internalComment",
1234
1238
  property_internalPrintPdf: "@internalPrintPdf",
1235
1239
  property_hasPrintRestriction: "@hasPrintRestriction",
1240
+ property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput",
1236
1241
  property_isCaseSensitive: "@isCaseSensitive",
1237
1242
  property_isInfoOnly: "@isInfoOnly",
1238
1243
  property_isPublic: "@isPublic",
@@ -1259,6 +1264,7 @@ var propertyKeys = {
1259
1264
  property_listItemIndent: "@listItemIndent",
1260
1265
  property_location: "@location",
1261
1266
  property_machineTranslated: "@machineTranslated",
1267
+ property_translationOf: "@translationOf",
1262
1268
  property_spansPageBreak: "@spansPageBreak",
1263
1269
  property_mailingList: "@mailingList",
1264
1270
  property_mark: "@mark",
@@ -1291,6 +1297,7 @@ var propertyKeys = {
1291
1297
  property_platformMargin: "@platformMargin",
1292
1298
  property_platformBorderRadius: "@platformBorderRadius",
1293
1299
  property_platformSelectionBorderRadius: "@platformSelectionBorderRadius",
1300
+ property_platformLogoMaxHeight: "@platformLogoMaxHeight",
1294
1301
  property_platformNeedsShadow: "@platformNeedsShadow",
1295
1302
  property_platformSeparatorColor: "@platformSeparatorColor",
1296
1303
  property_platformTextSelectionColor: "@platformTextSelectionColor",
@@ -2746,6 +2753,11 @@ var GROUPS = {
2746
2753
  description: "If true, the bit is machine-translated",
2747
2754
  format: TagFormat.plainText
2748
2755
  },
2756
+ {
2757
+ key: ConfigKey.property_translationOf,
2758
+ description: "Translation source reference",
2759
+ format: TagFormat.plainText
2760
+ },
2749
2761
  {
2750
2762
  key: ConfigKey.property_spansPageBreak,
2751
2763
  description: "If true, the bit spans a page break",
@@ -3396,6 +3408,12 @@ var GROUPS = {
3396
3408
  description: "If true, the book has print restrictions",
3397
3409
  format: TagFormat.boolean,
3398
3410
  defaultValue: "true"
3411
+ },
3412
+ {
3413
+ key: ConfigKey.property_enforceUpdateOverUserInput,
3414
+ description: "If true, prioritize new content over legacy content from the instance API",
3415
+ format: TagFormat.boolean,
3416
+ defaultValue: "false"
3399
3417
  }
3400
3418
  ]
3401
3419
  },
@@ -8722,6 +8740,11 @@ var BITS = {
8722
8740
  ],
8723
8741
  maxCount: 1
8724
8742
  },
8743
+ {
8744
+ key: ConfigKey.property_platformLogoMaxHeight,
8745
+ description: "Maximum height for the platform logo",
8746
+ format: TagFormat.number
8747
+ },
8725
8748
  {
8726
8749
  key: ConfigKey.group_platformStylesCommon,
8727
8750
  description: "Common platform styles"
@@ -9416,6 +9439,11 @@ var BITS = {
9416
9439
  baseBitType: BitType._standard,
9417
9440
  description: "Footnote bit, used to create footnotes in articles or books"
9418
9441
  },
9442
+ [BitType.formFreeText]: {
9443
+ since: "5.3.0",
9444
+ baseBitType: BitType.interview,
9445
+ description: "Form free text bit, used to create free text forms in articles or books"
9446
+ },
9419
9447
  [BitType.groupBorn]: {
9420
9448
  since: "1.3.0",
9421
9449
  baseBitType: BitType._standard,
@@ -9475,6 +9503,16 @@ var BITS = {
9475
9503
  }
9476
9504
  ]
9477
9505
  },
9506
+ [BitType.handInFreeText]: {
9507
+ since: "5.3.0",
9508
+ baseBitType: BitType.interview,
9509
+ description: "Hand in free text bit, used to create free text submission sections in articles or books"
9510
+ },
9511
+ [BitType.handInFreeTextExpert]: {
9512
+ since: "5.3.0",
9513
+ baseBitType: BitType.interview,
9514
+ description: "Hand in free text expert bit, used to create free text expert submission sections in articles or books"
9515
+ },
9478
9516
  [BitType.handInLocation]: {
9479
9517
  since: "1.5.15",
9480
9518
  baseBitType: BitType._standard,
@@ -9584,6 +9622,11 @@ var BITS = {
9584
9622
  description: "AmCharts 5 chart bit, used to embed AmCharts 5 charts in articles or books",
9585
9623
  textFormatDefault: TextFormat2.json
9586
9624
  },
9625
+ [BitType.vendorDatadogDashboard]: {
9626
+ since: "5.2.0",
9627
+ baseBitType: BitType.nonProductionPrototypeIframe,
9628
+ description: "A Datadog dashboard bit, used to embed Datadog dashboards"
9629
+ },
9587
9630
  [BitType.vendorDatadogDashboardEmbed]: {
9588
9631
  since: "3.12.0",
9589
9632
  baseBitType: BitType.code,
@@ -10213,7 +10256,7 @@ var instance2 = new Config();
10213
10256
  // src/generated/package_info.ts
10214
10257
  var PACKAGE_INFO = {
10215
10258
  "name": "@gmb/bitmark-parser-generator",
10216
- "version": "5.1.0",
10259
+ "version": "5.3.0",
10217
10260
  "author": "Get More Brain Ltd",
10218
10261
  "license": "ISC",
10219
10262
  "description": "A bitmark parser and generator using Peggy.js"
@@ -10834,6 +10877,8 @@ var NodeType = {
10834
10877
  internalPrintPdfValue: "internalPrintPdfValue",
10835
10878
  hasPrintRestriction: "hasPrintRestriction",
10836
10879
  hasPrintRestrictionValue: "hasPrintRestrictionValue",
10880
+ enforceUpdateOverUserInput: "enforceUpdateOverUserInput",
10881
+ enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue",
10837
10882
  isCaseSensitive: "isCaseSensitive",
10838
10883
  isCommented: "isCommented",
10839
10884
  isCorrect: "isCorrect",
@@ -10900,6 +10945,8 @@ var NodeType = {
10900
10945
  locationValue: "locationValue",
10901
10946
  machineTranslated: "machineTranslated",
10902
10947
  machineTranslatedValue: "machineTranslatedValue",
10948
+ translationOf: "translationOf",
10949
+ translationOfValue: "translationOfValue",
10903
10950
  spansPageBreak: "spansPageBreak",
10904
10951
  spansPageBreakValue: "spansPageBreakValue",
10905
10952
  mailingList: "mailingList",
@@ -10951,6 +10998,8 @@ var NodeType = {
10951
10998
  platformIconValue: "platformIconValue",
10952
10999
  platformLogo: "platformLogo",
10953
11000
  platformLogoValue: "platformLogoValue",
11001
+ platformLogoMaxHeight: "platformLogoMaxHeight",
11002
+ platformLogoMaxHeightValue: "platformLogoMaxHeightValue",
10954
11003
  platformPrimaryColor: "platformPrimaryColor",
10955
11004
  platformPrimaryColorValue: "platformPrimaryColorValue",
10956
11005
  platformSecondaryColor: "platformSecondaryColor",
@@ -12019,7 +12068,7 @@ var Stage = {
12019
12068
  between: "between",
12020
12069
  exit: "exit"
12021
12070
  };
12022
- var TextGenerator = class extends AstWalkerGenerator {
12071
+ var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
12023
12072
  /**
12024
12073
  * Generate text from a bitmark text AST
12025
12074
  *
@@ -12031,6 +12080,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12031
12080
  __publicField(this, "ast", new Ast());
12032
12081
  __publicField(this, "bitmarkVersion");
12033
12082
  __publicField(this, "options");
12083
+ __publicField(this, "internalTextGenerator", null);
12034
12084
  // State
12035
12085
  __publicField(this, "generateOptions", {});
12036
12086
  __publicField(this, "textFormat", TextFormat2.bitmarkText);
@@ -12046,6 +12096,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12046
12096
  __publicField(this, "exitedCodeBlock", false);
12047
12097
  __publicField(this, "inBulletList", false);
12048
12098
  __publicField(this, "inInline", false);
12099
+ __publicField(this, "markDepth", 0);
12049
12100
  __publicField(this, "textDepth", 0);
12050
12101
  __publicField(this, "placeholderIndex", 0);
12051
12102
  __publicField(this, "placeholders", {});
@@ -12070,6 +12121,13 @@ var TextGenerator = class extends AstWalkerGenerator {
12070
12121
  this.between = this.between.bind(this);
12071
12122
  this.exit = this.exit.bind(this);
12072
12123
  this.leaf = this.leaf.bind(this);
12124
+ if (!this.options.isInternal) {
12125
+ this.internalTextGenerator = new _TextGenerator(bitmarkVersion, {
12126
+ ...this.options,
12127
+ writeCallback: void 0,
12128
+ isInternal: true
12129
+ });
12130
+ }
12073
12131
  }
12074
12132
  /**
12075
12133
  * Generate text from a bitmark text AST
@@ -12126,6 +12184,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12126
12184
  this.exitedCodeBlock = false;
12127
12185
  this.inBulletList = false;
12128
12186
  this.inInline = false;
12187
+ this.markDepth = 0;
12129
12188
  this.textDepth = 0;
12130
12189
  this.placeholderIndex = 0;
12131
12190
  this.placeholders = {};
@@ -12173,8 +12232,16 @@ var TextGenerator = class extends AstWalkerGenerator {
12173
12232
  exit_contentValueValue(node, route) {
12174
12233
  return this.handleExitNode(node.value, route);
12175
12234
  }
12235
+ // * -> marks
12236
+ enter_marks(_node, _route) {
12237
+ this.markDepth++;
12238
+ }
12239
+ exit_marks(_node, _route) {
12240
+ this.markDepth--;
12241
+ }
12176
12242
  // END NODE HANDLERS
12177
12243
  handleEnterNode(node, route) {
12244
+ if (this.markDepth > 0) return;
12178
12245
  this.handleEnterNodePreTextCheck(node, route);
12179
12246
  this.handleIndent(node);
12180
12247
  switch (node.type) {
@@ -12185,7 +12252,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12185
12252
  case TextNodeType.hardBreak:
12186
12253
  this.writeHardBreak(node);
12187
12254
  break;
12188
- case TextNodeType.text:
12255
+ case TextNodeType.text: {
12189
12256
  this.writeMarks(node, Stage.enter);
12190
12257
  this.writeText(node);
12191
12258
  this.writeMarks(node, Stage.between);
@@ -12194,6 +12261,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12194
12261
  }
12195
12262
  this.textDepth++;
12196
12263
  break;
12264
+ }
12197
12265
  case TextNodeType.heading:
12198
12266
  this.writeHeading(node);
12199
12267
  this.inHeading = true;
@@ -12244,6 +12312,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12244
12312
  }
12245
12313
  }
12246
12314
  handleExitNode(node, _route) {
12315
+ if (this.markDepth > 0) return;
12247
12316
  switch (node.type) {
12248
12317
  case TextNodeType.text:
12249
12318
  this.textDepth--;
@@ -12550,7 +12619,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12550
12619
  */
12551
12620
  writeMarks(node, stage) {
12552
12621
  if (node.marks) {
12553
- const forceSingleMark = !!(this.inInline || this.inHeading);
12622
+ const forceSingleMark = this.generateOptions.forceInline || !!(this.inInline || this.inHeading);
12554
12623
  this.thisNodeIsPreText = false;
12555
12624
  const emptyMarks = node.marks.length === 0;
12556
12625
  if (emptyMarks) {
@@ -12781,13 +12850,33 @@ var TextGenerator = class extends AstWalkerGenerator {
12781
12850
  s += `|provider:${provider}`;
12782
12851
  this.write(s);
12783
12852
  }
12784
- writeFootnoteMark(_mark) {
12853
+ writeFootnoteMark(mark) {
12785
12854
  const s = `footnote:`;
12786
12855
  this.write(s);
12856
+ const text = this.internalTextGenerator?.generateSync(
12857
+ mark.attrs?.content,
12858
+ this.textFormat,
12859
+ this.textLocation,
12860
+ {
12861
+ ...this.generateOptions,
12862
+ forceInline: true
12863
+ }
12864
+ ) ?? "";
12865
+ this.write(text);
12787
12866
  }
12788
- writeFootnoteStarMark(_mark) {
12867
+ writeFootnoteStarMark(mark) {
12789
12868
  const s = `footnote*:`;
12790
12869
  this.write(s);
12870
+ const text = this.internalTextGenerator?.generateSync(
12871
+ mark.attrs?.content,
12872
+ this.textFormat,
12873
+ this.textLocation,
12874
+ {
12875
+ ...this.generateOptions,
12876
+ forceInline: true
12877
+ }
12878
+ ) ?? "";
12879
+ this.write(text);
12791
12880
  }
12792
12881
  writeSymbolMark(mark) {
12793
12882
  if (mark.attrs == null) return;
@@ -23944,6 +24033,12 @@ var Builder = class extends BaseBuilder {
23944
24033
  data.machineTranslated,
23945
24034
  options
23946
24035
  ),
24036
+ translationOf: this.toAstProperty(
24037
+ bitType,
24038
+ ConfigKey.property_translationOf,
24039
+ data.translationOf,
24040
+ options
24041
+ ),
23947
24042
  spansPageBreak: this.toAstProperty(
23948
24043
  bitType,
23949
24044
  ConfigKey.property_spansPageBreak,
@@ -24660,6 +24755,12 @@ var Builder = class extends BaseBuilder {
24660
24755
  data.hasPrintRestriction,
24661
24756
  options
24662
24757
  ),
24758
+ enforceUpdateOverUserInput: this.toAstProperty(
24759
+ bitType,
24760
+ ConfigKey.property_enforceUpdateOverUserInput,
24761
+ data.enforceUpdateOverUserInput,
24762
+ options
24763
+ ),
24663
24764
  tocResource: this.toAstProperty(
24664
24765
  bitType,
24665
24766
  ConfigKey.property_tocResource,
@@ -24687,6 +24788,12 @@ var Builder = class extends BaseBuilder {
24687
24788
  ),
24688
24789
  platformIcon: this.toImageResource(context, data.platformIcon),
24689
24790
  platformLogo: this.toImageResource(context, data.platformLogo),
24791
+ platformLogoMaxHeight: this.toAstProperty(
24792
+ bitType,
24793
+ ConfigKey.property_platformLogoMaxHeight,
24794
+ data.platformLogoMaxHeight,
24795
+ options
24796
+ ),
24690
24797
  platformPrimaryColor: this.toAstProperty(
24691
24798
  bitType,
24692
24799
  ConfigKey.property_platformPrimaryColor,
@@ -30360,6 +30467,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30360
30467
  if (instance2.isOfBitType(bitType, BitType.book)) {
30361
30468
  if (bitJson.maxTocChapterLevel == null) bitJson.maxTocChapterLevel = -1;
30362
30469
  if (bitJson.hasPrintRestriction == null) bitJson.hasPrintRestriction = true;
30470
+ if (bitJson.enforceUpdateOverUserInput == null) bitJson.enforceUpdateOverUserInput = false;
30363
30471
  if (bitJson.hasMarkAsDone == null) bitJson.hasMarkAsDone = false;
30364
30472
  if (bitJson.processHandIn == null) bitJson.processHandIn = false;
30365
30473
  if (bitJson.isPublic == null) bitJson.isPublic = false;
@@ -30440,6 +30548,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
30440
30548
  if (instance2.isOfBitType(bitType, BitType.platformBrandTarget)) {
30441
30549
  if (bitJson.platformBrandTarget == null) bitJson.platformBrandTarget = "none";
30442
30550
  }
30551
+ if (instance2.isOfBitType(bitType, BitType.platformHeader)) {
30552
+ if (bitJson.platformLogoMaxHeight == null) bitJson.platformLogoMaxHeight = 40;
30553
+ }
30443
30554
  if (isTopLevelExample) {
30444
30555
  if (bitJson.isExample == null) bitJson.isExample = false;
30445
30556
  } else {
@@ -32709,6 +32820,9 @@ function parseFeedback(_context, _bitType, cardSet) {
32709
32820
  const choice = {
32710
32821
  choice: tfTags.choice,
32711
32822
  requireReason: tfTags.isCorrect,
32823
+ item: tfTags.item,
32824
+ lead: tfTags.lead,
32825
+ instruction: tfTags.instruction,
32712
32826
  __isDefaultExample,
32713
32827
  example
32714
32828
  };