@gmb/bitmark-parser-generator 1.4.8 → 1.4.9
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/BitmarkParserGenerator.js +6 -3
- package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
- package/dist/cjs/ast/BaseBuilder.js +6 -5
- package/dist/cjs/ast/BaseBuilder.js.map +1 -1
- package/dist/cjs/ast/Builder.js +2 -1
- package/dist/cjs/ast/Builder.js.map +1 -1
- package/dist/cjs/ast/ResourceBuilder.js +2 -1
- package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
- package/dist/cjs/breakscaping/Breakscape.js +240 -0
- package/dist/cjs/breakscaping/Breakscape.js.map +1 -0
- package/dist/cjs/generated/build-info.js +1 -1
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +193 -73
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
- package/dist/cjs/generated/parser/text/text-peggy-parser.js +9 -9
- package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +136 -126
- package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
- package/dist/cjs/generator/text/TextGenerator.js +13 -28
- package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/ast/BreakscapedString.js +3 -0
- package/dist/cjs/model/ast/BreakscapedString.js.map +1 -0
- package/dist/cjs/model/ast/StardardString.js +3 -0
- package/dist/cjs/model/ast/StardardString.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +8 -7
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +17 -16
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/json/JsonParser.js +98 -99
- package/dist/cjs/parser/json/JsonParser.js.map +1 -1
- package/dist/esm/BitmarkParserGenerator.js +7 -4
- package/dist/esm/BitmarkParserGenerator.js.map +1 -1
- package/dist/esm/ast/BaseBuilder.js +6 -5
- package/dist/esm/ast/BaseBuilder.js.map +1 -1
- package/dist/esm/ast/Builder.js +2 -1
- package/dist/esm/ast/Builder.js.map +1 -1
- package/dist/esm/ast/ResourceBuilder.js +2 -1
- package/dist/esm/ast/ResourceBuilder.js.map +1 -1
- package/dist/esm/breakscaping/Breakscape.js +237 -0
- package/dist/esm/breakscaping/Breakscape.js.map +1 -0
- package/dist/esm/generated/build-info.js +1 -1
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +193 -73
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
- package/dist/esm/generated/parser/text/text-peggy-parser.js +9 -8
- package/dist/esm/generated/parser/text/text-peggy-parser.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +136 -126
- package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
- package/dist/esm/generator/text/TextGenerator.js +13 -26
- package/dist/esm/generator/text/TextGenerator.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/ast/BreakscapedString.js +2 -0
- package/dist/esm/model/ast/BreakscapedString.js.map +1 -0
- package/dist/esm/model/ast/StardardString.js +2 -0
- package/dist/esm/model/ast/StardardString.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +8 -7
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +17 -16
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/json/JsonParser.js +98 -99
- package/dist/esm/parser/json/JsonParser.js.map +1 -1
- package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
- package/dist/types/ast/BaseBuilder.d.ts +4 -3
- package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
- package/dist/types/ast/Builder.d.ts +157 -156
- package/dist/types/ast/Builder.d.ts.map +1 -1
- package/dist/types/ast/ResourceBuilder.d.ts +111 -110
- package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
- package/dist/types/breakscaping/Breakscape.d.ts +49 -0
- package/dist/types/breakscaping/Breakscape.d.ts.map +1 -0
- package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +1 -1
- package/dist/types/generated/parser/text/text-peggy-parser.d.ts +0 -1
- package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +1 -1
- package/dist/types/generator/json/JsonGenerator.d.ts +8 -7
- package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
- package/dist/types/generator/text/TextGenerator.d.ts +11 -12
- package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/model/ast/BreakscapedString.d.ts +4 -0
- package/dist/types/model/ast/BreakscapedString.d.ts.map +1 -0
- package/dist/types/model/ast/Nodes.d.ts +97 -96
- package/dist/types/model/ast/Nodes.d.ts.map +1 -1
- package/dist/types/model/ast/StardardString.d.ts +4 -0
- package/dist/types/model/ast/StardardString.d.ts.map +1 -0
- package/dist/types/model/json/BitJson.d.ts +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +36 -35
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +4 -3
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.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/ClozeTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +2 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/json/JsonParser.d.ts +9 -0
- package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.JsonGenerator = void 0;
|
|
24
24
|
const Ast_1 = require("../../ast/Ast");
|
|
25
|
+
const Breakscape_1 = require("../../breakscaping/Breakscape");
|
|
25
26
|
const Config_1 = require("../../config/Config");
|
|
26
27
|
const NodeType_1 = require("../../model/ast/NodeType");
|
|
27
28
|
const BitType_1 = require("../../model/enum/BitType");
|
|
@@ -306,10 +307,10 @@ class JsonGenerator {
|
|
|
306
307
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
307
308
|
return;
|
|
308
309
|
if (item != null) {
|
|
309
|
-
this.bitJson.item = this.toTextAstOrString(item);
|
|
310
|
+
this.bitJson.item = this.toTextAstOrString(item, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
310
311
|
}
|
|
311
312
|
if (lead != null) {
|
|
312
|
-
this.bitJson.lead = this.toTextAstOrString(lead);
|
|
313
|
+
this.bitJson.lead = this.toTextAstOrString(lead, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
316
|
// bitmarkAst -> bits -> bitsValue -> extraProperties
|
|
@@ -362,12 +363,12 @@ class JsonGenerator {
|
|
|
362
363
|
const asText = bodyPart;
|
|
363
364
|
const bodyTextPart = asText.data.bodyText;
|
|
364
365
|
// Append the text part to the full text body
|
|
365
|
-
fullBodyTextStr
|
|
366
|
+
fullBodyTextStr = Breakscape_1.Breakscape.concatenate(fullBodyTextStr, bodyTextPart);
|
|
366
367
|
}
|
|
367
368
|
else {
|
|
368
369
|
const { legacyPlaceholderKey, placeholderKey } = createPlaceholderKeys(placeholderIndex);
|
|
369
370
|
// Append the placeholder to the full text body
|
|
370
|
-
fullBodyTextStr
|
|
371
|
+
fullBodyTextStr = Breakscape_1.Breakscape.concatenate(fullBodyTextStr, plainText ? legacyPlaceholderKey : placeholderKey);
|
|
371
372
|
placeholderIndex++;
|
|
372
373
|
}
|
|
373
374
|
}
|
|
@@ -434,7 +435,7 @@ class JsonGenerator {
|
|
|
434
435
|
// Ignore elements that are not at the bit level as they are handled elsewhere as quizzes
|
|
435
436
|
// if (parent?.key !== NodeType.bitsValue) return;
|
|
436
437
|
if (elements && elements.length > 0) {
|
|
437
|
-
this.bitJson.elements = elements;
|
|
438
|
+
this.bitJson.elements = Breakscape_1.Breakscape.unbreakscape(elements);
|
|
438
439
|
}
|
|
439
440
|
}
|
|
440
441
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue
|
|
@@ -448,7 +449,7 @@ class JsonGenerator {
|
|
|
448
449
|
if (flashcards) {
|
|
449
450
|
for (const c of flashcards) {
|
|
450
451
|
// Create the flashcard
|
|
451
|
-
const flashcardJson = Object.assign(Object.assign({ question: (_a = c.question) !== null && _a !== void 0 ? _a : '', answer: (_b = c.answer) !== null && _b !== void 0 ? _b : '', alternativeAnswers: (_c = c.alternativeAnswers) !== null && _c !== void 0 ? _c : [] }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
|
|
452
|
+
const flashcardJson = Object.assign(Object.assign({ question: (_a = Breakscape_1.Breakscape.unbreakscape(c.question)) !== null && _a !== void 0 ? _a : '', answer: (_b = Breakscape_1.Breakscape.unbreakscape(c.answer)) !== null && _b !== void 0 ? _b : '', alternativeAnswers: (_c = Breakscape_1.Breakscape.unbreakscape(c.alternativeAnswers)) !== null && _c !== void 0 ? _c : [] }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
|
|
452
453
|
defaultExample: c.isDefaultExample,
|
|
453
454
|
isBoolean: true,
|
|
454
455
|
}));
|
|
@@ -470,7 +471,7 @@ class JsonGenerator {
|
|
|
470
471
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.cardNode)
|
|
471
472
|
return;
|
|
472
473
|
if (statement) {
|
|
473
|
-
this.bitJson.statement = (_a = statement.text) !== null && _a !== void 0 ? _a : '';
|
|
474
|
+
this.bitJson.statement = (_a = Breakscape_1.Breakscape.unbreakscape(statement.text)) !== null && _a !== void 0 ? _a : '';
|
|
474
475
|
this.bitJson.isCorrect = (_b = statement.isCorrect) !== null && _b !== void 0 ? _b : false;
|
|
475
476
|
}
|
|
476
477
|
}
|
|
@@ -485,7 +486,7 @@ class JsonGenerator {
|
|
|
485
486
|
if (statements) {
|
|
486
487
|
for (const s of statements) {
|
|
487
488
|
// Create the statement
|
|
488
|
-
const statementJson = Object.assign(Object.assign({ statement: (_a = s.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!s.isCorrect }, this.toItemLeadHintInstruction(s)), this.toExample(s, {
|
|
489
|
+
const statementJson = Object.assign(Object.assign({ statement: (_a = Breakscape_1.Breakscape.unbreakscape(s.text)) !== null && _a !== void 0 ? _a : '', isCorrect: !!s.isCorrect }, this.toItemLeadHintInstruction(s)), this.toExample(s, {
|
|
489
490
|
defaultExample: !!s.isCorrect,
|
|
490
491
|
isBoolean: true,
|
|
491
492
|
}));
|
|
@@ -517,7 +518,7 @@ class JsonGenerator {
|
|
|
517
518
|
if (choices) {
|
|
518
519
|
for (const c of choices) {
|
|
519
520
|
// Create the choice
|
|
520
|
-
const choiceJson = Object.assign(Object.assign({ choice: (_a = c.text) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = c.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
|
|
521
|
+
const choiceJson = Object.assign(Object.assign({ choice: (_a = Breakscape_1.Breakscape.unbreakscape(c.text)) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = c.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
|
|
521
522
|
defaultExample: !!c.isCorrect,
|
|
522
523
|
isBoolean: true,
|
|
523
524
|
}));
|
|
@@ -543,7 +544,7 @@ class JsonGenerator {
|
|
|
543
544
|
if (responses) {
|
|
544
545
|
for (const r of responses) {
|
|
545
546
|
// Create the response
|
|
546
|
-
const responseJson = Object.assign(Object.assign({ response: (_a = r.text) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = r.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(r)), this.toExample(r, {
|
|
547
|
+
const responseJson = Object.assign(Object.assign({ response: (_a = Breakscape_1.Breakscape.unbreakscape(r.text)) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = r.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(r)), this.toExample(r, {
|
|
547
548
|
defaultExample: !!r.isCorrect,
|
|
548
549
|
isBoolean: true,
|
|
549
550
|
}));
|
|
@@ -569,7 +570,7 @@ class JsonGenerator {
|
|
|
569
570
|
if (q.choices) {
|
|
570
571
|
for (const c of q.choices) {
|
|
571
572
|
// Create the choice
|
|
572
|
-
const choiceJson = Object.assign(Object.assign({ choice: (_a = c.text) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = c.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
|
|
573
|
+
const choiceJson = Object.assign(Object.assign({ choice: (_a = Breakscape_1.Breakscape.unbreakscape(c.text)) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = c.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
|
|
573
574
|
defaultExample: !!c.isCorrect,
|
|
574
575
|
isBoolean: true,
|
|
575
576
|
}));
|
|
@@ -584,7 +585,7 @@ class JsonGenerator {
|
|
|
584
585
|
if (q.responses) {
|
|
585
586
|
for (const r of q.responses) {
|
|
586
587
|
// Create the choice
|
|
587
|
-
const responseJson = Object.assign(Object.assign({ response: (_d = r.text) !== null && _d !== void 0 ? _d : '', isCorrect: (_e = r.isCorrect) !== null && _e !== void 0 ? _e : false }, this.toItemLeadHintInstruction(r)), this.toExample(r, {
|
|
588
|
+
const responseJson = Object.assign(Object.assign({ response: (_d = Breakscape_1.Breakscape.unbreakscape(r.text)) !== null && _d !== void 0 ? _d : '', isCorrect: (_e = r.isCorrect) !== null && _e !== void 0 ? _e : false }, this.toItemLeadHintInstruction(r)), this.toExample(r, {
|
|
588
589
|
defaultExample: !!r.isCorrect,
|
|
589
590
|
isBoolean: true,
|
|
590
591
|
}));
|
|
@@ -619,22 +620,22 @@ class JsonGenerator {
|
|
|
619
620
|
return false;
|
|
620
621
|
// Create the heading
|
|
621
622
|
const headingJson = {
|
|
622
|
-
forKeys: (_a = heading.forKeys) !== null && _a !== void 0 ? _a : '',
|
|
623
|
+
forKeys: (_a = Breakscape_1.Breakscape.unbreakscape(heading.forKeys)) !== null && _a !== void 0 ? _a : '',
|
|
623
624
|
};
|
|
624
625
|
// TODO: Should probably check wether bit is a match or a matrix and add a string for match and array for matrix
|
|
625
626
|
if (Array.isArray(heading.forValues)) {
|
|
626
627
|
if (heading.forValues.length > 1) {
|
|
627
|
-
headingJson.forValues = heading.forValues;
|
|
628
|
+
headingJson.forValues = Breakscape_1.Breakscape.unbreakscape(heading.forValues);
|
|
628
629
|
}
|
|
629
630
|
else if (heading.forValues.length === 1) {
|
|
630
|
-
headingJson.forValues = heading.forValues[0];
|
|
631
|
+
headingJson.forValues = Breakscape_1.Breakscape.unbreakscape(heading.forValues[0]);
|
|
631
632
|
}
|
|
632
633
|
else {
|
|
633
|
-
headingJson.forValues = heading.forValues;
|
|
634
|
+
headingJson.forValues = Breakscape_1.Breakscape.unbreakscape(heading.forValues);
|
|
634
635
|
}
|
|
635
636
|
}
|
|
636
637
|
else {
|
|
637
|
-
headingJson.forValues = (_b = heading.forValues) !== null && _b !== void 0 ? _b : '';
|
|
638
|
+
headingJson.forValues = (_b = Breakscape_1.Breakscape.unbreakscape(heading.forValues)) !== null && _b !== void 0 ? _b : '';
|
|
638
639
|
}
|
|
639
640
|
this.bitJson.heading = headingJson;
|
|
640
641
|
}
|
|
@@ -648,7 +649,7 @@ class JsonGenerator {
|
|
|
648
649
|
// Get default example
|
|
649
650
|
const defaultExample = Array.isArray(p.values) && p.values.length > 0 && p.values[0];
|
|
650
651
|
// Create the question
|
|
651
|
-
const pairJson = Object.assign(Object.assign(Object.assign({ key: (_a = p.key) !== null && _a !== void 0 ? _a : '', keyAudio: p.keyAudio ? this.addAudioResource(p.keyAudio) : undefined, keyImage: p.keyImage ? this.addImageResource(p.keyImage) : undefined, values: (_b = p.values) !== null && _b !== void 0 ? _b : [] }, this.toItemLeadHintInstruction(p)), { isCaseSensitive: (_c = p.isCaseSensitive) !== null && _c !== void 0 ? _c : true }), this.toExample(p, {
|
|
652
|
+
const pairJson = Object.assign(Object.assign(Object.assign({ key: (_a = Breakscape_1.Breakscape.unbreakscape(p.key)) !== null && _a !== void 0 ? _a : '', keyAudio: p.keyAudio ? this.addAudioResource(p.keyAudio) : undefined, keyImage: p.keyImage ? this.addImageResource(p.keyImage) : undefined, values: (_b = Breakscape_1.Breakscape.unbreakscape(p.values)) !== null && _b !== void 0 ? _b : [] }, this.toItemLeadHintInstruction(p)), { isCaseSensitive: (_c = p.isCaseSensitive) !== null && _c !== void 0 ? _c : true }), this.toExample(p, {
|
|
652
653
|
defaultExample,
|
|
653
654
|
isBoolean: false,
|
|
654
655
|
}));
|
|
@@ -688,7 +689,7 @@ class JsonGenerator {
|
|
|
688
689
|
// Get default example
|
|
689
690
|
const defaultExample = Array.isArray(c.values) && c.values.length > 0 && c.values[0];
|
|
690
691
|
// Create the choice
|
|
691
|
-
const matrixCellJson = Object.assign(Object.assign(Object.assign({ values: (_a = c.values) !== null && _a !== void 0 ? _a : [] }, this.toItemLeadHintInstruction(c)), { isCaseSensitive: (_b = c.isCaseSensitive) !== null && _b !== void 0 ? _b : true }), this.toExample(c, {
|
|
692
|
+
const matrixCellJson = Object.assign(Object.assign(Object.assign({ values: (_a = Breakscape_1.Breakscape.unbreakscape(c.values)) !== null && _a !== void 0 ? _a : [] }, this.toItemLeadHintInstruction(c)), { isCaseSensitive: (_b = c.isCaseSensitive) !== null && _b !== void 0 ? _b : true }), this.toExample(c, {
|
|
692
693
|
defaultExample,
|
|
693
694
|
isBoolean: false,
|
|
694
695
|
}));
|
|
@@ -701,7 +702,7 @@ class JsonGenerator {
|
|
|
701
702
|
}
|
|
702
703
|
}
|
|
703
704
|
// Create the matrix
|
|
704
|
-
const matrixJson = Object.assign(Object.assign({ key: (_d = m.key) !== null && _d !== void 0 ? _d : '', cells: matrixCellsJson !== null && matrixCellsJson !== void 0 ? matrixCellsJson : [] }, this.toItemLeadHintInstruction(m)), {
|
|
705
|
+
const matrixJson = Object.assign(Object.assign({ key: (_d = Breakscape_1.Breakscape.unbreakscape(m.key)) !== null && _d !== void 0 ? _d : '', cells: matrixCellsJson !== null && matrixCellsJson !== void 0 ? matrixCellsJson : [] }, this.toItemLeadHintInstruction(m)), {
|
|
705
706
|
// ...this.toExample(m.example, m.isExample),
|
|
706
707
|
isExample: (_e = m.isExample) !== null && _e !== void 0 ? _e : false });
|
|
707
708
|
// Delete unwanted properties
|
|
@@ -724,7 +725,7 @@ class JsonGenerator {
|
|
|
724
725
|
if (questions) {
|
|
725
726
|
for (const q of questions) {
|
|
726
727
|
// Create the question
|
|
727
|
-
const questionJson = Object.assign(Object.assign(Object.assign({ question: (_a = q.question) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = ArrayUtils_1.ArrayUtils.asSingle(q.partialAnswer)) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = q.sampleSolution) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(q)), { reasonableNumOfChars: q.reasonableNumOfChars }), this.toExample(q, {
|
|
728
|
+
const questionJson = Object.assign(Object.assign(Object.assign({ question: (_a = Breakscape_1.Breakscape.unbreakscape(q.question)) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = Breakscape_1.Breakscape.unbreakscape(ArrayUtils_1.ArrayUtils.asSingle(q.partialAnswer))) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = Breakscape_1.Breakscape.unbreakscape(q.sampleSolution)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(q)), { reasonableNumOfChars: q.reasonableNumOfChars }), this.toExample(q, {
|
|
728
729
|
defaultExample: q.sampleSolution || '',
|
|
729
730
|
isBoolean: false,
|
|
730
731
|
}));
|
|
@@ -749,7 +750,7 @@ class JsonGenerator {
|
|
|
749
750
|
if (botResponses) {
|
|
750
751
|
for (const r of botResponses) {
|
|
751
752
|
// Create the response
|
|
752
|
-
const responseJson = Object.assign({ response: (_a = r.response) !== null && _a !== void 0 ? _a : '', reaction: (_b = r.reaction) !== null && _b !== void 0 ? _b : '', feedback: (_c = r.feedback) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(r));
|
|
753
|
+
const responseJson = Object.assign({ response: (_a = Breakscape_1.Breakscape.unbreakscape(r.response)) !== null && _a !== void 0 ? _a : '', reaction: (_b = Breakscape_1.Breakscape.unbreakscape(r.reaction)) !== null && _b !== void 0 ? _b : '', feedback: (_c = Breakscape_1.Breakscape.unbreakscape(r.feedback)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(r));
|
|
753
754
|
// Delete unwanted properties
|
|
754
755
|
if (((_d = r.itemLead) === null || _d === void 0 ? void 0 : _d.lead) == null)
|
|
755
756
|
delete responseJson.lead;
|
|
@@ -821,11 +822,11 @@ class JsonGenerator {
|
|
|
821
822
|
//
|
|
822
823
|
// bitmarkAst -> bits -> bitsValue -> title
|
|
823
824
|
leaf_title(node, _parent, _route) {
|
|
824
|
-
this.bitJson.title = this.toTextAstOrString(node.value);
|
|
825
|
+
this.bitJson.title = this.toTextAstOrString(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
825
826
|
}
|
|
826
827
|
// bitmarkAst -> bits -> bitsValue -> subtitle
|
|
827
828
|
leaf_subtitle(node, _parent, _route) {
|
|
828
|
-
this.bitJson.subtitle = this.toTextAstOrString(node.value);
|
|
829
|
+
this.bitJson.subtitle = this.toTextAstOrString(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
829
830
|
}
|
|
830
831
|
// // bitmarkAst -> bits -> bitsValue -> level
|
|
831
832
|
leaf_level(node, _parent, _route) {
|
|
@@ -859,7 +860,7 @@ class JsonGenerator {
|
|
|
859
860
|
// Ignore hint that is not at the bit level as it are handled elsewhere
|
|
860
861
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
861
862
|
return;
|
|
862
|
-
this.bitJson.hint = this.toTextAstOrString(hint);
|
|
863
|
+
this.bitJson.hint = this.toTextAstOrString(hint, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
863
864
|
}
|
|
864
865
|
// bitmarkAst -> bits -> bitsValue -> * -> instruction
|
|
865
866
|
leaf_instruction(node, parent, _route) {
|
|
@@ -867,12 +868,12 @@ class JsonGenerator {
|
|
|
867
868
|
// Ignore instruction that is not at the bit level as it are handled elsewhere
|
|
868
869
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
869
870
|
return;
|
|
870
|
-
this.bitJson.instruction = this.toTextAstOrString(instruction);
|
|
871
|
+
this.bitJson.instruction = this.toTextAstOrString(instruction, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
871
872
|
}
|
|
872
873
|
// bitmarkAst -> bits -> footer -> footerText
|
|
873
874
|
leaf_footerText(node, _parent, _route) {
|
|
874
875
|
const footer = node.value;
|
|
875
|
-
this.bitJson.footer = this.toTextAstOrString(footer);
|
|
876
|
+
this.bitJson.footer = this.toTextAstOrString(footer, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
876
877
|
}
|
|
877
878
|
// bitmarkAst -> bits -> bitsValue -> markup
|
|
878
879
|
leaf_markup(node, _parent, _route) {
|
|
@@ -981,7 +982,7 @@ class JsonGenerator {
|
|
|
981
982
|
const gapJson = Object.assign(Object.assign(Object.assign(Object.assign({ type: 'gap' }, this.toItemLeadHintInstruction(data)), { isCaseSensitive: (_a = data.isCaseSensitive) !== null && _a !== void 0 ? _a : true }), this.toExample(data, {
|
|
982
983
|
defaultExample,
|
|
983
984
|
isBoolean: false,
|
|
984
|
-
})), { solutions: data.solutions });
|
|
985
|
+
})), { solutions: Breakscape_1.Breakscape.unbreakscape(data.solutions) });
|
|
985
986
|
// Remove unwanted properties
|
|
986
987
|
if (!gapJson.lead)
|
|
987
988
|
delete gapJson.lead;
|
|
@@ -990,7 +991,7 @@ class JsonGenerator {
|
|
|
990
991
|
createMarkJson(mark) {
|
|
991
992
|
const data = mark.data;
|
|
992
993
|
// Create the mark
|
|
993
|
-
const markJson = Object.assign(Object.assign({ type: 'mark', solution: data.solution, mark: data.mark }, this.toItemLeadHintInstruction(data)), this.toExample(data, {
|
|
994
|
+
const markJson = Object.assign(Object.assign({ type: 'mark', solution: Breakscape_1.Breakscape.unbreakscape(data.solution), mark: Breakscape_1.Breakscape.unbreakscape(data.mark) }, this.toItemLeadHintInstruction(data)), this.toExample(data, {
|
|
994
995
|
defaultExample: true,
|
|
995
996
|
isBoolean: true,
|
|
996
997
|
}));
|
|
@@ -1005,7 +1006,7 @@ class JsonGenerator {
|
|
|
1005
1006
|
// Create the select options
|
|
1006
1007
|
const options = [];
|
|
1007
1008
|
for (const option of data.options) {
|
|
1008
|
-
const optionJson = Object.assign(Object.assign({ text: option.text, isCorrect: (_a = option.isCorrect) !== null && _a !== void 0 ? _a : false }, this.toItemLeadHintInstruction(option)), this.toExample(option, {
|
|
1009
|
+
const optionJson = Object.assign(Object.assign({ text: Breakscape_1.Breakscape.unbreakscape(option.text), isCorrect: (_a = option.isCorrect) !== null && _a !== void 0 ? _a : false }, this.toItemLeadHintInstruction(option)), this.toExample(option, {
|
|
1009
1010
|
defaultExample: !!option.isCorrect,
|
|
1010
1011
|
isBoolean: true,
|
|
1011
1012
|
}));
|
|
@@ -1019,7 +1020,7 @@ class JsonGenerator {
|
|
|
1019
1020
|
options.push(optionJson);
|
|
1020
1021
|
}
|
|
1021
1022
|
// Create the select
|
|
1022
|
-
const selectJson = Object.assign(Object.assign({ type: 'select', prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_d = data.isExample) !== null && _d !== void 0 ? _d : false, options });
|
|
1023
|
+
const selectJson = Object.assign(Object.assign({ type: 'select', prefix: (_b = Breakscape_1.Breakscape.unbreakscape(data.prefix)) !== null && _b !== void 0 ? _b : '', postfix: (_c = Breakscape_1.Breakscape.unbreakscape(data.postfix)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_d = data.isExample) !== null && _d !== void 0 ? _d : false, options });
|
|
1023
1024
|
// Remove unwanted properties
|
|
1024
1025
|
if (!selectJson.lead)
|
|
1025
1026
|
delete selectJson.lead;
|
|
@@ -1031,7 +1032,7 @@ class JsonGenerator {
|
|
|
1031
1032
|
// Create the highlight options
|
|
1032
1033
|
const texts = [];
|
|
1033
1034
|
for (const text of data.texts) {
|
|
1034
|
-
const textJson = Object.assign(Object.assign({ text: text.text, isCorrect: (_a = text.isCorrect) !== null && _a !== void 0 ? _a : false, isHighlighted: (_b = text.isHighlighted) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(text)), this.toExample(text, {
|
|
1035
|
+
const textJson = Object.assign(Object.assign({ text: Breakscape_1.Breakscape.unbreakscape(text.text), isCorrect: (_a = text.isCorrect) !== null && _a !== void 0 ? _a : false, isHighlighted: (_b = text.isHighlighted) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(text)), this.toExample(text, {
|
|
1035
1036
|
defaultExample: !!text.isCorrect,
|
|
1036
1037
|
isBoolean: true,
|
|
1037
1038
|
}));
|
|
@@ -1045,7 +1046,7 @@ class JsonGenerator {
|
|
|
1045
1046
|
texts.push(textJson);
|
|
1046
1047
|
}
|
|
1047
1048
|
// Create the select
|
|
1048
|
-
const highlightJson = Object.assign(Object.assign({ type: 'highlight', prefix: (_c = data.prefix) !== null && _c !== void 0 ? _c : '', postfix: (_d = data.postfix) !== null && _d !== void 0 ? _d : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_e = data.isExample) !== null && _e !== void 0 ? _e : false, texts });
|
|
1049
|
+
const highlightJson = Object.assign(Object.assign({ type: 'highlight', prefix: (_c = Breakscape_1.Breakscape.unbreakscape(data.prefix)) !== null && _c !== void 0 ? _c : '', postfix: (_d = Breakscape_1.Breakscape.unbreakscape(data.postfix)) !== null && _d !== void 0 ? _d : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_e = data.isExample) !== null && _e !== void 0 ? _e : false, texts });
|
|
1049
1050
|
// Remove unwanted properties
|
|
1050
1051
|
if (!highlightJson.lead)
|
|
1051
1052
|
delete highlightJson.lead;
|
|
@@ -1181,29 +1182,29 @@ class JsonGenerator {
|
|
|
1181
1182
|
resource = {
|
|
1182
1183
|
type: ResourceTag_1.ResourceTag.image,
|
|
1183
1184
|
typeAlias: ResourceTag_1.ResourceTag.image,
|
|
1184
|
-
value,
|
|
1185
|
+
value: value,
|
|
1185
1186
|
format: UrlUtils_1.UrlUtils.fileExtensionFromUrl(value),
|
|
1186
1187
|
provider: UrlUtils_1.UrlUtils.domainFromUrl(value),
|
|
1187
1188
|
};
|
|
1188
1189
|
}
|
|
1189
1190
|
resource = resource; // Keep TS compiler happy
|
|
1190
1191
|
if (resource.format != null)
|
|
1191
|
-
resourceJson.format = resource.format;
|
|
1192
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1192
1193
|
if (resource.provider != null)
|
|
1193
|
-
resourceJson.provider = resource.provider;
|
|
1194
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1194
1195
|
if (resource.value != null)
|
|
1195
|
-
resourceJson.src = resource.value;
|
|
1196
|
+
resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1196
1197
|
if (resource.src1x != null)
|
|
1197
|
-
resourceJson.src1x = resource.src1x;
|
|
1198
|
+
resourceJson.src1x = Breakscape_1.Breakscape.unbreakscape(resource.src1x);
|
|
1198
1199
|
if (resource.src2x != null)
|
|
1199
|
-
resourceJson.src2x = resource.src2x;
|
|
1200
|
+
resourceJson.src2x = Breakscape_1.Breakscape.unbreakscape(resource.src2x);
|
|
1200
1201
|
if (resource.src3x != null)
|
|
1201
|
-
resourceJson.src3x = resource.src3x;
|
|
1202
|
+
resourceJson.src3x = Breakscape_1.Breakscape.unbreakscape(resource.src3x);
|
|
1202
1203
|
if (resource.src4x != null)
|
|
1203
|
-
resourceJson.src4x = resource.src4x;
|
|
1204
|
+
resourceJson.src4x = Breakscape_1.Breakscape.unbreakscape(resource.src4x);
|
|
1204
1205
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1205
1206
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1206
|
-
resourceJson.alt = (_c = resource.alt) !== null && _c !== void 0 ? _c : '';
|
|
1207
|
+
resourceJson.alt = (_c = Breakscape_1.Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
|
|
1207
1208
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1208
1209
|
return resourceJson;
|
|
1209
1210
|
}
|
|
@@ -1222,33 +1223,33 @@ class JsonGenerator {
|
|
|
1222
1223
|
}
|
|
1223
1224
|
resource = resource; // Keep TS compiler happy
|
|
1224
1225
|
if (resource.format != null)
|
|
1225
|
-
resourceJson.format = resource.format;
|
|
1226
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1226
1227
|
if (resource.provider != null)
|
|
1227
|
-
resourceJson.provider = resource.provider;
|
|
1228
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1228
1229
|
if (resource.value != null)
|
|
1229
|
-
resourceJson.url = resource.value;
|
|
1230
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1230
1231
|
if (resource.src1x != null)
|
|
1231
|
-
resourceJson.src1x = resource.src1x;
|
|
1232
|
+
resourceJson.src1x = Breakscape_1.Breakscape.unbreakscape(resource.src1x);
|
|
1232
1233
|
if (resource.src2x != null)
|
|
1233
|
-
resourceJson.src2x = resource.src2x;
|
|
1234
|
+
resourceJson.src2x = Breakscape_1.Breakscape.unbreakscape(resource.src2x);
|
|
1234
1235
|
if (resource.src3x != null)
|
|
1235
|
-
resourceJson.src3x = resource.src3x;
|
|
1236
|
+
resourceJson.src3x = Breakscape_1.Breakscape.unbreakscape(resource.src3x);
|
|
1236
1237
|
if (resource.src4x != null)
|
|
1237
|
-
resourceJson.src4x = resource.src4x;
|
|
1238
|
+
resourceJson.src4x = Breakscape_1.Breakscape.unbreakscape(resource.src4x);
|
|
1238
1239
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1239
1240
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1240
|
-
resourceJson.alt = (_c = resource.alt) !== null && _c !== void 0 ? _c : '';
|
|
1241
|
+
resourceJson.alt = (_c = Breakscape_1.Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
|
|
1241
1242
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1242
1243
|
return resourceJson;
|
|
1243
1244
|
}
|
|
1244
1245
|
addAudioResource(resource) {
|
|
1245
1246
|
const resourceJson = {};
|
|
1246
1247
|
if (resource.format != null)
|
|
1247
|
-
resourceJson.format = resource.format;
|
|
1248
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1248
1249
|
if (resource.provider != null)
|
|
1249
|
-
resourceJson.provider = resource.provider;
|
|
1250
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1250
1251
|
if (resource.value != null)
|
|
1251
|
-
resourceJson.src = resource.value;
|
|
1252
|
+
resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1252
1253
|
if (resource.duration != null)
|
|
1253
1254
|
resourceJson.duration = resource.duration;
|
|
1254
1255
|
if (resource.mute != null)
|
|
@@ -1261,11 +1262,11 @@ class JsonGenerator {
|
|
|
1261
1262
|
addAudioEmbedResource(resource) {
|
|
1262
1263
|
const resourceJson = {};
|
|
1263
1264
|
if (resource.format != null)
|
|
1264
|
-
resourceJson.format = resource.format;
|
|
1265
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1265
1266
|
if (resource.provider != null)
|
|
1266
|
-
resourceJson.provider = resource.provider;
|
|
1267
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1267
1268
|
if (resource.value != null)
|
|
1268
|
-
resourceJson.src = resource.value;
|
|
1269
|
+
resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1269
1270
|
if (resource.duration != null)
|
|
1270
1271
|
resourceJson.duration = resource.duration;
|
|
1271
1272
|
if (resource.mute != null)
|
|
@@ -1278,11 +1279,11 @@ class JsonGenerator {
|
|
|
1278
1279
|
addAudioLinkResource(resource) {
|
|
1279
1280
|
const resourceJson = {};
|
|
1280
1281
|
if (resource.format != null)
|
|
1281
|
-
resourceJson.format = resource.format;
|
|
1282
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1282
1283
|
if (resource.provider != null)
|
|
1283
|
-
resourceJson.provider = resource.provider;
|
|
1284
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1284
1285
|
if (resource.value != null)
|
|
1285
|
-
resourceJson.url = resource.value;
|
|
1286
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1286
1287
|
if (resource.duration != null)
|
|
1287
1288
|
resourceJson.duration = resource.duration;
|
|
1288
1289
|
if (resource.mute != null)
|
|
@@ -1296,11 +1297,11 @@ class JsonGenerator {
|
|
|
1296
1297
|
var _a, _b;
|
|
1297
1298
|
const resourceJson = {};
|
|
1298
1299
|
if (resource.format != null)
|
|
1299
|
-
resourceJson.format = resource.format;
|
|
1300
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1300
1301
|
if (resource.provider != null)
|
|
1301
|
-
resourceJson.provider = resource.provider;
|
|
1302
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1302
1303
|
if (resource.value != null)
|
|
1303
|
-
resourceJson.src = resource.value;
|
|
1304
|
+
resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1304
1305
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1305
1306
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1306
1307
|
if (resource.duration != null)
|
|
@@ -1314,7 +1315,7 @@ class JsonGenerator {
|
|
|
1314
1315
|
if (resource.showSubtitles != null)
|
|
1315
1316
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1316
1317
|
if (resource.alt != null)
|
|
1317
|
-
resourceJson.alt = resource.alt;
|
|
1318
|
+
resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
|
|
1318
1319
|
if (resource.posterImage != null)
|
|
1319
1320
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1320
1321
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1330,11 +1331,11 @@ class JsonGenerator {
|
|
|
1330
1331
|
var _a, _b;
|
|
1331
1332
|
const resourceJson = {};
|
|
1332
1333
|
if (resource.format != null)
|
|
1333
|
-
resourceJson.format = resource.format;
|
|
1334
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1334
1335
|
if (resource.provider != null)
|
|
1335
|
-
resourceJson.provider = resource.provider;
|
|
1336
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1336
1337
|
if (resource.value != null)
|
|
1337
|
-
resourceJson.src = resource.value;
|
|
1338
|
+
resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1338
1339
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1339
1340
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1340
1341
|
if (resource.duration != null)
|
|
@@ -1348,7 +1349,7 @@ class JsonGenerator {
|
|
|
1348
1349
|
if (resource.showSubtitles != null)
|
|
1349
1350
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1350
1351
|
if (resource.alt != null)
|
|
1351
|
-
resourceJson.alt = resource.alt;
|
|
1352
|
+
resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
|
|
1352
1353
|
if (resource.posterImage != null)
|
|
1353
1354
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1354
1355
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1364,11 +1365,11 @@ class JsonGenerator {
|
|
|
1364
1365
|
var _a, _b;
|
|
1365
1366
|
const resourceJson = {};
|
|
1366
1367
|
if (resource.format != null)
|
|
1367
|
-
resourceJson.format = resource.format;
|
|
1368
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1368
1369
|
if (resource.provider != null)
|
|
1369
|
-
resourceJson.provider = resource.provider;
|
|
1370
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1370
1371
|
if (resource.value != null)
|
|
1371
|
-
resourceJson.url = resource.value;
|
|
1372
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1372
1373
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1373
1374
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1374
1375
|
if (resource.duration != null)
|
|
@@ -1382,7 +1383,7 @@ class JsonGenerator {
|
|
|
1382
1383
|
if (resource.showSubtitles != null)
|
|
1383
1384
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1384
1385
|
if (resource.alt != null)
|
|
1385
|
-
resourceJson.alt = resource.alt;
|
|
1386
|
+
resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
|
|
1386
1387
|
if (resource.posterImage != null)
|
|
1387
1388
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1388
1389
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1398,11 +1399,11 @@ class JsonGenerator {
|
|
|
1398
1399
|
var _a, _b;
|
|
1399
1400
|
const resourceJson = {};
|
|
1400
1401
|
if (resource.format != null)
|
|
1401
|
-
resourceJson.format = resource.format;
|
|
1402
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1402
1403
|
if (resource.provider != null)
|
|
1403
|
-
resourceJson.provider = resource.provider;
|
|
1404
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1404
1405
|
if (resource.value != null)
|
|
1405
|
-
resourceJson.url = resource.value;
|
|
1406
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1406
1407
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1407
1408
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1408
1409
|
if (resource.duration != null)
|
|
@@ -1416,7 +1417,7 @@ class JsonGenerator {
|
|
|
1416
1417
|
if (resource.showSubtitles != null)
|
|
1417
1418
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1418
1419
|
if (resource.alt != null)
|
|
1419
|
-
resourceJson.alt = resource.alt;
|
|
1420
|
+
resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
|
|
1420
1421
|
if (resource.posterImage != null)
|
|
1421
1422
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1422
1423
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1432,11 +1433,11 @@ class JsonGenerator {
|
|
|
1432
1433
|
var _a, _b;
|
|
1433
1434
|
const resourceJson = {};
|
|
1434
1435
|
if (resource.format != null)
|
|
1435
|
-
resourceJson.format = resource.format;
|
|
1436
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1436
1437
|
if (resource.provider != null)
|
|
1437
|
-
resourceJson.provider = resource.provider;
|
|
1438
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1438
1439
|
if (resource.value != null)
|
|
1439
|
-
resourceJson.url = resource.value;
|
|
1440
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1440
1441
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1441
1442
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1442
1443
|
if (resource.duration != null)
|
|
@@ -1450,7 +1451,7 @@ class JsonGenerator {
|
|
|
1450
1451
|
if (resource.showSubtitles != null)
|
|
1451
1452
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1452
1453
|
if (resource.alt != null)
|
|
1453
|
-
resourceJson.alt = resource.alt;
|
|
1454
|
+
resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
|
|
1454
1455
|
if (resource.posterImage != null)
|
|
1455
1456
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1456
1457
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1465,78 +1466,78 @@ class JsonGenerator {
|
|
|
1465
1466
|
addArticleResource(resource) {
|
|
1466
1467
|
const resourceJson = {};
|
|
1467
1468
|
if (resource.format != null)
|
|
1468
|
-
resourceJson.format = resource.format;
|
|
1469
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1469
1470
|
if (resource.provider != null)
|
|
1470
|
-
resourceJson.provider = resource.provider;
|
|
1471
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1471
1472
|
if (resource.value != null)
|
|
1472
|
-
resourceJson.body = resource.value;
|
|
1473
|
-
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1473
|
+
resourceJson.body = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1474
|
+
// if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
|
|
1474
1475
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1475
1476
|
return resourceJson;
|
|
1476
1477
|
}
|
|
1477
1478
|
addDocumentResource(resource) {
|
|
1478
1479
|
const resourceJson = {};
|
|
1479
1480
|
if (resource.format != null)
|
|
1480
|
-
resourceJson.format = resource.format;
|
|
1481
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1481
1482
|
if (resource.provider != null)
|
|
1482
|
-
resourceJson.provider = resource.provider;
|
|
1483
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1483
1484
|
if (resource.value != null)
|
|
1484
|
-
resourceJson.url = resource.value;
|
|
1485
|
-
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1485
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1486
|
+
// if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
|
|
1486
1487
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1487
1488
|
return resourceJson;
|
|
1488
1489
|
}
|
|
1489
1490
|
addDocumentEmbedResource(resource) {
|
|
1490
1491
|
const resourceJson = {};
|
|
1491
1492
|
if (resource.format != null)
|
|
1492
|
-
resourceJson.format = resource.format;
|
|
1493
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1493
1494
|
if (resource.provider != null)
|
|
1494
|
-
resourceJson.provider = resource.provider;
|
|
1495
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1495
1496
|
if (resource.value != null)
|
|
1496
|
-
resourceJson.url = resource.value;
|
|
1497
|
-
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1497
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1498
|
+
// if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
|
|
1498
1499
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1499
1500
|
return resourceJson;
|
|
1500
1501
|
}
|
|
1501
1502
|
addDocumentLinkResource(resource) {
|
|
1502
1503
|
const resourceJson = {};
|
|
1503
1504
|
if (resource.format != null)
|
|
1504
|
-
resourceJson.format = resource.format;
|
|
1505
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1505
1506
|
if (resource.provider != null)
|
|
1506
|
-
resourceJson.provider = resource.provider;
|
|
1507
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1507
1508
|
if (resource.value != null)
|
|
1508
|
-
resourceJson.url = resource.value;
|
|
1509
|
-
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1509
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1510
|
+
// if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
|
|
1510
1511
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1511
1512
|
return resourceJson;
|
|
1512
1513
|
}
|
|
1513
1514
|
addDocumentDownloadResource(resource) {
|
|
1514
1515
|
const resourceJson = {};
|
|
1515
1516
|
if (resource.format != null)
|
|
1516
|
-
resourceJson.format = resource.format;
|
|
1517
|
+
resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
|
|
1517
1518
|
if (resource.provider != null)
|
|
1518
|
-
resourceJson.provider = resource.provider;
|
|
1519
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1519
1520
|
if (resource.value != null)
|
|
1520
|
-
resourceJson.url = resource.value;
|
|
1521
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1521
1522
|
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1522
1523
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1523
1524
|
return resourceJson;
|
|
1524
1525
|
}
|
|
1525
1526
|
addAppLinkResource(resource) {
|
|
1526
1527
|
const resourceJson = {};
|
|
1527
|
-
// if (resource.format != null) resourceJson.format = resource.format;
|
|
1528
|
+
// if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
|
|
1528
1529
|
if (resource.value != null)
|
|
1529
|
-
resourceJson.url = resource.value;
|
|
1530
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1530
1531
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1531
1532
|
return resourceJson;
|
|
1532
1533
|
}
|
|
1533
1534
|
addWebsiteLinkResource(resource) {
|
|
1534
1535
|
const resourceJson = {};
|
|
1535
|
-
// if (resource.format != null) resourceJson.format = resource.format;
|
|
1536
|
+
// if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
|
|
1536
1537
|
if (resource.value != null)
|
|
1537
|
-
resourceJson.url = resource.value;
|
|
1538
|
+
resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
|
|
1538
1539
|
if (resource.siteName != null)
|
|
1539
|
-
resourceJson.siteName = resource.siteName;
|
|
1540
|
+
resourceJson.siteName = Breakscape_1.Breakscape.unbreakscape(resource.siteName);
|
|
1540
1541
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1541
1542
|
return resourceJson;
|
|
1542
1543
|
}
|
|
@@ -1544,33 +1545,33 @@ class JsonGenerator {
|
|
|
1544
1545
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1545
1546
|
if (noDefaults) {
|
|
1546
1547
|
if (resource.license != null)
|
|
1547
|
-
resourceJson.license = (_a = resource.license) !== null && _a !== void 0 ? _a : '';
|
|
1548
|
+
resourceJson.license = (_a = Breakscape_1.Breakscape.unbreakscape(resource.license)) !== null && _a !== void 0 ? _a : '';
|
|
1548
1549
|
if (resource.copyright != null)
|
|
1549
|
-
resourceJson.copyright = (_b = resource.copyright) !== null && _b !== void 0 ? _b : '';
|
|
1550
|
+
resourceJson.copyright = (_b = Breakscape_1.Breakscape.unbreakscape(resource.copyright)) !== null && _b !== void 0 ? _b : '';
|
|
1550
1551
|
if (resource.provider != null)
|
|
1551
|
-
resourceJson.provider = resource.provider;
|
|
1552
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1552
1553
|
if (resource.showInIndex != null)
|
|
1553
1554
|
resourceJson.showInIndex = (_c = resource.showInIndex) !== null && _c !== void 0 ? _c : false;
|
|
1554
1555
|
if (resource.caption != null)
|
|
1555
|
-
resourceJson.caption = this.toTextAstOrString((_d = resource.caption) !== null && _d !== void 0 ? _d : '');
|
|
1556
|
+
resourceJson.caption = this.toTextAstOrString((_d = resource.caption) !== null && _d !== void 0 ? _d : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1556
1557
|
}
|
|
1557
1558
|
else {
|
|
1558
|
-
resourceJson.license = (_e = resource.license) !== null && _e !== void 0 ? _e : '';
|
|
1559
|
-
resourceJson.copyright = (_f = resource.copyright) !== null && _f !== void 0 ? _f : '';
|
|
1559
|
+
resourceJson.license = (_e = Breakscape_1.Breakscape.unbreakscape(resource.license)) !== null && _e !== void 0 ? _e : '';
|
|
1560
|
+
resourceJson.copyright = (_f = Breakscape_1.Breakscape.unbreakscape(resource.copyright)) !== null && _f !== void 0 ? _f : '';
|
|
1560
1561
|
if (resource.provider != null)
|
|
1561
|
-
resourceJson.provider = resource.provider;
|
|
1562
|
+
resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
|
|
1562
1563
|
resourceJson.showInIndex = (_g = resource.showInIndex) !== null && _g !== void 0 ? _g : false;
|
|
1563
|
-
resourceJson.caption = this.toTextAstOrString((_h = resource.caption) !== null && _h !== void 0 ? _h :
|
|
1564
|
+
resourceJson.caption = this.toTextAstOrString((_h = resource.caption) !== null && _h !== void 0 ? _h : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1564
1565
|
}
|
|
1565
1566
|
return resourceJson;
|
|
1566
1567
|
}
|
|
1567
1568
|
toItemLeadHintInstruction(item) {
|
|
1568
1569
|
var _a, _b, _c, _d, _e, _f;
|
|
1569
1570
|
return {
|
|
1570
|
-
item: this.toTextAstOrString((_b = (_a = item.itemLead) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b :
|
|
1571
|
-
lead: this.toTextAstOrString((_d = (_c = item.itemLead) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d :
|
|
1572
|
-
hint: this.toTextAstOrString((_e = item.hint) !== null && _e !== void 0 ? _e :
|
|
1573
|
-
instruction: this.toTextAstOrString((_f = item.instruction) !== null && _f !== void 0 ? _f :
|
|
1571
|
+
item: this.toTextAstOrString((_b = (_a = item.itemLead) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus),
|
|
1572
|
+
lead: this.toTextAstOrString((_d = (_c = item.itemLead) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus),
|
|
1573
|
+
hint: this.toTextAstOrString((_e = item.hint) !== null && _e !== void 0 ? _e : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus),
|
|
1574
|
+
instruction: this.toTextAstOrString((_f = item.instruction) !== null && _f !== void 0 ? _f : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus),
|
|
1574
1575
|
};
|
|
1575
1576
|
}
|
|
1576
1577
|
toExample(node, options) {
|
|
@@ -1586,10 +1587,12 @@ class JsonGenerator {
|
|
|
1586
1587
|
if (isDefaultExample) {
|
|
1587
1588
|
exampleValue = isBoolean
|
|
1588
1589
|
? BooleanUtils_1.BooleanUtils.toBoolean(defaultExample)
|
|
1589
|
-
: this.toTextAstOrString(defaultExample);
|
|
1590
|
+
: this.toTextAstOrString(defaultExample, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1590
1591
|
}
|
|
1591
1592
|
else {
|
|
1592
|
-
exampleValue = isBoolean
|
|
1593
|
+
exampleValue = isBoolean
|
|
1594
|
+
? BooleanUtils_1.BooleanUtils.toBoolean(example)
|
|
1595
|
+
: this.toTextAstOrString(example, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1593
1596
|
}
|
|
1594
1597
|
return {
|
|
1595
1598
|
isExample: true,
|
|
@@ -1600,16 +1603,22 @@ class JsonGenerator {
|
|
|
1600
1603
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1601
1604
|
target, name, values, singleWithoutArray) {
|
|
1602
1605
|
if (values !== undefined) {
|
|
1606
|
+
let finalValue;
|
|
1603
1607
|
if (!Array.isArray(values))
|
|
1604
1608
|
values = [values];
|
|
1605
1609
|
if (Array.isArray(values) && values.length > 0) {
|
|
1606
|
-
|
|
1607
|
-
|
|
1610
|
+
// Unbreakscape values that are strings
|
|
1611
|
+
values = Breakscape_1.Breakscape.unbreakscape(values);
|
|
1612
|
+
if (Array.isArray(values) && singleWithoutArray && values.length >= 1) {
|
|
1613
|
+
finalValue = values[values.length - 1];
|
|
1608
1614
|
}
|
|
1609
1615
|
else {
|
|
1610
|
-
|
|
1616
|
+
finalValue = values;
|
|
1611
1617
|
}
|
|
1612
1618
|
}
|
|
1619
|
+
// if (finalValue != null) {
|
|
1620
|
+
target[name] = finalValue;
|
|
1621
|
+
// }
|
|
1613
1622
|
}
|
|
1614
1623
|
}
|
|
1615
1624
|
/**
|
|
@@ -1634,13 +1643,14 @@ class JsonGenerator {
|
|
|
1634
1643
|
* @returns the text format
|
|
1635
1644
|
*/
|
|
1636
1645
|
getTextFormat(route) {
|
|
1646
|
+
var _a;
|
|
1637
1647
|
for (const node of route) {
|
|
1638
1648
|
if (node.key === NodeType_1.NodeType.bitsValue) {
|
|
1639
1649
|
const n = node.value;
|
|
1640
|
-
return TextFormat_1.TextFormat.fromValue(n === null || n === void 0 ? void 0 : n.textFormat);
|
|
1650
|
+
return (_a = TextFormat_1.TextFormat.fromValue(n === null || n === void 0 ? void 0 : n.textFormat)) !== null && _a !== void 0 ? _a : TextFormat_1.TextFormat.bitmarkMinusMinus;
|
|
1641
1651
|
}
|
|
1642
1652
|
}
|
|
1643
|
-
return
|
|
1653
|
+
return TextFormat_1.TextFormat.bitmarkMinusMinus;
|
|
1644
1654
|
}
|
|
1645
1655
|
/**
|
|
1646
1656
|
* Get the bit resourceType atttachment from any node
|
|
@@ -1658,15 +1668,15 @@ class JsonGenerator {
|
|
|
1658
1668
|
return undefined;
|
|
1659
1669
|
}
|
|
1660
1670
|
/**
|
|
1661
|
-
* Convert parse a string to TextAst if required, otherwise just return the string
|
|
1671
|
+
* Convert parse a string to TextAst if required, otherwise just return the string but unbreakscaped.
|
|
1662
1672
|
* @param text
|
|
1663
1673
|
* @returns
|
|
1664
1674
|
*/
|
|
1665
|
-
toTextAstOrString(text, format
|
|
1675
|
+
toTextAstOrString(text, format) {
|
|
1666
1676
|
if (!text)
|
|
1667
1677
|
undefined;
|
|
1668
|
-
if (this.options.textAsPlainText) {
|
|
1669
|
-
return text;
|
|
1678
|
+
if (this.options.textAsPlainText || format === TextFormat_1.TextFormat.text) {
|
|
1679
|
+
return Breakscape_1.Breakscape.unbreakscape(text);
|
|
1670
1680
|
}
|
|
1671
1681
|
// Use the text parser to parse the text
|
|
1672
1682
|
const textAst = this.textParser.toAst(text, {
|