@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
|
@@ -19,6 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
21
|
import { Ast } from '../../ast/Ast';
|
|
22
|
+
import { Breakscape } from '../../breakscaping/Breakscape';
|
|
22
23
|
import { Config } from '../../config/Config';
|
|
23
24
|
import { NodeType } from '../../model/ast/NodeType';
|
|
24
25
|
import { AliasBitType, RootBitType } from '../../model/enum/BitType';
|
|
@@ -303,10 +304,10 @@ class JsonGenerator {
|
|
|
303
304
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
304
305
|
return;
|
|
305
306
|
if (item != null) {
|
|
306
|
-
this.bitJson.item = this.toTextAstOrString(item);
|
|
307
|
+
this.bitJson.item = this.toTextAstOrString(item, TextFormat.bitmarkMinusMinus);
|
|
307
308
|
}
|
|
308
309
|
if (lead != null) {
|
|
309
|
-
this.bitJson.lead = this.toTextAstOrString(lead);
|
|
310
|
+
this.bitJson.lead = this.toTextAstOrString(lead, TextFormat.bitmarkMinusMinus);
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
313
|
// bitmarkAst -> bits -> bitsValue -> extraProperties
|
|
@@ -359,12 +360,12 @@ class JsonGenerator {
|
|
|
359
360
|
const asText = bodyPart;
|
|
360
361
|
const bodyTextPart = asText.data.bodyText;
|
|
361
362
|
// Append the text part to the full text body
|
|
362
|
-
fullBodyTextStr
|
|
363
|
+
fullBodyTextStr = Breakscape.concatenate(fullBodyTextStr, bodyTextPart);
|
|
363
364
|
}
|
|
364
365
|
else {
|
|
365
366
|
const { legacyPlaceholderKey, placeholderKey } = createPlaceholderKeys(placeholderIndex);
|
|
366
367
|
// Append the placeholder to the full text body
|
|
367
|
-
fullBodyTextStr
|
|
368
|
+
fullBodyTextStr = Breakscape.concatenate(fullBodyTextStr, plainText ? legacyPlaceholderKey : placeholderKey);
|
|
368
369
|
placeholderIndex++;
|
|
369
370
|
}
|
|
370
371
|
}
|
|
@@ -431,7 +432,7 @@ class JsonGenerator {
|
|
|
431
432
|
// Ignore elements that are not at the bit level as they are handled elsewhere as quizzes
|
|
432
433
|
// if (parent?.key !== NodeType.bitsValue) return;
|
|
433
434
|
if (elements && elements.length > 0) {
|
|
434
|
-
this.bitJson.elements = elements;
|
|
435
|
+
this.bitJson.elements = Breakscape.unbreakscape(elements);
|
|
435
436
|
}
|
|
436
437
|
}
|
|
437
438
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue
|
|
@@ -445,7 +446,7 @@ class JsonGenerator {
|
|
|
445
446
|
if (flashcards) {
|
|
446
447
|
for (const c of flashcards) {
|
|
447
448
|
// Create the flashcard
|
|
448
|
-
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, {
|
|
449
|
+
const flashcardJson = Object.assign(Object.assign({ question: (_a = Breakscape.unbreakscape(c.question)) !== null && _a !== void 0 ? _a : '', answer: (_b = Breakscape.unbreakscape(c.answer)) !== null && _b !== void 0 ? _b : '', alternativeAnswers: (_c = Breakscape.unbreakscape(c.alternativeAnswers)) !== null && _c !== void 0 ? _c : [] }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
|
|
449
450
|
defaultExample: c.isDefaultExample,
|
|
450
451
|
isBoolean: true,
|
|
451
452
|
}));
|
|
@@ -467,7 +468,7 @@ class JsonGenerator {
|
|
|
467
468
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.cardNode)
|
|
468
469
|
return;
|
|
469
470
|
if (statement) {
|
|
470
|
-
this.bitJson.statement = (_a = statement.text) !== null && _a !== void 0 ? _a : '';
|
|
471
|
+
this.bitJson.statement = (_a = Breakscape.unbreakscape(statement.text)) !== null && _a !== void 0 ? _a : '';
|
|
471
472
|
this.bitJson.isCorrect = (_b = statement.isCorrect) !== null && _b !== void 0 ? _b : false;
|
|
472
473
|
}
|
|
473
474
|
}
|
|
@@ -482,7 +483,7 @@ class JsonGenerator {
|
|
|
482
483
|
if (statements) {
|
|
483
484
|
for (const s of statements) {
|
|
484
485
|
// Create the statement
|
|
485
|
-
const statementJson = Object.assign(Object.assign({ statement: (_a = s.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!s.isCorrect }, this.toItemLeadHintInstruction(s)), this.toExample(s, {
|
|
486
|
+
const statementJson = Object.assign(Object.assign({ statement: (_a = Breakscape.unbreakscape(s.text)) !== null && _a !== void 0 ? _a : '', isCorrect: !!s.isCorrect }, this.toItemLeadHintInstruction(s)), this.toExample(s, {
|
|
486
487
|
defaultExample: !!s.isCorrect,
|
|
487
488
|
isBoolean: true,
|
|
488
489
|
}));
|
|
@@ -514,7 +515,7 @@ class JsonGenerator {
|
|
|
514
515
|
if (choices) {
|
|
515
516
|
for (const c of choices) {
|
|
516
517
|
// Create the choice
|
|
517
|
-
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, {
|
|
518
|
+
const choiceJson = Object.assign(Object.assign({ choice: (_a = 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, {
|
|
518
519
|
defaultExample: !!c.isCorrect,
|
|
519
520
|
isBoolean: true,
|
|
520
521
|
}));
|
|
@@ -540,7 +541,7 @@ class JsonGenerator {
|
|
|
540
541
|
if (responses) {
|
|
541
542
|
for (const r of responses) {
|
|
542
543
|
// Create the response
|
|
543
|
-
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, {
|
|
544
|
+
const responseJson = Object.assign(Object.assign({ response: (_a = 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, {
|
|
544
545
|
defaultExample: !!r.isCorrect,
|
|
545
546
|
isBoolean: true,
|
|
546
547
|
}));
|
|
@@ -566,7 +567,7 @@ class JsonGenerator {
|
|
|
566
567
|
if (q.choices) {
|
|
567
568
|
for (const c of q.choices) {
|
|
568
569
|
// Create the choice
|
|
569
|
-
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, {
|
|
570
|
+
const choiceJson = Object.assign(Object.assign({ choice: (_a = 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, {
|
|
570
571
|
defaultExample: !!c.isCorrect,
|
|
571
572
|
isBoolean: true,
|
|
572
573
|
}));
|
|
@@ -581,7 +582,7 @@ class JsonGenerator {
|
|
|
581
582
|
if (q.responses) {
|
|
582
583
|
for (const r of q.responses) {
|
|
583
584
|
// Create the choice
|
|
584
|
-
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, {
|
|
585
|
+
const responseJson = Object.assign(Object.assign({ response: (_d = 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, {
|
|
585
586
|
defaultExample: !!r.isCorrect,
|
|
586
587
|
isBoolean: true,
|
|
587
588
|
}));
|
|
@@ -616,22 +617,22 @@ class JsonGenerator {
|
|
|
616
617
|
return false;
|
|
617
618
|
// Create the heading
|
|
618
619
|
const headingJson = {
|
|
619
|
-
forKeys: (_a = heading.forKeys) !== null && _a !== void 0 ? _a : '',
|
|
620
|
+
forKeys: (_a = Breakscape.unbreakscape(heading.forKeys)) !== null && _a !== void 0 ? _a : '',
|
|
620
621
|
};
|
|
621
622
|
// TODO: Should probably check wether bit is a match or a matrix and add a string for match and array for matrix
|
|
622
623
|
if (Array.isArray(heading.forValues)) {
|
|
623
624
|
if (heading.forValues.length > 1) {
|
|
624
|
-
headingJson.forValues = heading.forValues;
|
|
625
|
+
headingJson.forValues = Breakscape.unbreakscape(heading.forValues);
|
|
625
626
|
}
|
|
626
627
|
else if (heading.forValues.length === 1) {
|
|
627
|
-
headingJson.forValues = heading.forValues[0];
|
|
628
|
+
headingJson.forValues = Breakscape.unbreakscape(heading.forValues[0]);
|
|
628
629
|
}
|
|
629
630
|
else {
|
|
630
|
-
headingJson.forValues = heading.forValues;
|
|
631
|
+
headingJson.forValues = Breakscape.unbreakscape(heading.forValues);
|
|
631
632
|
}
|
|
632
633
|
}
|
|
633
634
|
else {
|
|
634
|
-
headingJson.forValues = (_b = heading.forValues) !== null && _b !== void 0 ? _b : '';
|
|
635
|
+
headingJson.forValues = (_b = Breakscape.unbreakscape(heading.forValues)) !== null && _b !== void 0 ? _b : '';
|
|
635
636
|
}
|
|
636
637
|
this.bitJson.heading = headingJson;
|
|
637
638
|
}
|
|
@@ -645,7 +646,7 @@ class JsonGenerator {
|
|
|
645
646
|
// Get default example
|
|
646
647
|
const defaultExample = Array.isArray(p.values) && p.values.length > 0 && p.values[0];
|
|
647
648
|
// Create the question
|
|
648
|
-
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, {
|
|
649
|
+
const pairJson = Object.assign(Object.assign(Object.assign({ key: (_a = 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.unbreakscape(p.values)) !== null && _b !== void 0 ? _b : [] }, this.toItemLeadHintInstruction(p)), { isCaseSensitive: (_c = p.isCaseSensitive) !== null && _c !== void 0 ? _c : true }), this.toExample(p, {
|
|
649
650
|
defaultExample,
|
|
650
651
|
isBoolean: false,
|
|
651
652
|
}));
|
|
@@ -685,7 +686,7 @@ class JsonGenerator {
|
|
|
685
686
|
// Get default example
|
|
686
687
|
const defaultExample = Array.isArray(c.values) && c.values.length > 0 && c.values[0];
|
|
687
688
|
// Create the choice
|
|
688
|
-
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, {
|
|
689
|
+
const matrixCellJson = Object.assign(Object.assign(Object.assign({ values: (_a = 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, {
|
|
689
690
|
defaultExample,
|
|
690
691
|
isBoolean: false,
|
|
691
692
|
}));
|
|
@@ -698,7 +699,7 @@ class JsonGenerator {
|
|
|
698
699
|
}
|
|
699
700
|
}
|
|
700
701
|
// Create the matrix
|
|
701
|
-
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)), {
|
|
702
|
+
const matrixJson = Object.assign(Object.assign({ key: (_d = Breakscape.unbreakscape(m.key)) !== null && _d !== void 0 ? _d : '', cells: matrixCellsJson !== null && matrixCellsJson !== void 0 ? matrixCellsJson : [] }, this.toItemLeadHintInstruction(m)), {
|
|
702
703
|
// ...this.toExample(m.example, m.isExample),
|
|
703
704
|
isExample: (_e = m.isExample) !== null && _e !== void 0 ? _e : false });
|
|
704
705
|
// Delete unwanted properties
|
|
@@ -721,7 +722,7 @@ class JsonGenerator {
|
|
|
721
722
|
if (questions) {
|
|
722
723
|
for (const q of questions) {
|
|
723
724
|
// Create the question
|
|
724
|
-
const questionJson = Object.assign(Object.assign(Object.assign({ question: (_a = q.question) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = 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, {
|
|
725
|
+
const questionJson = Object.assign(Object.assign(Object.assign({ question: (_a = Breakscape.unbreakscape(q.question)) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = Breakscape.unbreakscape(ArrayUtils.asSingle(q.partialAnswer))) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = Breakscape.unbreakscape(q.sampleSolution)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(q)), { reasonableNumOfChars: q.reasonableNumOfChars }), this.toExample(q, {
|
|
725
726
|
defaultExample: q.sampleSolution || '',
|
|
726
727
|
isBoolean: false,
|
|
727
728
|
}));
|
|
@@ -746,7 +747,7 @@ class JsonGenerator {
|
|
|
746
747
|
if (botResponses) {
|
|
747
748
|
for (const r of botResponses) {
|
|
748
749
|
// Create the response
|
|
749
|
-
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));
|
|
750
|
+
const responseJson = Object.assign({ response: (_a = Breakscape.unbreakscape(r.response)) !== null && _a !== void 0 ? _a : '', reaction: (_b = Breakscape.unbreakscape(r.reaction)) !== null && _b !== void 0 ? _b : '', feedback: (_c = Breakscape.unbreakscape(r.feedback)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(r));
|
|
750
751
|
// Delete unwanted properties
|
|
751
752
|
if (((_d = r.itemLead) === null || _d === void 0 ? void 0 : _d.lead) == null)
|
|
752
753
|
delete responseJson.lead;
|
|
@@ -818,11 +819,11 @@ class JsonGenerator {
|
|
|
818
819
|
//
|
|
819
820
|
// bitmarkAst -> bits -> bitsValue -> title
|
|
820
821
|
leaf_title(node, _parent, _route) {
|
|
821
|
-
this.bitJson.title = this.toTextAstOrString(node.value);
|
|
822
|
+
this.bitJson.title = this.toTextAstOrString(node.value, TextFormat.bitmarkMinusMinus);
|
|
822
823
|
}
|
|
823
824
|
// bitmarkAst -> bits -> bitsValue -> subtitle
|
|
824
825
|
leaf_subtitle(node, _parent, _route) {
|
|
825
|
-
this.bitJson.subtitle = this.toTextAstOrString(node.value);
|
|
826
|
+
this.bitJson.subtitle = this.toTextAstOrString(node.value, TextFormat.bitmarkMinusMinus);
|
|
826
827
|
}
|
|
827
828
|
// // bitmarkAst -> bits -> bitsValue -> level
|
|
828
829
|
leaf_level(node, _parent, _route) {
|
|
@@ -856,7 +857,7 @@ class JsonGenerator {
|
|
|
856
857
|
// Ignore hint that is not at the bit level as it are handled elsewhere
|
|
857
858
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
858
859
|
return;
|
|
859
|
-
this.bitJson.hint = this.toTextAstOrString(hint);
|
|
860
|
+
this.bitJson.hint = this.toTextAstOrString(hint, TextFormat.bitmarkMinusMinus);
|
|
860
861
|
}
|
|
861
862
|
// bitmarkAst -> bits -> bitsValue -> * -> instruction
|
|
862
863
|
leaf_instruction(node, parent, _route) {
|
|
@@ -864,12 +865,12 @@ class JsonGenerator {
|
|
|
864
865
|
// Ignore instruction that is not at the bit level as it are handled elsewhere
|
|
865
866
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
866
867
|
return;
|
|
867
|
-
this.bitJson.instruction = this.toTextAstOrString(instruction);
|
|
868
|
+
this.bitJson.instruction = this.toTextAstOrString(instruction, TextFormat.bitmarkMinusMinus);
|
|
868
869
|
}
|
|
869
870
|
// bitmarkAst -> bits -> footer -> footerText
|
|
870
871
|
leaf_footerText(node, _parent, _route) {
|
|
871
872
|
const footer = node.value;
|
|
872
|
-
this.bitJson.footer = this.toTextAstOrString(footer);
|
|
873
|
+
this.bitJson.footer = this.toTextAstOrString(footer, TextFormat.bitmarkMinusMinus);
|
|
873
874
|
}
|
|
874
875
|
// bitmarkAst -> bits -> bitsValue -> markup
|
|
875
876
|
leaf_markup(node, _parent, _route) {
|
|
@@ -978,7 +979,7 @@ class JsonGenerator {
|
|
|
978
979
|
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, {
|
|
979
980
|
defaultExample,
|
|
980
981
|
isBoolean: false,
|
|
981
|
-
})), { solutions: data.solutions });
|
|
982
|
+
})), { solutions: Breakscape.unbreakscape(data.solutions) });
|
|
982
983
|
// Remove unwanted properties
|
|
983
984
|
if (!gapJson.lead)
|
|
984
985
|
delete gapJson.lead;
|
|
@@ -987,7 +988,7 @@ class JsonGenerator {
|
|
|
987
988
|
createMarkJson(mark) {
|
|
988
989
|
const data = mark.data;
|
|
989
990
|
// Create the mark
|
|
990
|
-
const markJson = Object.assign(Object.assign({ type: 'mark', solution: data.solution, mark: data.mark }, this.toItemLeadHintInstruction(data)), this.toExample(data, {
|
|
991
|
+
const markJson = Object.assign(Object.assign({ type: 'mark', solution: Breakscape.unbreakscape(data.solution), mark: Breakscape.unbreakscape(data.mark) }, this.toItemLeadHintInstruction(data)), this.toExample(data, {
|
|
991
992
|
defaultExample: true,
|
|
992
993
|
isBoolean: true,
|
|
993
994
|
}));
|
|
@@ -1002,7 +1003,7 @@ class JsonGenerator {
|
|
|
1002
1003
|
// Create the select options
|
|
1003
1004
|
const options = [];
|
|
1004
1005
|
for (const option of data.options) {
|
|
1005
|
-
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, {
|
|
1006
|
+
const optionJson = Object.assign(Object.assign({ text: Breakscape.unbreakscape(option.text), isCorrect: (_a = option.isCorrect) !== null && _a !== void 0 ? _a : false }, this.toItemLeadHintInstruction(option)), this.toExample(option, {
|
|
1006
1007
|
defaultExample: !!option.isCorrect,
|
|
1007
1008
|
isBoolean: true,
|
|
1008
1009
|
}));
|
|
@@ -1016,7 +1017,7 @@ class JsonGenerator {
|
|
|
1016
1017
|
options.push(optionJson);
|
|
1017
1018
|
}
|
|
1018
1019
|
// Create the select
|
|
1019
|
-
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 });
|
|
1020
|
+
const selectJson = Object.assign(Object.assign({ type: 'select', prefix: (_b = Breakscape.unbreakscape(data.prefix)) !== null && _b !== void 0 ? _b : '', postfix: (_c = Breakscape.unbreakscape(data.postfix)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_d = data.isExample) !== null && _d !== void 0 ? _d : false, options });
|
|
1020
1021
|
// Remove unwanted properties
|
|
1021
1022
|
if (!selectJson.lead)
|
|
1022
1023
|
delete selectJson.lead;
|
|
@@ -1028,7 +1029,7 @@ class JsonGenerator {
|
|
|
1028
1029
|
// Create the highlight options
|
|
1029
1030
|
const texts = [];
|
|
1030
1031
|
for (const text of data.texts) {
|
|
1031
|
-
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, {
|
|
1032
|
+
const textJson = Object.assign(Object.assign({ text: 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, {
|
|
1032
1033
|
defaultExample: !!text.isCorrect,
|
|
1033
1034
|
isBoolean: true,
|
|
1034
1035
|
}));
|
|
@@ -1042,7 +1043,7 @@ class JsonGenerator {
|
|
|
1042
1043
|
texts.push(textJson);
|
|
1043
1044
|
}
|
|
1044
1045
|
// Create the select
|
|
1045
|
-
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 });
|
|
1046
|
+
const highlightJson = Object.assign(Object.assign({ type: 'highlight', prefix: (_c = Breakscape.unbreakscape(data.prefix)) !== null && _c !== void 0 ? _c : '', postfix: (_d = Breakscape.unbreakscape(data.postfix)) !== null && _d !== void 0 ? _d : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_e = data.isExample) !== null && _e !== void 0 ? _e : false, texts });
|
|
1046
1047
|
// Remove unwanted properties
|
|
1047
1048
|
if (!highlightJson.lead)
|
|
1048
1049
|
delete highlightJson.lead;
|
|
@@ -1178,29 +1179,29 @@ class JsonGenerator {
|
|
|
1178
1179
|
resource = {
|
|
1179
1180
|
type: ResourceTag.image,
|
|
1180
1181
|
typeAlias: ResourceTag.image,
|
|
1181
|
-
value,
|
|
1182
|
+
value: value,
|
|
1182
1183
|
format: UrlUtils.fileExtensionFromUrl(value),
|
|
1183
1184
|
provider: UrlUtils.domainFromUrl(value),
|
|
1184
1185
|
};
|
|
1185
1186
|
}
|
|
1186
1187
|
resource = resource; // Keep TS compiler happy
|
|
1187
1188
|
if (resource.format != null)
|
|
1188
|
-
resourceJson.format = resource.format;
|
|
1189
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1189
1190
|
if (resource.provider != null)
|
|
1190
|
-
resourceJson.provider = resource.provider;
|
|
1191
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1191
1192
|
if (resource.value != null)
|
|
1192
|
-
resourceJson.src = resource.value;
|
|
1193
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1193
1194
|
if (resource.src1x != null)
|
|
1194
|
-
resourceJson.src1x = resource.src1x;
|
|
1195
|
+
resourceJson.src1x = Breakscape.unbreakscape(resource.src1x);
|
|
1195
1196
|
if (resource.src2x != null)
|
|
1196
|
-
resourceJson.src2x = resource.src2x;
|
|
1197
|
+
resourceJson.src2x = Breakscape.unbreakscape(resource.src2x);
|
|
1197
1198
|
if (resource.src3x != null)
|
|
1198
|
-
resourceJson.src3x = resource.src3x;
|
|
1199
|
+
resourceJson.src3x = Breakscape.unbreakscape(resource.src3x);
|
|
1199
1200
|
if (resource.src4x != null)
|
|
1200
|
-
resourceJson.src4x = resource.src4x;
|
|
1201
|
+
resourceJson.src4x = Breakscape.unbreakscape(resource.src4x);
|
|
1201
1202
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1202
1203
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1203
|
-
resourceJson.alt = (_c = resource.alt) !== null && _c !== void 0 ? _c : '';
|
|
1204
|
+
resourceJson.alt = (_c = Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
|
|
1204
1205
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1205
1206
|
return resourceJson;
|
|
1206
1207
|
}
|
|
@@ -1219,33 +1220,33 @@ class JsonGenerator {
|
|
|
1219
1220
|
}
|
|
1220
1221
|
resource = resource; // Keep TS compiler happy
|
|
1221
1222
|
if (resource.format != null)
|
|
1222
|
-
resourceJson.format = resource.format;
|
|
1223
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1223
1224
|
if (resource.provider != null)
|
|
1224
|
-
resourceJson.provider = resource.provider;
|
|
1225
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1225
1226
|
if (resource.value != null)
|
|
1226
|
-
resourceJson.url = resource.value;
|
|
1227
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1227
1228
|
if (resource.src1x != null)
|
|
1228
|
-
resourceJson.src1x = resource.src1x;
|
|
1229
|
+
resourceJson.src1x = Breakscape.unbreakscape(resource.src1x);
|
|
1229
1230
|
if (resource.src2x != null)
|
|
1230
|
-
resourceJson.src2x = resource.src2x;
|
|
1231
|
+
resourceJson.src2x = Breakscape.unbreakscape(resource.src2x);
|
|
1231
1232
|
if (resource.src3x != null)
|
|
1232
|
-
resourceJson.src3x = resource.src3x;
|
|
1233
|
+
resourceJson.src3x = Breakscape.unbreakscape(resource.src3x);
|
|
1233
1234
|
if (resource.src4x != null)
|
|
1234
|
-
resourceJson.src4x = resource.src4x;
|
|
1235
|
+
resourceJson.src4x = Breakscape.unbreakscape(resource.src4x);
|
|
1235
1236
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1236
1237
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1237
|
-
resourceJson.alt = (_c = resource.alt) !== null && _c !== void 0 ? _c : '';
|
|
1238
|
+
resourceJson.alt = (_c = Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
|
|
1238
1239
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1239
1240
|
return resourceJson;
|
|
1240
1241
|
}
|
|
1241
1242
|
addAudioResource(resource) {
|
|
1242
1243
|
const resourceJson = {};
|
|
1243
1244
|
if (resource.format != null)
|
|
1244
|
-
resourceJson.format = resource.format;
|
|
1245
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1245
1246
|
if (resource.provider != null)
|
|
1246
|
-
resourceJson.provider = resource.provider;
|
|
1247
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1247
1248
|
if (resource.value != null)
|
|
1248
|
-
resourceJson.src = resource.value;
|
|
1249
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1249
1250
|
if (resource.duration != null)
|
|
1250
1251
|
resourceJson.duration = resource.duration;
|
|
1251
1252
|
if (resource.mute != null)
|
|
@@ -1258,11 +1259,11 @@ class JsonGenerator {
|
|
|
1258
1259
|
addAudioEmbedResource(resource) {
|
|
1259
1260
|
const resourceJson = {};
|
|
1260
1261
|
if (resource.format != null)
|
|
1261
|
-
resourceJson.format = resource.format;
|
|
1262
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1262
1263
|
if (resource.provider != null)
|
|
1263
|
-
resourceJson.provider = resource.provider;
|
|
1264
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1264
1265
|
if (resource.value != null)
|
|
1265
|
-
resourceJson.src = resource.value;
|
|
1266
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1266
1267
|
if (resource.duration != null)
|
|
1267
1268
|
resourceJson.duration = resource.duration;
|
|
1268
1269
|
if (resource.mute != null)
|
|
@@ -1275,11 +1276,11 @@ class JsonGenerator {
|
|
|
1275
1276
|
addAudioLinkResource(resource) {
|
|
1276
1277
|
const resourceJson = {};
|
|
1277
1278
|
if (resource.format != null)
|
|
1278
|
-
resourceJson.format = resource.format;
|
|
1279
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1279
1280
|
if (resource.provider != null)
|
|
1280
|
-
resourceJson.provider = resource.provider;
|
|
1281
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1281
1282
|
if (resource.value != null)
|
|
1282
|
-
resourceJson.url = resource.value;
|
|
1283
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1283
1284
|
if (resource.duration != null)
|
|
1284
1285
|
resourceJson.duration = resource.duration;
|
|
1285
1286
|
if (resource.mute != null)
|
|
@@ -1293,11 +1294,11 @@ class JsonGenerator {
|
|
|
1293
1294
|
var _a, _b;
|
|
1294
1295
|
const resourceJson = {};
|
|
1295
1296
|
if (resource.format != null)
|
|
1296
|
-
resourceJson.format = resource.format;
|
|
1297
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1297
1298
|
if (resource.provider != null)
|
|
1298
|
-
resourceJson.provider = resource.provider;
|
|
1299
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1299
1300
|
if (resource.value != null)
|
|
1300
|
-
resourceJson.src = resource.value;
|
|
1301
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1301
1302
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1302
1303
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1303
1304
|
if (resource.duration != null)
|
|
@@ -1311,7 +1312,7 @@ class JsonGenerator {
|
|
|
1311
1312
|
if (resource.showSubtitles != null)
|
|
1312
1313
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1313
1314
|
if (resource.alt != null)
|
|
1314
|
-
resourceJson.alt = resource.alt;
|
|
1315
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1315
1316
|
if (resource.posterImage != null)
|
|
1316
1317
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1317
1318
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1327,11 +1328,11 @@ class JsonGenerator {
|
|
|
1327
1328
|
var _a, _b;
|
|
1328
1329
|
const resourceJson = {};
|
|
1329
1330
|
if (resource.format != null)
|
|
1330
|
-
resourceJson.format = resource.format;
|
|
1331
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1331
1332
|
if (resource.provider != null)
|
|
1332
|
-
resourceJson.provider = resource.provider;
|
|
1333
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1333
1334
|
if (resource.value != null)
|
|
1334
|
-
resourceJson.src = resource.value;
|
|
1335
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1335
1336
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1336
1337
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1337
1338
|
if (resource.duration != null)
|
|
@@ -1345,7 +1346,7 @@ class JsonGenerator {
|
|
|
1345
1346
|
if (resource.showSubtitles != null)
|
|
1346
1347
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1347
1348
|
if (resource.alt != null)
|
|
1348
|
-
resourceJson.alt = resource.alt;
|
|
1349
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1349
1350
|
if (resource.posterImage != null)
|
|
1350
1351
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1351
1352
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1361,11 +1362,11 @@ class JsonGenerator {
|
|
|
1361
1362
|
var _a, _b;
|
|
1362
1363
|
const resourceJson = {};
|
|
1363
1364
|
if (resource.format != null)
|
|
1364
|
-
resourceJson.format = resource.format;
|
|
1365
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1365
1366
|
if (resource.provider != null)
|
|
1366
|
-
resourceJson.provider = resource.provider;
|
|
1367
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1367
1368
|
if (resource.value != null)
|
|
1368
|
-
resourceJson.url = resource.value;
|
|
1369
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1369
1370
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1370
1371
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1371
1372
|
if (resource.duration != null)
|
|
@@ -1379,7 +1380,7 @@ class JsonGenerator {
|
|
|
1379
1380
|
if (resource.showSubtitles != null)
|
|
1380
1381
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1381
1382
|
if (resource.alt != null)
|
|
1382
|
-
resourceJson.alt = resource.alt;
|
|
1383
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1383
1384
|
if (resource.posterImage != null)
|
|
1384
1385
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1385
1386
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1395,11 +1396,11 @@ class JsonGenerator {
|
|
|
1395
1396
|
var _a, _b;
|
|
1396
1397
|
const resourceJson = {};
|
|
1397
1398
|
if (resource.format != null)
|
|
1398
|
-
resourceJson.format = resource.format;
|
|
1399
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1399
1400
|
if (resource.provider != null)
|
|
1400
|
-
resourceJson.provider = resource.provider;
|
|
1401
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1401
1402
|
if (resource.value != null)
|
|
1402
|
-
resourceJson.url = resource.value;
|
|
1403
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1403
1404
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1404
1405
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1405
1406
|
if (resource.duration != null)
|
|
@@ -1413,7 +1414,7 @@ class JsonGenerator {
|
|
|
1413
1414
|
if (resource.showSubtitles != null)
|
|
1414
1415
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1415
1416
|
if (resource.alt != null)
|
|
1416
|
-
resourceJson.alt = resource.alt;
|
|
1417
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1417
1418
|
if (resource.posterImage != null)
|
|
1418
1419
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1419
1420
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1429,11 +1430,11 @@ class JsonGenerator {
|
|
|
1429
1430
|
var _a, _b;
|
|
1430
1431
|
const resourceJson = {};
|
|
1431
1432
|
if (resource.format != null)
|
|
1432
|
-
resourceJson.format = resource.format;
|
|
1433
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1433
1434
|
if (resource.provider != null)
|
|
1434
|
-
resourceJson.provider = resource.provider;
|
|
1435
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1435
1436
|
if (resource.value != null)
|
|
1436
|
-
resourceJson.url = resource.value;
|
|
1437
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1437
1438
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1438
1439
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1439
1440
|
if (resource.duration != null)
|
|
@@ -1447,7 +1448,7 @@ class JsonGenerator {
|
|
|
1447
1448
|
if (resource.showSubtitles != null)
|
|
1448
1449
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1449
1450
|
if (resource.alt != null)
|
|
1450
|
-
resourceJson.alt = resource.alt;
|
|
1451
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1451
1452
|
if (resource.posterImage != null)
|
|
1452
1453
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1453
1454
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1462,78 +1463,78 @@ class JsonGenerator {
|
|
|
1462
1463
|
addArticleResource(resource) {
|
|
1463
1464
|
const resourceJson = {};
|
|
1464
1465
|
if (resource.format != null)
|
|
1465
|
-
resourceJson.format = resource.format;
|
|
1466
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1466
1467
|
if (resource.provider != null)
|
|
1467
|
-
resourceJson.provider = resource.provider;
|
|
1468
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1468
1469
|
if (resource.value != null)
|
|
1469
|
-
resourceJson.body = resource.value;
|
|
1470
|
-
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1470
|
+
resourceJson.body = Breakscape.unbreakscape(resource.value);
|
|
1471
|
+
// if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
|
|
1471
1472
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1472
1473
|
return resourceJson;
|
|
1473
1474
|
}
|
|
1474
1475
|
addDocumentResource(resource) {
|
|
1475
1476
|
const resourceJson = {};
|
|
1476
1477
|
if (resource.format != null)
|
|
1477
|
-
resourceJson.format = resource.format;
|
|
1478
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1478
1479
|
if (resource.provider != null)
|
|
1479
|
-
resourceJson.provider = resource.provider;
|
|
1480
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1480
1481
|
if (resource.value != null)
|
|
1481
|
-
resourceJson.url = resource.value;
|
|
1482
|
-
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1482
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1483
|
+
// if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
|
|
1483
1484
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1484
1485
|
return resourceJson;
|
|
1485
1486
|
}
|
|
1486
1487
|
addDocumentEmbedResource(resource) {
|
|
1487
1488
|
const resourceJson = {};
|
|
1488
1489
|
if (resource.format != null)
|
|
1489
|
-
resourceJson.format = resource.format;
|
|
1490
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1490
1491
|
if (resource.provider != null)
|
|
1491
|
-
resourceJson.provider = resource.provider;
|
|
1492
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1492
1493
|
if (resource.value != null)
|
|
1493
|
-
resourceJson.url = resource.value;
|
|
1494
|
-
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1494
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1495
|
+
// if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
|
|
1495
1496
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1496
1497
|
return resourceJson;
|
|
1497
1498
|
}
|
|
1498
1499
|
addDocumentLinkResource(resource) {
|
|
1499
1500
|
const resourceJson = {};
|
|
1500
1501
|
if (resource.format != null)
|
|
1501
|
-
resourceJson.format = resource.format;
|
|
1502
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1502
1503
|
if (resource.provider != null)
|
|
1503
|
-
resourceJson.provider = resource.provider;
|
|
1504
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1504
1505
|
if (resource.value != null)
|
|
1505
|
-
resourceJson.url = resource.value;
|
|
1506
|
-
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1506
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1507
|
+
// if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
|
|
1507
1508
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1508
1509
|
return resourceJson;
|
|
1509
1510
|
}
|
|
1510
1511
|
addDocumentDownloadResource(resource) {
|
|
1511
1512
|
const resourceJson = {};
|
|
1512
1513
|
if (resource.format != null)
|
|
1513
|
-
resourceJson.format = resource.format;
|
|
1514
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1514
1515
|
if (resource.provider != null)
|
|
1515
|
-
resourceJson.provider = resource.provider;
|
|
1516
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1516
1517
|
if (resource.value != null)
|
|
1517
|
-
resourceJson.url = resource.value;
|
|
1518
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1518
1519
|
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1519
1520
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1520
1521
|
return resourceJson;
|
|
1521
1522
|
}
|
|
1522
1523
|
addAppLinkResource(resource) {
|
|
1523
1524
|
const resourceJson = {};
|
|
1524
|
-
// if (resource.format != null) resourceJson.format = resource.format;
|
|
1525
|
+
// if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
|
|
1525
1526
|
if (resource.value != null)
|
|
1526
|
-
resourceJson.url = resource.value;
|
|
1527
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1527
1528
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1528
1529
|
return resourceJson;
|
|
1529
1530
|
}
|
|
1530
1531
|
addWebsiteLinkResource(resource) {
|
|
1531
1532
|
const resourceJson = {};
|
|
1532
|
-
// if (resource.format != null) resourceJson.format = resource.format;
|
|
1533
|
+
// if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
|
|
1533
1534
|
if (resource.value != null)
|
|
1534
|
-
resourceJson.url = resource.value;
|
|
1535
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1535
1536
|
if (resource.siteName != null)
|
|
1536
|
-
resourceJson.siteName = resource.siteName;
|
|
1537
|
+
resourceJson.siteName = Breakscape.unbreakscape(resource.siteName);
|
|
1537
1538
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1538
1539
|
return resourceJson;
|
|
1539
1540
|
}
|
|
@@ -1541,33 +1542,33 @@ class JsonGenerator {
|
|
|
1541
1542
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1542
1543
|
if (noDefaults) {
|
|
1543
1544
|
if (resource.license != null)
|
|
1544
|
-
resourceJson.license = (_a = resource.license) !== null && _a !== void 0 ? _a : '';
|
|
1545
|
+
resourceJson.license = (_a = Breakscape.unbreakscape(resource.license)) !== null && _a !== void 0 ? _a : '';
|
|
1545
1546
|
if (resource.copyright != null)
|
|
1546
|
-
resourceJson.copyright = (_b = resource.copyright) !== null && _b !== void 0 ? _b : '';
|
|
1547
|
+
resourceJson.copyright = (_b = Breakscape.unbreakscape(resource.copyright)) !== null && _b !== void 0 ? _b : '';
|
|
1547
1548
|
if (resource.provider != null)
|
|
1548
|
-
resourceJson.provider = resource.provider;
|
|
1549
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1549
1550
|
if (resource.showInIndex != null)
|
|
1550
1551
|
resourceJson.showInIndex = (_c = resource.showInIndex) !== null && _c !== void 0 ? _c : false;
|
|
1551
1552
|
if (resource.caption != null)
|
|
1552
|
-
resourceJson.caption = this.toTextAstOrString((_d = resource.caption) !== null && _d !== void 0 ? _d : '');
|
|
1553
|
+
resourceJson.caption = this.toTextAstOrString((_d = resource.caption) !== null && _d !== void 0 ? _d : '', TextFormat.bitmarkMinusMinus);
|
|
1553
1554
|
}
|
|
1554
1555
|
else {
|
|
1555
|
-
resourceJson.license = (_e = resource.license) !== null && _e !== void 0 ? _e : '';
|
|
1556
|
-
resourceJson.copyright = (_f = resource.copyright) !== null && _f !== void 0 ? _f : '';
|
|
1556
|
+
resourceJson.license = (_e = Breakscape.unbreakscape(resource.license)) !== null && _e !== void 0 ? _e : '';
|
|
1557
|
+
resourceJson.copyright = (_f = Breakscape.unbreakscape(resource.copyright)) !== null && _f !== void 0 ? _f : '';
|
|
1557
1558
|
if (resource.provider != null)
|
|
1558
|
-
resourceJson.provider = resource.provider;
|
|
1559
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1559
1560
|
resourceJson.showInIndex = (_g = resource.showInIndex) !== null && _g !== void 0 ? _g : false;
|
|
1560
|
-
resourceJson.caption = this.toTextAstOrString((_h = resource.caption) !== null && _h !== void 0 ? _h :
|
|
1561
|
+
resourceJson.caption = this.toTextAstOrString((_h = resource.caption) !== null && _h !== void 0 ? _h : Breakscape.EMPTY_STRING, TextFormat.bitmarkMinusMinus);
|
|
1561
1562
|
}
|
|
1562
1563
|
return resourceJson;
|
|
1563
1564
|
}
|
|
1564
1565
|
toItemLeadHintInstruction(item) {
|
|
1565
1566
|
var _a, _b, _c, _d, _e, _f;
|
|
1566
1567
|
return {
|
|
1567
|
-
item: this.toTextAstOrString((_b = (_a = item.itemLead) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b :
|
|
1568
|
-
lead: this.toTextAstOrString((_d = (_c = item.itemLead) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d :
|
|
1569
|
-
hint: this.toTextAstOrString((_e = item.hint) !== null && _e !== void 0 ? _e :
|
|
1570
|
-
instruction: this.toTextAstOrString((_f = item.instruction) !== null && _f !== void 0 ? _f :
|
|
1568
|
+
item: this.toTextAstOrString((_b = (_a = item.itemLead) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b : Breakscape.EMPTY_STRING, TextFormat.bitmarkMinusMinus),
|
|
1569
|
+
lead: this.toTextAstOrString((_d = (_c = item.itemLead) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d : Breakscape.EMPTY_STRING, TextFormat.bitmarkMinusMinus),
|
|
1570
|
+
hint: this.toTextAstOrString((_e = item.hint) !== null && _e !== void 0 ? _e : Breakscape.EMPTY_STRING, TextFormat.bitmarkMinusMinus),
|
|
1571
|
+
instruction: this.toTextAstOrString((_f = item.instruction) !== null && _f !== void 0 ? _f : Breakscape.EMPTY_STRING, TextFormat.bitmarkMinusMinus),
|
|
1571
1572
|
};
|
|
1572
1573
|
}
|
|
1573
1574
|
toExample(node, options) {
|
|
@@ -1583,10 +1584,12 @@ class JsonGenerator {
|
|
|
1583
1584
|
if (isDefaultExample) {
|
|
1584
1585
|
exampleValue = isBoolean
|
|
1585
1586
|
? BooleanUtils.toBoolean(defaultExample)
|
|
1586
|
-
: this.toTextAstOrString(defaultExample);
|
|
1587
|
+
: this.toTextAstOrString(defaultExample, TextFormat.bitmarkMinusMinus);
|
|
1587
1588
|
}
|
|
1588
1589
|
else {
|
|
1589
|
-
exampleValue = isBoolean
|
|
1590
|
+
exampleValue = isBoolean
|
|
1591
|
+
? BooleanUtils.toBoolean(example)
|
|
1592
|
+
: this.toTextAstOrString(example, TextFormat.bitmarkMinusMinus);
|
|
1590
1593
|
}
|
|
1591
1594
|
return {
|
|
1592
1595
|
isExample: true,
|
|
@@ -1597,16 +1600,22 @@ class JsonGenerator {
|
|
|
1597
1600
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1598
1601
|
target, name, values, singleWithoutArray) {
|
|
1599
1602
|
if (values !== undefined) {
|
|
1603
|
+
let finalValue;
|
|
1600
1604
|
if (!Array.isArray(values))
|
|
1601
1605
|
values = [values];
|
|
1602
1606
|
if (Array.isArray(values) && values.length > 0) {
|
|
1603
|
-
|
|
1604
|
-
|
|
1607
|
+
// Unbreakscape values that are strings
|
|
1608
|
+
values = Breakscape.unbreakscape(values);
|
|
1609
|
+
if (Array.isArray(values) && singleWithoutArray && values.length >= 1) {
|
|
1610
|
+
finalValue = values[values.length - 1];
|
|
1605
1611
|
}
|
|
1606
1612
|
else {
|
|
1607
|
-
|
|
1613
|
+
finalValue = values;
|
|
1608
1614
|
}
|
|
1609
1615
|
}
|
|
1616
|
+
// if (finalValue != null) {
|
|
1617
|
+
target[name] = finalValue;
|
|
1618
|
+
// }
|
|
1610
1619
|
}
|
|
1611
1620
|
}
|
|
1612
1621
|
/**
|
|
@@ -1631,13 +1640,14 @@ class JsonGenerator {
|
|
|
1631
1640
|
* @returns the text format
|
|
1632
1641
|
*/
|
|
1633
1642
|
getTextFormat(route) {
|
|
1643
|
+
var _a;
|
|
1634
1644
|
for (const node of route) {
|
|
1635
1645
|
if (node.key === NodeType.bitsValue) {
|
|
1636
1646
|
const n = node.value;
|
|
1637
|
-
return TextFormat.fromValue(n === null || n === void 0 ? void 0 : n.textFormat);
|
|
1647
|
+
return (_a = TextFormat.fromValue(n === null || n === void 0 ? void 0 : n.textFormat)) !== null && _a !== void 0 ? _a : TextFormat.bitmarkMinusMinus;
|
|
1638
1648
|
}
|
|
1639
1649
|
}
|
|
1640
|
-
return
|
|
1650
|
+
return TextFormat.bitmarkMinusMinus;
|
|
1641
1651
|
}
|
|
1642
1652
|
/**
|
|
1643
1653
|
* Get the bit resourceType atttachment from any node
|
|
@@ -1655,15 +1665,15 @@ class JsonGenerator {
|
|
|
1655
1665
|
return undefined;
|
|
1656
1666
|
}
|
|
1657
1667
|
/**
|
|
1658
|
-
* Convert parse a string to TextAst if required, otherwise just return the string
|
|
1668
|
+
* Convert parse a string to TextAst if required, otherwise just return the string but unbreakscaped.
|
|
1659
1669
|
* @param text
|
|
1660
1670
|
* @returns
|
|
1661
1671
|
*/
|
|
1662
|
-
toTextAstOrString(text, format
|
|
1672
|
+
toTextAstOrString(text, format) {
|
|
1663
1673
|
if (!text)
|
|
1664
1674
|
undefined;
|
|
1665
|
-
if (this.options.textAsPlainText) {
|
|
1666
|
-
return text;
|
|
1675
|
+
if (this.options.textAsPlainText || format === TextFormat.text) {
|
|
1676
|
+
return Breakscape.unbreakscape(text);
|
|
1667
1677
|
}
|
|
1668
1678
|
// Use the text parser to parse the text
|
|
1669
1679
|
const textAst = this.textParser.toAst(text, {
|