@gmb/bitmark-parser-generator 1.5.12 → 1.5.13

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.
Files changed (48) hide show
  1. package/dist/browser/bitmark-parser-generator.min.js +1 -1
  2. package/dist/browser/bundle-report.html +2 -2
  3. package/dist/cjs/ast/Ast.js +13 -13
  4. package/dist/cjs/ast/Ast.js.map +1 -1
  5. package/dist/cjs/generated/build-info.js +1 -1
  6. package/dist/cjs/generated/parser/text/text-peggy-parser.js +729 -642
  7. package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +1 -1
  8. package/dist/cjs/generator/AstWalkerGenerator.js +83 -0
  9. package/dist/cjs/generator/AstWalkerGenerator.js.map +1 -0
  10. package/dist/cjs/generator/bitmark/BitmarkGenerator.js +144 -180
  11. package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
  12. package/dist/cjs/generator/json/JsonGenerator.js +66 -95
  13. package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
  14. package/dist/cjs/generator/text/TextGenerator.js +36 -73
  15. package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
  16. package/dist/cjs/model/enum/TextNodeType.js +1 -0
  17. package/dist/cjs/model/enum/TextNodeType.js.map +1 -1
  18. package/dist/esm/ast/Ast.js +13 -13
  19. package/dist/esm/ast/Ast.js.map +1 -1
  20. package/dist/esm/generated/build-info.js +1 -1
  21. package/dist/esm/generated/parser/text/text-peggy-parser.js +729 -642
  22. package/dist/esm/generated/parser/text/text-peggy-parser.js.map +1 -1
  23. package/dist/esm/generator/AstWalkerGenerator.js +80 -0
  24. package/dist/esm/generator/AstWalkerGenerator.js.map +1 -0
  25. package/dist/esm/generator/bitmark/BitmarkGenerator.js +144 -180
  26. package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
  27. package/dist/esm/generator/json/JsonGenerator.js +66 -95
  28. package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
  29. package/dist/esm/generator/text/TextGenerator.js +36 -73
  30. package/dist/esm/generator/text/TextGenerator.js.map +1 -1
  31. package/dist/esm/model/enum/TextNodeType.js +1 -0
  32. package/dist/esm/model/enum/TextNodeType.js.map +1 -1
  33. package/dist/types/ast/Ast.d.ts +4 -8
  34. package/dist/types/ast/Ast.d.ts.map +1 -1
  35. package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +1 -1
  36. package/dist/types/generator/AstWalkerGenerator.d.ts +32 -0
  37. package/dist/types/generator/AstWalkerGenerator.d.ts.map +1 -0
  38. package/dist/types/generator/Generator.d.ts +2 -2
  39. package/dist/types/generator/Generator.d.ts.map +1 -1
  40. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +121 -127
  41. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
  42. package/dist/types/generator/json/JsonGenerator.d.ts +43 -48
  43. package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
  44. package/dist/types/generator/text/TextGenerator.d.ts +13 -17
  45. package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
  46. package/dist/types/model/enum/TextNodeType.d.ts +2 -0
  47. package/dist/types/model/enum/TextNodeType.d.ts.map +1 -1
  48. package/package.json +1 -1
@@ -19,13 +19,14 @@ import { PropertyTag } from '../../model/enum/PropertyTag';
19
19
  import { ResourceTag } from '../../model/enum/ResourceTag';
20
20
  import { TextFormat } from '../../model/enum/TextFormat';
21
21
  import { BooleanUtils } from '../../utils/BooleanUtils';
22
+ import { AstWalkerGenerator } from '../AstWalkerGenerator';
22
23
  const DEFAULT_OPTIONS = {
23
24
  debugGenerationInline: false,
24
25
  };
25
26
  /**
26
27
  * Generate bitmark markup from a bitmark AST
27
28
  */
