@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.
Files changed (209) hide show
  1. package/dist/browser/bitmark-parser-generator.min.js +1 -1
  2. package/dist/browser/bundle-report.html +2 -2
  3. package/dist/cjs/BitmarkParserGenerator.js +6 -3
  4. package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
  5. package/dist/cjs/ast/BaseBuilder.js +6 -5
  6. package/dist/cjs/ast/BaseBuilder.js.map +1 -1
  7. package/dist/cjs/ast/Builder.js +28 -34
  8. package/dist/cjs/ast/Builder.js.map +1 -1
  9. package/dist/cjs/ast/ResourceBuilder.js +2 -1
  10. package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
  11. package/dist/cjs/breakscaping/Breakscape.js +240 -0
  12. package/dist/cjs/breakscaping/Breakscape.js.map +1 -0
  13. package/dist/cjs/config/raw/cardSets.js +8 -8
  14. package/dist/cjs/config/raw/cardSets.js.map +1 -1
  15. package/dist/cjs/config/raw/groups.js +4 -0
  16. package/dist/cjs/config/raw/groups.js.map +1 -1
  17. package/dist/cjs/config/raw/properties.js +2 -19
  18. package/dist/cjs/config/raw/properties.js.map +1 -1
  19. package/dist/cjs/generated/build-info.js +1 -1
  20. package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +193 -73
  21. package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
  22. package/dist/cjs/generated/parser/text/text-peggy-parser.js +9 -9
  23. package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +1 -1
  24. package/dist/cjs/generator/bitmark/BitmarkGenerator.js +3 -11
  25. package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
  26. package/dist/cjs/generator/json/JsonGenerator.js +144 -140
  27. package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
  28. package/dist/cjs/generator/text/TextGenerator.js +13 -28
  29. package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/model/ast/BreakscapedString.js +3 -0
  32. package/dist/cjs/model/ast/BreakscapedString.js.map +1 -0
  33. package/dist/cjs/model/ast/NodeType.js +0 -1
  34. package/dist/cjs/model/ast/NodeType.js.map +1 -1
  35. package/dist/cjs/model/ast/StardardString.js +3 -0
  36. package/dist/cjs/model/ast/StardardString.js.map +1 -0
  37. package/dist/cjs/model/config/enum/PropertyConfigKey.js +1 -3
  38. package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
  39. package/dist/cjs/model/enum/PropertyAstKey.js +0 -1
  40. package/dist/cjs/model/enum/PropertyAstKey.js.map +1 -1
  41. package/dist/cjs/model/enum/PropertyJsonKey.js +1 -2
  42. package/dist/cjs/model/enum/PropertyJsonKey.js.map +1 -1
  43. package/dist/cjs/model/enum/PropertyTag.js +1 -3
  44. package/dist/cjs/model/enum/PropertyTag.js.map +1 -1
  45. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +8 -7
  46. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  47. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
  48. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  49. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  50. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +27 -22
  51. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  52. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  53. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  54. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  55. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +1 -1
  56. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  57. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -1
  58. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  59. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  60. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -1
  61. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  62. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +1 -1
  63. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  64. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
  65. package/dist/cjs/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
  66. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  67. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  68. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  69. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  70. package/dist/cjs/parser/json/JsonParser.js +108 -111
  71. package/dist/cjs/parser/json/JsonParser.js.map +1 -1
  72. package/dist/esm/BitmarkParserGenerator.js +7 -4
  73. package/dist/esm/BitmarkParserGenerator.js.map +1 -1
  74. package/dist/esm/ast/BaseBuilder.js +6 -5
  75. package/dist/esm/ast/BaseBuilder.js.map +1 -1
  76. package/dist/esm/ast/Builder.js +28 -34
  77. package/dist/esm/ast/Builder.js.map +1 -1
  78. package/dist/esm/ast/ResourceBuilder.js +2 -1
  79. package/dist/esm/ast/ResourceBuilder.js.map +1 -1
  80. package/dist/esm/breakscaping/Breakscape.js +237 -0
  81. package/dist/esm/breakscaping/Breakscape.js.map +1 -0
  82. package/dist/esm/config/raw/cardSets.js +8 -8
  83. package/dist/esm/config/raw/cardSets.js.map +1 -1
  84. package/dist/esm/config/raw/groups.js +4 -0
  85. package/dist/esm/config/raw/groups.js.map +1 -1
  86. package/dist/esm/config/raw/properties.js +2 -19
  87. package/dist/esm/config/raw/properties.js.map +1 -1
  88. package/dist/esm/generated/build-info.js +1 -1
  89. package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +193 -73
  90. package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
  91. package/dist/esm/generated/parser/text/text-peggy-parser.js +9 -8
  92. package/dist/esm/generated/parser/text/text-peggy-parser.js.map +1 -1
  93. package/dist/esm/generator/bitmark/BitmarkGenerator.js +3 -11
  94. package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
  95. package/dist/esm/generator/json/JsonGenerator.js +144 -140
  96. package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
  97. package/dist/esm/generator/text/TextGenerator.js +13 -26
  98. package/dist/esm/generator/text/TextGenerator.js.map +1 -1
  99. package/dist/esm/index.js.map +1 -1
  100. package/dist/esm/model/ast/BreakscapedString.js +2 -0
  101. package/dist/esm/model/ast/BreakscapedString.js.map +1 -0
  102. package/dist/esm/model/ast/NodeType.js +0 -1
  103. package/dist/esm/model/ast/NodeType.js.map +1 -1
  104. package/dist/esm/model/ast/StardardString.js +2 -0
  105. package/dist/esm/model/ast/StardardString.js.map +1 -0
  106. package/dist/esm/model/config/enum/PropertyConfigKey.js +1 -3
  107. package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
  108. package/dist/esm/model/enum/PropertyAstKey.js +0 -1
  109. package/dist/esm/model/enum/PropertyAstKey.js.map +1 -1
  110. package/dist/esm/model/enum/PropertyJsonKey.js +1 -2
  111. package/dist/esm/model/enum/PropertyJsonKey.js.map +1 -1
  112. package/dist/esm/model/enum/PropertyTag.js +1 -3
  113. package/dist/esm/model/enum/PropertyTag.js.map +1 -1
  114. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +8 -7
  115. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  116. package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
  117. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  118. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  119. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +27 -22
  120. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  121. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  122. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  123. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  124. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +1 -1
  125. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  126. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -1
  127. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  128. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  129. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -1
  130. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  131. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +1 -1
  132. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  133. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
  134. package/dist/esm/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
  135. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  136. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  137. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  138. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  139. package/dist/esm/parser/json/JsonParser.js +108 -111
  140. package/dist/esm/parser/json/JsonParser.js.map +1 -1
  141. package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
  142. package/dist/types/ast/BaseBuilder.d.ts +4 -3
  143. package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
  144. package/dist/types/ast/Builder.d.ts +158 -168
  145. package/dist/types/ast/Builder.d.ts.map +1 -1
  146. package/dist/types/ast/ResourceBuilder.d.ts +111 -110
  147. package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
  148. package/dist/types/breakscaping/Breakscape.d.ts +49 -0
  149. package/dist/types/breakscaping/Breakscape.d.ts.map +1 -0
  150. package/dist/types/config/raw/groups.d.ts.map +1 -1
  151. package/dist/types/config/raw/properties.d.ts.map +1 -1
  152. package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +1 -1
  153. package/dist/types/generated/parser/text/text-peggy-parser.d.ts +0 -1
  154. package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +1 -1
  155. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +1 -1
  156. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
  157. package/dist/types/generator/json/JsonGenerator.d.ts +8 -7
  158. package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
  159. package/dist/types/generator/text/TextGenerator.d.ts +11 -12
  160. package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
  161. package/dist/types/index.d.ts +1 -0
  162. package/dist/types/index.d.ts.map +1 -1
  163. package/dist/types/model/ast/BreakscapedString.d.ts +4 -0
  164. package/dist/types/model/ast/BreakscapedString.d.ts.map +1 -0
  165. package/dist/types/model/ast/NodeType.d.ts +0 -2
  166. package/dist/types/model/ast/NodeType.d.ts.map +1 -1
  167. package/dist/types/model/ast/Nodes.d.ts +98 -106
  168. package/dist/types/model/ast/Nodes.d.ts.map +1 -1
  169. package/dist/types/model/ast/StardardString.d.ts +4 -0
  170. package/dist/types/model/ast/StardardString.d.ts.map +1 -0
  171. package/dist/types/model/config/enum/ConfigKey.d.ts +2 -6
  172. package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
  173. package/dist/types/model/config/enum/PropertyConfigKey.d.ts +3 -9
  174. package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
  175. package/dist/types/model/enum/PropertyAstKey.d.ts +0 -2
  176. package/dist/types/model/enum/PropertyAstKey.d.ts.map +1 -1
  177. package/dist/types/model/enum/PropertyJsonKey.d.ts +1 -7
  178. package/dist/types/model/enum/PropertyJsonKey.d.ts.map +1 -1
  179. package/dist/types/model/enum/PropertyTag.d.ts +2 -6
  180. package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
  181. package/dist/types/model/json/BitJson.d.ts +2 -9
  182. package/dist/types/model/json/BitJson.d.ts.map +1 -1
  183. package/dist/types/model/json/BodyBitJson.d.ts +0 -2
  184. package/dist/types/model/json/BodyBitJson.d.ts.map +1 -1
  185. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
  186. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +36 -36
  187. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
  188. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +4 -3
  189. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
  190. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
  191. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
  192. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
  193. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
  194. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
  195. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
  196. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
  197. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
  198. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
  199. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
  200. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +1 -1
  201. package/dist/types/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.d.ts.map +1 -1
  202. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
  203. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
  204. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +2 -1
  205. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
  206. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
  207. package/dist/types/parser/json/JsonParser.d.ts +9 -0
  208. package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
  209. package/package.json +1 -1
