@gmb/bitmark-parser-generator 3.10.0 → 3.12.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/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/cjs/ast/BaseBuilder.js +2 -0
- package/dist/cjs/ast/BaseBuilder.js.map +1 -1
- package/dist/cjs/ast/Builder.js +32 -3
- package/dist/cjs/ast/Builder.js.map +1 -1
- package/dist/cjs/ast/ResourceBuilder.js +1 -0
- package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
- package/dist/cjs/config/raw/bits.js +40 -0
- package/dist/cjs/config/raw/bits.js.map +1 -1
- package/dist/cjs/config/raw/cardSets.js +8 -0
- package/dist/cjs/config/raw/cardSets.js.map +1 -1
- package/dist/cjs/config/raw/groups.js +15 -0
- package/dist/cjs/config/raw/groups.js.map +1 -1
- package/dist/cjs/config/raw/properties.js +10 -0
- package/dist/cjs/config/raw/properties.js.map +1 -1
- package/dist/cjs/generated/build-info.js +1 -1
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js +246 -398
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +9 -6
- package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
- package/dist/cjs/model/ast/NodeType.js +3 -0
- package/dist/cjs/model/ast/NodeType.js.map +1 -1
- package/dist/cjs/model/config/enum/GroupConfigKey.js +1 -0
- package/dist/cjs/model/config/enum/GroupConfigKey.js.map +1 -1
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +2 -0
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/cjs/model/enum/BitType.js +16 -0
- package/dist/cjs/model/enum/BitType.js.map +1 -1
- package/dist/cjs/model/enum/ResourceTag.js +1 -0
- package/dist/cjs/model/enum/ResourceTag.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +26 -16
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +5 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/esm/ast/BaseBuilder.js +2 -0
- package/dist/esm/ast/BaseBuilder.js.map +1 -1
- package/dist/esm/ast/Builder.js +32 -3
- package/dist/esm/ast/Builder.js.map +1 -1
- package/dist/esm/ast/ResourceBuilder.js +1 -0
- package/dist/esm/ast/ResourceBuilder.js.map +1 -1
- package/dist/esm/config/raw/bits.js +40 -0
- package/dist/esm/config/raw/bits.js.map +1 -1
- package/dist/esm/config/raw/cardSets.js +8 -0
- package/dist/esm/config/raw/cardSets.js.map +1 -1
- package/dist/esm/config/raw/groups.js +15 -0
- package/dist/esm/config/raw/groups.js.map +1 -1
- package/dist/esm/config/raw/properties.js +10 -0
- package/dist/esm/config/raw/properties.js.map +1 -1
- package/dist/esm/generated/build-info.js +1 -1
- package/dist/esm/generator/bitmark/BitmarkGenerator.js +246 -398
- package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +9 -6
- package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
- package/dist/esm/model/ast/NodeType.js +3 -0
- package/dist/esm/model/ast/NodeType.js.map +1 -1
- package/dist/esm/model/config/enum/GroupConfigKey.js +1 -0
- package/dist/esm/model/config/enum/GroupConfigKey.js.map +1 -1
- package/dist/esm/model/config/enum/PropertyConfigKey.js +2 -0
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/esm/model/enum/BitType.js +16 -0
- package/dist/esm/model/enum/BitType.js.map +1 -1
- package/dist/esm/model/enum/ResourceTag.js +1 -0
- package/dist/esm/model/enum/ResourceTag.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +26 -16
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +6 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/types/ast/BaseBuilder.d.ts +2 -0
- package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
- package/dist/types/ast/Builder.d.ts +4 -1
- package/dist/types/ast/Builder.d.ts.map +1 -1
- package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
- package/dist/types/config/raw/bits.d.ts.map +1 -1
- package/dist/types/config/raw/cardSets.d.ts.map +1 -1
- package/dist/types/config/raw/groups.d.ts.map +1 -1
- package/dist/types/config/raw/properties.d.ts.map +1 -1
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +16 -43
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
- package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
- package/dist/types/model/ast/NodeType.d.ts +6 -0
- package/dist/types/model/ast/NodeType.d.ts.map +1 -1
- package/dist/types/model/ast/Nodes.d.ts +2 -0
- package/dist/types/model/ast/Nodes.d.ts.map +1 -1
- package/dist/types/model/config/enum/ConfigKey.d.ts +6 -0
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/GroupConfigKey.d.ts +3 -0
- package/dist/types/model/config/enum/GroupConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +6 -0
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
- package/dist/types/model/enum/BitType.d.ts +32 -0
- package/dist/types/model/enum/BitType.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyTag.d.ts +4 -0
- package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
- package/dist/types/model/enum/ResourceTag.d.ts +2 -0
- package/dist/types/model/enum/ResourceTag.d.ts.map +1 -1
- package/dist/types/model/json/BitJson.d.ts +12 -6
- package/dist/types/model/json/BitJson.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +2 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,9 @@ const DEFAULT_OPTIONS = {
|
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Generate bitmark markup from a bitmark AST
|
|
32
|
+
*
|
|
33
|
+
* NOTE: Newlines - a newline is written BEFORE each content that requries a newline
|
|
34
|
+
*
|
|
32
35
|
*/
|
|
33
36
|
class BitmarkGenerator extends AstWalkerGenerator {
|
|
34
37
|
/**
|
|
@@ -51,10 +54,9 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
51
54
|
super();
|
|
52
55
|
this.ast = new Ast();
|
|
53
56
|
// State
|
|
57
|
+
this.firstBit = true;
|
|
54
58
|
this.hasCardSet = false;
|
|
55
59
|
this.hasFooter = false;
|
|
56
|
-
this.skipNLBetweenBitsValue = false;
|
|
57
|
-
this.wroteSomething = false;
|
|
58
60
|
this.inTag = true;
|
|
59
61
|
// Keep TS happy
|
|
60
62
|
this.inTag;
|
|
@@ -127,10 +129,9 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
127
129
|
this.writer.closeSync();
|
|
128
130
|
}
|
|
129
131
|
resetState() {
|
|
132
|
+
this.firstBit = true;
|
|
130
133
|
this.hasCardSet = false;
|
|
131
134
|
this.hasFooter = false;
|
|
132
|
-
this.skipNLBetweenBitsValue = false;
|
|
133
|
-
this.wroteSomething = false;
|
|
134
135
|
this.inTag = true;
|
|
135
136
|
this.printed = false;
|
|
136
137
|
}
|
|
@@ -147,12 +148,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
147
148
|
// Non-Terminal nodes (branches)
|
|
148
149
|
//
|
|
149
150
|
// bitmark
|
|
150
|
-
// bitmarkAst -> bits
|
|
151
|
-
between_bits(_node, _left, _right, _route) {
|
|
152
|
-
this.writeNL();
|
|
153
|
-
this.writeNL();
|
|
154
|
-
this.writeNL();
|
|
155
|
-
}
|
|
156
151
|
// bitmarkAst -> bits -> bitsValue
|
|
157
152
|
enter_bitsValue(node, _route) {
|
|
158
153
|
const bit = node.value;
|
|
@@ -160,6 +155,12 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
160
155
|
const bitResourcesConfig = Config.getBitResourcesConfig(bit.bitType, bit.resourceType);
|
|
161
156
|
this.hasCardSet = this.haveValidCardSet(bit);
|
|
162
157
|
this.hasFooter = this.haveValidFooter(bit);
|
|
158
|
+
// Separate the bits with 3 newlines
|
|
159
|
+
if (!this.firstBit) {
|
|
160
|
+
this.writeNL();
|
|
161
|
+
this.writeNL();
|
|
162
|
+
this.writeNL();
|
|
163
|
+
}
|
|
163
164
|
// Write the bit tag opening
|
|
164
165
|
this.writeOPD(bit.bitLevel);
|
|
165
166
|
if (bit.isCommented)
|
|
@@ -195,22 +196,12 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
195
196
|
this.writeBreakscapedTagString(resourceType);
|
|
196
197
|
}
|
|
197
198
|
this.writeCL();
|
|
198
|
-
this.writeNL();
|
|
199
|
+
// this.writeNL();
|
|
199
200
|
// Continue traversal
|
|
200
201
|
return true;
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const noNlKeys = [
|
|
205
|
-
NodeType.bitType,
|
|
206
|
-
NodeType.textFormat,
|
|
207
|
-
NodeType.level,
|
|
208
|
-
NodeType.progress,
|
|
209
|
-
NodeType.toc,
|
|
210
|
-
NodeType.referenceEnd,
|
|
211
|
-
NodeType.labelFalse,
|
|
212
|
-
];
|
|
213
|
-
this.writeNlBetween(node, left, right, route, noNlKeys);
|
|
203
|
+
exit_bitsValue(_node, _route) {
|
|
204
|
+
this.firstBit = false;
|
|
214
205
|
}
|
|
215
206
|
// bitmarkAst -> bits -> bitsValue -> internalComment
|
|
216
207
|
enter_internalComment(node, route) {
|
|
@@ -221,14 +212,12 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
221
212
|
return true;
|
|
222
213
|
for (let i = 0; i < internalComment.length; i++) {
|
|
223
214
|
const comment = internalComment[i];
|
|
224
|
-
|
|
215
|
+
this.writeNL();
|
|
225
216
|
this.writeProperty('internalComment', comment, {
|
|
226
217
|
format: PropertyFormat.trimmedString,
|
|
227
218
|
single: false,
|
|
228
219
|
ignoreEmpty: true,
|
|
229
220
|
});
|
|
230
|
-
if (!last)
|
|
231
|
-
this.writeNL();
|
|
232
221
|
}
|
|
233
222
|
// Stop traversal of this branch
|
|
234
223
|
return false;
|
|
@@ -242,13 +231,18 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
242
231
|
return true;
|
|
243
232
|
const bit = parent === null || parent === void 0 ? void 0 : parent.value;
|
|
244
233
|
if (bit) {
|
|
245
|
-
|
|
234
|
+
const haveTrue = value != '';
|
|
235
|
+
const haveFalse = bit.labelFalse && bit.labelFalse[0] != '';
|
|
236
|
+
if (haveTrue || haveFalse) {
|
|
237
|
+
this.writeNL();
|
|
238
|
+
}
|
|
239
|
+
if (haveTrue)
|
|
246
240
|
this.writeProperty(PropertyTag.labelTrue, value, {
|
|
247
241
|
format: PropertyFormat.trimmedString,
|
|
248
242
|
single: true,
|
|
249
243
|
ignoreEmpty: true,
|
|
250
244
|
});
|
|
251
|
-
if (
|
|
245
|
+
if (haveFalse)
|
|
252
246
|
this.writeProperty(PropertyTag.labelFalse, bit.labelFalse, {
|
|
253
247
|
format: PropertyFormat.trimmedString,
|
|
254
248
|
single: true,
|
|
@@ -258,6 +252,10 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
258
252
|
// Stop traversal of this branch
|
|
259
253
|
return false;
|
|
260
254
|
}
|
|
255
|
+
enter_labelFalse(_node, _route) {
|
|
256
|
+
// Handled above in enter_labelTrue(), but this function needed to block automatic property handling
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
261
259
|
// bitmarkAst -> bits -> bitsValue -> imageSource
|
|
262
260
|
enter_imageSource(node, route) {
|
|
263
261
|
const imageSource = node.value;
|
|
@@ -266,6 +264,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
266
264
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
267
265
|
return true;
|
|
268
266
|
const { url, mockupId, size, format, trim } = imageSource;
|
|
267
|
+
this.writeNL();
|
|
269
268
|
this.writeProperty('imageSource', url, {
|
|
270
269
|
format: PropertyFormat.trimmedString,
|
|
271
270
|
single: true,
|
|
@@ -308,6 +307,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
308
307
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
309
308
|
return true;
|
|
310
309
|
const { technicalTerm, lang } = nodeValue;
|
|
310
|
+
this.writeNL();
|
|
311
311
|
this.writeProperty('technicalTerm', technicalTerm, {
|
|
312
312
|
format: PropertyFormat.trimmedString,
|
|
313
313
|
single: true,
|
|
@@ -331,6 +331,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
331
331
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
332
332
|
return true;
|
|
333
333
|
const { servings, unit, unitAbbr, decimalPlaces, disableCalculation, hint } = nodeValue;
|
|
334
|
+
this.writeNL();
|
|
334
335
|
this.writeProperty('servings', servings, {
|
|
335
336
|
format: PropertyFormat.trimmedString,
|
|
336
337
|
single: true,
|
|
@@ -384,6 +385,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
384
385
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
385
386
|
return true;
|
|
386
387
|
const { name, title, avatarImage } = person;
|
|
388
|
+
this.writeNL();
|
|
387
389
|
this.writeProperty('person', name, {
|
|
388
390
|
format: PropertyFormat.trimmedString,
|
|
389
391
|
single: true,
|
|
@@ -402,6 +404,88 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
402
404
|
// Stop traversal of this branch
|
|
403
405
|
return false;
|
|
404
406
|
}
|
|
407
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> term -> text
|
|
408
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> definition -> text
|
|
409
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> alternativeDefinitions
|
|
410
|
+
// -> alternativeDefinitionsValue -> text
|
|
411
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> question -> text
|
|
412
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> answer -> text
|
|
413
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers ->
|
|
414
|
+
// -> alternativeAnswersValue -> text
|
|
415
|
+
enter_text(node, route) {
|
|
416
|
+
const parent = this.getParentNode(route);
|
|
417
|
+
if (!parent ||
|
|
418
|
+
(parent.key !== NodeType.term &&
|
|
419
|
+
parent.key !== NodeType.definition &&
|
|
420
|
+
parent.key !== NodeType.alternativeDefinitionsValue &&
|
|
421
|
+
parent.key !== NodeType.question &&
|
|
422
|
+
parent.key !== NodeType.answer &&
|
|
423
|
+
parent.key !== NodeType.alternativeAnswersValue)) {
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
426
|
+
if (node.value) {
|
|
427
|
+
this.writeNL();
|
|
428
|
+
this.textGenerator.generateSync(node.value, TextFormat.bitmarkMinusMinus);
|
|
429
|
+
}
|
|
430
|
+
// Stop traversal of this branch
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
leaf_text(node, route) {
|
|
434
|
+
const parent = this.getParentNode(route);
|
|
435
|
+
if (!parent ||
|
|
436
|
+
(parent.key !== NodeType.term &&
|
|
437
|
+
parent.key !== NodeType.definition &&
|
|
438
|
+
parent.key !== NodeType.alternativeDefinitionsValue &&
|
|
439
|
+
parent.key !== NodeType.question &&
|
|
440
|
+
parent.key !== NodeType.answer &&
|
|
441
|
+
parent.key !== NodeType.alternativeAnswersValue)) {
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
if (StringUtils.isString(node.value)) {
|
|
445
|
+
const str = node.value;
|
|
446
|
+
this.writeNL();
|
|
447
|
+
this.write(Breakscape.breakscape(str, {
|
|
448
|
+
textFormat: TextFormat.text,
|
|
449
|
+
}));
|
|
450
|
+
}
|
|
451
|
+
// Stop traversal of this branch
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
// bitmarkAst -> bits -> bitsValue -> * -> term -> icon
|
|
455
|
+
// bitmarkAst -> bits -> bitsValue -> * -> definition -> icon
|
|
456
|
+
// bitmarkAst -> bits -> bitsValue -> * -> alternativeDefinitionsValue -> icon
|
|
457
|
+
enter_icon(node, route) {
|
|
458
|
+
const resource = node.value;
|
|
459
|
+
const parent = this.getParentNode(route);
|
|
460
|
+
if (!parent)
|
|
461
|
+
return true;
|
|
462
|
+
if (parent.key !== NodeType.term &&
|
|
463
|
+
parent.key !== NodeType.definition &&
|
|
464
|
+
parent.key !== NodeType.alternativeDefinitionsValue &&
|
|
465
|
+
parent.key !== NodeType.question &&
|
|
466
|
+
parent.key !== NodeType.answer &&
|
|
467
|
+
parent.key !== NodeType.alternativeAnswersValue) {
|
|
468
|
+
// Continue traversal of this branch
|
|
469
|
+
return true;
|
|
470
|
+
}
|
|
471
|
+
// This is a resource, so handle it with the common code
|
|
472
|
+
this.writeNL();
|
|
473
|
+
this.writeResource(ResourceTag.icon, resource.src);
|
|
474
|
+
// this.writePropertyStyleResource(ResourceTag.icon, resource as ResourceJson);
|
|
475
|
+
// Continue traversal of this branch (for the chained properties)
|
|
476
|
+
return true;
|
|
477
|
+
}
|
|
478
|
+
leaf_iconValue(node, _route) {
|
|
479
|
+
// Handle as a standard icon property
|
|
480
|
+
this.writeNL();
|
|
481
|
+
this.writeProperty('icon', node.value, {
|
|
482
|
+
format: PropertyFormat.trimmedString,
|
|
483
|
+
single: true,
|
|
484
|
+
ignoreEmpty: true,
|
|
485
|
+
});
|
|
486
|
+
// Stop traversal of this branch
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
405
489
|
// bitmarkAst -> bits -> bitsValue -> ratingLevelStart
|
|
406
490
|
enter_ratingLevelStart(node, route) {
|
|
407
491
|
this.enterRatingLevelStartEndCommon(node, route);
|
|
@@ -423,6 +507,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
423
507
|
return true;
|
|
424
508
|
const { level, label } = n;
|
|
425
509
|
const levelKey = node.key === NodeType.ratingLevelStart ? PropertyTag.ratingLevelStart : PropertyTag.ratingLevelEnd;
|
|
510
|
+
this.writeNL();
|
|
426
511
|
this.writeProperty(levelKey, level, {
|
|
427
512
|
format: PropertyFormat.trimmedString,
|
|
428
513
|
single: true,
|
|
@@ -452,6 +537,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
452
537
|
return true;
|
|
453
538
|
const { mark, color, emphasis } = markConfig;
|
|
454
539
|
if (mark) {
|
|
540
|
+
this.writeNL();
|
|
455
541
|
this.writeProperty('mark', mark, {
|
|
456
542
|
format: PropertyFormat.trimmedString,
|
|
457
543
|
single: true,
|
|
@@ -471,74 +557,79 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
471
557
|
ignoreEmpty: true,
|
|
472
558
|
});
|
|
473
559
|
}
|
|
474
|
-
this.writeNL();
|
|
475
560
|
}
|
|
476
561
|
// Stop traversal of this branch
|
|
477
562
|
return false;
|
|
478
563
|
}
|
|
479
564
|
// bitmarkAst -> bits -> bitsValue -> partialAnswer
|
|
480
565
|
enter_partialAnswer(node, _route) {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
566
|
+
if (node.value) {
|
|
567
|
+
this.writeNL();
|
|
568
|
+
this.writeProperty('partialAnswer', node.value, {
|
|
569
|
+
format: PropertyFormat.trimmedString,
|
|
570
|
+
single: true,
|
|
571
|
+
ignoreEmpty: true,
|
|
572
|
+
});
|
|
573
|
+
}
|
|
486
574
|
// Stop traversal of this branch
|
|
487
575
|
return false;
|
|
488
576
|
}
|
|
489
577
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> partialAnswer
|
|
490
578
|
leaf_partialAnswer(node, _route) {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
579
|
+
if (node.value) {
|
|
580
|
+
this.writeNL();
|
|
581
|
+
this.writeProperty('partialAnswer', node.value, {
|
|
582
|
+
format: PropertyFormat.trimmedString,
|
|
583
|
+
single: true,
|
|
584
|
+
ignoreEmpty: true,
|
|
585
|
+
});
|
|
586
|
+
}
|
|
496
587
|
// Stop traversal of this branch
|
|
497
588
|
return false;
|
|
498
589
|
}
|
|
499
590
|
// bitmarkAst -> bits -> bitsValue -> sampleSolution
|
|
500
591
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> sampleSolution
|
|
501
592
|
enter_sampleSolution(node, _route) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
593
|
+
if (node.value) {
|
|
594
|
+
this.writeNL();
|
|
595
|
+
this.writeProperty('sampleSolution', node.value, {
|
|
596
|
+
format: PropertyFormat.trimmedString,
|
|
597
|
+
single: true,
|
|
598
|
+
ignoreEmpty: true,
|
|
599
|
+
});
|
|
600
|
+
}
|
|
507
601
|
// Stop traversal of this branch
|
|
508
602
|
return false;
|
|
509
603
|
}
|
|
510
604
|
leaf_sampleSolution(node, _route) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
605
|
+
if (node.value) {
|
|
606
|
+
this.writeNL();
|
|
607
|
+
this.writeProperty('sampleSolution', node.value, {
|
|
608
|
+
format: PropertyFormat.trimmedString,
|
|
609
|
+
single: true,
|
|
610
|
+
ignoreEmpty: true,
|
|
611
|
+
});
|
|
612
|
+
}
|
|
516
613
|
// Stop traversal of this branch
|
|
517
614
|
return false;
|
|
518
615
|
}
|
|
519
616
|
// bitmarkAst -> bits -> bitsValue -> reasonableNumOfChars
|
|
520
617
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> reasonableNumOfChars
|
|
521
618
|
leaf_reasonableNumOfChars(node, _route) {
|
|
619
|
+
this.writeNL();
|
|
522
620
|
this.writeProperty('reasonableNumOfChars', node.value, {
|
|
523
621
|
format: PropertyFormat.trimmedString,
|
|
524
622
|
single: true,
|
|
525
623
|
ignoreEmpty: true,
|
|
526
624
|
});
|
|
527
625
|
}
|
|
528
|
-
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> additionalSolutions
|
|
529
|
-
between_additionalSolutions(_node, _left, _right, route) {
|
|
530
|
-
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
531
|
-
const parent = this.getParentNode(route);
|
|
532
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.questionsValue)
|
|
533
|
-
return;
|
|
534
|
-
this.writeNL();
|
|
535
|
-
}
|
|
536
626
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> additionalSolutions -> additionalSolutionsValue
|
|
537
627
|
leaf_additionalSolutionsValue(node, route) {
|
|
538
628
|
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
539
629
|
const parent = this.getParentNode(route, 2);
|
|
540
630
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.questionsValue)
|
|
541
631
|
return;
|
|
632
|
+
this.writeNL();
|
|
542
633
|
this.writeProperty('additionalSolutions', node.value, {
|
|
543
634
|
format: PropertyFormat.trimmedString,
|
|
544
635
|
single: false,
|
|
@@ -557,6 +648,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
557
648
|
return true; // Will be handled by pageNumber
|
|
558
649
|
if (!this.isEmptyText((_c = parent === null || parent === void 0 ? void 0 : parent.value) === null || _c === void 0 ? void 0 : _c.marginNumber))
|
|
559
650
|
return true; // Will be handled by marginNumber
|
|
651
|
+
this.writeNL_IfNotChain(route);
|
|
560
652
|
this.writeOPC();
|
|
561
653
|
this.textGenerator.generateSync(item, TextFormat.bitmarkMinusMinus);
|
|
562
654
|
this.writeCL();
|
|
@@ -573,6 +665,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
573
665
|
return true; // Will be handled by pageNumber
|
|
574
666
|
if (!this.isEmptyText((_b = parent === null || parent === void 0 ? void 0 : parent.value) === null || _b === void 0 ? void 0 : _b.marginNumber))
|
|
575
667
|
return true; // Will be handled by marginNumber
|
|
668
|
+
this.writeNL_IfNotChain(route);
|
|
576
669
|
this.writeOPC();
|
|
577
670
|
this.textGenerator.generateSync((_d = (_c = parent === null || parent === void 0 ? void 0 : parent.value) === null || _c === void 0 ? void 0 : _c.item) !== null && _d !== void 0 ? _d : '', TextFormat.bitmarkMinusMinus);
|
|
578
671
|
this.writeCL();
|
|
@@ -590,6 +683,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
590
683
|
return false; // Ignore empty
|
|
591
684
|
if (!this.isEmptyText((_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.marginNumber))
|
|
592
685
|
return true; // Will be handled by marginNumber
|
|
686
|
+
this.writeNL_IfNotChain(route);
|
|
593
687
|
this.writeOPC();
|
|
594
688
|
this.textGenerator.generateSync((_c = (_b = parent === null || parent === void 0 ? void 0 : parent.value) === null || _b === void 0 ? void 0 : _b.item) !== null && _c !== void 0 ? _c : '', TextFormat.bitmarkMinusMinus);
|
|
595
689
|
this.writeCL();
|
|
@@ -608,6 +702,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
608
702
|
const parent = this.getParentNode(route);
|
|
609
703
|
if (this.isEmptyText(marginNumber))
|
|
610
704
|
return false; // Ignore empty
|
|
705
|
+
this.writeNL_IfNotChain(route);
|
|
611
706
|
this.writeOPC();
|
|
612
707
|
this.textGenerator.generateSync((_b = (_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b : '', TextFormat.bitmarkMinusMinus);
|
|
613
708
|
this.writeCL();
|
|
@@ -630,7 +725,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
630
725
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.cardBitsValue)
|
|
631
726
|
return true;
|
|
632
727
|
this.inTag = false;
|
|
633
|
-
//
|
|
728
|
+
// Always write a NL before the body content if there is any (see Handle body)
|
|
634
729
|
const body = node.value;
|
|
635
730
|
const textFormat = this.getTextFormat(route);
|
|
636
731
|
const isBitmarkText = textFormat === TextFormat.bitmarkPlusPlus || textFormat === TextFormat.bitmarkMinusMinus;
|
|
@@ -640,7 +735,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
640
735
|
if (Array.isArray(json) || ObjectUtils.isObject(json)) {
|
|
641
736
|
const text = JSON.stringify(json, null, this.prettifySpace);
|
|
642
737
|
if (text) {
|
|
643
|
-
this.writeNL();
|
|
644
738
|
this.writePlainTextDivider();
|
|
645
739
|
this.writeNL();
|
|
646
740
|
this.write(Breakscape.breakscape(text, {
|
|
@@ -661,27 +755,15 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
661
755
|
}
|
|
662
756
|
else {
|
|
663
757
|
// handle plain text
|
|
664
|
-
this.writeNL();
|
|
665
758
|
this.writePlainTextDivider();
|
|
666
759
|
this.writeNL();
|
|
667
760
|
const s = (StringUtils.isString(body.body) ? body.body : '');
|
|
668
761
|
this.write(Breakscape.breakscape(`${s}`, {
|
|
669
762
|
textFormat: TextFormat.text,
|
|
670
763
|
}));
|
|
671
|
-
this.writeNL();
|
|
672
764
|
}
|
|
673
765
|
// Stop traversal of this branch
|
|
674
766
|
return false;
|
|
675
|
-
// if ((body.body && body.body.length > 0) || body.bodyJson) {
|
|
676
|
-
// this.writeNL();
|
|
677
|
-
// // Write the plain text divider if not bitmark++/-- format
|
|
678
|
-
// const textFormat = this.getTextFormat(route);
|
|
679
|
-
// const isBitmarkText = textFormat === TextFormat.bitmarkPlusPlus || textFormat === TextFormat.bitmarkMinusMinus;
|
|
680
|
-
// if (!isBitmarkText) {
|
|
681
|
-
// this.writePlainTextDivider();
|
|
682
|
-
// this.writeNL();
|
|
683
|
-
// }
|
|
684
|
-
// }
|
|
685
767
|
}
|
|
686
768
|
exit_body(_node, _route) {
|
|
687
769
|
this.inTag = true;
|
|
@@ -747,6 +829,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
747
829
|
const isBitmarkText = textFormat === TextFormat.bitmarkPlusPlus || textFormat === TextFormat.bitmarkMinusMinus;
|
|
748
830
|
if (isBitmarkText) {
|
|
749
831
|
// handle bitmark text
|
|
832
|
+
this.writeNL();
|
|
750
833
|
this.write('==== footer ====');
|
|
751
834
|
this.writeNL();
|
|
752
835
|
// The text generator will write to the writer
|
|
@@ -841,7 +924,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
841
924
|
if (!this.isCardAllowed(route))
|
|
842
925
|
return true;
|
|
843
926
|
this.writeCardSetStart();
|
|
844
|
-
this.writeNL();
|
|
845
927
|
// Continue traversal
|
|
846
928
|
return true;
|
|
847
929
|
}
|
|
@@ -849,41 +931,27 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
849
931
|
// Ignore cards if not allowed
|
|
850
932
|
if (!this.isCardAllowed(route))
|
|
851
933
|
return;
|
|
852
|
-
this.writeNL();
|
|
853
934
|
this.writeCardSetCardDivider();
|
|
854
|
-
this.writeNL();
|
|
855
935
|
}
|
|
856
936
|
exit_cardNode(_node, route) {
|
|
857
937
|
// Ignore cards if not allowed
|
|
858
938
|
if (!this.isCardAllowed(route))
|
|
859
939
|
return;
|
|
860
|
-
this.writeNL();
|
|
861
940
|
this.writeCardSetEnd();
|
|
862
941
|
if (this.options.cardSetVersion === CardSetVersion.v1) {
|
|
863
|
-
this.writeNL();
|
|
942
|
+
// this.writeNL();
|
|
864
943
|
}
|
|
865
944
|
}
|
|
866
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> cardBitsValue
|
|
867
|
-
between_cardBitsValue(_node, _left, _right, _route) {
|
|
868
|
-
this.writeNL();
|
|
869
|
-
}
|
|
870
945
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> elements
|
|
871
946
|
enter_elements(_node, _route) {
|
|
872
947
|
//
|
|
873
948
|
}
|
|
874
949
|
between_elements(_node, _left, _right, _route) {
|
|
875
|
-
this.writeNL();
|
|
876
950
|
this.writeCardSetVariantDivider();
|
|
877
|
-
this.writeNL();
|
|
878
|
-
}
|
|
879
|
-
exit_elements(_node, _route) {
|
|
880
|
-
//
|
|
881
951
|
}
|
|
882
952
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards
|
|
883
953
|
between_flashcards(_node, _left, _right, _route) {
|
|
884
|
-
this.writeNL();
|
|
885
954
|
this.writeCardSetCardDivider();
|
|
886
|
-
this.writeNL();
|
|
887
955
|
}
|
|
888
956
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue
|
|
889
957
|
between_flashcardsValue(_node, _left, right, route) {
|
|
@@ -892,67 +960,19 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
892
960
|
if (!this.isCardAllowed(route))
|
|
893
961
|
return;
|
|
894
962
|
if (right.key === NodeType.answer) {
|
|
895
|
-
this.writeNL();
|
|
896
963
|
this.writeCardSetSideDivider();
|
|
897
|
-
this.writeNL();
|
|
898
964
|
}
|
|
899
965
|
else if (right.key === NodeType.alternativeAnswers && ((_a = right.value) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
|
|
900
|
-
this.writeNL();
|
|
901
966
|
this.writeCardSetVariantDivider();
|
|
902
|
-
this.writeNL();
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> answer
|
|
906
|
-
enter_answer(node, route) {
|
|
907
|
-
// Ignore responses that are not at the flashcardsValue level as they are handled elsewhere
|
|
908
|
-
const parent = this.getParentNode(route);
|
|
909
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.flashcardsValue)
|
|
910
|
-
return true;
|
|
911
|
-
if (node.value) {
|
|
912
|
-
this.textGenerator.generateSync(node.value, TextFormat.bitmarkMinusMinus);
|
|
913
967
|
}
|
|
914
|
-
// Stop traversal of this branch
|
|
915
|
-
return false;
|
|
916
968
|
}
|
|
917
969
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers
|
|
918
970
|
between_alternativeAnswers(_node, _route) {
|
|
919
|
-
this.writeNL();
|
|
920
971
|
this.writeCardSetVariantDivider();
|
|
921
|
-
this.writeNL();
|
|
922
|
-
}
|
|
923
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers -> alternativeAnswersValue
|
|
924
|
-
enter_alternativeAnswersValue(node, route) {
|
|
925
|
-
// Ignore responses that are not at the alternativeAnswers level as they are handled elsewhere
|
|
926
|
-
const parent = this.getParentNode(route);
|
|
927
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.alternativeAnswers)
|
|
928
|
-
return true;
|
|
929
|
-
if (node.value) {
|
|
930
|
-
// this.writeBreakscapedTagString(node.value);
|
|
931
|
-
this.textGenerator.generateSync(node.value, TextFormat.bitmarkMinusMinus);
|
|
932
|
-
}
|
|
933
|
-
// Stop traversal of this branch
|
|
934
|
-
return false;
|
|
935
972
|
}
|
|
936
973
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> alternativeDefintions
|
|
937
974
|
between_alternativeDefinitions(_node, _route) {
|
|
938
|
-
this.writeNL();
|
|
939
975
|
this.writeCardSetVariantDivider();
|
|
940
|
-
this.writeNL();
|
|
941
|
-
}
|
|
942
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> alternativeDefinitions -> alternativeDefinitionsValue
|
|
943
|
-
enter_alternativeDefinitionsValue(node, route) {
|
|
944
|
-
// Ignore responses that are not at the alternativeAnswers level as they are handled elsewhere
|
|
945
|
-
const parent = this.getParentNode(route);
|
|
946
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.alternativeDefinitions)
|
|
947
|
-
return true;
|
|
948
|
-
if (node.value) {
|
|
949
|
-
// this.writeNL();
|
|
950
|
-
// this.writeCardSetVariantDivider();
|
|
951
|
-
// this.writeNL();
|
|
952
|
-
this.textGenerator.generateSync(node.value, TextFormat.bitmarkMinusMinus);
|
|
953
|
-
}
|
|
954
|
-
// Stop traversal of this branch
|
|
955
|
-
return false;
|
|
956
976
|
}
|
|
957
977
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> statements
|
|
958
978
|
enter_statements(_node, _route) {
|
|
@@ -961,17 +981,13 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
961
981
|
between_statements(_node, _left, _right, route) {
|
|
962
982
|
const isTrueFalse1 = this.isOfBitType(route, BitType.trueFalse1);
|
|
963
983
|
if (!isTrueFalse1) {
|
|
964
|
-
this.writeNL();
|
|
965
984
|
this.writeCardSetCardDivider();
|
|
966
985
|
}
|
|
967
|
-
this.writeNL();
|
|
968
|
-
}
|
|
969
|
-
exit_statements(_node, _route) {
|
|
970
|
-
//
|
|
971
986
|
}
|
|
972
987
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> statements -> statementsValue
|
|
973
988
|
enter_statementsValue(node, _route) {
|
|
974
989
|
const statement = node.value;
|
|
990
|
+
this.writeNL();
|
|
975
991
|
if (statement.isCorrect) {
|
|
976
992
|
this.writeOPP();
|
|
977
993
|
}
|
|
@@ -983,18 +999,11 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
983
999
|
// Continue traversal
|
|
984
1000
|
return true;
|
|
985
1001
|
}
|
|
986
|
-
// bitmarkAst -> bits -> bitsValue -> choices
|
|
987
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> choices
|
|
988
|
-
between_choices(_node, _left, _right, _route) {
|
|
989
|
-
this.writeNL();
|
|
990
|
-
}
|
|
991
|
-
exit_choices(_node, _route) {
|
|
992
|
-
this.writeNL();
|
|
993
|
-
}
|
|
994
1002
|
// bitmarkAst -> bits -> bitsValue -> choices -> choicesValue
|
|
995
1003
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> choices -> choicesValue
|
|
996
1004
|
enter_choicesValue(node, _route) {
|
|
997
1005
|
const choice = node.value;
|
|
1006
|
+
this.writeNL();
|
|
998
1007
|
if (choice.isCorrect) {
|
|
999
1008
|
this.writeOPP();
|
|
1000
1009
|
}
|
|
@@ -1006,18 +1015,11 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1006
1015
|
// Continue traversal
|
|
1007
1016
|
return true;
|
|
1008
1017
|
}
|
|
1009
|
-
// bitmarkAst -> bits -> bitsValue -> responses
|
|
1010
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> responses
|
|
1011
|
-
between_responses(_node, _left, _right, _route) {
|
|
1012
|
-
this.writeNL();
|
|
1013
|
-
}
|
|
1014
|
-
exit_responses(_node, _route) {
|
|
1015
|
-
this.writeNL();
|
|
1016
|
-
}
|
|
1017
1018
|
// bitmarkAst -> bits -> bitsValue -> responses -> responsesValue
|
|
1018
1019
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> responses -> responsesValue
|
|
1019
1020
|
enter_responsesValue(node, _route) {
|
|
1020
1021
|
const response = node.value;
|
|
1022
|
+
this.writeNL();
|
|
1021
1023
|
if (response.isCorrect) {
|
|
1022
1024
|
this.writeOPP();
|
|
1023
1025
|
}
|
|
@@ -1034,18 +1036,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1034
1036
|
//
|
|
1035
1037
|
}
|
|
1036
1038
|
between_quizzes(_node, _left, _right, _route) {
|
|
1037
|
-
// this.writeNL();
|
|
1038
1039
|
this.writeCardSetCardDivider();
|
|
1039
|
-
this.writeNL();
|
|
1040
|
-
}
|
|
1041
|
-
exit_quizzes(_node, _route) {
|
|
1042
|
-
//
|
|
1043
|
-
}
|
|
1044
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue
|
|
1045
|
-
between_quizzesValue(_node, _left, right, _route) {
|
|
1046
|
-
if (right.key === NodeType.choices || right.key === NodeType.responses) {
|
|
1047
|
-
this.writeNL();
|
|
1048
|
-
}
|
|
1049
1040
|
}
|
|
1050
1041
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> heading
|
|
1051
1042
|
enter_heading(_node, _route) {
|
|
@@ -1055,12 +1046,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1055
1046
|
// Ignore cards if not allowed
|
|
1056
1047
|
if (!this.isCardAllowed(route))
|
|
1057
1048
|
return;
|
|
1058
|
-
this.writeNL();
|
|
1059
1049
|
this.writeCardSetSideDivider();
|
|
1060
|
-
this.writeNL();
|
|
1061
|
-
}
|
|
1062
|
-
exit_heading(_node, _route) {
|
|
1063
|
-
//
|
|
1064
1050
|
}
|
|
1065
1051
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> heading -> forValues
|
|
1066
1052
|
enter_forValues(_node, _route) {
|
|
@@ -1070,33 +1056,20 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1070
1056
|
// Ignore cards if not allowed
|
|
1071
1057
|
if (!this.isCardAllowed(route))
|
|
1072
1058
|
return;
|
|
1073
|
-
this.writeNL();
|
|
1074
1059
|
this.writeCardSetSideDivider();
|
|
1075
|
-
this.writeNL();
|
|
1076
|
-
}
|
|
1077
|
-
exit_forValues(_node, _route) {
|
|
1078
|
-
//
|
|
1079
1060
|
}
|
|
1080
1061
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> pairs
|
|
1081
1062
|
enter_pairs(_node, _route) {
|
|
1082
1063
|
//
|
|
1083
1064
|
}
|
|
1084
1065
|
between_pairs(_node, _left, _right, _route) {
|
|
1085
|
-
this.writeNL();
|
|
1086
1066
|
this.writeCardSetCardDivider();
|
|
1087
|
-
this.writeNL();
|
|
1088
|
-
}
|
|
1089
|
-
exit_pairs(_node, _route) {
|
|
1090
|
-
//
|
|
1091
|
-
}
|
|
1092
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue
|
|
1093
|
-
between_pairsValue(_node, _left, _right, _route) {
|
|
1094
|
-
//
|
|
1095
1067
|
}
|
|
1096
1068
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> keyAudio
|
|
1097
1069
|
enter_keyAudio(node, _route) {
|
|
1098
1070
|
const resource = node.value;
|
|
1099
1071
|
// This is a resource, so handle it with the common code
|
|
1072
|
+
this.writeNL();
|
|
1100
1073
|
this.writeResource(ResourceTag.audio, resource.src);
|
|
1101
1074
|
// Stop traversal of this branch
|
|
1102
1075
|
return false;
|
|
@@ -1105,6 +1078,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1105
1078
|
enter_keyImage(node, _route) {
|
|
1106
1079
|
const resource = node.value;
|
|
1107
1080
|
// This is a resource, so handle it with the common code
|
|
1081
|
+
this.writeNL();
|
|
1108
1082
|
this.writeResource(ResourceTag.image, resource.src);
|
|
1109
1083
|
// Stop traversal of this branch
|
|
1110
1084
|
return false;
|
|
@@ -1114,16 +1088,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1114
1088
|
//
|
|
1115
1089
|
}
|
|
1116
1090
|
between_matrix(_node, _left, _right, _route) {
|
|
1117
|
-
this.writeNL();
|
|
1118
1091
|
this.writeCardSetCardDivider();
|
|
1119
|
-
this.writeNL();
|
|
1120
|
-
}
|
|
1121
|
-
exit_matrix(_node, _route) {
|
|
1122
|
-
//
|
|
1123
|
-
}
|
|
1124
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> matrix -> matrixValue
|
|
1125
|
-
between_matrixValue(_node, _left, _right, _route) {
|
|
1126
|
-
//
|
|
1127
1092
|
}
|
|
1128
1093
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> values
|
|
1129
1094
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> matrix -> matrixValue -> cells -> cellsValue -> values
|
|
@@ -1131,17 +1096,13 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1131
1096
|
// Ignore cards if not allowed
|
|
1132
1097
|
if (!this.isCardAllowed(route))
|
|
1133
1098
|
return;
|
|
1134
|
-
this.writeNL();
|
|
1135
1099
|
this.writeCardSetSideDivider();
|
|
1136
|
-
this.writeNL();
|
|
1137
1100
|
}
|
|
1138
1101
|
between_values(_node, _left, _right, route) {
|
|
1139
1102
|
// Ignore cards if not allowed
|
|
1140
1103
|
if (!this.isCardAllowed(route))
|
|
1141
1104
|
return;
|
|
1142
|
-
this.writeNL();
|
|
1143
1105
|
this.writeCardSetVariantDivider();
|
|
1144
|
-
this.writeNL();
|
|
1145
1106
|
}
|
|
1146
1107
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> pronunciationTable
|
|
1147
1108
|
between_pronunciationTable(_node, _left, _right, route) {
|
|
@@ -1151,9 +1112,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1151
1112
|
// Ignore cards if not allowed
|
|
1152
1113
|
if (!this.isCardAllowed(route))
|
|
1153
1114
|
return;
|
|
1154
|
-
this.writeNL();
|
|
1155
1115
|
this.writeCardSetCardDivider();
|
|
1156
|
-
this.writeNL();
|
|
1157
1116
|
}
|
|
1158
1117
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> table
|
|
1159
1118
|
between_table(_node, _left, _right, route) {
|
|
@@ -1163,9 +1122,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1163
1122
|
// Ignore cards if not allowed
|
|
1164
1123
|
if (!this.isCardAllowed(route))
|
|
1165
1124
|
return;
|
|
1166
|
-
this.writeNL();
|
|
1167
1125
|
this.writeCardSetCardDivider();
|
|
1168
|
-
this.writeNL();
|
|
1169
1126
|
}
|
|
1170
1127
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data
|
|
1171
1128
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> pronunciationTable -> data
|
|
@@ -1173,9 +1130,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1173
1130
|
const parent = this.getParentNode(route);
|
|
1174
1131
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.table && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.pronunciationTable)
|
|
1175
1132
|
return;
|
|
1176
|
-
this.writeNL();
|
|
1177
1133
|
this.writeCardSetCardDivider();
|
|
1178
|
-
this.writeNL();
|
|
1179
1134
|
}
|
|
1180
1135
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> table -> columns
|
|
1181
1136
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> columns
|
|
@@ -1187,19 +1142,19 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1187
1142
|
// Ignore cards if not allowed
|
|
1188
1143
|
if (!this.isCardAllowed(route))
|
|
1189
1144
|
return;
|
|
1190
|
-
this.writeNL();
|
|
1191
1145
|
this.writeCardSetSideDivider();
|
|
1192
|
-
this.writeNL();
|
|
1193
1146
|
}
|
|
1194
1147
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> table -> columns -> columnsValue
|
|
1195
1148
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> columns -> columnsValue
|
|
1196
1149
|
leaf_columnsValue(node, _route) {
|
|
1150
|
+
this.writeNL();
|
|
1197
1151
|
this.writeOPHASH();
|
|
1198
1152
|
if (node.value)
|
|
1199
1153
|
this.writeBreakscapedTagString(node.value);
|
|
1200
1154
|
this.writeCL();
|
|
1201
1155
|
}
|
|
1202
1156
|
enter_columnsValue(node, _route) {
|
|
1157
|
+
this.writeNL();
|
|
1203
1158
|
this.writeOPHASH();
|
|
1204
1159
|
if (node.value) {
|
|
1205
1160
|
this.textGenerator.generateSync(node.value, TextFormat.bitmarkMinusMinus);
|
|
@@ -1215,15 +1170,14 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1215
1170
|
// Ignore cards if not allowed
|
|
1216
1171
|
if (!this.isCardAllowed(route))
|
|
1217
1172
|
return;
|
|
1218
|
-
this.writeNL();
|
|
1219
1173
|
this.writeCardSetSideDivider();
|
|
1220
|
-
this.writeNL();
|
|
1221
1174
|
}
|
|
1222
1175
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data -> dataValue -> dataValueValue
|
|
1223
1176
|
leaf_dataValueValue(node, route) {
|
|
1224
1177
|
const parent = this.getParentNode(route, 3);
|
|
1225
1178
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.table)
|
|
1226
1179
|
return;
|
|
1180
|
+
this.writeNL();
|
|
1227
1181
|
this.write(node.value);
|
|
1228
1182
|
}
|
|
1229
1183
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data -> dataValue -> dataValueValue
|
|
@@ -1239,17 +1193,18 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1239
1193
|
// Pronunciation Table
|
|
1240
1194
|
const cell = node.value;
|
|
1241
1195
|
if (cell.title) {
|
|
1196
|
+
this.writeNL();
|
|
1242
1197
|
this.writeOP();
|
|
1243
1198
|
this.writeHash();
|
|
1244
1199
|
this.textGenerator.generateSync(cell.title, TextFormat.bitmarkMinusMinus);
|
|
1245
1200
|
this.writeCL();
|
|
1246
|
-
this.writeNL();
|
|
1247
1201
|
}
|
|
1248
1202
|
if (cell.audio) {
|
|
1249
|
-
this.writeResource(ResourceTag.audio, cell.audio.src);
|
|
1250
1203
|
this.writeNL();
|
|
1204
|
+
this.writeResource(ResourceTag.audio, cell.audio.src);
|
|
1251
1205
|
}
|
|
1252
1206
|
if (cell.body) {
|
|
1207
|
+
this.writeNL();
|
|
1253
1208
|
this.textGenerator.generateSync(cell.body, textFormat);
|
|
1254
1209
|
}
|
|
1255
1210
|
// Stop traversal of this branch
|
|
@@ -1257,6 +1212,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1257
1212
|
}
|
|
1258
1213
|
else {
|
|
1259
1214
|
// Table
|
|
1215
|
+
this.writeNL();
|
|
1260
1216
|
this.textGenerator.generateSync(node.value, textFormat);
|
|
1261
1217
|
}
|
|
1262
1218
|
}
|
|
@@ -1267,38 +1223,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1267
1223
|
const parent = this.getParentNode(route);
|
|
1268
1224
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.cardNode)
|
|
1269
1225
|
return;
|
|
1270
|
-
this.writeNL();
|
|
1271
1226
|
this.writeCardSetCardDivider();
|
|
1272
|
-
this.writeNL();
|
|
1273
|
-
}
|
|
1274
|
-
// // bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions
|
|
1275
|
-
// protected between_definitions(_node: NodeInfo, _left: NodeInfo, _right: NodeInfo, route: NodeInfo[]): void {
|
|
1276
|
-
// const parent = this.getParentNode(route);
|
|
1277
|
-
// if (parent?.key !== NodeType.captionDefinitionList) return;
|
|
1278
|
-
// this.writeNL();
|
|
1279
|
-
// this.writeCardSetCardDivider();
|
|
1280
|
-
// this.writeNL();
|
|
1281
|
-
// }
|
|
1282
|
-
// // bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue
|
|
1283
|
-
// protected between_definitionsValue(_node: NodeInfo, _left: NodeInfo, _right: NodeInfo, route: NodeInfo[]): void {
|
|
1284
|
-
// const parent = this.getParentNode(route);
|
|
1285
|
-
// if (parent?.key !== NodeType.definitions) return;
|
|
1286
|
-
// // Ignore cards if not allowed
|
|
1287
|
-
// if (!this.isCardAllowed(route)) return;
|
|
1288
|
-
// this.writeNL();
|
|
1289
|
-
// this.writeCardSetSideDivider();
|
|
1290
|
-
// this.writeNL();
|
|
1291
|
-
// }
|
|
1292
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> term
|
|
1293
|
-
enter_term(node, route) {
|
|
1294
|
-
const parent = this.getParentNode(route);
|
|
1295
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.definitionsValue)
|
|
1296
|
-
return true;
|
|
1297
|
-
if (node.value) {
|
|
1298
|
-
this.textGenerator.generateSync(node.value, TextFormat.bitmarkMinusMinus);
|
|
1299
|
-
}
|
|
1300
|
-
// Stop traversal of this branch
|
|
1301
|
-
return false;
|
|
1302
1227
|
}
|
|
1303
1228
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue -> term
|
|
1304
1229
|
leaf_term(node, route) {
|
|
@@ -1306,28 +1231,19 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1306
1231
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.definitionsValue)
|
|
1307
1232
|
return true;
|
|
1308
1233
|
if (node.value) {
|
|
1234
|
+
this.writeNL();
|
|
1309
1235
|
this.write(node.value);
|
|
1310
1236
|
}
|
|
1311
1237
|
// Stop traversal of this branch
|
|
1312
1238
|
return false;
|
|
1313
1239
|
}
|
|
1314
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> definition
|
|
1315
|
-
enter_definition(node, route) {
|
|
1316
|
-
const parent = this.getParentNode(route);
|
|
1317
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.definitionsValue)
|
|
1318
|
-
return true;
|
|
1319
|
-
if (node.value) {
|
|
1320
|
-
this.textGenerator.generateSync(node.value, TextFormat.bitmarkMinusMinus);
|
|
1321
|
-
}
|
|
1322
|
-
// Stop traversal of this branch
|
|
1323
|
-
return false;
|
|
1324
|
-
}
|
|
1325
1240
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue -> definition
|
|
1326
1241
|
leaf_definition(node, route) {
|
|
1327
1242
|
const parent = this.getParentNode(route);
|
|
1328
1243
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.definitionsValue)
|
|
1329
1244
|
return true;
|
|
1330
1245
|
if (node.value) {
|
|
1246
|
+
this.writeNL();
|
|
1331
1247
|
this.write(node.value);
|
|
1332
1248
|
}
|
|
1333
1249
|
// Stop traversal of this branch
|
|
@@ -1339,9 +1255,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1339
1255
|
const parent = this.getParentNode(route);
|
|
1340
1256
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.cardNode && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.captionDefinitionList)
|
|
1341
1257
|
return;
|
|
1342
|
-
this.writeNL();
|
|
1343
1258
|
this.writeCardSetCardDivider();
|
|
1344
|
-
this.writeNL();
|
|
1345
1259
|
}
|
|
1346
1260
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue
|
|
1347
1261
|
between_definitionsValue(_node, _left, right, route) {
|
|
@@ -1353,75 +1267,37 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1353
1267
|
if (!this.isCardAllowed(route))
|
|
1354
1268
|
return;
|
|
1355
1269
|
if (right.key === NodeType.definition) {
|
|
1356
|
-
this.writeNL();
|
|
1357
1270
|
this.writeCardSetSideDivider();
|
|
1358
|
-
this.writeNL();
|
|
1359
1271
|
}
|
|
1360
1272
|
else if (right.key === NodeType.alternativeDefinitions && ((_a = right.value) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1361
|
-
this.writeNL();
|
|
1362
1273
|
this.writeCardSetVariantDivider();
|
|
1363
|
-
this.writeNL();
|
|
1364
1274
|
}
|
|
1365
1275
|
}
|
|
1366
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue
|
|
1367
|
-
// protected between_definitionsValue(_node: NodeInfo, _left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void {
|
|
1368
|
-
// const parent = this.getParentNode(route);
|
|
1369
|
-
// if (parent?.key !== NodeType.definitions) return;
|
|
1370
|
-
// // Ignore cards if not allowed
|
|
1371
|
-
// if (!this.isCardAllowed(route)) return;
|
|
1372
|
-
// if (right.key === NodeType.definition) {
|
|
1373
|
-
// this.writeNL();
|
|
1374
|
-
// this.writeCardSetSideDivider();
|
|
1375
|
-
// this.writeNL();
|
|
1376
|
-
// } else if (right.key === NodeType.alternativeDefinitions && right.value?.length > 0) {
|
|
1377
|
-
// this.writeNL();
|
|
1378
|
-
// this.writeCardSetVariantDivider();
|
|
1379
|
-
// this.writeNL();
|
|
1380
|
-
// }
|
|
1381
|
-
// }
|
|
1382
1276
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> questions
|
|
1383
1277
|
enter_questions(_node, _route) {
|
|
1384
1278
|
//
|
|
1385
1279
|
}
|
|
1386
1280
|
between_questions(_node, _left, _right, _route) {
|
|
1387
1281
|
this.writeCardSetCardDivider();
|
|
1388
|
-
this.writeNL();
|
|
1389
|
-
}
|
|
1390
|
-
exit_questions(_node, _route) {
|
|
1391
|
-
//
|
|
1392
|
-
}
|
|
1393
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> questions -> questionsValue
|
|
1394
|
-
between_questionsValue(node, left, right, route) {
|
|
1395
|
-
// The following keys are combined with other keys so don't need newlines
|
|
1396
|
-
const noNlKeys = [
|
|
1397
|
-
//
|
|
1398
|
-
];
|
|
1399
|
-
this.writeNlBetween(node, left, right, route, noNlKeys);
|
|
1400
|
-
}
|
|
1401
|
-
exit_questionsValue(_node, _route) {
|
|
1402
|
-
this.writeNL();
|
|
1403
1282
|
}
|
|
1404
1283
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> ingredients
|
|
1405
1284
|
enter_ingredients(_node, _route) {
|
|
1406
1285
|
//
|
|
1407
1286
|
}
|
|
1408
1287
|
between_ingredients(_node, _left, _right, _route) {
|
|
1409
|
-
this.writeNL();
|
|
1410
1288
|
this.writeCardSetCardDivider();
|
|
1411
|
-
this.writeNL();
|
|
1412
|
-
}
|
|
1413
|
-
exit_ingredients(_node, _route) {
|
|
1414
|
-
//
|
|
1415
1289
|
}
|
|
1416
1290
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> ingredients -> ingredientsValue
|
|
1417
1291
|
enter_ingredientsValue(node, _route) {
|
|
1418
1292
|
const ingredient = node.value;
|
|
1419
1293
|
if (ingredient.title != null) {
|
|
1294
|
+
this.writeNL();
|
|
1420
1295
|
this.writeOPHASH();
|
|
1421
1296
|
this.writeBreakscapedTagString(ingredient.title);
|
|
1422
1297
|
this.writeCL();
|
|
1423
|
-
this.writeNL();
|
|
1298
|
+
// this.writeNL();
|
|
1424
1299
|
}
|
|
1300
|
+
this.writeNL();
|
|
1425
1301
|
// [+] / [-]
|
|
1426
1302
|
if (ingredient.checked) {
|
|
1427
1303
|
this.writeOPP();
|
|
@@ -1465,8 +1341,10 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1465
1341
|
ignoreEmpty: true,
|
|
1466
1342
|
});
|
|
1467
1343
|
// item
|
|
1468
|
-
if (ingredient.item != null)
|
|
1344
|
+
if (ingredient.item != null) {
|
|
1345
|
+
this.writeNL();
|
|
1469
1346
|
this.write(ingredient.item);
|
|
1347
|
+
}
|
|
1470
1348
|
// Stop traversal of this branch
|
|
1471
1349
|
return false;
|
|
1472
1350
|
}
|
|
@@ -1476,35 +1354,20 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1476
1354
|
}
|
|
1477
1355
|
between_botResponses(_node, _left, _right, _route) {
|
|
1478
1356
|
this.writeCardSetCardDivider();
|
|
1479
|
-
this.writeNL();
|
|
1480
|
-
}
|
|
1481
|
-
exit_botResponses(_node, _route) {
|
|
1482
|
-
//
|
|
1483
|
-
}
|
|
1484
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue
|
|
1485
|
-
between_botResponsesValue(_node, _left, _right, _route) {
|
|
1486
|
-
this.writeNL();
|
|
1487
|
-
}
|
|
1488
|
-
exit_botResponsesValue(_node, _route) {
|
|
1489
|
-
this.writeNL();
|
|
1490
1357
|
}
|
|
1491
1358
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> cardBits
|
|
1492
1359
|
enter_cardBits(_node, _route) {
|
|
1493
1360
|
//
|
|
1494
1361
|
}
|
|
1495
1362
|
between_cardBits(_node, _left, _right, _route) {
|
|
1496
|
-
this.writeNL();
|
|
1497
1363
|
this.writeCardSetCardDivider();
|
|
1498
|
-
this.writeNL();
|
|
1499
|
-
}
|
|
1500
|
-
exit_cardBits(_node, _route) {
|
|
1501
|
-
//
|
|
1502
1364
|
}
|
|
1503
1365
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
|
|
1504
1366
|
leaf_response(node, route) {
|
|
1505
1367
|
const parent = this.getParentNode(route);
|
|
1506
1368
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.botResponsesValue)
|
|
1507
1369
|
return;
|
|
1370
|
+
this.writeNL();
|
|
1508
1371
|
this.writeOPB();
|
|
1509
1372
|
this.writeBreakscapedTagString(node.value);
|
|
1510
1373
|
this.writeCL();
|
|
@@ -1514,6 +1377,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1514
1377
|
const parent = this.getParentNode(route);
|
|
1515
1378
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.botResponsesValue)
|
|
1516
1379
|
return;
|
|
1380
|
+
this.writeNL();
|
|
1517
1381
|
this.writeProperty('reaction', node.value, {
|
|
1518
1382
|
format: PropertyFormat.trimmedString,
|
|
1519
1383
|
single: true,
|
|
@@ -1527,6 +1391,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1527
1391
|
return;
|
|
1528
1392
|
const feeback = node.value;
|
|
1529
1393
|
if (feeback) {
|
|
1394
|
+
this.writeNL();
|
|
1530
1395
|
this.write(feeback);
|
|
1531
1396
|
}
|
|
1532
1397
|
}
|
|
@@ -1534,12 +1399,13 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1534
1399
|
enter_imagePlaceholder(node, _route) {
|
|
1535
1400
|
const resource = node.value;
|
|
1536
1401
|
// This is a resource, so handle it with the common code
|
|
1402
|
+
this.writeNL();
|
|
1537
1403
|
this.writePropertyStyleResource(node.key, resource);
|
|
1538
1404
|
// Continue traversal
|
|
1539
1405
|
return true;
|
|
1540
1406
|
}
|
|
1541
1407
|
exit_imagePlaceholder(_node, _route) {
|
|
1542
|
-
this.writeNL();
|
|
1408
|
+
// this.writeNL();
|
|
1543
1409
|
}
|
|
1544
1410
|
// bitmarkAst -> bits -> bitsValue -> posterImage
|
|
1545
1411
|
// bitmarkAst -> bits -> bitsValue -> resource -> * -> posterImage
|
|
@@ -1638,9 +1504,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1638
1504
|
enter_book(_node, _route) {
|
|
1639
1505
|
// Block standard property handling
|
|
1640
1506
|
}
|
|
1641
|
-
between_book(_node, _route) {
|
|
1642
|
-
this.writeNL();
|
|
1643
|
-
}
|
|
1644
1507
|
enter_bookValue(node, _route) {
|
|
1645
1508
|
const book = node.value;
|
|
1646
1509
|
// const parent = this.getParentNode(route);
|
|
@@ -1711,10 +1574,11 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1711
1574
|
// * -> itemLead --> item
|
|
1712
1575
|
// * -> itemLead --> lead
|
|
1713
1576
|
// * -> hint
|
|
1714
|
-
enter_hint(node,
|
|
1577
|
+
enter_hint(node, route) {
|
|
1715
1578
|
const value = node.value;
|
|
1716
1579
|
const text = value;
|
|
1717
1580
|
if (!this.isEmptyText(text)) {
|
|
1581
|
+
this.writeNL_IfNotChain(route);
|
|
1718
1582
|
this.writeOPQ();
|
|
1719
1583
|
this.textGenerator.generateSync(text, TextFormat.bitmarkMinusMinus);
|
|
1720
1584
|
this.writeCL();
|
|
@@ -1723,10 +1587,11 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1723
1587
|
return false;
|
|
1724
1588
|
}
|
|
1725
1589
|
// bitmarkAst -> bits -> bitsValue -> * -> instruction
|
|
1726
|
-
enter_instruction(node,
|
|
1590
|
+
enter_instruction(node, route) {
|
|
1727
1591
|
const value = node.value;
|
|
1728
1592
|
const text = value;
|
|
1729
1593
|
if (!this.isEmptyText(text)) {
|
|
1594
|
+
this.writeNL_IfNotChain(route);
|
|
1730
1595
|
this.writeOPB();
|
|
1731
1596
|
this.textGenerator.generateSync(text, TextFormat.bitmarkMinusMinus);
|
|
1732
1597
|
this.writeCL();
|
|
@@ -1736,6 +1601,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1736
1601
|
}
|
|
1737
1602
|
// bitmarkAst -> bits -> bitsValue -> * -> lang
|
|
1738
1603
|
enter_lang(node, _route) {
|
|
1604
|
+
this.writeNL();
|
|
1739
1605
|
this.writeProperty('lang', node.value, {
|
|
1740
1606
|
format: PropertyFormat.boolean,
|
|
1741
1607
|
single: true,
|
|
@@ -1744,6 +1610,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1744
1610
|
}
|
|
1745
1611
|
// bitmarkAst -> bits -> bitsValue -> * -> refAuthor
|
|
1746
1612
|
enter_refAuthor(node, _route) {
|
|
1613
|
+
this.writeNL();
|
|
1747
1614
|
this.writeProperty('refAuthor', node.value, {
|
|
1748
1615
|
format: PropertyFormat.trimmedString,
|
|
1749
1616
|
single: false,
|
|
@@ -1752,6 +1619,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1752
1619
|
}
|
|
1753
1620
|
// bitmarkAst -> bits -> bitsValue -> * -> refBookTitle
|
|
1754
1621
|
enter_refBookTitle(node, _route) {
|
|
1622
|
+
this.writeNL();
|
|
1755
1623
|
this.writeProperty('refBookTitle', node.value, {
|
|
1756
1624
|
format: PropertyFormat.trimmedString,
|
|
1757
1625
|
single: true,
|
|
@@ -1760,14 +1628,24 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1760
1628
|
}
|
|
1761
1629
|
// bitmarkAst -> bits -> bitsValue -> * -> refPublisher
|
|
1762
1630
|
enter_refPublisher(node, _route) {
|
|
1631
|
+
this.writeNL();
|
|
1763
1632
|
this.writeProperty('refPublisher', node.value, {
|
|
1764
1633
|
format: PropertyFormat.trimmedString,
|
|
1765
1634
|
single: false,
|
|
1766
1635
|
ignoreEmpty: true,
|
|
1767
1636
|
});
|
|
1768
1637
|
}
|
|
1638
|
+
// bitmarkAst -> bits -> bitsValue -> * -> refPublicationYear
|
|
1639
|
+
enter_refPublicationYear(node, _route) {
|
|
1640
|
+
this.writeProperty('refPublicationYear', node.value, {
|
|
1641
|
+
format: PropertyFormat.trimmedString,
|
|
1642
|
+
single: true,
|
|
1643
|
+
ignoreEmpty: true,
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1769
1646
|
// bitmarkAst -> bits -> bitsValue -> * -> citationStyle
|
|
1770
1647
|
enter_citationStyle(node, _route) {
|
|
1648
|
+
this.writeNL();
|
|
1771
1649
|
this.writeProperty('citationStyle', node.value, {
|
|
1772
1650
|
format: PropertyFormat.trimmedString,
|
|
1773
1651
|
single: true,
|
|
@@ -1784,6 +1662,8 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1784
1662
|
const example = (_a = parent === null || parent === void 0 ? void 0 : parent.value.example) !== null && _a !== void 0 ? _a : null;
|
|
1785
1663
|
// const __isDefaultExample = parent?.value.__isDefaultExample ?? false;
|
|
1786
1664
|
if (example != null && example !== '') {
|
|
1665
|
+
// Write a newline if not in a chain
|
|
1666
|
+
this.writeNL_IfNotChain(route);
|
|
1787
1667
|
this.writeOPA();
|
|
1788
1668
|
this.writeString('example');
|
|
1789
1669
|
this.writeColon();
|
|
@@ -1813,6 +1693,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1813
1693
|
// bitmarkAst -> bits -> bitsValue -> elements -> elementsValue
|
|
1814
1694
|
leaf_elementsValue(node, _route) {
|
|
1815
1695
|
if (node.value) {
|
|
1696
|
+
this.writeNL();
|
|
1816
1697
|
this.writeBreakscapedTagString(node.value);
|
|
1817
1698
|
}
|
|
1818
1699
|
}
|
|
@@ -1858,18 +1739,21 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1858
1739
|
// bitmarkAst -> bits -> bitsValue -> * -> isCorrect
|
|
1859
1740
|
// bitmarkAst -> bits -> bitsValue -> heading -> forKeys
|
|
1860
1741
|
leaf_forKeys(node, _route) {
|
|
1742
|
+
this.writeNL();
|
|
1861
1743
|
this.writeOPHASH();
|
|
1862
1744
|
this.writeBreakscapedTagString(node.value);
|
|
1863
1745
|
this.writeCL();
|
|
1864
1746
|
}
|
|
1865
1747
|
// bitmarkAst -> bits -> bitsValue -> heading -> forValues
|
|
1866
1748
|
leaf_forValues(node, _route) {
|
|
1749
|
+
this.writeNL();
|
|
1867
1750
|
this.writeOPHASH();
|
|
1868
1751
|
this.writeBreakscapedTagString(node.value);
|
|
1869
1752
|
this.writeCL();
|
|
1870
1753
|
}
|
|
1871
1754
|
// bitmarkAst -> bits -> bitsValue -> heading -> forValuesValue
|
|
1872
1755
|
leaf_forValuesValue(node, _route) {
|
|
1756
|
+
this.writeNL();
|
|
1873
1757
|
this.writeOPHASH();
|
|
1874
1758
|
this.writeBreakscapedTagString(node.value);
|
|
1875
1759
|
this.writeCL();
|
|
@@ -1878,6 +1762,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1878
1762
|
// bitmarkAst -> bits -> bitsValue -> matrix -> matrixValue -> key
|
|
1879
1763
|
leaf_key(node, _route) {
|
|
1880
1764
|
if (node.value) {
|
|
1765
|
+
this.writeNL();
|
|
1881
1766
|
this.writeBreakscapedTagString(node.value);
|
|
1882
1767
|
}
|
|
1883
1768
|
}
|
|
@@ -1885,6 +1770,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1885
1770
|
// bitmarkAst -> bits -> bitsValue -> matrix -> matrixValue -> cells -> cellsValue -> values -> valuesValue
|
|
1886
1771
|
leaf_valuesValue(node, _route) {
|
|
1887
1772
|
if (node.value) {
|
|
1773
|
+
this.writeNL();
|
|
1888
1774
|
this.writeBreakscapedTagString(node.value);
|
|
1889
1775
|
}
|
|
1890
1776
|
}
|
|
@@ -1896,22 +1782,9 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
1896
1782
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.questionsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.flashcardsValue)
|
|
1897
1783
|
return;
|
|
1898
1784
|
if (node.value) {
|
|
1785
|
+
this.writeNL();
|
|
1899
1786
|
this.writeBreakscapedTagString(node.value);
|
|
1900
|
-
// this.writeNL();
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
enter_question(node, route) {
|
|
1904
|
-
// Ignore responses that are not at the questionsValue level as they are handled elsewhere
|
|
1905
|
-
const parent = this.getParentNode(route);
|
|
1906
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.questionsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.flashcardsValue)
|
|
1907
|
-
return true;
|
|
1908
|
-
if (node.value) {
|
|
1909
|
-
this.textGenerator.generateSync(node.value, TextFormat.bitmarkMinusMinus);
|
|
1910
|
-
// this.writeString(node.value);
|
|
1911
|
-
// this.writeNL();
|
|
1912
1787
|
}
|
|
1913
|
-
// Stop traversal of this branch
|
|
1914
|
-
return false;
|
|
1915
1788
|
}
|
|
1916
1789
|
// bitmarkAst -> bits -> bitsValue -> statements -> text
|
|
1917
1790
|
// bitmarkAst -> bits -> bitsValue -> resource -> ...
|
|
@@ -2017,8 +1890,9 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2017
1890
|
ignoreFalse: true,
|
|
2018
1891
|
});
|
|
2019
1892
|
}
|
|
2020
|
-
enter_caption(node,
|
|
1893
|
+
enter_caption(node, route) {
|
|
2021
1894
|
const value = node.value;
|
|
1895
|
+
this.writeNL_IfNotChain(route);
|
|
2022
1896
|
this.writeProperty('caption', value, {
|
|
2023
1897
|
format: PropertyFormat.bitmarkMinusMinus,
|
|
2024
1898
|
single: true, // ??
|
|
@@ -2081,17 +1955,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2081
1955
|
//
|
|
2082
1956
|
// Resources
|
|
2083
1957
|
//
|
|
2084
|
-
// bitmarkAst -> bits -> bitsValue -> resources
|
|
2085
|
-
between_resources(_node, _left, _right, _route) {
|
|
2086
|
-
this.writeNL();
|
|
2087
|
-
}
|
|
2088
|
-
exit_resources(_node, _left, _right, _route) {
|
|
2089
|
-
this.writeNL();
|
|
2090
|
-
}
|
|
2091
|
-
// bitmarkAst -> bits -> bitsValue -> resourcesValue
|
|
2092
|
-
between_resourcesValue(_node, _left, _right, _route) {
|
|
2093
|
-
this.writeNL();
|
|
2094
|
-
}
|
|
2095
1958
|
//
|
|
2096
1959
|
// Generated Node Handlers
|
|
2097
1960
|
//
|
|
@@ -2126,6 +1989,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2126
1989
|
// url / src / href / app
|
|
2127
1990
|
const url = resource.url || resource.src || resource.body || '';
|
|
2128
1991
|
// Write the resource
|
|
1992
|
+
this.writeNL();
|
|
2129
1993
|
this.writeResource(type, url);
|
|
2130
1994
|
// Continue traversal
|
|
2131
1995
|
return true;
|
|
@@ -2138,14 +2002,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2138
2002
|
/**
|
|
2139
2003
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
2140
2004
|
*/
|
|
2141
|
-
// protected enter_labelTrue(node: NodeInfo, _route: NodeInfo[],
|
|
2142
|
-
// ): void {
|
|
2143
|
-
// const bit = parent?.value as Bit;
|
|
2144
|
-
// if (bit) {
|
|
2145
|
-
// this.writeProperty('labelTrue', node.value ?? '', true);
|
|
2146
|
-
// this.writeProperty('labelFalse', bit.labelFalse ?? '', true);
|
|
2147
|
-
// }
|
|
2148
|
-
// }
|
|
2149
2005
|
generatePropertyHandlers() {
|
|
2150
2006
|
var _a;
|
|
2151
2007
|
const propertiesConfig = Config.getRawPropertiesConfig();
|
|
@@ -2172,6 +2028,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2172
2028
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
2173
2029
|
return;
|
|
2174
2030
|
// Write the property
|
|
2031
|
+
this.writeNL(); // Only if NOT in chain (how do we know this?)
|
|
2175
2032
|
this.writeProperty(propertyConfig.tag, node.value, {
|
|
2176
2033
|
format: (_a = propertyConfig.format) !== null && _a !== void 0 ? _a : PropertyFormat.trimmedString,
|
|
2177
2034
|
single: (_b = propertyConfig.single) !== null && _b !== void 0 ? _b : false,
|
|
@@ -2184,35 +2041,30 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2184
2041
|
this[enterFuncName] = this[enterFuncName].bind(this);
|
|
2185
2042
|
}
|
|
2186
2043
|
}
|
|
2187
|
-
writeNlBetween(node, left, _right, _route,
|
|
2188
|
-
// The following keys are combined with other keys so don't need newlines
|
|
2189
|
-
noNlKeys) {
|
|
2190
|
-
const bit = node.value;
|
|
2191
|
-
if (bit.book) {
|
|
2192
|
-
// If the book node exists, remove the newline caused by reference as it will be bound to book
|
|
2193
|
-
noNlKeys.push(NodeType.reference);
|
|
2194
|
-
}
|
|
2195
|
-
// Check if a no newline key is to the left in this 'between' callback
|
|
2196
|
-
const noNl = (() => {
|
|
2197
|
-
if (!this.wroteSomething || this.skipNLBetweenBitsValue) {
|
|
2198
|
-
return true;
|
|
2199
|
-
}
|
|
2200
|
-
for (const keyType of noNlKeys) {
|
|
2201
|
-
if (left.key === keyType /*|| right.key === keyType*/)
|
|
2202
|
-
return true;
|
|
2203
|
-
}
|
|
2204
|
-
return false;
|
|
2205
|
-
})();
|
|
2206
|
-
if (!noNl) {
|
|
2207
|
-
this.writeNL();
|
|
2208
|
-
}
|
|
2209
|
-
this.skipNLBetweenBitsValue = false;
|
|
2210
|
-
this.wroteSomething = false;
|
|
2211
|
-
}
|
|
2212
2044
|
// END NODE HANDLERS
|
|
2213
2045
|
//
|
|
2214
2046
|
// UTILITY FUNCTIONS
|
|
2215
2047
|
//
|
|
2048
|
+
isChain(route) {
|
|
2049
|
+
const parent = this.getParentNode(route);
|
|
2050
|
+
// Root of bit
|
|
2051
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.bitsValue)
|
|
2052
|
+
return false;
|
|
2053
|
+
// Root of card bits
|
|
2054
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.cardBitsValue)
|
|
2055
|
+
return false;
|
|
2056
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.quizzesValue)
|
|
2057
|
+
return false;
|
|
2058
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.pairsValue)
|
|
2059
|
+
return false;
|
|
2060
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.matrixValue)
|
|
2061
|
+
return false;
|
|
2062
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.definitionsValue)
|
|
2063
|
+
return false;
|
|
2064
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.questionsValue)
|
|
2065
|
+
return false;
|
|
2066
|
+
return true;
|
|
2067
|
+
}
|
|
2216
2068
|
haveValidCardSet(bit) {
|
|
2217
2069
|
const bitConfig = Config.getBitConfig(bit.bitType);
|
|
2218
2070
|
if (!bitConfig)
|
|
@@ -2344,17 +2196,20 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2344
2196
|
this.write('#');
|
|
2345
2197
|
}
|
|
2346
2198
|
writePlainTextDivider() {
|
|
2199
|
+
this.writeNL();
|
|
2347
2200
|
this.write('==== text ====');
|
|
2348
2201
|
}
|
|
2349
2202
|
writeCardSetStart() {
|
|
2203
|
+
this.writeNL();
|
|
2350
2204
|
if (this.options.cardSetVersion === CardSetVersion.v1) {
|
|
2351
|
-
this.write('
|
|
2205
|
+
this.write('===');
|
|
2352
2206
|
}
|
|
2353
2207
|
else {
|
|
2354
|
-
this.write('
|
|
2208
|
+
this.write('====');
|
|
2355
2209
|
}
|
|
2356
2210
|
}
|
|
2357
2211
|
writeCardSetEnd() {
|
|
2212
|
+
this.writeNL();
|
|
2358
2213
|
if (this.options.cardSetVersion === CardSetVersion.v1) {
|
|
2359
2214
|
this.write('===');
|
|
2360
2215
|
}
|
|
@@ -2363,6 +2218,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2363
2218
|
}
|
|
2364
2219
|
}
|
|
2365
2220
|
writeCardSetCardDivider() {
|
|
2221
|
+
this.writeNL();
|
|
2366
2222
|
if (this.options.cardSetVersion === CardSetVersion.v1) {
|
|
2367
2223
|
this.write('===');
|
|
2368
2224
|
}
|
|
@@ -2371,6 +2227,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2371
2227
|
}
|
|
2372
2228
|
}
|
|
2373
2229
|
writeCardSetSideDivider() {
|
|
2230
|
+
this.writeNL();
|
|
2374
2231
|
if (this.options.cardSetVersion === CardSetVersion.v1) {
|
|
2375
2232
|
this.write('==');
|
|
2376
2233
|
}
|
|
@@ -2379,6 +2236,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2379
2236
|
}
|
|
2380
2237
|
}
|
|
2381
2238
|
writeCardSetVariantDivider() {
|
|
2239
|
+
this.writeNL();
|
|
2382
2240
|
if (this.options.cardSetVersion === CardSetVersion.v1) {
|
|
2383
2241
|
this.write('--');
|
|
2384
2242
|
}
|
|
@@ -2386,6 +2244,11 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2386
2244
|
this.write('++');
|
|
2387
2245
|
}
|
|
2388
2246
|
}
|
|
2247
|
+
writeNL_IfNotChain(route) {
|
|
2248
|
+
if (!this.isChain(route)) {
|
|
2249
|
+
this.writeNL();
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2389
2252
|
writeNL() {
|
|
2390
2253
|
if (this.options.debugGenerationInline) {
|
|
2391
2254
|
this.write('\\n');
|
|
@@ -2405,7 +2268,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2405
2268
|
this.writeColon();
|
|
2406
2269
|
this.writeBreakscapedTagString(src);
|
|
2407
2270
|
if (resource.type === ResourceTag.article) {
|
|
2408
|
-
this.writeNL();
|
|
2271
|
+
// this.writeNL();
|
|
2409
2272
|
}
|
|
2410
2273
|
this.writeCL();
|
|
2411
2274
|
}
|
|
@@ -2419,7 +2282,7 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2419
2282
|
this.writeColon();
|
|
2420
2283
|
this.writeBreakscapedTagString(value);
|
|
2421
2284
|
if (type === ResourceTag.article) {
|
|
2422
|
-
this.writeNL();
|
|
2285
|
+
// this.writeNL();
|
|
2423
2286
|
}
|
|
2424
2287
|
this.writeCL();
|
|
2425
2288
|
}
|
|
@@ -2427,7 +2290,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2427
2290
|
writeProperty(name, values, options) {
|
|
2428
2291
|
var _a;
|
|
2429
2292
|
let valuesArray;
|
|
2430
|
-
let wroteSomething = false;
|
|
2431
2293
|
if (values !== undefined) {
|
|
2432
2294
|
const isBitmarkText = options.format === PropertyFormat.bitmarkMinusMinus || options.format === PropertyFormat.bitmarkPlusPlus;
|
|
2433
2295
|
if (isBitmarkText) {
|
|
@@ -2439,7 +2301,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2439
2301
|
this.writeColon();
|
|
2440
2302
|
this.textGenerator.generateSync(values, (_a = TextFormat.fromValue(options.format)) !== null && _a !== void 0 ? _a : TextFormat.bitmarkMinusMinus);
|
|
2441
2303
|
this.writeCL();
|
|
2442
|
-
wroteSomething = true;
|
|
2443
2304
|
}
|
|
2444
2305
|
else {
|
|
2445
2306
|
// Write any other property type
|
|
@@ -2452,7 +2313,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2452
2313
|
if (valuesArray.length > 0) {
|
|
2453
2314
|
if (options.single)
|
|
2454
2315
|
valuesArray = valuesArray.slice(valuesArray.length - 1);
|
|
2455
|
-
let propertyIndex = 0;
|
|
2456
2316
|
for (const val of valuesArray) {
|
|
2457
2317
|
if (val !== undefined) {
|
|
2458
2318
|
if (options.ignoreFalse && val === false)
|
|
@@ -2461,23 +2321,17 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2461
2321
|
continue;
|
|
2462
2322
|
if (options.ignoreEmpty && val === '')
|
|
2463
2323
|
continue;
|
|
2464
|
-
if (propertyIndex > 0)
|
|
2465
|
-
this.writeNL();
|
|
2466
2324
|
this.writeOPA();
|
|
2467
2325
|
this.writeBreakscapedTagString(name);
|
|
2468
2326
|
this.writeColon();
|
|
2469
2327
|
this.writeBreakscapedTagString(`${val}`);
|
|
2470
2328
|
this.writeCL();
|
|
2471
|
-
|
|
2472
|
-
propertyIndex++;
|
|
2329
|
+
// propertyIndex++;
|
|
2473
2330
|
}
|
|
2474
2331
|
}
|
|
2475
2332
|
}
|
|
2476
2333
|
} // isBitmarkText
|
|
2477
2334
|
}
|
|
2478
|
-
if (!wroteSomething) {
|
|
2479
|
-
this.skipNLBetweenBitsValue = true;
|
|
2480
|
-
}
|
|
2481
2335
|
}
|
|
2482
2336
|
writeInlineDebug(key, state) {
|
|
2483
2337
|
let tag = key;
|
|
@@ -2545,8 +2399,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2545
2399
|
* @param value - The string value to be written.
|
|
2546
2400
|
*/
|
|
2547
2401
|
write(value) {
|
|
2548
|
-
if (value)
|
|
2549
|
-
this.wroteSomething = true;
|
|
2550
2402
|
this.writer.write(value);
|
|
2551
2403
|
return this;
|
|
2552
2404
|
}
|
|
@@ -2555,8 +2407,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2555
2407
|
* @param value - The line to write. When omitted, only the endOfLineString is written.
|
|
2556
2408
|
*/
|
|
2557
2409
|
writeLine(value) {
|
|
2558
|
-
if (value)
|
|
2559
|
-
this.wroteSomething = true;
|
|
2560
2410
|
this.writer.writeLine(value);
|
|
2561
2411
|
return this;
|
|
2562
2412
|
}
|
|
@@ -2566,8 +2416,6 @@ class BitmarkGenerator extends AstWalkerGenerator {
|
|
|
2566
2416
|
* @param delimiter - An optional delimiter to be written at the end of each line, except for the last one.
|
|
2567
2417
|
*/
|
|
2568
2418
|
writeLines(values, delimiter) {
|
|
2569
|
-
if (values.length > 0 && values.reduce((acc, v) => (v ? true : acc), false))
|
|
2570
|
-
this.wroteSomething = true;
|
|
2571
2419
|
this.writer.writeLines(values, delimiter);
|
|
2572
2420
|
return this;
|
|
2573
2421
|
}
|