28
- class BitmarkGenerator {
29
+ class BitmarkGenerator extends AstWalkerGenerator {
29
30
  /**
30
31
  * Generate bitmark markup from a bitmark AST
31
32
  *
@@ -42,14 +43,14 @@ class BitmarkGenerator {
42
43
  * @param options - bitmark generation options
43
44
  */
44
45
  constructor(writer, options) {
45
- var _a;
46
+ var _a, _b;
47
+ super();
46
48
  this.ast = new Ast();
47
49
  // State
48
50
  this.skipNLBetweenBitsValue = false;
49
- // Debug
50
- this.printed = false;
51
51
  this.bitmarkVersion = (_a = BitmarkVersion.fromValue(options === null || options === void 0 ? void 0 : options.bitmarkVersion)) !== null && _a !== void 0 ? _a : DEFAULT_BITMARK_VERSION;
52
52
  this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options === null || options === void 0 ? void 0 : options.bitmarkOptions);
53
+ this.debugGenerationInline = (_b = this.options.debugGenerationInline) !== null && _b !== void 0 ? _b : false;
53
54
  // Set defaults according to bitmark version
54
55
  if (this.bitmarkVersion === BitmarkVersion.v2) {
55
56
  if (this.options.cardSetVersion === undefined) {
@@ -112,55 +113,6 @@ class BitmarkGenerator {
112
113
  // Ensure a blank line at end of file
113
114
  this.writeLine();
114
115
  }
115
- enter(node, parent, route) {
116
- let res = void 0;
117
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
118
- const gen = this;
119
- const funcName = `enter_${node.key}`;
120
- if (!this.printed) {
121
- this.printed = true;
122
- }
123
- if (this.options.debugGenerationInline)
124
- this.writeInlineDebug(node.key, { open: true });
125
- if (typeof gen[funcName] === 'function') {
126
- res = gen[funcName](node, parent, route);
127
- }
128
- return res;
129
- }
130
- between(node, left, right, parent, route) {
131
- let res = void 0;
132
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
- const gen = this;
134
- const funcName = `between_${node.key}`;
135
- if (this.options.debugGenerationInline)
136
- this.writeInlineDebug(node.key, { single: true });
137
- if (typeof gen[funcName] === 'function') {
138
- res = gen[funcName](node, left, right, parent, route);
139
- }
140
- return res;
141
- }
142
- exit(node, parent, route) {
143
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
- const gen = this;
145
- const funcName = `exit_${node.key}`;
146
- if (this.options.debugGenerationInline)
147
- this.writeInlineDebug(node.key, { close: true });
148
- if (typeof gen[funcName] === 'function') {
149
- gen[funcName](node, parent, route);
150
- }
151
- }
152
- leaf(node, parent, route) {
153
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
- const gen = this;
155
- const funcName = `leaf_${node.key}`;
156
- if (this.options.debugGenerationInline)
157
- this.writeInlineDebug(node.key, { open: true });
158
- if (typeof gen[funcName] === 'function') {
159
- gen[funcName](node, parent, route);
160
- }
161
- if (this.options.debugGenerationInline)
162
- this.writeInlineDebug(node.key, { close: true });
163
- }
164
116
  //
165
117
  // NODE HANDLERS
166
118
  //
@@ -169,13 +121,13 @@ class BitmarkGenerator {
169
121
  //
170
122
  // bitmark
171
123
  // bitmarkAst -> bits
172
- between_bits(_node, _left, _right, _parent, _route) {
124
+ between_bits(_node, _left, _right, _route) {
173
125
  this.writeNL();
174
126
  this.writeNL();
175
127
  this.writeNL();
176
128
  }
177
129
  // bitmarkAst -> bits -> bitsValue
178
- enter_bitsValue(node, _parent, _route) {
130
+ enter_bitsValue(node, _route) {
179
131
  const bit = node.value;
180
132
  const bitConfig = Config.getBitConfig(bit.bitType);
181
133
  const bitResourcesConfig = Config.getBitResourcesConfig(bit.bitType, bit.resourceType);
@@ -213,7 +165,7 @@ class BitmarkGenerator {
213
165
  this.writeCL();
214
166
  this.writeNL();
215
167
  }
216
- between_bitsValue(node, left, _right, _parent, _route) {
168
+ between_bitsValue(node, left, _right, _route) {
217
169
  // The following keys are combined with other keys so don't need newlines
218
170
  const noNlKeys = [
219
171
  NodeType.bitType,
@@ -246,9 +198,10 @@ class BitmarkGenerator {
246
198
  }
247
199
  }
248
200
  // bitmarkAst -> bits -> bitsValue -> internalComment
249
- enter_internalComment(node, parent, _route) {
201
+ enter_internalComment(node, route) {
250
202
  const internalComment = node.value;
251
203
  // Ignore values that are not at the bit level as they might be handled elsewhere
204
+ const parent = this.getParentNode(route);
252
205
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
253
206
  return;
254
207
  for (let i = 0; i < internalComment.length; i++) {
@@ -260,9 +213,10 @@ class BitmarkGenerator {
260
213
  }
261
214
  }
262
215
  // bitmarkAst -> bits -> bitsValue -> labelTrue / labelFalse
263
- enter_labelTrue(node, parent, _route) {
216
+ enter_labelTrue(node, route) {
264
217
  const value = node.value;
265
218
  // Ignore example that is not at the bit level as it are handled elsewhere
219
+ const parent = this.getParentNode(route);
266
220
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
267
221
  return;
268
222
  const bit = parent === null || parent === void 0 ? void 0 : parent.value;
@@ -274,9 +228,10 @@ class BitmarkGenerator {
274
228
  }
275
229
  }
276
230
  // bitmarkAst -> bits -> bitsValue -> imageSource
277
- enter_imageSource(node, parent, _route) {
231
+ enter_imageSource(node, route) {
278
232
  const imageSource = node.value;
279
233
  // Ignore values that are not at the bit level as they might be handled elsewhere
234
+ const parent = this.getParentNode(route);
280
235
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
281
236
  return;
282
237
  const { url, mockupId, size, format, trim } = imageSource;
@@ -293,9 +248,10 @@ class BitmarkGenerator {
293
248
  }
294
249
  }
295
250
  // bitmarkAst -> bits -> bitsValue -> partner
296
- enter_partner(node, parent, _route) {
251
+ enter_partner(node, route) {
297
252
  const partner = node.value;
298
253
  // Ignore values that are not at the bit level as they might be handled elsewhere
254
+ const parent = this.getParentNode(route);
299
255
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
300
256
  return;
301
257
  const { name, avatarImage } = partner;
@@ -305,9 +261,10 @@ class BitmarkGenerator {
305
261
  }
306
262
  }
307
263
  // bitmarkAst -> bits -> bitsValue -> markConfigValue
308
- enter_markConfigValue(node, parent, _route) {
264
+ enter_markConfigValue(node, route) {
309
265
  const markConfig = node.value;
310
266
  // Ignore values that are not at the correct level as they might be handled elsewhere
267
+ const parent = this.getParentNode(route);
311
268
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.markConfig)
312
269
  return;
313
270
  const { mark, color, emphasis } = markConfig;
@@ -322,16 +279,16 @@ class BitmarkGenerator {
322
279
  }
323
280
  // bitmarkAst -> bits -> bitsValue -> sampleSolution
324
281
  // bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> sampleSolution
325
- leaf_sampleSolution(node, _parent, _route) {
282
+ leaf_sampleSolution(node, _route) {
326
283
  this.writeProperty('sampleSolution', node.value);
327
284
  }
328
285
  // bitmarkAst -> bits -> bitsValue -> reasonableNumOfChars
329
286
  // bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> reasonableNumOfChars
330
- leaf_reasonableNumOfChars(node, _parent, _route) {
287
+ leaf_reasonableNumOfChars(node, _route) {
331
288
  this.writeProperty('reasonableNumOfChars', node.value);
332
289
  }
333
290
  // bitmarkAst -> bits -> bitsValue -> itemLead
334
- enter_itemLead(node, _parent, _route) {
291
+ enter_itemLead(node, _route) {
335
292
  const itemLead = node.value;
336
293
  if (itemLead && (itemLead.item || itemLead.lead || itemLead.pageNumber || itemLead.marginNumber)) {
337
294
  // Always write item if item or lead is set
@@ -356,7 +313,7 @@ class BitmarkGenerator {
356
313
  }
357
314
  }
358
315
  // bitmarkAst -> bits -> bitsValue -> body
359
- enter_body(node, _parent, _route) {
316
+ enter_body(node, _route) {
360
317
  // always write a NL before the body content if there is any?
361
318
  const body = node.value;
362
319
  if (body.bodyParts.length > 0) {
@@ -364,7 +321,7 @@ class BitmarkGenerator {
364
321
  }
365
322
  }
366
323
  // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> solutions
367
- enter_solutions(node, _parent, _route) {
324
+ enter_solutions(node, _route) {
368
325
  const solutions = node.value;
369
326
  if (solutions && solutions.length === 0) {
370
327
  // If there are no solutions, we need to write the special cloze gap [_] to indicate this
@@ -373,7 +330,7 @@ class BitmarkGenerator {
373
330
  }
374
331
  }
375
332
  // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> solution
376
- leaf_solution(node, _parent, route) {
333
+ leaf_solution(node, route) {
377
334
  var _a;
378
335
  const solution = node.value;
379
336
  // Ignore values that are not at the correct level as they might be handled elsewhere
@@ -387,7 +344,7 @@ class BitmarkGenerator {
387
344
  }
388
345
  }
389
346
  // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> mark
390
- leaf_mark(node, _parent, route) {
347
+ leaf_mark(node, route) {
391
348
  var _a;
392
349
  const mark = node.value;
393
350
  // Ignore values that are not at the correct level as they might be handled elsewhere
@@ -399,7 +356,7 @@ class BitmarkGenerator {
399
356
  }
400
357
  }
401
358
  // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> options -> optionsValue
402
- enter_optionsValue(node, _parent, _route) {
359
+ enter_optionsValue(node, _route) {
403
360
  const selectOption = node.value;
404
361
  if (selectOption.isCorrect) {
405
362
  this.writeOPP();
@@ -411,7 +368,7 @@ class BitmarkGenerator {
411
368
  this.writeCL();
412
369
  }
413
370
  // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> texts -> textsValue
414
- enter_textsValue(node, _parent, _route) {
371
+ enter_textsValue(node, _route) {
415
372
  const highlightText = node.value;
416
373
  if (highlightText.isCorrect) {
417
374
  this.writeOPP();
@@ -423,7 +380,7 @@ class BitmarkGenerator {
423
380
  this.writeCL();
424
381
  }
425
382
  // bitmarkAst -> bits -> bitsValue -> cardNode
426
- enter_cardNode(_node, _parent, route) {
383
+ enter_cardNode(_node, route) {
427
384
  // Ignore cards for xxx-1
428
385
  const isBitType1 = this.isOfBitType1(route);
429
386
  if (isBitType1)
@@ -431,7 +388,7 @@ class BitmarkGenerator {
431
388
  this.writeCardSetStart();
432
389
  this.writeNL();
433
390
  }
434
- between_cardNode(_node, _left, _right, _parent, route) {
391
+ between_cardNode(_node, _left, _right, route) {
435
392
  // Ignore cards for xxx-1
436
393
  const isBitType1 = this.isOfBitType1(route);
437
394
  if (isBitType1)
@@ -440,7 +397,7 @@ class BitmarkGenerator {
440
397
  this.writeCardSetCardDivider();
441
398
  this.writeNL();
442
399
  }
443
- exit_cardNode(_node, _parent, route) {
400
+ exit_cardNode(_node, route) {
444
401
  // Ignore cards for xxx-1
445
402
  const isBitType1 = this.isOfBitType1(route);
446
403
  if (isBitType1)
@@ -450,25 +407,25 @@ class BitmarkGenerator {
450
407
  this.writeNL();
451
408
  }
452
409
  // bitmarkAst -> bits -> bitsValue -> cardNode -> elements
453
- enter_elements(_node, _parent, _route) {
410
+ enter_elements(_node, _route) {
454
411
  //
455
412
  }
456
- between_elements(_node, _left, _right, _parent, _route) {
413
+ between_elements(_node, _left, _right, _route) {
457
414
  this.writeNL();
458
415
  this.writeCardSetVariantDivider();
459
416
  this.writeNL();
460
417
  }
461
- exit_elements(_node, _parent, _route) {
418
+ exit_elements(_node, _route) {
462
419
  //
463
420
  }
464
421
  // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards
465
- between_flashcards(_node, _left, _right, _parent, _route) {
422
+ between_flashcards(_node, _left, _right, _route) {
466
423
  this.writeNL();
467
424
  this.writeCardSetCardDivider();
468
425
  this.writeNL();
469
426
  }
470
427
  // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue
471
- between_flashcardsValue(_node, _left, right, _parent, _route) {
428
+ between_flashcardsValue(_node, _left, right, _route) {
472
429
  if (right.key === NodeType.answer) {
473
430
  this.writeNL();
474
431
  this.writeCardSetSideDivider();
@@ -481,8 +438,9 @@ class BitmarkGenerator {
481
438
  }
482
439
  }
483
440
  // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> answer
484
- leaf_answer(node, parent, _route) {
441
+ leaf_answer(node, route) {
485
442
  // Ignore responses that are not at the flashcardsValue level as they are handled elsewhere
443
+ const parent = this.getParentNode(route);
486
444
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.flashcardsValue)
487
445
  return;
488
446
  if (node.value) {
@@ -490,14 +448,15 @@ class BitmarkGenerator {
490
448
  }
491
449
  }
492
450
  // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers
493
- between_alternativeAnswers(_node, _parent, _route) {
451
+ between_alternativeAnswers(_node, _route) {
494
452
  this.writeNL();
495
453
  this.writeCardSetVariantDivider();
496
454
  this.writeNL();
497
455
  }
498
456
  // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers -> alternativeAnswersValue
499
- leaf_alternativeAnswersValue(node, parent, _route) {
457
+ leaf_alternativeAnswersValue(node, route) {
500
458
  // Ignore responses that are not at the alternativeAnswers level as they are handled elsewhere
459
+ const parent = this.getParentNode(route);
501
460
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.alternativeAnswers)
502
461
  return;
503
462
  if (node.value) {
@@ -505,10 +464,10 @@ class BitmarkGenerator {
505
464
  }
506
465
  }
507
466
  // bitmarkAst -> bits -> bitsValue -> cardNode -> statements
508
- enter_statements(_node, _parent, _route) {
467
+ enter_statements(_node, _route) {
509
468
  //
510
469
  }
511
- between_statements(_node, _left, _right, _parent, route) {
470
+ between_statements(_node, _left, _right, route) {
512
471
  const isTrueFalse1 = this.isOfBitType(route, BitType.trueFalse1);
513
472
  if (!isTrueFalse1) {
514
473
  this.writeNL();
@@ -516,11 +475,11 @@ class BitmarkGenerator {
516
475
  }
517
476
  this.writeNL();
518
477
  }
519
- exit_statements(_node, _parent, _route) {
478
+ exit_statements(_node, _route) {
520
479
  //
521
480
  }
522
481
  // bitmarkAst -> bits -> bitsValue -> cardNode -> statements -> statementsValue
523
- enter_statementsValue(node, _parent, _route) {
482
+ enter_statementsValue(node, _route) {
524
483
  const statement = node.value;
525
484
  if (statement.isCorrect) {
526
485
  this.writeOPP();
@@ -533,15 +492,15 @@ class BitmarkGenerator {
533
492
  }
534
493
  // bitmarkAst -> bits -> bitsValue -> choices
535
494
  // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> choices
536
- between_choices(_node, _left, _right, _parent, _route) {
495
+ between_choices(_node, _left, _right, _route) {
537
496
  this.writeNL();
538
497
  }
539
- exit_choices(_node, _parent, _route) {
498
+ exit_choices(_node, _route) {
540
499
  this.writeNL();
541
500
  }
542
501
  // bitmarkAst -> bits -> bitsValue -> choices -> choicesValue
543
502
  // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> choices -> choicesValue
544
- enter_choicesValue(node, _parent, _route) {
503
+ enter_choicesValue(node, _route) {
545
504
  const choice = node.value;
546
505
  if (choice.isCorrect) {
547
506
  this.writeOPP();
@@ -554,15 +513,15 @@ class BitmarkGenerator {
554
513
  }
555
514
  // bitmarkAst -> bits -> bitsValue -> responses
556
515
  // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> responses
557
- between_responses(_node, _left, _right, _parent, _route) {
516
+ between_responses(_node, _left, _right, _route) {
558
517
  this.writeNL();
559
518
  }
560
- exit_responses(_node, _parent, _route) {
519
+ exit_responses(_node, _route) {
561
520
  this.writeNL();
562
521
  }
563
522
  // bitmarkAst -> bits -> bitsValue -> responses -> responsesValue
564
523
  // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> responses -> responsesValue
565
- enter_responsesValue(node, _parent, _route) {
524
+ enter_responsesValue(node, _route) {
566
525
  const response = node.value;
567
526
  if (response.isCorrect) {
568
527
  this.writeOPP();
@@ -574,183 +533,184 @@ class BitmarkGenerator {
574
533
  this.writeCL();
575
534
  }
576
535
  // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes
577
- enter_quizzes(_node, _parent, _route) {
536
+ enter_quizzes(_node, _route) {
578
537
  //
579
538
  }
580
- between_quizzes(_node, _left, _right, _parent, _route) {
539
+ between_quizzes(_node, _left, _right, _route) {
581
540
  // this.writeNL();
582
541
  this.writeCardSetCardDivider();
583
542
  this.writeNL();
584
543
  }
585
- exit_quizzes(_node, _parent, _route) {
544
+ exit_quizzes(_node, _route) {
586
545
  //
587
546
  }
588
547
  // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue
589
- between_quizzesValue(_node, _left, right, _parent, _route) {
548
+ between_quizzesValue(_node, _left, right, _route) {
590
549
  if (right.key === NodeType.choices || right.key === NodeType.responses) {
591
550
  this.writeNL();
592
551
  }
593
552
  }
594
553
  // bitmarkAst -> bits -> bitsValue -> cardNode -> heading
595
- enter_heading(_node, _parent, _route) {
554
+ enter_heading(_node, _route) {
596
555
  //
597
556
  }
598
- between_heading(_node, _left, _right, _parent, _route) {
557
+ between_heading(_node, _left, _right, _route) {
599
558
  this.writeNL();
600
559
  this.writeCardSetSideDivider();
601
560
  this.writeNL();
602
561
  }
603
- exit_heading(_node, _parent, _route) {
562
+ exit_heading(_node, _route) {
604
563
  //
605
564
  }
606
565
  // bitmarkAst -> bits -> bitsValue -> cardNode -> heading -> forValues
607
- enter_forValues(_node, _parent, _route) {
566
+ enter_forValues(_node, _route) {
608
567
  //
609
568
  }
610
- between_forValues(_node, _left, _right, _parent, _route) {
569
+ between_forValues(_node, _left, _right, _route) {
611
570
  this.writeNL();
612
571
  this.writeCardSetSideDivider();
613
572
  this.writeNL();
614
573
  }
615
- exit_forValues(_node, _parent, _route) {
574
+ exit_forValues(_node, _route) {
616
575
  //
617
576
  }
618
577
  // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs
619
- enter_pairs(_node, _parent, _route) {
578
+ enter_pairs(_node, _route) {
620
579
  //
621
580
  }
622
- between_pairs(_node, _left, _right, _parent, _route) {
581
+ between_pairs(_node, _left, _right, _route) {
623
582
  this.writeNL();
624
583
  this.writeCardSetCardDivider();
625
584
  this.writeNL();
626
585
  }
627
- exit_pairs(_node, _parent, _route) {
586
+ exit_pairs(_node, _route) {
628
587
  //
629
588
  }
630
589
  // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue
631
- between_pairsValue(_node, _left, _right, _parent, _route) {
590
+ between_pairsValue(_node, _left, _right, _route) {
632
591
  //
633
592
  }
634
593
  // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> keyAudio
635
- enter_keyAudio(node, _parent, _route) {
594
+ enter_keyAudio(node, _route) {
636
595
  const resource = node.value;
637
596
  // This is a resource, so handle it with the common code
638
597
  this.writeResource(resource);
639
598
  }
640
599
  // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> keyImage
641
- enter_keyImage(node, _parent, _route) {
600
+ enter_keyImage(node, _route) {
642
601
  const resource = node.value;
643
602
  // This is a resource, so handle it with the common code
644
603
  this.writeResource(resource);
645
604
  }
646
605
  // bitmarkAst -> bits -> bitsValue -> cardNode -> matrix
647
- enter_matrix(_node, _parent, _route) {
606
+ enter_matrix(_node, _route) {
648
607
  //
649
608
  }
650
- between_matrix(_node, _left, _right, _parent, _route) {
609
+ between_matrix(_node, _left, _right, _route) {
651
610
  this.writeNL();
652
611
  this.writeCardSetCardDivider();
653
612
  this.writeNL();
654
613
  }
655
- exit_matrix(_node, _parent, _route) {
614
+ exit_matrix(_node, _route) {
656
615
  //
657
616
  }
658
617
  // bitmarkAst -> bits -> bitsValue -> cardNode -> matrix -> matrixValue
659
- between_matrixValue(_node, _left, _right, _parent, _route) {
618
+ between_matrixValue(_node, _left, _right, _route) {
660
619
  //
661
620
  }
662
621
  // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> values
663
622
  // bitmarkAst -> bits -> bitsValue -> cardNode -> matrix -> matrixValue -> cells -> cellsValue -> values
664
- enter_values(_node, _parent, _route) {
623
+ enter_values(_node, _route) {
665
624
  this.writeNL();
666
625
  this.writeCardSetSideDivider();
667
626
  this.writeNL();
668
627
  }
669
- between_values(_node, _left, _right, _parent, _route) {
628
+ between_values(_node, _left, _right, _route) {
670
629
  this.writeNL();
671
630
  this.writeCardSetVariantDivider();
672
631
  this.writeNL();
673
632
  }
674
633
  // bitmarkAst -> bits -> bitsValue -> cardNode -> questions
675
- enter_questions(_node, _parent, _route) {
634
+ enter_questions(_node, _route) {
676
635
  //
677
636
  }
678
- between_questions(_node, _left, _right, _parent, _route) {
637
+ between_questions(_node, _left, _right, _route) {
679
638
  this.writeCardSetCardDivider();
680
639
  this.writeNL();
681
640
  }
682
- exit_questions(_node, _parent, _route) {
641
+ exit_questions(_node, _route) {
683
642
  //
684
643
  }
685
644
  // bitmarkAst -> bits -> bitsValue -> cardNode -> questions -> questionsValue
686
- between_questionsValue(_node, _left, right, _parent, _route) {
645
+ between_questionsValue(_node, _left, right, _route) {
687
646
  if (right.key === NodeType.sampleSolution) {
688
647
  this.writeNL();
689
648
  }
690
649
  }
691
- exit_questionsValue(_node, _parent, _route) {
650
+ exit_questionsValue(_node, _route) {
692
651
  this.writeNL();
693
652
  }
694
653
  // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses
695
- enter_botResponses(_node, _parent, _route) {
654
+ enter_botResponses(_node, _route) {
696
655
  //
697
656
  }
698
- between_botResponses(_node, _left, _right, _parent, _route) {
657
+ between_botResponses(_node, _left, _right, _route) {
699
658
  this.writeCardSetCardDivider();
700
659
  this.writeNL();
701
660
  }
702
- exit_botResponses(_node, _parent, _route) {
661
+ exit_botResponses(_node, _route) {
703
662
  //
704
663
  }
705
664
  // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue
706
- between_botResponsesValue(_node, _left, _right, _parent, _route) {
665
+ between_botResponsesValue(_node, _left, _right, _route) {
707
666
  this.writeNL();
708
667
  }
709
- exit_botResponsesValue(_node, _parent, _route) {
668
+ exit_botResponsesValue(_node, _route) {
710
669
  this.writeNL();
711
670
  }
712
671
  // bitmarkAst -> bits -> bitsValue -> cardNode -> cardBits
713
- enter_cardBits(_node, _parent, _route) {
672
+ enter_cardBits(_node, _route) {
714
673
  //
715
674
  }
716
- between_cardBits(_node, _left, _right, _parent, _route) {
675
+ between_cardBits(_node, _left, _right, _route) {
717
676
  this.writeNL();
718
677
  this.writeCardSetCardDivider();
719
678
  this.writeNL();
720
679
  }
721
- exit_cardBits(_node, _parent, _route) {
680
+ exit_cardBits(_node, _route) {
722
681
  //
723
682
  }
724
683
  // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
725
- leaf_response(node, _parent, _route) {
684
+ leaf_response(node, _route) {
726
685
  this.writeOPB();
727
686
  this.writeString(node.value);
728
687
  this.writeCL();
729
688
  }
730
689
  // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> reaction
731
- leaf_reaction(node, _parent, _route) {
690
+ leaf_reaction(node, _route) {
732
691
  this.writeProperty('reaction', node.value, true);
733
692
  }
734
693
  // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> feedback
735
- leaf_feedback(node, _parent, _route) {
694
+ leaf_feedback(node, _route) {
736
695
  const feeback = node.value;
737
696
  if (feeback) {
738
697
  this.write(feeback);
739
698
  }
740
699
  }
741
700
  // bitmarkAst -> bits -> bitsValue -> resources
742
- between_resources(_node, _left, _right, _parent, _route) {
701
+ between_resources(_node, _left, _right, _route) {
743
702
  this.writeNL();
744
703
  }
745
704
  // bitmarkAst -> bits -> bitsValue -> resourcesValue
746
- enter_resourcesValue(node, _parent, _route) {
705
+ enter_resourcesValue(node, _route) {
747
706
  const resource = node.value;
748
707
  // This is a resource, so handle it with the common code
749
708
  this.writeResource(resource);
750
709
  }
751
710
  // bitmarkAst -> bits -> bitsValue -> posterImage
752
711
  // bitmarkAst -> bits -> bitsValue -> resource -> posterImage
753
- enter_posterImage(node, parent, _route) {
712
+ enter_posterImage(node, route) {
713
+ const parent = this.getParentNode(route);
754
714
  if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.bitsValue) {
755
715
  // Bit poster image
756
716
  const posterImage = node.value;
@@ -768,7 +728,7 @@ class BitmarkGenerator {
768
728
  }
769
729
  // bitmarkAst -> bits -> bitsValue -> resource -> thumbnails
770
730
  // [src1x,src2x,src3x,src4x,width,height,alt,zoomDisabled,caption]
771
- enter_thumbnails(node, _parent, _route) {
731
+ enter_thumbnails(node, _route) {
772
732
  const thumbnails = node.value;
773
733
  if (Array.isArray(thumbnails)) {
774
734
  const thumbnailKeys = ['src1x', 'src2x', 'src3x', 'src4x'];
@@ -788,7 +748,8 @@ class BitmarkGenerator {
788
748
  // bitmarkAst -> bits -> bitsValue -> bitType
789
749
  // bitmarkAst -> bits -> bitsValue -> textFormat
790
750
  // bitmarkAst -> bits -> title
791
- leaf_title(node, parent, _route) {
751
+ leaf_title(node, route) {
752
+ const parent = this.getParentNode(route);
792
753
  const value = node.value;
793
754
  const title = value;
794
755
  const bit = parent === null || parent === void 0 ? void 0 : parent.value;
@@ -802,7 +763,7 @@ class BitmarkGenerator {
802
763
  }
803
764
  }
804
765
  // bitmarkAst -> bits -> subtitle
805
- leaf_subtitle(node, _parent, _route) {
766
+ leaf_subtitle(node, _route) {
806
767
  const value = node.value;
807
768
  const subtitle = value;
808
769
  const level = 2;
@@ -815,7 +776,8 @@ class BitmarkGenerator {
815
776
  }
816
777
  }
817
778
  // bitmarkAst -> bits -> bitsValue -> book
818
- leaf_book(node, parent, _route) {
779
+ leaf_book(node, route) {
780
+ const parent = this.getParentNode(route);
819
781
  const bit = parent === null || parent === void 0 ? void 0 : parent.value;
820
782
  if (bit && node.value) {
821
783
  this.writeProperty('book', node.value);
@@ -832,7 +794,7 @@ class BitmarkGenerator {
832
794
  }
833
795
  }
834
796
  // bitmarkAst -> bits -> bitsValue -> anchor
835
- leaf_anchor(node, _parent, _route) {
797
+ leaf_anchor(node, _route) {
836
798
  if (node.value) {
837
799
  this.writeOPDANGLE();
838
800
  this.writeString(node.value);
@@ -840,7 +802,8 @@ class BitmarkGenerator {
840
802
  }
841
803
  }
842
804
  // bitmarkAst -> bits -> bitsValue -> reference
843
- leaf_reference(node, parent, _route) {
805
+ leaf_reference(node, route) {
806
+ const parent = this.getParentNode(route);
844
807
  const bit = parent === null || parent === void 0 ? void 0 : parent.value;
845
808
  if (bit && node.value) {
846
809
  // Only write reference if it is not chained to 'book'
@@ -854,7 +817,7 @@ class BitmarkGenerator {
854
817
  // * -> itemLead --> item
855
818
  // * -> itemLead --> lead
856
819
  // * -> hint
857
- leaf_hint(node, _parent, _route) {
820
+ leaf_hint(node, _route) {
858
821
  const value = node.value;
859
822
  const text = value;
860
823
  if (text) {
@@ -864,7 +827,7 @@ class BitmarkGenerator {
864
827
  }
865
828
  }
866
829
  // bitmarkAst -> bits -> bitsValue -> * -> instruction
867
- leaf_instruction(node, _parent, _route) {
830
+ leaf_instruction(node, _route) {
868
831
  const value = node.value;
869
832
  const text = value;
870
833
  if (text) {
@@ -874,9 +837,10 @@ class BitmarkGenerator {
874
837
  }
875
838
  }
876
839
  // bitmarkAst -> bits -> bitsValue -> * -> example
877
- leaf_example(node, parent, _route) {
840
+ leaf_example(node, route) {
878
841
  var _a, _b;
879
842
  const value = node.value;
843
+ const parent = this.getParentNode(route);
880
844
  const isExample = (_a = parent === null || parent === void 0 ? void 0 : parent.value.isExample) !== null && _a !== void 0 ? _a : false;
881
845
  const isDefaultExample = (_b = parent === null || parent === void 0 ? void 0 : parent.value.isDefaultExample) !== null && _b !== void 0 ? _b : false;
882
846
  if (!isExample)
@@ -904,7 +868,7 @@ class BitmarkGenerator {
904
868
  }
905
869
  }
906
870
  // bitmarkAst -> bits -> body -> bodyValue -> bodyText
907
- leaf_bodyText(node, _parent, _route) {
871
+ leaf_bodyText(node, _route) {
908
872
  const value = node.value;
909
873
  const text = value;
910
874
  if (text) {
@@ -912,7 +876,7 @@ class BitmarkGenerator {
912
876
  }
913
877
  }
914
878
  // bitmarkAst -> bits -> footer -> footerText
915
- leaf_footerText(node, _parent, _route) {
879
+ leaf_footerText(node, _route) {
916
880
  const value = node.value;
917
881
  const text = value;
918
882
  if (text) {
@@ -920,14 +884,14 @@ class BitmarkGenerator {
920
884
  }
921
885
  }
922
886
  // bitmarkAst -> bits -> bitsValue -> elements -> elementsValue
923
- leaf_elementsValue(node, _parent, _route) {
887
+ leaf_elementsValue(node, _route) {
924
888
  if (node.value) {
925
889
  this.writeString(node.value);
926
890
  }
927
891
  }
928
892
  // bitmarkAst -> bits -> bitsValue -> body -> bodyValue -> gap -> solutions -> solution
929
893
  // ? -> solutions -> solution
930
- leaf_solutionsValue(node, _parent, _route) {
894
+ leaf_solutionsValue(node, _route) {
931
895
  if (node.value) {
932
896
  this.writeOPU();
933
897
  this.writeString(node.value);
@@ -936,7 +900,7 @@ class BitmarkGenerator {
936
900
  }
937
901
  // bitmarkAst -> bits -> bitsValue-> body -> bodyValue -> select -> options -> prefix
938
902
  // bitmarkAst -> bits -> bitsValue-> body -> bodyValue -> highlight -> options -> prefix
939
- leaf_prefix(node, _parent, _route) {
903
+ leaf_prefix(node, _route) {
940
904
  if (node.value) {
941
905
  this.writeOPPRE();
942
906
  this.writeString(node.value);
@@ -945,7 +909,7 @@ class BitmarkGenerator {
945
909
  }
946
910
  // bitmarkAst -> bits -> bitsValue-> body -> bodyValue -> select -> options -> postfix
947
911
  // bitmarkAst -> bits -> bitsValue-> body -> bodyValue -> highlight -> options -> postfix
948
- leaf_postfix(node, _parent, _route) {
912
+ leaf_postfix(node, _route) {
949
913
  if (node.value) {
950
914
  this.writeOPPOST();
951
915
  this.writeString(node.value);
@@ -953,40 +917,41 @@ class BitmarkGenerator {
953
917
  }
954
918
  }
955
919
  // bitmarkAst -> bits -> bitsValue -> * -> isCaseSensitive
956
- leaf_isCaseSensitive(node, _parent, _route) {
920
+ leaf_isCaseSensitive(node, _route) {
957
921
  this.writeProperty('isCaseSensitive', node.value, true, false, true);
958
922
  }
959
923
  // bitmarkAst -> bits -> bitsValue -> * -> isCorrect
960
924
  // bitmarkAst -> bits -> bitsValue -> heading -> forKeys
961
- leaf_forKeys(node, _parent, _route) {
925
+ leaf_forKeys(node, _route) {
962
926
  this.writeOPHASH();
963
927
  this.writeString(node.value);
964
928
  this.writeCL();
965
929
  }
966
930
  // bitmarkAst -> bits -> bitsValue -> heading -> forValuesValue
967
- leaf_forValuesValue(node, _parent, _route) {
931
+ leaf_forValuesValue(node, _route) {
968
932
  this.writeOPHASH();
969
933
  this.writeString(node.value);
970
934
  this.writeCL();
971
935
  }
972
936
  // bitmarkAst -> bits -> bitsValue -> pairs -> pairsValue -> key
973
937
  // bitmarkAst -> bits -> bitsValue -> matrix -> matrixValue -> key
974
- leaf_key(node, _parent, _route) {
938
+ leaf_key(node, _route) {
975
939
  if (node.value) {
976
940
  this.writeString(node.value);
977
941
  }
978
942
  }
979
943
  // bitmarkAst -> bits -> bitsValue -> pairs -> pairsValue -> values -> valuesValue
980
944
  // bitmarkAst -> bits -> bitsValue -> matrix -> matrixValue -> cells -> cellsValue -> values -> valuesValue
981
- leaf_valuesValue(node, _parent, _route) {
945
+ leaf_valuesValue(node, _route) {
982
946
  if (node.value) {
983
947
  this.writeString(node.value);
984
948
  }
985
949
  }
986
950
  // bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> question
987
951
  // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> question
988
- leaf_question(node, parent, _route) {
952
+ leaf_question(node, route) {
989
953
  // Ignore responses that are not at the questionsValue level as they are handled elsewhere
954
+ const parent = this.getParentNode(route);
990
955
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.questionsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.flashcardsValue)
991
956
  return;
992
957
  if (node.value) {
@@ -999,29 +964,29 @@ class BitmarkGenerator {
999
964
  // bitmarkAst -> bits -> bitsValue -> resource -> posterImage -> ...
1000
965
  // bitmarkAst -> bits -> bitsValue -> resource -> thumbnails -> thumbnailsValue -> ...
1001
966
  // [src1x,src2x,src3x,src4x,width,height,alt,zoomDisabled,caption]
1002
- leaf_src1x(node, _parent, _route) {
967
+ leaf_src1x(node, _route) {
1003
968
  this.writeProperty('src1x', node.value);
1004
969
  }
1005
- leaf_src2x(node, _parent, _route) {
970
+ leaf_src2x(node, _route) {
1006
971
  this.writeProperty('src2x', node.value);
1007
972
  }
1008
- leaf_src3x(node, _parent, _route) {
973
+ leaf_src3x(node, _route) {
1009
974
  this.writeProperty('src3x', node.value);
1010
975
  }
1011
- leaf_src4x(node, _parent, _route) {
976
+ leaf_src4x(node, _route) {
1012
977
  this.writeProperty('src4x', node.value);
1013
978
  }
1014
- leaf_width(node, _parent, _route) {
979
+ leaf_width(node, _route) {
1015
980
  this.writeProperty('width', node.value);
1016
981
  }
1017
- leaf_height(node, _parent, _route) {
982
+ leaf_height(node, _route) {
1018
983
  this.writeProperty('height', node.value);
1019
984
  }
1020
- leaf_alt(node, _parent, _route) {
985
+ leaf_alt(node, _route) {
1021
986
  this.writeProperty('alt', node.value);
1022
987
  }
1023
- leaf_zoomDisabled(node, _parent, _route) {
1024
- const bitType = this.getBitType(_route);
988
+ leaf_zoomDisabled(node, route) {
989
+ const bitType = this.getBitType(route);
1025
990
  if (Config.isOfBitType(bitType, [BitType.imageSeparator, BitType.pageBanner])) {
1026
991
  this.writeProperty('zoomDisabled', node.value, undefined, false, true);
1027
992
  }
@@ -1029,20 +994,20 @@ class BitmarkGenerator {
1029
994
  this.writeProperty('zoomDisabled', node.value, undefined, true, false);
1030
995
  }
1031
996
  }
1032
- leaf_license(node, _parent, _route) {
997
+ leaf_license(node, _route) {
1033
998
  this.writeProperty('license', node.value);
1034
999
  }
1035
- leaf_copyright(node, _parent, _route) {
1000
+ leaf_copyright(node, _route) {
1036
1001
  this.writeProperty('copyright', node.value);
1037
1002
  }
1038
- leaf_provider(_node, _parent, _route) {
1003
+ leaf_provider(_node, _route) {
1039
1004
  // provider is included in the url (it is the domain) and should not be written as a property
1040
1005
  // this.writeProperty('provider', node.value);
1041
1006
  }
1042
- leaf_showInIndex(node, _parent, _route) {
1007
+ leaf_showInIndex(node, _route) {
1043
1008
  this.writeProperty('showInIndex', node.value);
1044
1009
  }
1045
- leaf_caption(node, _parent, _route) {
1010
+ leaf_caption(node, _route) {
1046
1011
  const value = node.value;
1047
1012
  this.writeProperty('caption', value);
1048
1013
  }
@@ -1050,22 +1015,23 @@ class BitmarkGenerator {
1050
1015
  // bitmarkAst -> bits -> bitsValue -> resource -> posterImage -> ...
1051
1016
  // bitmarkAst -> bits -> bitsValue -> resource -> thumbnails -> thumbnailsValue -> ...
1052
1017
  // [duration,mute,autoplay,allowSubtitles,showSubtitles]
1053
- leaf_duration(node, parent, _route) {
1018
+ leaf_duration(node, route) {
1054
1019
  // Ignore duration that IS at the bit level as there is a key clash with resource...duration / bit.duration
1020
+ const parent = this.getParentNode(route);
1055
1021
  if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.bitsValue)
1056
1022
  return;
1057
1023
  this.writeProperty('duration', node.value);
1058
1024
  }
1059
- leaf_mute(node, _parent, _route) {
1025
+ leaf_mute(node, _route) {
1060
1026
  this.writeProperty('mute', node.value);
1061
1027
  }
1062
- leaf_autoplay(node, _parent, _route) {
1028
+ leaf_autoplay(node, _route) {
1063
1029
  this.writeProperty('autoplay', node.value);
1064
1030
  }
1065
- leaf_allowSubtitles(node, _parent, _route) {
1031
+ leaf_allowSubtitles(node, _route) {
1066
1032
  this.writeProperty('allowSubtitles', node.value);
1067
1033
  }
1068
- leaf_showSubtitles(node, _parent, _route) {
1034
+ leaf_showSubtitles(node, _route) {
1069
1035
  this.writeProperty('showSubtitles', node.value);
1070
1036
  }
1071
1037
  //
@@ -1074,7 +1040,7 @@ class BitmarkGenerator {
1074
1040
  /**
1075
1041
  * Generate the handlers for properties, as they are mostly the same, but not quite
1076
1042
  */
1077
- // protected enter_labelTrue(node: NodeInfo, parent: NodeInfo | undefined, _route: NodeInfo[],
1043
+ // protected enter_labelTrue(node: NodeInfo, _route: NodeInfo[],
1078
1044
  // ): void {
1079
1045
  // const bit = parent?.value as Bit;
1080
1046
  // if (bit) {
@@ -1106,12 +1072,13 @@ class BitmarkGenerator {
1106
1072
  continue;
1107
1073
  const funcName = `enter_${astKey}`;
1108
1074
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1109
- this[funcName] = (node, parent, _route) => {
1075
+ this[funcName] = (node, route) => {
1110
1076
  const value = node.value;
1111
1077
  if (value == null)
1112
1078
  return;
1113
1079
  // if (propertyConfig.tag === 'progress') debugger;
1114
1080
  // Ignore any property that is not at the bit level as that will be handled by a different handler
1081
+ const parent = this.getParentNode(route);
1115
1082
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
1116
1083
  return;
1117
1084
  // Write the property
@@ -1330,6 +1297,9 @@ class BitmarkGenerator {
1330
1297
  }
1331
1298
  this.writeString(tag);
1332
1299
  }
1300
+ //
1301
+ // Helper functions
1302
+ //
1333
1303
  isWriteTextFormat(bitsValue, textFormatDefault) {
1334
1304
  const isDefault = TextFormat.fromValue(bitsValue) === textFormatDefault;
1335
1305
  const writeFormat = !isDefault || this.options.explicitTextFormat;
@@ -1351,12 +1321,6 @@ class BitmarkGenerator {
1351
1321
  }
1352
1322
  return undefined;
1353
1323
  }
1354
- getParentNode(route, nodesBack = 1) {
1355
- if (route.length > nodesBack + 1) {
1356
- return route[route.length - nodesBack - 1];
1357
- }
1358
- return undefined;
1359
- }
1360
1324
  //
1361
1325
  // Writer interface
1362
1326
  //