@@ -22,6 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.JsonGenerator = void 0;
24
24
  const Ast_1 = require("../../ast/Ast");
25
+ const Breakscape_1 = require("../../breakscaping/Breakscape");
25
26
  const Config_1 = require("../../config/Config");
26
27
  const NodeType_1 = require("../../model/ast/NodeType");
27
28
  const BitType_1 = require("../../model/enum/BitType");
@@ -306,10 +307,10 @@ class JsonGenerator {
306
307
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
307
308
  return;
308
309
  if (item != null) {
309
- this.bitJson.item = this.toTextAstOrString(item);
310
+ this.bitJson.item = this.toTextAstOrString(item, TextFormat_1.TextFormat.bitmarkMinusMinus);
310
311
  }
311
312
  if (lead != null) {
312
- this.bitJson.lead = this.toTextAstOrString(lead);
313
+ this.bitJson.lead = this.toTextAstOrString(lead, TextFormat_1.TextFormat.bitmarkMinusMinus);
313
314
  }
314
315
  }
315
316
  // bitmarkAst -> bits -> bitsValue -> extraProperties
@@ -362,12 +363,12 @@ class JsonGenerator {
362
363
  const asText = bodyPart;
363
364
  const bodyTextPart = asText.data.bodyText;
364
365
  // Append the text part to the full text body
365
- fullBodyTextStr += bodyTextPart;
366
+ fullBodyTextStr = Breakscape_1.Breakscape.concatenate(fullBodyTextStr, bodyTextPart);
366
367
  }
367
368
  else {
368
369
  const { legacyPlaceholderKey, placeholderKey } = createPlaceholderKeys(placeholderIndex);
369
370
  // Append the placeholder to the full text body
370
- fullBodyTextStr += plainText ? legacyPlaceholderKey : placeholderKey;
371
+ fullBodyTextStr = Breakscape_1.Breakscape.concatenate(fullBodyTextStr, plainText ? legacyPlaceholderKey : placeholderKey);
371
372
  placeholderIndex++;
372
373
  }
373
374
  }
@@ -434,7 +435,7 @@ class JsonGenerator {
434
435
  // Ignore elements that are not at the bit level as they are handled elsewhere as quizzes
435
436
  // if (parent?.key !== NodeType.bitsValue) return;
436
437
  if (elements && elements.length > 0) {
437
- this.bitJson.elements = elements;
438
+ this.bitJson.elements = Breakscape_1.Breakscape.unbreakscape(elements);
438
439
  }
439
440
  }
440
441
  // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue
@@ -448,7 +449,7 @@ class JsonGenerator {
448
449
  if (flashcards) {
449
450
  for (const c of flashcards) {
450
451
  // Create the flashcard
451
- const flashcardJson = Object.assign(Object.assign({ question: (_a = c.question) !== null && _a !== void 0 ? _a : '', answer: (_b = c.answer) !== null && _b !== void 0 ? _b : '', alternativeAnswers: (_c = c.alternativeAnswers) !== null && _c !== void 0 ? _c : [] }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
452
+ const flashcardJson = Object.assign(Object.assign({ question: (_a = Breakscape_1.Breakscape.unbreakscape(c.question)) !== null && _a !== void 0 ? _a : '', answer: (_b = Breakscape_1.Breakscape.unbreakscape(c.answer)) !== null && _b !== void 0 ? _b : '', alternativeAnswers: (_c = Breakscape_1.Breakscape.unbreakscape(c.alternativeAnswers)) !== null && _c !== void 0 ? _c : [] }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
452
453
  defaultExample: c.isDefaultExample,
453
454
  isBoolean: true,
454
455
  }));
@@ -470,7 +471,7 @@ class JsonGenerator {
470
471
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.cardNode)
471
472
  return;
472
473
  if (statement) {
473
- this.bitJson.statement = (_a = statement.text) !== null && _a !== void 0 ? _a : '';
474
+ this.bitJson.statement = (_a = Breakscape_1.Breakscape.unbreakscape(statement.text)) !== null && _a !== void 0 ? _a : '';
474
475
  this.bitJson.isCorrect = (_b = statement.isCorrect) !== null && _b !== void 0 ? _b : false;
475
476
  }
476
477
  }
@@ -485,7 +486,7 @@ class JsonGenerator {
485
486
  if (statements) {
486
487
  for (const s of statements) {
487
488
  // Create the statement
488
- const statementJson = Object.assign(Object.assign({ statement: (_a = s.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!s.isCorrect }, this.toItemLeadHintInstruction(s)), this.toExample(s, {
489
+ const statementJson = Object.assign(Object.assign({ statement: (_a = Breakscape_1.Breakscape.unbreakscape(s.text)) !== null && _a !== void 0 ? _a : '', isCorrect: !!s.isCorrect }, this.toItemLeadHintInstruction(s)), this.toExample(s, {
489
490
  defaultExample: !!s.isCorrect,
490
491
  isBoolean: true,
491
492
  }));
@@ -517,7 +518,7 @@ class JsonGenerator {
517
518
  if (choices) {
518
519
  for (const c of choices) {
519
520
  // Create the choice
520
- const choiceJson = Object.assign(Object.assign({ choice: (_a = c.text) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = c.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
521
+ const choiceJson = Object.assign(Object.assign({ choice: (_a = Breakscape_1.Breakscape.unbreakscape(c.text)) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = c.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
521
522
  defaultExample: !!c.isCorrect,
522
523
  isBoolean: true,
523
524
  }));
@@ -543,7 +544,7 @@ class JsonGenerator {
543
544
  if (responses) {
544
545
  for (const r of responses) {
545
546
  // Create the response
546
- const responseJson = Object.assign(Object.assign({ response: (_a = r.text) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = r.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(r)), this.toExample(r, {
547
+ const responseJson = Object.assign(Object.assign({ response: (_a = Breakscape_1.Breakscape.unbreakscape(r.text)) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = r.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(r)), this.toExample(r, {
547
548
  defaultExample: !!r.isCorrect,
548
549
  isBoolean: true,
549
550
  }));
@@ -569,7 +570,7 @@ class JsonGenerator {
569
570
  if (q.choices) {
570
571
  for (const c of q.choices) {
571
572
  // Create the choice
572
- const choiceJson = Object.assign(Object.assign({ choice: (_a = c.text) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = c.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
573
+ const choiceJson = Object.assign(Object.assign({ choice: (_a = Breakscape_1.Breakscape.unbreakscape(c.text)) !== null && _a !== void 0 ? _a : '', isCorrect: (_b = c.isCorrect) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
573
574
  defaultExample: !!c.isCorrect,
574
575
  isBoolean: true,
575
576
  }));
@@ -584,7 +585,7 @@ class JsonGenerator {
584
585
  if (q.responses) {
585
586
  for (const r of q.responses) {
586
587
  // Create the choice
587
- const responseJson = Object.assign(Object.assign({ response: (_d = r.text) !== null && _d !== void 0 ? _d : '', isCorrect: (_e = r.isCorrect) !== null && _e !== void 0 ? _e : false }, this.toItemLeadHintInstruction(r)), this.toExample(r, {
588
+ const responseJson = Object.assign(Object.assign({ response: (_d = Breakscape_1.Breakscape.unbreakscape(r.text)) !== null && _d !== void 0 ? _d : '', isCorrect: (_e = r.isCorrect) !== null && _e !== void 0 ? _e : false }, this.toItemLeadHintInstruction(r)), this.toExample(r, {
588
589
  defaultExample: !!r.isCorrect,
589
590
  isBoolean: true,
590
591
  }));
@@ -619,28 +620,28 @@ class JsonGenerator {
619
620
  return false;
620
621
  // Create the heading
621
622
  const headingJson = {
622
- forKeys: (_a = heading.forKeys) !== null && _a !== void 0 ? _a : '',
623
+ forKeys: (_a = Breakscape_1.Breakscape.unbreakscape(heading.forKeys)) !== null && _a !== void 0 ? _a : '',
623
624
  };
624
625
  // TODO: Should probably check wether bit is a match or a matrix and add a string for match and array for matrix
625
626
  if (Array.isArray(heading.forValues)) {
626
627
  if (heading.forValues.length > 1) {
627
- headingJson.forValues = heading.forValues;
628
+ headingJson.forValues = Breakscape_1.Breakscape.unbreakscape(heading.forValues);
628
629
  }
629
630
  else if (heading.forValues.length === 1) {
630
- headingJson.forValues = heading.forValues[0];
631
+ headingJson.forValues = Breakscape_1.Breakscape.unbreakscape(heading.forValues[0]);
631
632
  }
632
633
  else {
633
- headingJson.forValues = heading.forValues;
634
+ headingJson.forValues = Breakscape_1.Breakscape.unbreakscape(heading.forValues);
634
635
  }
635
636
  }
636
637
  else {
637
- headingJson.forValues = (_b = heading.forValues) !== null && _b !== void 0 ? _b : '';
638
+ headingJson.forValues = (_b = Breakscape_1.Breakscape.unbreakscape(heading.forValues)) !== null && _b !== void 0 ? _b : '';
638
639
  }
639
640
  this.bitJson.heading = headingJson;
640
641
  }
641
642
  // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs
642
643
  enter_pairs(node, _parent, _route) {
643
- var _a, _b, _c, _d, _e;
644
+ var _a, _b, _c, _d;
644
645
  const pairs = node.value;
645
646
  const pairsJson = [];
646
647
  if (pairs) {
@@ -648,12 +649,12 @@ class JsonGenerator {
648
649
  // Get default example
649
650
  const defaultExample = Array.isArray(p.values) && p.values.length > 0 && p.values[0];
650
651
  // Create the question
651
- const pairJson = Object.assign(Object.assign(Object.assign({ key: (_a = p.key) !== null && _a !== void 0 ? _a : '', keyAudio: p.keyAudio ? this.addAudioResource(p.keyAudio) : undefined, keyImage: p.keyImage ? this.addImageResource(p.keyImage) : undefined, values: (_b = p.values) !== null && _b !== void 0 ? _b : [] }, this.toItemLeadHintInstruction(p)), { isCaseSensitive: (_c = p.isCaseSensitive) !== null && _c !== void 0 ? _c : true, isLongAnswer: (_d = !p.isShortAnswer) !== null && _d !== void 0 ? _d : false }), this.toExample(p, {
652
+ const pairJson = Object.assign(Object.assign(Object.assign({ key: (_a = Breakscape_1.Breakscape.unbreakscape(p.key)) !== null && _a !== void 0 ? _a : '', keyAudio: p.keyAudio ? this.addAudioResource(p.keyAudio) : undefined, keyImage: p.keyImage ? this.addImageResource(p.keyImage) : undefined, values: (_b = Breakscape_1.Breakscape.unbreakscape(p.values)) !== null && _b !== void 0 ? _b : [] }, this.toItemLeadHintInstruction(p)), { isCaseSensitive: (_c = p.isCaseSensitive) !== null && _c !== void 0 ? _c : true }), this.toExample(p, {
652
653
  defaultExample,
653
654
  isBoolean: false,
654
655
  }));
655
656
  // Delete unwanted properties
656
- if (((_e = p.itemLead) === null || _e === void 0 ? void 0 : _e.lead) == null)
657
+ if (((_d = p.itemLead) === null || _d === void 0 ? void 0 : _d.lead) == null)
657
658
  delete pairJson.lead;
658
659
  if (pairJson.key) {
659
660
  delete pairJson.keyAudio;
@@ -676,7 +677,7 @@ class JsonGenerator {
676
677
  }
677
678
  // bitmarkAst -> bits -> bitsValue -> cardNode -> matrix
678
679
  enter_matrix(node, _parent, _route) {
679
- var _a, _b, _c, _d, _e, _f, _g;
680
+ var _a, _b, _c, _d, _e, _f;
680
681
  const matrix = node.value;
681
682
  const matrixJsonArray = [];
682
683
  if (matrix) {
@@ -688,12 +689,12 @@ class JsonGenerator {
688
689
  // Get default example
689
690
  const defaultExample = Array.isArray(c.values) && c.values.length > 0 && c.values[0];
690
691
  // Create the choice
691
- const matrixCellJson = Object.assign(Object.assign({ values: (_a = c.values) !== null && _a !== void 0 ? _a : [] }, this.toItemLeadHintInstruction(c)), this.toExample(c, {
692
+ const matrixCellJson = Object.assign(Object.assign(Object.assign({ values: (_a = Breakscape_1.Breakscape.unbreakscape(c.values)) !== null && _a !== void 0 ? _a : [] }, this.toItemLeadHintInstruction(c)), { isCaseSensitive: (_b = c.isCaseSensitive) !== null && _b !== void 0 ? _b : true }), this.toExample(c, {
692
693
  defaultExample,
693
694
  isBoolean: false,
694
695
  }));
695
696
  // Delete unwanted properties
696
- if (((_b = c.itemLead) === null || _b === void 0 ? void 0 : _b.lead) == null)
697
+ if (((_c = c.itemLead) === null || _c === void 0 ? void 0 : _c.lead) == null)
697
698
  delete matrixCellJson.lead;
698
699
  if (c.hint == null)
699
700
  delete matrixCellJson.hint;
@@ -701,11 +702,11 @@ class JsonGenerator {
701
702
  }
702
703
  }
703
704
  // Create the matrix
704
- const matrixJson = Object.assign(Object.assign({ key: (_c = m.key) !== null && _c !== void 0 ? _c : '', cells: matrixCellsJson !== null && matrixCellsJson !== void 0 ? matrixCellsJson : [] }, this.toItemLeadHintInstruction(m)), {
705
+ const matrixJson = Object.assign(Object.assign({ key: (_d = Breakscape_1.Breakscape.unbreakscape(m.key)) !== null && _d !== void 0 ? _d : '', cells: matrixCellsJson !== null && matrixCellsJson !== void 0 ? matrixCellsJson : [] }, this.toItemLeadHintInstruction(m)), {
705
706
  // ...this.toExample(m.example, m.isExample),
706
- isCaseSensitive: (_d = m.isCaseSensitive) !== null && _d !== void 0 ? _d : true, isLongAnswer: (_e = !m.isShortAnswer) !== null && _e !== void 0 ? _e : false, isExample: (_f = m.isExample) !== null && _f !== void 0 ? _f : false });
707
+ isExample: (_e = m.isExample) !== null && _e !== void 0 ? _e : false });
707
708
  // Delete unwanted properties
708
- if (((_g = m.itemLead) === null || _g === void 0 ? void 0 : _g.lead) == null)
709
+ if (((_f = m.itemLead) === null || _f === void 0 ? void 0 : _f.lead) == null)
709
710
  delete matrixJson.lead;
710
711
  if (m.instruction == null)
711
712
  delete matrixJson.instruction;
@@ -718,20 +719,18 @@ class JsonGenerator {
718
719
  }
719
720
  // bitmarkAst -> bits -> bitsValue -> cardNode -> questions
720
721
  enter_questions(node, _parent, _route) {
721
- var _a, _b, _c, _d, _e;
722
+ var _a, _b, _c, _d;
722
723
  const questions = node.value;
723
724
  const questionsJson = [];
724
725
  if (questions) {
725
726
  for (const q of questions) {
726
727
  // Create the question
727
- const questionJson = Object.assign(Object.assign(Object.assign({ question: (_a = q.question) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = ArrayUtils_1.ArrayUtils.asSingle(q.partialAnswer)) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = q.sampleSolution) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(q)), {
728
- // isCaseSensitive: q.isCaseSensitive ?? true,
729
- isShortAnswer: (_d = q.isShortAnswer) !== null && _d !== void 0 ? _d : true, reasonableNumOfChars: q.reasonableNumOfChars }), this.toExample(q, {
728
+ const questionJson = Object.assign(Object.assign(Object.assign({ question: (_a = Breakscape_1.Breakscape.unbreakscape(q.question)) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = Breakscape_1.Breakscape.unbreakscape(ArrayUtils_1.ArrayUtils.asSingle(q.partialAnswer))) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = Breakscape_1.Breakscape.unbreakscape(q.sampleSolution)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(q)), { reasonableNumOfChars: q.reasonableNumOfChars }), this.toExample(q, {
730
729
  defaultExample: q.sampleSolution || '',
731
730
  isBoolean: false,
732
731
  }));
733
732
  // Delete unwanted properties
734
- if (((_e = q.itemLead) === null || _e === void 0 ? void 0 : _e.lead) == null)
733
+ if (((_d = q.itemLead) === null || _d === void 0 ? void 0 : _d.lead) == null)
735
734
  delete questionJson.lead;
736
735
  questionsJson.push(questionJson);
737
736
  }
@@ -751,7 +750,7 @@ class JsonGenerator {
751
750
  if (botResponses) {
752
751
  for (const r of botResponses) {
753
752
  // Create the response
754
- const responseJson = Object.assign({ response: (_a = r.response) !== null && _a !== void 0 ? _a : '', reaction: (_b = r.reaction) !== null && _b !== void 0 ? _b : '', feedback: (_c = r.feedback) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(r));
753
+ const responseJson = Object.assign({ response: (_a = Breakscape_1.Breakscape.unbreakscape(r.response)) !== null && _a !== void 0 ? _a : '', reaction: (_b = Breakscape_1.Breakscape.unbreakscape(r.reaction)) !== null && _b !== void 0 ? _b : '', feedback: (_c = Breakscape_1.Breakscape.unbreakscape(r.feedback)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(r));
755
754
  // Delete unwanted properties
756
755
  if (((_d = r.itemLead) === null || _d === void 0 ? void 0 : _d.lead) == null)
757
756
  delete responseJson.lead;
@@ -823,11 +822,11 @@ class JsonGenerator {
823
822
  //
824
823
  // bitmarkAst -> bits -> bitsValue -> title
825
824
  leaf_title(node, _parent, _route) {
826
- this.bitJson.title = this.toTextAstOrString(node.value);
825
+ this.bitJson.title = this.toTextAstOrString(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
827
826
  }
828
827
  // bitmarkAst -> bits -> bitsValue -> subtitle
829
828
  leaf_subtitle(node, _parent, _route) {
830
- this.bitJson.subtitle = this.toTextAstOrString(node.value);
829
+ this.bitJson.subtitle = this.toTextAstOrString(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
831
830
  }
832
831
  // // bitmarkAst -> bits -> bitsValue -> level
833
832
  leaf_level(node, _parent, _route) {
@@ -861,7 +860,7 @@ class JsonGenerator {
861
860
  // Ignore hint that is not at the bit level as it are handled elsewhere
862
861
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
863
862
  return;
864
- this.bitJson.hint = this.toTextAstOrString(hint);
863
+ this.bitJson.hint = this.toTextAstOrString(hint, TextFormat_1.TextFormat.bitmarkMinusMinus);
865
864
  }
866
865
  // bitmarkAst -> bits -> bitsValue -> * -> instruction
867
866
  leaf_instruction(node, parent, _route) {
@@ -869,12 +868,12 @@ class JsonGenerator {
869
868
  // Ignore instruction that is not at the bit level as it are handled elsewhere
870
869
  if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
871
870
  return;
872
- this.bitJson.instruction = this.toTextAstOrString(instruction);
871
+ this.bitJson.instruction = this.toTextAstOrString(instruction, TextFormat_1.TextFormat.bitmarkMinusMinus);
873
872
  }
874
873
  // bitmarkAst -> bits -> footer -> footerText
875
874
  leaf_footerText(node, _parent, _route) {
876
875
  const footer = node.value;
877
- this.bitJson.footer = this.toTextAstOrString(footer);
876
+ this.bitJson.footer = this.toTextAstOrString(footer, TextFormat_1.TextFormat.bitmarkMinusMinus);
878
877
  }
879
878
  // bitmarkAst -> bits -> bitsValue -> markup
880
879
  leaf_markup(node, _parent, _route) {
@@ -983,7 +982,7 @@ class JsonGenerator {
983
982
  const gapJson = Object.assign(Object.assign(Object.assign(Object.assign({ type: 'gap' }, this.toItemLeadHintInstruction(data)), { isCaseSensitive: (_a = data.isCaseSensitive) !== null && _a !== void 0 ? _a : true }), this.toExample(data, {
984
983
  defaultExample,
985
984
  isBoolean: false,
986
- })), { solutions: data.solutions });
985
+ })), { solutions: Breakscape_1.Breakscape.unbreakscape(data.solutions) });
987
986
  // Remove unwanted properties
988
987
  if (!gapJson.lead)
989
988
  delete gapJson.lead;
@@ -992,7 +991,7 @@ class JsonGenerator {
992
991
  createMarkJson(mark) {
993
992
  const data = mark.data;
994
993
  // Create the mark
995
- const markJson = Object.assign(Object.assign({ type: 'mark', solution: data.solution, mark: data.mark }, this.toItemLeadHintInstruction(data)), this.toExample(data, {
994
+ const markJson = Object.assign(Object.assign({ type: 'mark', solution: Breakscape_1.Breakscape.unbreakscape(data.solution), mark: Breakscape_1.Breakscape.unbreakscape(data.mark) }, this.toItemLeadHintInstruction(data)), this.toExample(data, {
996
995
  defaultExample: true,
997
996
  isBoolean: true,
998
997
  }));
@@ -1007,7 +1006,7 @@ class JsonGenerator {
1007
1006
  // Create the select options
1008
1007
  const options = [];
1009
1008
  for (const option of data.options) {
1010
- const optionJson = Object.assign(Object.assign({ text: option.text, isCorrect: (_a = option.isCorrect) !== null && _a !== void 0 ? _a : false }, this.toItemLeadHintInstruction(option)), this.toExample(option, {
1009
+ const optionJson = Object.assign(Object.assign({ text: Breakscape_1.Breakscape.unbreakscape(option.text), isCorrect: (_a = option.isCorrect) !== null && _a !== void 0 ? _a : false }, this.toItemLeadHintInstruction(option)), this.toExample(option, {
1011
1010
  defaultExample: !!option.isCorrect,
1012
1011
  isBoolean: true,
1013
1012
  }));
@@ -1018,12 +1017,10 @@ class JsonGenerator {
1018
1017
  delete optionJson.lead;
1019
1018
  if (!optionJson.instruction)
1020
1019
  delete optionJson.instruction;
1021
- if (!optionJson.isCaseSensitive)
1022
- delete optionJson.isCaseSensitive;
1023
1020
  options.push(optionJson);
1024
1021
  }
1025
1022
  // Create the select
1026
- const selectJson = Object.assign(Object.assign({ type: 'select', prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_d = data.isExample) !== null && _d !== void 0 ? _d : false, options });
1023
+ const selectJson = Object.assign(Object.assign({ type: 'select', prefix: (_b = Breakscape_1.Breakscape.unbreakscape(data.prefix)) !== null && _b !== void 0 ? _b : '', postfix: (_c = Breakscape_1.Breakscape.unbreakscape(data.postfix)) !== null && _c !== void 0 ? _c : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_d = data.isExample) !== null && _d !== void 0 ? _d : false, options });
1027
1024
  // Remove unwanted properties
1028
1025
  if (!selectJson.lead)
1029
1026
  delete selectJson.lead;
@@ -1035,7 +1032,7 @@ class JsonGenerator {
1035
1032
  // Create the highlight options
1036
1033
  const texts = [];
1037
1034
  for (const text of data.texts) {
1038
- const textJson = Object.assign(Object.assign({ text: text.text, isCorrect: (_a = text.isCorrect) !== null && _a !== void 0 ? _a : false, isHighlighted: (_b = text.isHighlighted) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(text)), this.toExample(text, {
1035
+ const textJson = Object.assign(Object.assign({ text: Breakscape_1.Breakscape.unbreakscape(text.text), isCorrect: (_a = text.isCorrect) !== null && _a !== void 0 ? _a : false, isHighlighted: (_b = text.isHighlighted) !== null && _b !== void 0 ? _b : false }, this.toItemLeadHintInstruction(text)), this.toExample(text, {
1039
1036
  defaultExample: !!text.isCorrect,
1040
1037
  isBoolean: true,
1041
1038
  }));
@@ -1046,12 +1043,10 @@ class JsonGenerator {
1046
1043
  delete textJson.lead;
1047
1044
  if (!textJson.hint)
1048
1045
  delete textJson.hint;
1049
- if (!textJson.isCaseSensitive)
1050
- delete textJson.isCaseSensitive;
1051
1046
  texts.push(textJson);
1052
1047
  }
1053
1048
  // Create the select
1054
- const highlightJson = Object.assign(Object.assign({ type: 'highlight', prefix: (_c = data.prefix) !== null && _c !== void 0 ? _c : '', postfix: (_d = data.postfix) !== null && _d !== void 0 ? _d : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_e = data.isExample) !== null && _e !== void 0 ? _e : false, texts });
1049
+ const highlightJson = Object.assign(Object.assign({ type: 'highlight', prefix: (_c = Breakscape_1.Breakscape.unbreakscape(data.prefix)) !== null && _c !== void 0 ? _c : '', postfix: (_d = Breakscape_1.Breakscape.unbreakscape(data.postfix)) !== null && _d !== void 0 ? _d : '' }, this.toItemLeadHintInstruction(data)), { isExample: (_e = data.isExample) !== null && _e !== void 0 ? _e : false, texts });
1055
1050
  // Remove unwanted properties
1056
1051
  if (!highlightJson.lead)
1057
1052
  delete highlightJson.lead;
@@ -1187,29 +1182,29 @@ class JsonGenerator {
1187
1182
  resource = {
1188
1183
  type: ResourceTag_1.ResourceTag.image,
1189
1184
  typeAlias: ResourceTag_1.ResourceTag.image,
1190
- value,
1185
+ value: value,
1191
1186
  format: UrlUtils_1.UrlUtils.fileExtensionFromUrl(value),
1192
1187
  provider: UrlUtils_1.UrlUtils.domainFromUrl(value),
1193
1188
  };
1194
1189
  }
1195
1190
  resource = resource; // Keep TS compiler happy
1196
1191
  if (resource.format != null)
1197
- resourceJson.format = resource.format;
1192
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1198
1193
  if (resource.provider != null)
1199
- resourceJson.provider = resource.provider;
1194
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1200
1195
  if (resource.value != null)
1201
- resourceJson.src = resource.value;
1196
+ resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
1202
1197
  if (resource.src1x != null)
1203
- resourceJson.src1x = resource.src1x;
1198
+ resourceJson.src1x = Breakscape_1.Breakscape.unbreakscape(resource.src1x);
1204
1199
  if (resource.src2x != null)
1205
- resourceJson.src2x = resource.src2x;
1200
+ resourceJson.src2x = Breakscape_1.Breakscape.unbreakscape(resource.src2x);
1206
1201
  if (resource.src3x != null)
1207
- resourceJson.src3x = resource.src3x;
1202
+ resourceJson.src3x = Breakscape_1.Breakscape.unbreakscape(resource.src3x);
1208
1203
  if (resource.src4x != null)
1209
- resourceJson.src4x = resource.src4x;
1204
+ resourceJson.src4x = Breakscape_1.Breakscape.unbreakscape(resource.src4x);
1210
1205
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1211
1206
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1212
- resourceJson.alt = (_c = resource.alt) !== null && _c !== void 0 ? _c : '';
1207
+ resourceJson.alt = (_c = Breakscape_1.Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
1213
1208
  this.addGenericResourceProperties(resource, resourceJson);
1214
1209
  return resourceJson;
1215
1210
  }
@@ -1228,33 +1223,33 @@ class JsonGenerator {
1228
1223
  }
1229
1224
  resource = resource; // Keep TS compiler happy
1230
1225
  if (resource.format != null)
1231
- resourceJson.format = resource.format;
1226
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1232
1227
  if (resource.provider != null)
1233
- resourceJson.provider = resource.provider;
1228
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1234
1229
  if (resource.value != null)
1235
- resourceJson.url = resource.value;
1230
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1236
1231
  if (resource.src1x != null)
1237
- resourceJson.src1x = resource.src1x;
1232
+ resourceJson.src1x = Breakscape_1.Breakscape.unbreakscape(resource.src1x);
1238
1233
  if (resource.src2x != null)
1239
- resourceJson.src2x = resource.src2x;
1234
+ resourceJson.src2x = Breakscape_1.Breakscape.unbreakscape(resource.src2x);
1240
1235
  if (resource.src3x != null)
1241
- resourceJson.src3x = resource.src3x;
1236
+ resourceJson.src3x = Breakscape_1.Breakscape.unbreakscape(resource.src3x);
1242
1237
  if (resource.src4x != null)
1243
- resourceJson.src4x = resource.src4x;
1238
+ resourceJson.src4x = Breakscape_1.Breakscape.unbreakscape(resource.src4x);
1244
1239
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1245
1240
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1246
- resourceJson.alt = (_c = resource.alt) !== null && _c !== void 0 ? _c : '';
1241
+ resourceJson.alt = (_c = Breakscape_1.Breakscape.unbreakscape(resource.alt)) !== null && _c !== void 0 ? _c : '';
1247
1242
  this.addGenericResourceProperties(resource, resourceJson);
1248
1243
  return resourceJson;
1249
1244
  }
1250
1245
  addAudioResource(resource) {
1251
1246
  const resourceJson = {};
1252
1247
  if (resource.format != null)
1253
- resourceJson.format = resource.format;
1248
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1254
1249
  if (resource.provider != null)
1255
- resourceJson.provider = resource.provider;
1250
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1256
1251
  if (resource.value != null)
1257
- resourceJson.src = resource.value;
1252
+ resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
1258
1253
  if (resource.duration != null)
1259
1254
  resourceJson.duration = resource.duration;
1260
1255
  if (resource.mute != null)
@@ -1267,11 +1262,11 @@ class JsonGenerator {
1267
1262
  addAudioEmbedResource(resource) {
1268
1263
  const resourceJson = {};
1269
1264
  if (resource.format != null)
1270
- resourceJson.format = resource.format;
1265
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1271
1266
  if (resource.provider != null)
1272
- resourceJson.provider = resource.provider;
1267
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1273
1268
  if (resource.value != null)
1274
- resourceJson.src = resource.value;
1269
+ resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
1275
1270
  if (resource.duration != null)
1276
1271
  resourceJson.duration = resource.duration;
1277
1272
  if (resource.mute != null)
@@ -1284,11 +1279,11 @@ class JsonGenerator {
1284
1279
  addAudioLinkResource(resource) {
1285
1280
  const resourceJson = {};
1286
1281
  if (resource.format != null)
1287
- resourceJson.format = resource.format;
1282
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1288
1283
  if (resource.provider != null)
1289
- resourceJson.provider = resource.provider;
1284
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1290
1285
  if (resource.value != null)
1291
- resourceJson.url = resource.value;
1286
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1292
1287
  if (resource.duration != null)
1293
1288
  resourceJson.duration = resource.duration;
1294
1289
  if (resource.mute != null)
@@ -1302,11 +1297,11 @@ class JsonGenerator {
1302
1297
  var _a, _b;
1303
1298
  const resourceJson = {};
1304
1299
  if (resource.format != null)
1305
- resourceJson.format = resource.format;
1300
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1306
1301
  if (resource.provider != null)
1307
- resourceJson.provider = resource.provider;
1302
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1308
1303
  if (resource.value != null)
1309
- resourceJson.src = resource.value;
1304
+ resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
1310
1305
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1311
1306
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1312
1307
  if (resource.duration != null)
@@ -1320,7 +1315,7 @@ class JsonGenerator {
1320
1315
  if (resource.showSubtitles != null)
1321
1316
  resourceJson.showSubtitles = resource.showSubtitles;
1322
1317
  if (resource.alt != null)
1323
- resourceJson.alt = resource.alt;
1318
+ resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1324
1319
  if (resource.posterImage != null)
1325
1320
  resourceJson.posterImage = this.addImageResource(resource.posterImage);
1326
1321
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
@@ -1336,11 +1331,11 @@ class JsonGenerator {
1336
1331
  var _a, _b;
1337
1332
  const resourceJson = {};
1338
1333
  if (resource.format != null)
1339
- resourceJson.format = resource.format;
1334
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1340
1335
  if (resource.provider != null)
1341
- resourceJson.provider = resource.provider;
1336
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1342
1337
  if (resource.value != null)
1343
- resourceJson.src = resource.value;
1338
+ resourceJson.src = Breakscape_1.Breakscape.unbreakscape(resource.value);
1344
1339
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1345
1340
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1346
1341
  if (resource.duration != null)
@@ -1354,7 +1349,7 @@ class JsonGenerator {
1354
1349
  if (resource.showSubtitles != null)
1355
1350
  resourceJson.showSubtitles = resource.showSubtitles;
1356
1351
  if (resource.alt != null)
1357
- resourceJson.alt = resource.alt;
1352
+ resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1358
1353
  if (resource.posterImage != null)
1359
1354
  resourceJson.posterImage = this.addImageResource(resource.posterImage);
1360
1355
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
@@ -1370,11 +1365,11 @@ class JsonGenerator {
1370
1365
  var _a, _b;
1371
1366
  const resourceJson = {};
1372
1367
  if (resource.format != null)
1373
- resourceJson.format = resource.format;
1368
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1374
1369
  if (resource.provider != null)
1375
- resourceJson.provider = resource.provider;
1370
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1376
1371
  if (resource.value != null)
1377
- resourceJson.url = resource.value;
1372
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1378
1373
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1379
1374
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1380
1375
  if (resource.duration != null)
@@ -1388,7 +1383,7 @@ class JsonGenerator {
1388
1383
  if (resource.showSubtitles != null)
1389
1384
  resourceJson.showSubtitles = resource.showSubtitles;
1390
1385
  if (resource.alt != null)
1391
- resourceJson.alt = resource.alt;
1386
+ resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1392
1387
  if (resource.posterImage != null)
1393
1388
  resourceJson.posterImage = this.addImageResource(resource.posterImage);
1394
1389
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
@@ -1404,11 +1399,11 @@ class JsonGenerator {
1404
1399
  var _a, _b;
1405
1400
  const resourceJson = {};
1406
1401
  if (resource.format != null)
1407
- resourceJson.format = resource.format;
1402
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1408
1403
  if (resource.provider != null)
1409
- resourceJson.provider = resource.provider;
1404
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1410
1405
  if (resource.value != null)
1411
- resourceJson.url = resource.value;
1406
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1412
1407
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1413
1408
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1414
1409
  if (resource.duration != null)
@@ -1422,7 +1417,7 @@ class JsonGenerator {
1422
1417
  if (resource.showSubtitles != null)
1423
1418
  resourceJson.showSubtitles = resource.showSubtitles;
1424
1419
  if (resource.alt != null)
1425
- resourceJson.alt = resource.alt;
1420
+ resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1426
1421
  if (resource.posterImage != null)
1427
1422
  resourceJson.posterImage = this.addImageResource(resource.posterImage);
1428
1423
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
@@ -1438,11 +1433,11 @@ class JsonGenerator {
1438
1433
  var _a, _b;
1439
1434
  const resourceJson = {};
1440
1435
  if (resource.format != null)
1441
- resourceJson.format = resource.format;
1436
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1442
1437
  if (resource.provider != null)
1443
- resourceJson.provider = resource.provider;
1438
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1444
1439
  if (resource.value != null)
1445
- resourceJson.url = resource.value;
1440
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1446
1441
  resourceJson.width = (_a = resource.width) !== null && _a !== void 0 ? _a : null;
1447
1442
  resourceJson.height = (_b = resource.height) !== null && _b !== void 0 ? _b : null;
1448
1443
  if (resource.duration != null)
@@ -1456,7 +1451,7 @@ class JsonGenerator {
1456
1451
  if (resource.showSubtitles != null)
1457
1452
  resourceJson.showSubtitles = resource.showSubtitles;
1458
1453
  if (resource.alt != null)
1459
- resourceJson.alt = resource.alt;
1454
+ resourceJson.alt = Breakscape_1.Breakscape.unbreakscape(resource.alt);
1460
1455
  if (resource.posterImage != null)
1461
1456
  resourceJson.posterImage = this.addImageResource(resource.posterImage);
1462
1457
  if (resource.thumbnails != null && resource.thumbnails.length > 0) {
@@ -1471,78 +1466,78 @@ class JsonGenerator {
1471
1466
  addArticleResource(resource) {
1472
1467
  const resourceJson = {};
1473
1468
  if (resource.format != null)
1474
- resourceJson.format = resource.format;
1469
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1475
1470
  if (resource.provider != null)
1476
- resourceJson.provider = resource.provider;
1471
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1477
1472
  if (resource.value != null)
1478
- resourceJson.body = resource.value;
1479
- // if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
1473
+ resourceJson.body = Breakscape_1.Breakscape.unbreakscape(resource.value);
1474
+ // if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
1480
1475
  this.addGenericResourceProperties(resource, resourceJson);
1481
1476
  return resourceJson;
1482
1477
  }
1483
1478
  addDocumentResource(resource) {
1484
1479
  const resourceJson = {};
1485
1480
  if (resource.format != null)
1486
- resourceJson.format = resource.format;
1481
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1487
1482
  if (resource.provider != null)
1488
- resourceJson.provider = resource.provider;
1483
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1489
1484
  if (resource.value != null)
1490
- resourceJson.url = resource.value;
1491
- // if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
1485
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1486
+ // if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
1492
1487
  this.addGenericResourceProperties(resource, resourceJson);
1493
1488
  return resourceJson;
1494
1489
  }
1495
1490
  addDocumentEmbedResource(resource) {
1496
1491
  const resourceJson = {};
1497
1492
  if (resource.format != null)
1498
- resourceJson.format = resource.format;
1493
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1499
1494
  if (resource.provider != null)
1500
- resourceJson.provider = resource.provider;
1495
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1501
1496
  if (resource.value != null)
1502
- resourceJson.url = resource.value;
1503
- // if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
1497
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1498
+ // if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
1504
1499
  this.addGenericResourceProperties(resource, resourceJson);
1505
1500
  return resourceJson;
1506
1501
  }
1507
1502
  addDocumentLinkResource(resource) {
1508
1503
  const resourceJson = {};
1509
1504
  if (resource.format != null)
1510
- resourceJson.format = resource.format;
1505
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1511
1506
  if (resource.provider != null)
1512
- resourceJson.provider = resource.provider;
1507
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1513
1508
  if (resource.value != null)
1514
- resourceJson.url = resource.value;
1515
- // if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
1509
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1510
+ // if (resource.href != null) resourceJson.href = BreakscapeUtils.unbreakscape(resource.href); // It is never used (and doesn't exist in the AST model)
1516
1511
  this.addGenericResourceProperties(resource, resourceJson);
1517
1512
  return resourceJson;
1518
1513
  }
1519
1514
  addDocumentDownloadResource(resource) {
1520
1515
  const resourceJson = {};
1521
1516
  if (resource.format != null)
1522
- resourceJson.format = resource.format;
1517
+ resourceJson.format = Breakscape_1.Breakscape.unbreakscape(resource.format);
1523
1518
  if (resource.provider != null)
1524
- resourceJson.provider = resource.provider;
1519
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1525
1520
  if (resource.value != null)
1526
- resourceJson.url = resource.value;
1521
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1527
1522
  // if (resource.href != null) resourceJson.href = resource.href; // It is never used (and doesn't exist in the AST model)
1528
1523
  this.addGenericResourceProperties(resource, resourceJson);
1529
1524
  return resourceJson;
1530
1525
  }
1531
1526
  addAppLinkResource(resource) {
1532
1527
  const resourceJson = {};
1533
- // if (resource.format != null) resourceJson.format = resource.format;
1528
+ // if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
1534
1529
  if (resource.value != null)
1535
- resourceJson.url = resource.value;
1530
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1536
1531
  this.addGenericResourceProperties(resource, resourceJson);
1537
1532
  return resourceJson;
1538
1533
  }
1539
1534
  addWebsiteLinkResource(resource) {
1540
1535
  const resourceJson = {};
1541
- // if (resource.format != null) resourceJson.format = resource.format;
1536
+ // if (resource.format != null) resourceJson.format = BreakscapeUtils.unbreakscape(resource.format);
1542
1537
  if (resource.value != null)
1543
- resourceJson.url = resource.value;
1538
+ resourceJson.url = Breakscape_1.Breakscape.unbreakscape(resource.value);
1544
1539
  if (resource.siteName != null)
1545
- resourceJson.siteName = resource.siteName;
1540
+ resourceJson.siteName = Breakscape_1.Breakscape.unbreakscape(resource.siteName);
1546
1541
  this.addGenericResourceProperties(resource, resourceJson);
1547
1542
  return resourceJson;
1548
1543
  }
@@ -1550,33 +1545,33 @@ class JsonGenerator {
1550
1545
  var _a, _b, _c, _d, _e, _f, _g, _h;
1551
1546
  if (noDefaults) {
1552
1547
  if (resource.license != null)
1553
- resourceJson.license = (_a = resource.license) !== null && _a !== void 0 ? _a : '';
1548
+ resourceJson.license = (_a = Breakscape_1.Breakscape.unbreakscape(resource.license)) !== null && _a !== void 0 ? _a : '';
1554
1549
  if (resource.copyright != null)
1555
- resourceJson.copyright = (_b = resource.copyright) !== null && _b !== void 0 ? _b : '';
1550
+ resourceJson.copyright = (_b = Breakscape_1.Breakscape.unbreakscape(resource.copyright)) !== null && _b !== void 0 ? _b : '';
1556
1551
  if (resource.provider != null)
1557
- resourceJson.provider = resource.provider;
1552
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1558
1553
  if (resource.showInIndex != null)
1559
1554
  resourceJson.showInIndex = (_c = resource.showInIndex) !== null && _c !== void 0 ? _c : false;
1560
1555
  if (resource.caption != null)
1561
- resourceJson.caption = this.toTextAstOrString((_d = resource.caption) !== null && _d !== void 0 ? _d : '');
1556
+ resourceJson.caption = this.toTextAstOrString((_d = resource.caption) !== null && _d !== void 0 ? _d : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
1562
1557
  }
1563
1558
  else {
1564
- resourceJson.license = (_e = resource.license) !== null && _e !== void 0 ? _e : '';
1565
- resourceJson.copyright = (_f = resource.copyright) !== null && _f !== void 0 ? _f : '';
1559
+ resourceJson.license = (_e = Breakscape_1.Breakscape.unbreakscape(resource.license)) !== null && _e !== void 0 ? _e : '';
1560
+ resourceJson.copyright = (_f = Breakscape_1.Breakscape.unbreakscape(resource.copyright)) !== null && _f !== void 0 ? _f : '';
1566
1561
  if (resource.provider != null)
1567
- resourceJson.provider = resource.provider;
1562
+ resourceJson.provider = Breakscape_1.Breakscape.unbreakscape(resource.provider);
1568
1563
  resourceJson.showInIndex = (_g = resource.showInIndex) !== null && _g !== void 0 ? _g : false;
1569
- resourceJson.caption = this.toTextAstOrString((_h = resource.caption) !== null && _h !== void 0 ? _h : '');
1564
+ resourceJson.caption = this.toTextAstOrString((_h = resource.caption) !== null && _h !== void 0 ? _h : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus);
1570
1565
  }
1571
1566
  return resourceJson;
1572
1567
  }
1573
1568
  toItemLeadHintInstruction(item) {
1574
1569
  var _a, _b, _c, _d, _e, _f;
1575
1570
  return {
1576
- item: this.toTextAstOrString((_b = (_a = item.itemLead) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b : ''),
1577
- lead: this.toTextAstOrString((_d = (_c = item.itemLead) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d : ''),
1578
- hint: this.toTextAstOrString((_e = item.hint) !== null && _e !== void 0 ? _e : ''),
1579
- instruction: this.toTextAstOrString((_f = item.instruction) !== null && _f !== void 0 ? _f : ''),
1571
+ item: this.toTextAstOrString((_b = (_a = item.itemLead) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus),
1572
+ lead: this.toTextAstOrString((_d = (_c = item.itemLead) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus),
1573
+ hint: this.toTextAstOrString((_e = item.hint) !== null && _e !== void 0 ? _e : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus),
1574
+ instruction: this.toTextAstOrString((_f = item.instruction) !== null && _f !== void 0 ? _f : Breakscape_1.Breakscape.EMPTY_STRING, TextFormat_1.TextFormat.bitmarkMinusMinus),
1580
1575
  };
1581
1576
  }
1582
1577
  toExample(node, options) {
@@ -1592,10 +1587,12 @@ class JsonGenerator {
1592
1587
  if (isDefaultExample) {
1593
1588
  exampleValue = isBoolean
1594
1589
  ? BooleanUtils_1.BooleanUtils.toBoolean(defaultExample)
1595
- : this.toTextAstOrString(defaultExample);
1590
+ : this.toTextAstOrString(defaultExample, TextFormat_1.TextFormat.bitmarkMinusMinus);
1596
1591
  }
1597
1592
  else {
1598
- exampleValue = isBoolean ? BooleanUtils_1.BooleanUtils.toBoolean(example) : this.toTextAstOrString(example);
1593
+ exampleValue = isBoolean
1594
+ ? BooleanUtils_1.BooleanUtils.toBoolean(example)
1595
+ : this.toTextAstOrString(example, TextFormat_1.TextFormat.bitmarkMinusMinus);
1599
1596
  }
1600
1597
  return {
1601
1598
  isExample: true,
@@ -1606,16 +1603,22 @@ class JsonGenerator {
1606
1603
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1607
1604
  target, name, values, singleWithoutArray) {
1608
1605
  if (values !== undefined) {
1606
+ let finalValue;
1609
1607
  if (!Array.isArray(values))
1610
1608
  values = [values];
1611
1609
  if (Array.isArray(values) && values.length > 0) {
1612
- if (singleWithoutArray && values.length >= 1) {
1613
- target[name] = values[values.length - 1];
1610
+ // Unbreakscape values that are strings
1611
+ values = Breakscape_1.Breakscape.unbreakscape(values);
1612
+ if (Array.isArray(values) && singleWithoutArray && values.length >= 1) {
1613
+ finalValue = values[values.length - 1];
1614
1614
  }
1615
1615
  else {
1616
- target[name] = values;
1616
+ finalValue = values;
1617
1617
  }
1618
1618
  }
1619
+ // if (finalValue != null) {
1620
+ target[name] = finalValue;
1621
+ // }
1619
1622
  }
1620
1623
  }
1621
1624
  /**
@@ -1640,13 +1643,14 @@ class JsonGenerator {
1640
1643
  * @returns the text format
1641
1644
  */
1642
1645
  getTextFormat(route) {
1646
+ var _a;
1643
1647
  for (const node of route) {
1644
1648
  if (node.key === NodeType_1.NodeType.bitsValue) {
1645
1649
  const n = node.value;
1646
- return TextFormat_1.TextFormat.fromValue(n === null || n === void 0 ? void 0 : n.textFormat);
1650
+ return (_a = TextFormat_1.TextFormat.fromValue(n === null || n === void 0 ? void 0 : n.textFormat)) !== null && _a !== void 0 ? _a : TextFormat_1.TextFormat.bitmarkMinusMinus;
1647
1651
  }
1648
1652
  }
1649
- return undefined;
1653
+ return TextFormat_1.TextFormat.bitmarkMinusMinus;
1650
1654
  }
1651
1655
  /**
1652
1656
  * Get the bit resourceType atttachment from any node
@@ -1664,15 +1668,15 @@ class JsonGenerator {
1664
1668
  return undefined;
1665
1669
  }
1666
1670
  /**
1667
- * Convert parse a string to TextAst if required, otherwise just return the string as is.
1671
+ * Convert parse a string to TextAst if required, otherwise just return the string but unbreakscaped.
1668
1672
  * @param text
1669
1673
  * @returns
1670
1674
  */
1671
- toTextAstOrString(text, format = TextFormat_1.TextFormat.bitmarkMinusMinus) {
1675
+ toTextAstOrString(text, format) {
1672
1676
  if (!text)
1673
1677
  undefined;
1674
- if (this.options.textAsPlainText) {
1675
- return text;
1678
+ if (this.options.textAsPlainText || format === TextFormat_1.TextFormat.text) {
1679
+ return Breakscape_1.Breakscape.unbreakscape(text);
1676
1680
  }
1677
1681
  // Use the text parser to parse the text
1678
1682
  const textAst = this.textParser.toAst(text, {