@gmb/bitmark-parser-generator 1.4.7 → 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 +28 -34
- 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/config/raw/cardSets.js +8 -8
- package/dist/cjs/config/raw/cardSets.js.map +1 -1
- package/dist/cjs/config/raw/groups.js +4 -0
- package/dist/cjs/config/raw/groups.js.map +1 -1
- package/dist/cjs/config/raw/properties.js +2 -19
- package/dist/cjs/config/raw/properties.js.map +1 -1
- 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/bitmark/BitmarkGenerator.js +3 -11
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +144 -140
- 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/NodeType.js +0 -1
- package/dist/cjs/model/ast/NodeType.js.map +1 -1
- package/dist/cjs/model/ast/StardardString.js +3 -0
- package/dist/cjs/model/ast/StardardString.js.map +1 -0
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +1 -3
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/cjs/model/enum/PropertyAstKey.js +0 -1
- package/dist/cjs/model/enum/PropertyAstKey.js.map +1 -1
- package/dist/cjs/model/enum/PropertyJsonKey.js +1 -2
- package/dist/cjs/model/enum/PropertyJsonKey.js.map +1 -1
- package/dist/cjs/model/enum/PropertyTag.js +1 -3
- package/dist/cjs/model/enum/PropertyTag.js.map +1 -1
- 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 +27 -22
- 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/GapChainContentProcessor.js +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.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 +108 -111
- 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 +28 -34
- 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/config/raw/cardSets.js +8 -8
- package/dist/esm/config/raw/cardSets.js.map +1 -1
- package/dist/esm/config/raw/groups.js +4 -0
- package/dist/esm/config/raw/groups.js.map +1 -1
- package/dist/esm/config/raw/properties.js +2 -19
- package/dist/esm/config/raw/properties.js.map +1 -1
- 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/bitmark/BitmarkGenerator.js +3 -11
- package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +144 -140
- 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/NodeType.js +0 -1
- package/dist/esm/model/ast/NodeType.js.map +1 -1
- package/dist/esm/model/ast/StardardString.js +2 -0
- package/dist/esm/model/ast/StardardString.js.map +1 -0
- package/dist/esm/model/config/enum/PropertyConfigKey.js +1 -3
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/esm/model/enum/PropertyAstKey.js +0 -1
- package/dist/esm/model/enum/PropertyAstKey.js.map +1 -1
- package/dist/esm/model/enum/PropertyJsonKey.js +1 -2
- package/dist/esm/model/enum/PropertyJsonKey.js.map +1 -1
- package/dist/esm/model/enum/PropertyTag.js +1 -3
- package/dist/esm/model/enum/PropertyTag.js.map +1 -1
- 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 +27 -22
- 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/GapChainContentProcessor.js +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.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 +108 -111
- 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 +158 -168
- 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/config/raw/groups.d.ts.map +1 -1
- package/dist/types/config/raw/properties.d.ts.map +1 -1
- 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/bitmark/BitmarkGenerator.d.ts +1 -1
- package/dist/types/generator/bitmark/BitmarkGenerator.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/NodeType.d.ts +0 -2
- package/dist/types/model/ast/NodeType.d.ts.map +1 -1
- package/dist/types/model/ast/Nodes.d.ts +98 -106
- 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/config/enum/ConfigKey.d.ts +2 -6
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +3 -9
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyAstKey.d.ts +0 -2
- package/dist/types/model/enum/PropertyAstKey.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyJsonKey.d.ts +1 -7
- package/dist/types/model/enum/PropertyJsonKey.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyTag.d.ts +2 -6
- package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
- package/dist/types/model/json/BitJson.d.ts +2 -9
- package/dist/types/model/json/BitJson.d.ts.map +1 -1
- package/dist/types/model/json/BodyBitJson.d.ts +0 -2
- package/dist/types/model/json/BodyBitJson.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +36 -36
- 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/GapChainContentProcessor.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,28 +617,28 @@ 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
|
}
|
|
638
639
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> pairs
|
|
639
640
|
enter_pairs(node, _parent, _route) {
|
|
640
|
-
var _a, _b, _c, _d
|
|
641
|
+
var _a, _b, _c, _d;
|
|
641
642
|
const pairs = node.value;
|
|
642
643
|
const pairsJson = [];
|
|
643
644
|
if (pairs) {
|
|
@@ -645,12 +646,12 @@ 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
|
|
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
|
}));
|
|
652
653
|
// Delete unwanted properties
|
|
653
|
-
if (((
|
|
654
|
+
if (((_d = p.itemLead) === null || _d === void 0 ? void 0 : _d.lead) == null)
|
|
654
655
|
delete pairJson.lead;
|
|
655
656
|
if (pairJson.key) {
|
|
656
657
|
delete pairJson.keyAudio;
|
|
@@ -673,7 +674,7 @@ class JsonGenerator {
|
|
|
673
674
|
}
|
|
674
675
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> matrix
|
|
675
676
|
enter_matrix(node, _parent, _route) {
|
|
676
|
-
var _a, _b, _c, _d, _e, _f
|
|
677
|
+
var _a, _b, _c, _d, _e, _f;
|
|
677
678
|
const matrix = node.value;
|
|
678
679
|
const matrixJsonArray = [];
|
|
679
680
|
if (matrix) {
|
|
@@ -685,12 +686,12 @@ 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({ values: (_a = c.values) !== null && _a !== void 0 ? _a : [] }, this.toItemLeadHintInstruction(c)), 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
|
}));
|
|
692
693
|
// Delete unwanted properties
|
|
693
|
-
if (((
|
|
694
|
+
if (((_c = c.itemLead) === null || _c === void 0 ? void 0 : _c.lead) == null)
|
|
694
695
|
delete matrixCellJson.lead;
|
|
695
696
|
if (c.hint == null)
|
|
696
697
|
delete matrixCellJson.hint;
|
|
@@ -698,11 +699,11 @@ class JsonGenerator {
|
|
|
698
699
|
}
|
|
699
700
|
}
|
|
700
701
|
// Create the matrix
|
|
701
|
-
const matrixJson = Object.assign(Object.assign({ key: (
|
|
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
|
|
705
|
-
if (((
|
|
706
|
+
if (((_f = m.itemLead) === null || _f === void 0 ? void 0 : _f.lead) == null)
|
|
706
707
|
delete matrixJson.lead;
|
|
707
708
|
if (m.instruction == null)
|
|
708
709
|
delete matrixJson.instruction;
|
|
@@ -715,20 +716,18 @@ class JsonGenerator {
|
|
|
715
716
|
}
|
|
716
717
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> questions
|
|
717
718
|
enter_questions(node, _parent, _route) {
|
|
718
|
-
var _a, _b, _c, _d
|
|
719
|
+
var _a, _b, _c, _d;
|
|
719
720
|
const questions = node.value;
|
|
720
721
|
const questionsJson = [];
|
|
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)), {
|
|
725
|
-
// isCaseSensitive: q.isCaseSensitive ?? true,
|
|
726
|
-
isShortAnswer: (_d = q.isShortAnswer) !== null && _d !== void 0 ? _d : true, 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, {
|
|
727
726
|
defaultExample: q.sampleSolution || '',
|
|
728
727
|
isBoolean: false,
|
|
729
728
|
}));
|
|
730
729
|
// Delete unwanted properties
|
|
731
|
-
if (((
|
|
730
|
+
if (((_d = q.itemLead) === null || _d === void 0 ? void 0 : _d.lead) == null)
|
|
732
731
|
delete questionJson.lead;
|
|
733
732
|
questionsJson.push(questionJson);
|
|
734
733
|
}
|
|
@@ -748,7 +747,7 @@ class JsonGenerator {
|
|
|
748
747
|
if (botResponses) {
|
|
749
748
|
for (const r of botResponses) {
|
|
750
749
|
// Create the response
|
|
751
|
-
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));
|
|
752
751
|
// Delete unwanted properties
|
|
753
752
|
if (((_d = r.itemLead) === null || _d === void 0 ? void 0 : _d.lead) == null)
|
|
754
753
|
delete responseJson.lead;
|
|
@@ -820,11 +819,11 @@ class JsonGenerator {
|
|
|
820
819
|
//
|
|
821
820
|
// bitmarkAst -> bits -> bitsValue -> title
|
|
822
821
|
leaf_title(node, _parent, _route) {
|
|
823
|
-
this.bitJson.title = this.toTextAstOrString(node.value);
|
|
822
|
+
this.bitJson.title = this.toTextAstOrString(node.value, TextFormat.bitmarkMinusMinus);
|
|
824
823
|
}
|
|
825
824
|
// bitmarkAst -> bits -> bitsValue -> subtitle
|
|
826
825
|
leaf_subtitle(node, _parent, _route) {
|
|
827
|
-
this.bitJson.subtitle = this.toTextAstOrString(node.value);
|
|
826
|
+
this.bitJson.subtitle = this.toTextAstOrString(node.value, TextFormat.bitmarkMinusMinus);
|
|
828
827
|
}
|
|
829
828
|
// // bitmarkAst -> bits -> bitsValue -> level
|
|
830
829
|
leaf_level(node, _parent, _route) {
|
|
@@ -858,7 +857,7 @@ class JsonGenerator {
|
|
|
858
857
|
// Ignore hint that is not at the bit level as it are handled elsewhere
|
|
859
858
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
860
859
|
return;
|
|
861
|
-
this.bitJson.hint = this.toTextAstOrString(hint);
|
|
860
|
+
this.bitJson.hint = this.toTextAstOrString(hint, TextFormat.bitmarkMinusMinus);
|
|
862
861
|
}
|
|
863
862
|
// bitmarkAst -> bits -> bitsValue -> * -> instruction
|
|
864
863
|
leaf_instruction(node, parent, _route) {
|
|
@@ -866,12 +865,12 @@ class JsonGenerator {
|
|
|
866
865
|
// Ignore instruction that is not at the bit level as it are handled elsewhere
|
|
867
866
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
868
867
|
return;
|
|
869
|
-
this.bitJson.instruction = this.toTextAstOrString(instruction);
|
|
868
|
+
this.bitJson.instruction = this.toTextAstOrString(instruction, TextFormat.bitmarkMinusMinus);
|
|
870
869
|
}
|
|
871
870
|
// bitmarkAst -> bits -> footer -> footerText
|
|
872
871
|
leaf_footerText(node, _parent, _route) {
|
|
873
872
|
const footer = node.value;
|
|
874
|
-
this.bitJson.footer = this.toTextAstOrString(footer);
|
|
873
|
+
this.bitJson.footer = this.toTextAstOrString(footer, TextFormat.bitmarkMinusMinus);
|
|
875
874
|
}
|
|
876
875
|
// bitmarkAst -> bits -> bitsValue -> markup
|
|
877
876
|
leaf_markup(node, _parent, _route) {
|
|
@@ -980,7 +979,7 @@ class JsonGenerator {
|
|
|
980
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, {
|
|
981
980
|
defaultExample,
|
|
982
981
|
isBoolean: false,
|
|
983
|
-
})), { solutions: data.solutions });
|
|
982
|
+
})), { solutions: Breakscape.unbreakscape(data.solutions) });
|
|
984
983
|
// Remove unwanted properties
|
|
985
984
|
if (!gapJson.lead)
|
|
986
985
|
delete gapJson.lead;
|
|
@@ -989,7 +988,7 @@ class JsonGenerator {
|
|
|
989
988
|
createMarkJson(mark) {
|
|
990
989
|
const data = mark.data;
|
|
991
990
|
// Create the mark
|
|
992
|
-
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, {
|
|
993
992
|
defaultExample: true,
|
|
994
993
|
isBoolean: true,
|
|
995
994
|
}));
|
|
@@ -1004,7 +1003,7 @@ class JsonGenerator {
|
|
|
1004
1003
|
// Create the select options
|
|
1005
1004
|
const options = [];
|
|
1006
1005
|
for (const option of data.options) {
|
|
1007
|
-
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, {
|
|
1008
1007
|
defaultExample: !!option.isCorrect,
|
|
1009
1008
|
isBoolean: true,
|
|
1010
1009
|
}));
|
|
@@ -1015,12 +1014,10 @@ class JsonGenerator {
|
|
|
1015
1014
|
delete optionJson.lead;
|
|
1016
1015
|
if (!optionJson.instruction)
|
|
1017
1016
|
delete optionJson.instruction;
|
|
1018
|
-
if (!optionJson.isCaseSensitive)
|
|
1019
|
-
delete optionJson.isCaseSensitive;
|
|
1020
1017
|
options.push(optionJson);
|
|
1021
1018
|
}
|
|
1022
1019
|
// Create the select
|
|
1023
|
-
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 });
|
|
1024
1021
|
// Remove unwanted properties
|
|
1025
1022
|
if (!selectJson.lead)
|
|
1026
1023
|
delete selectJson.lead;
|
|
@@ -1032,7 +1029,7 @@ class JsonGenerator {
|
|
|
1032
1029
|
// Create the highlight options
|
|
1033
1030
|
const texts = [];
|
|
1034
1031
|
for (const text of data.texts) {
|
|
1035
|
-
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, {
|
|
1036
1033
|
defaultExample: !!text.isCorrect,
|
|
1037
1034
|
isBoolean: true,
|
|
1038
1035
|
}));
|
|
@@ -1043,12 +1040,10 @@ class JsonGenerator {
|
|
|
1043
1040
|
delete textJson.lead;
|
|
1044
1041
|
if (!textJson.hint)
|
|
1045
1042
|
delete textJson.hint;
|
|
1046
|
-
if (!textJson.isCaseSensitive)
|
|
1047
|
-
delete textJson.isCaseSensitive;
|
|
1048
1043
|
texts.push(textJson);
|
|
1049
1044
|
}
|
|
1050
1045
|
// Create the select
|
|
1051
|
-
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 });
|
|
1052
1047
|
// Remove unwanted properties
|
|
1053
1048
|
if (!highlightJson.lead)
|
|
1054
1049
|
delete highlightJson.lead;
|
|
@@ -1184,29 +1179,29 @@ class JsonGenerator {
|
|
|
1184
1179
|
resource = {
|
|
1185
1180
|
type: ResourceTag.image,
|
|
1186
1181
|
typeAlias: ResourceTag.image,
|
|
1187
|
-
value,
|
|
1182
|
+
value: value,
|
|
1188
1183
|
format: UrlUtils.fileExtensionFromUrl(value),
|
|
1189
1184
|
provider: UrlUtils.domainFromUrl(value),
|
|
1190
1185
|
};
|
|
1191
1186
|
}
|
|
1192
1187
|
resource = resource; // Keep TS compiler happy
|
|
1193
1188
|
if (resource.format != null)
|
|
1194
|
-
resourceJson.format = resource.format;
|
|
1189
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1195
1190
|
if (resource.provider != null)
|
|
1196
|
-
resourceJson.provider = resource.provider;
|
|
1191
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1197
1192
|
if (resource.value != null)
|
|
1198
|
-
resourceJson.src = resource.value;
|
|
1193
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1199
1194
|
if (resource.src1x != null)
|
|
1200
|
-
resourceJson.src1x = resource.src1x;
|
|
1195
|
+
resourceJson.src1x = Breakscape.unbreakscape(resource.src1x);
|
|
1201
1196
|
if (resource.src2x != null)
|
|
1202
|
-
resourceJson.src2x = resource.src2x;
|
|
1197
|
+
resourceJson.src2x = Breakscape.unbreakscape(resource.src2x);
|
|
1203
1198
|
if (resource.src3x != null)
|
|
1204
|
-
resourceJson.src3x = resource.src3x;
|
|
1199
|
+
resourceJson.src3x = Breakscape.unbreakscape(resource.src3x);
|
|
1205
1200
|
if (resource.src4x != null)
|
|
1206
|
-
resourceJson.src4x = resource.src4x;
|
|
1201
|
+
resourceJson.src4x = Breakscape.unbreakscape(resource.src4x);
|
|
1207
1202
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1208
1203
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1209
|
-
resourceJson.alt = (_c = resource.alt) !== null && _c !== void 0 ? _c : '';
|
|
1204
|
+
resourceJson.alt = (_c = Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
|
|
1210
1205
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1211
1206
|
return resourceJson;
|
|
1212
1207
|
}
|
|
@@ -1225,33 +1220,33 @@ class JsonGenerator {
|
|
|
1225
1220
|
}
|
|
1226
1221
|
resource = resource; // Keep TS compiler happy
|
|
1227
1222
|
if (resource.format != null)
|
|
1228
|
-
resourceJson.format = resource.format;
|
|
1223
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1229
1224
|
if (resource.provider != null)
|
|
1230
|
-
resourceJson.provider = resource.provider;
|
|
1225
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1231
1226
|
if (resource.value != null)
|
|
1232
|
-
resourceJson.url = resource.value;
|
|
1227
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1233
1228
|
if (resource.src1x != null)
|
|
1234
|
-
resourceJson.src1x = resource.src1x;
|
|
1229
|
+
resourceJson.src1x = Breakscape.unbreakscape(resource.src1x);
|
|
1235
1230
|
if (resource.src2x != null)
|
|
1236
|
-
resourceJson.src2x = resource.src2x;
|
|
1231
|
+
resourceJson.src2x = Breakscape.unbreakscape(resource.src2x);
|
|
1237
1232
|
if (resource.src3x != null)
|
|
1238
|
-
resourceJson.src3x = resource.src3x;
|
|
1233
|
+
resourceJson.src3x = Breakscape.unbreakscape(resource.src3x);
|
|
1239
1234
|
if (resource.src4x != null)
|
|
1240
|
-
resourceJson.src4x = resource.src4x;
|
|
1235
|
+
resourceJson.src4x = Breakscape.unbreakscape(resource.src4x);
|
|
1241
1236
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1242
1237
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1243
|
-
resourceJson.alt = (_c = resource.alt) !== null && _c !== void 0 ? _c : '';
|
|
1238
|
+
resourceJson.alt = (_c = Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
|
|
1244
1239
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1245
1240
|
return resourceJson;
|
|
1246
1241
|
}
|
|
1247
1242
|
addAudioResource(resource) {
|
|
1248
1243
|
const resourceJson = {};
|
|
1249
1244
|
if (resource.format != null)
|
|
1250
|
-
resourceJson.format = resource.format;
|
|
1245
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1251
1246
|
if (resource.provider != null)
|
|
1252
|
-
resourceJson.provider = resource.provider;
|
|
1247
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1253
1248
|
if (resource.value != null)
|
|
1254
|
-
resourceJson.src = resource.value;
|
|
1249
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1255
1250
|
if (resource.duration != null)
|
|
1256
1251
|
resourceJson.duration = resource.duration;
|
|
1257
1252
|
if (resource.mute != null)
|
|
@@ -1264,11 +1259,11 @@ class JsonGenerator {
|
|
|
1264
1259
|
addAudioEmbedResource(resource) {
|
|
1265
1260
|
const resourceJson = {};
|
|
1266
1261
|
if (resource.format != null)
|
|
1267
|
-
resourceJson.format = resource.format;
|
|
1262
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1268
1263
|
if (resource.provider != null)
|
|
1269
|
-
resourceJson.provider = resource.provider;
|
|
1264
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1270
1265
|
if (resource.value != null)
|
|
1271
|
-
resourceJson.src = resource.value;
|
|
1266
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1272
1267
|
if (resource.duration != null)
|
|
1273
1268
|
resourceJson.duration = resource.duration;
|
|
1274
1269
|
if (resource.mute != null)
|
|
@@ -1281,11 +1276,11 @@ class JsonGenerator {
|
|
|
1281
1276
|
addAudioLinkResource(resource) {
|
|
1282
1277
|
const resourceJson = {};
|
|
1283
1278
|
if (resource.format != null)
|
|
1284
|
-
resourceJson.format = resource.format;
|
|
1279
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1285
1280
|
if (resource.provider != null)
|
|
1286
|
-
resourceJson.provider = resource.provider;
|
|
1281
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1287
1282
|
if (resource.value != null)
|
|
1288
|
-
resourceJson.url = resource.value;
|
|
1283
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1289
1284
|
if (resource.duration != null)
|
|
1290
1285
|
resourceJson.duration = resource.duration;
|
|
1291
1286
|
if (resource.mute != null)
|
|
@@ -1299,11 +1294,11 @@ class JsonGenerator {
|
|
|
1299
1294
|
var _a, _b;
|
|
1300
1295
|
const resourceJson = {};
|
|
1301
1296
|
if (resource.format != null)
|
|
1302
|
-
resourceJson.format = resource.format;
|
|
1297
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1303
1298
|
if (resource.provider != null)
|
|
1304
|
-
resourceJson.provider = resource.provider;
|
|
1299
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1305
1300
|
if (resource.value != null)
|
|
1306
|
-
resourceJson.src = resource.value;
|
|
1301
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1307
1302
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1308
1303
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1309
1304
|
if (resource.duration != null)
|
|
@@ -1317,7 +1312,7 @@ class JsonGenerator {
|
|
|
1317
1312
|
if (resource.showSubtitles != null)
|
|
1318
1313
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1319
1314
|
if (resource.alt != null)
|
|
1320
|
-
resourceJson.alt = resource.alt;
|
|
1315
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1321
1316
|
if (resource.posterImage != null)
|
|
1322
1317
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1323
1318
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1333,11 +1328,11 @@ class JsonGenerator {
|
|
|
1333
1328
|
var _a, _b;
|
|
1334
1329
|
const resourceJson = {};
|
|
1335
1330
|
if (resource.format != null)
|
|
1336
|
-
resourceJson.format = resource.format;
|
|
1331
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1337
1332
|
if (resource.provider != null)
|
|
1338
|
-
resourceJson.provider = resource.provider;
|
|
1333
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1339
1334
|
if (resource.value != null)
|
|
1340
|
-
resourceJson.src = resource.value;
|
|
1335
|
+
resourceJson.src = Breakscape.unbreakscape(resource.value);
|
|
1341
1336
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1342
1337
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1343
1338
|
if (resource.duration != null)
|
|
@@ -1351,7 +1346,7 @@ class JsonGenerator {
|
|
|
1351
1346
|
if (resource.showSubtitles != null)
|
|
1352
1347
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1353
1348
|
if (resource.alt != null)
|
|
1354
|
-
resourceJson.alt = resource.alt;
|
|
1349
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1355
1350
|
if (resource.posterImage != null)
|
|
1356
1351
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1357
1352
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1367,11 +1362,11 @@ class JsonGenerator {
|
|
|
1367
1362
|
var _a, _b;
|
|
1368
1363
|
const resourceJson = {};
|
|
1369
1364
|
if (resource.format != null)
|
|
1370
|
-
resourceJson.format = resource.format;
|
|
1365
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1371
1366
|
if (resource.provider != null)
|
|
1372
|
-
resourceJson.provider = resource.provider;
|
|
1367
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1373
1368
|
if (resource.value != null)
|
|
1374
|
-
resourceJson.url = resource.value;
|
|
1369
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1375
1370
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1376
1371
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1377
1372
|
if (resource.duration != null)
|
|
@@ -1385,7 +1380,7 @@ class JsonGenerator {
|
|
|
1385
1380
|
if (resource.showSubtitles != null)
|
|
1386
1381
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1387
1382
|
if (resource.alt != null)
|
|
1388
|
-
resourceJson.alt = resource.alt;
|
|
1383
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1389
1384
|
if (resource.posterImage != null)
|
|
1390
1385
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1391
1386
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1401,11 +1396,11 @@ class JsonGenerator {
|
|
|
1401
1396
|
var _a, _b;
|
|
1402
1397
|
const resourceJson = {};
|
|
1403
1398
|
if (resource.format != null)
|
|
1404
|
-
resourceJson.format = resource.format;
|
|
1399
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1405
1400
|
if (resource.provider != null)
|
|
1406
|
-
resourceJson.provider = resource.provider;
|
|
1401
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1407
1402
|
if (resource.value != null)
|
|
1408
|
-
resourceJson.url = resource.value;
|
|
1403
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1409
1404
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1410
1405
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1411
1406
|
if (resource.duration != null)
|
|
@@ -1419,7 +1414,7 @@ class JsonGenerator {
|
|
|
1419
1414
|
if (resource.showSubtitles != null)
|
|
1420
1415
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1421
1416
|
if (resource.alt != null)
|
|
1422
|
-
resourceJson.alt = resource.alt;
|
|
1417
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1423
1418
|
if (resource.posterImage != null)
|
|
1424
1419
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1425
1420
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1435,11 +1430,11 @@ class JsonGenerator {
|
|
|
1435
1430
|
var _a, _b;
|
|
1436
1431
|
const resourceJson = {};
|
|
1437
1432
|
if (resource.format != null)
|
|
1438
|
-
resourceJson.format = resource.format;
|
|
1433
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1439
1434
|
if (resource.provider != null)
|
|
1440
|
-
resourceJson.provider = resource.provider;
|
|
1435
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1441
1436
|
if (resource.value != null)
|
|
1442
|
-
resourceJson.url = resource.value;
|
|
1437
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1443
1438
|
resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
|
|
1444
1439
|
resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
|
|
1445
1440
|
if (resource.duration != null)
|
|
@@ -1453,7 +1448,7 @@ class JsonGenerator {
|
|
|
1453
1448
|
if (resource.showSubtitles != null)
|
|
1454
1449
|
resourceJson.showSubtitles = resource.showSubtitles;
|
|
1455
1450
|
if (resource.alt != null)
|
|
1456
|
-
resourceJson.alt = resource.alt;
|
|
1451
|
+
resourceJson.alt = Breakscape.unbreakscape(resource.alt);
|
|
1457
1452
|
if (resource.posterImage != null)
|
|
1458
1453
|
resourceJson.posterImage = this.addImageResource(resource.posterImage);
|
|
1459
1454
|
if (resource.thumbnails != null && resource.thumbnails.length > 0) {
|
|
@@ -1468,78 +1463,78 @@ class JsonGenerator {
|
|
|
1468
1463
|
addArticleResource(resource) {
|
|
1469
1464
|
const resourceJson = {};
|
|
1470
1465
|
if (resource.format != null)
|
|
1471
|
-
resourceJson.format = resource.format;
|
|
1466
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1472
1467
|
if (resource.provider != null)
|
|
1473
|
-
resourceJson.provider = resource.provider;
|
|
1468
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1474
1469
|
if (resource.value != null)
|
|
1475
|
-
resourceJson.body = resource.value;
|
|
1476
|
-
// 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)
|
|
1477
1472
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1478
1473
|
return resourceJson;
|
|
1479
1474
|
}
|
|
1480
1475
|
addDocumentResource(resource) {
|
|
1481
1476
|
const resourceJson = {};
|
|
1482
1477
|
if (resource.format != null)
|
|
1483
|
-
resourceJson.format = resource.format;
|
|
1478
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1484
1479
|
if (resource.provider != null)
|
|
1485
|
-
resourceJson.provider = resource.provider;
|
|
1480
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1486
1481
|
if (resource.value != null)
|
|
1487
|
-
resourceJson.url = resource.value;
|
|
1488
|
-
// 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)
|
|
1489
1484
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1490
1485
|
return resourceJson;
|
|
1491
1486
|
}
|
|
1492
1487
|
addDocumentEmbedResource(resource) {
|
|
1493
1488
|
const resourceJson = {};
|
|
1494
1489
|
if (resource.format != null)
|
|
1495
|
-
resourceJson.format = resource.format;
|
|
1490
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1496
1491
|
if (resource.provider != null)
|
|
1497
|
-
resourceJson.provider = resource.provider;
|
|
1492
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1498
1493
|
if (resource.value != null)
|
|
1499
|
-
resourceJson.url = resource.value;
|
|
1500
|
-
// 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)
|
|
1501
1496
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1502
1497
|
return resourceJson;
|
|
1503
1498
|
}
|
|
1504
1499
|
addDocumentLinkResource(resource) {
|
|
1505
1500
|
const resourceJson = {};
|
|
1506
1501
|
if (resource.format != null)
|
|
1507
|
-
resourceJson.format = resource.format;
|
|
1502
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1508
1503
|
if (resource.provider != null)
|
|
1509
|
-
resourceJson.provider = resource.provider;
|
|
1504
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1510
1505
|
if (resource.value != null)
|
|
1511
|
-
resourceJson.url = resource.value;
|
|
1512
|
-
// 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)
|
|
1513
1508
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1514
1509
|
return resourceJson;
|
|
1515
1510
|
}
|
|
1516
1511
|
addDocumentDownloadResource(resource) {
|
|
1517
1512
|
const resourceJson = {};
|
|
1518
1513
|
if (resource.format != null)
|
|
1519
|
-
resourceJson.format = resource.format;
|
|
1514
|
+
resourceJson.format = Breakscape.unbreakscape(resource.format);
|
|
1520
1515
|
if (resource.provider != null)
|
|
1521
|
-
resourceJson.provider = resource.provider;
|
|
1516
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1522
1517
|
if (resource.value != null)
|
|
1523
|
-
resourceJson.url = resource.value;
|
|
1518
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1524
1519
|
// if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
|
|
1525
1520
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1526
1521
|
return resourceJson;
|
|
1527
1522
|
}
|
|
1528
1523
|
addAppLinkResource(resource) {
|
|
1529
1524
|
const resourceJson = {};
|
|
1530
|
-
// if (resource.format != null) resourceJson.format = resource.format;
|
|
1525
|
+
// if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
|
|
1531
1526
|
if (resource.value != null)
|
|
1532
|
-
resourceJson.url = resource.value;
|
|
1527
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1533
1528
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1534
1529
|
return resourceJson;
|
|
1535
1530
|
}
|
|
1536
1531
|
addWebsiteLinkResource(resource) {
|
|
1537
1532
|
const resourceJson = {};
|
|
1538
|
-
// if (resource.format != null) resourceJson.format = resource.format;
|
|
1533
|
+
// if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
|
|
1539
1534
|
if (resource.value != null)
|
|
1540
|
-
resourceJson.url = resource.value;
|
|
1535
|
+
resourceJson.url = Breakscape.unbreakscape(resource.value);
|
|
1541
1536
|
if (resource.siteName != null)
|
|
1542
|
-
resourceJson.siteName = resource.siteName;
|
|
1537
|
+
resourceJson.siteName = Breakscape.unbreakscape(resource.siteName);
|
|
1543
1538
|
this.addGenericResourceProperties(resource, resourceJson);
|
|
1544
1539
|
return resourceJson;
|
|
1545
1540
|
}
|
|
@@ -1547,33 +1542,33 @@ class JsonGenerator {
|
|
|
1547
1542
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1548
1543
|
if (noDefaults) {
|
|
1549
1544
|
if (resource.license != null)
|
|
1550
|
-
resourceJson.license = (_a = resource.license) !== null && _a !== void 0 ? _a : '';
|
|
1545
|
+
resourceJson.license = (_a = Breakscape.unbreakscape(resource.license)) !== null && _a !== void 0 ? _a : '';
|
|
1551
1546
|
if (resource.copyright != null)
|
|
1552
|
-
resourceJson.copyright = (_b = resource.copyright) !== null && _b !== void 0 ? _b : '';
|
|
1547
|
+
resourceJson.copyright = (_b = Breakscape.unbreakscape(resource.copyright)) !== null && _b !== void 0 ? _b : '';
|
|
1553
1548
|
if (resource.provider != null)
|
|
1554
|
-
resourceJson.provider = resource.provider;
|
|
1549
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1555
1550
|
if (resource.showInIndex != null)
|
|
1556
1551
|
resourceJson.showInIndex = (_c = resource.showInIndex) !== null && _c !== void 0 ? _c : false;
|
|
1557
1552
|
if (resource.caption != null)
|
|
1558
|
-
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);
|
|
1559
1554
|
}
|
|
1560
1555
|
else {
|
|
1561
|
-
resourceJson.license = (_e = resource.license) !== null && _e !== void 0 ? _e : '';
|
|
1562
|
-
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 : '';
|
|
1563
1558
|
if (resource.provider != null)
|
|
1564
|
-
resourceJson.provider = resource.provider;
|
|
1559
|
+
resourceJson.provider = Breakscape.unbreakscape(resource.provider);
|
|
1565
1560
|
resourceJson.showInIndex = (_g = resource.showInIndex) !== null && _g !== void 0 ? _g : false;
|
|
1566
|
-
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);
|
|
1567
1562
|
}
|
|
1568
1563
|
return resourceJson;
|
|
1569
1564
|
}
|
|
1570
1565
|
toItemLeadHintInstruction(item) {
|
|
1571
1566
|
var _a, _b, _c, _d, _e, _f;
|
|
1572
1567
|
return {
|
|
1573
|
-
item: this.toTextAstOrString((_b = (_a = item.itemLead) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b :
|
|
1574
|
-
lead: this.toTextAstOrString((_d = (_c = item.itemLead) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d :
|
|
1575
|
-
hint: this.toTextAstOrString((_e = item.hint) !== null && _e !== void 0 ? _e :
|
|
1576
|
-
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),
|
|
1577
1572
|
};
|
|
1578
1573
|
}
|
|
1579
1574
|
toExample(node, options) {
|
|
@@ -1589,10 +1584,12 @@ class JsonGenerator {
|
|
|
1589
1584
|
if (isDefaultExample) {
|
|
1590
1585
|
exampleValue = isBoolean
|
|
1591
1586
|
? BooleanUtils.toBoolean(defaultExample)
|
|
1592
|
-
: this.toTextAstOrString(defaultExample);
|
|
1587
|
+
: this.toTextAstOrString(defaultExample, TextFormat.bitmarkMinusMinus);
|
|
1593
1588
|
}
|
|
1594
1589
|
else {
|
|
1595
|
-
exampleValue = isBoolean
|
|
1590
|
+
exampleValue = isBoolean
|
|
1591
|
+
? BooleanUtils.toBoolean(example)
|
|
1592
|
+
: this.toTextAstOrString(example, TextFormat.bitmarkMinusMinus);
|
|
1596
1593
|
}
|
|
1597
1594
|
return {
|
|
1598
1595
|
isExample: true,
|
|
@@ -1603,16 +1600,22 @@ class JsonGenerator {
|
|
|
1603
1600
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1604
1601
|
target, name, values, singleWithoutArray) {
|
|
1605
1602
|
if (values !== undefined) {
|
|
1603
|
+
let finalValue;
|
|
1606
1604
|
if (!Array.isArray(values))
|
|
1607
1605
|
values = [values];
|
|
1608
1606
|
if (Array.isArray(values) && values.length > 0) {
|
|
1609
|
-
|
|
1610
|
-
|
|
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];
|
|
1611
1611
|
}
|
|
1612
1612
|
else {
|
|
1613
|
-
|
|
1613
|
+
finalValue = values;
|
|
1614
1614
|
}
|
|
1615
1615
|
}
|
|
1616
|
+
// if (finalValue != null) {
|
|
1617
|
+
target[name] = finalValue;
|
|
1618
|
+
// }
|
|
1616
1619
|
}
|
|
1617
1620
|
}
|
|
1618
1621
|
/**
|
|
@@ -1637,13 +1640,14 @@ class JsonGenerator {
|
|
|
1637
1640
|
* @returns the text format
|
|
1638
1641
|
*/
|
|
1639
1642
|
getTextFormat(route) {
|
|
1643
|
+
var _a;
|
|
1640
1644
|
for (const node of route) {
|
|
1641
1645
|
if (node.key === NodeType.bitsValue) {
|
|
1642
1646
|
const n = node.value;
|
|
1643
|
-
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;
|
|
1644
1648
|
}
|
|
1645
1649
|
}
|
|
1646
|
-
return
|
|
1650
|
+
return TextFormat.bitmarkMinusMinus;
|
|
1647
1651
|
}
|
|
1648
1652
|
/**
|
|
1649
1653
|
* Get the bit resourceType atttachment from any node
|
|
@@ -1661,15 +1665,15 @@ class JsonGenerator {
|
|
|
1661
1665
|
return undefined;
|
|
1662
1666
|
}
|
|
1663
1667
|
/**
|
|
1664
|
-
* 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.
|
|
1665
1669
|
* @param text
|
|
1666
1670
|
* @returns
|
|
1667
1671
|
*/
|
|
1668
|
-
toTextAstOrString(text, format
|
|
1672
|
+
toTextAstOrString(text, format) {
|
|
1669
1673
|
if (!text)
|
|
1670
1674
|
undefined;
|
|
1671
|
-
if (this.options.textAsPlainText) {
|
|
1672
|
-
return text;
|
|
1675
|
+
if (this.options.textAsPlainText || format === TextFormat.text) {
|
|
1676
|
+
return Breakscape.unbreakscape(text);
|
|
1673
1677
|
}
|
|
1674
1678
|
// Use the text parser to parse the text
|
|
1675
1679
|
const textAst = this.textParser.toAst(text, {
|