@gmb/bitmark-parser-generator 3.7.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) 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 +1 -0
  4. package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
  5. package/dist/cjs/ast/BaseBuilder.js +7 -6
  6. package/dist/cjs/ast/BaseBuilder.js.map +1 -1
  7. package/dist/cjs/ast/Builder.js +165 -160
  8. package/dist/cjs/ast/Builder.js.map +1 -1
  9. package/dist/cjs/ast/ResourceBuilder.js +68 -67
  10. package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
  11. package/dist/cjs/breakscaping/Breakscape.js +1 -1
  12. package/dist/cjs/config/raw/bits.js +41 -0
  13. package/dist/cjs/config/raw/bits.js.map +1 -1
  14. package/dist/cjs/config/raw/groups.js +35 -0
  15. package/dist/cjs/config/raw/groups.js.map +1 -1
  16. package/dist/cjs/config/raw/properties.js +48 -0
  17. package/dist/cjs/config/raw/properties.js.map +1 -1
  18. package/dist/cjs/generated/build-info.js +1 -1
  19. package/dist/cjs/generated/build-info.js.map +1 -1
  20. package/dist/cjs/generated/parser/text/text-peggy-parser.js +960 -595
  21. package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +1 -1
  22. package/dist/cjs/generator/json/JsonGenerator.js +7 -3
  23. package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
  24. package/dist/cjs/generator/text/TextGenerator.js +84 -38
  25. package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
  26. package/dist/cjs/model/ast/NodeType.js +19 -0
  27. package/dist/cjs/model/ast/NodeType.js.map +1 -1
  28. package/dist/cjs/model/config/enum/PropertyConfigKey.js +10 -0
  29. package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
  30. package/dist/cjs/model/enum/BitType.js +7 -0
  31. package/dist/cjs/model/enum/BitType.js.map +1 -1
  32. package/dist/cjs/model/enum/TextMarkType.js +2 -0
  33. package/dist/cjs/model/enum/TextMarkType.js.map +1 -1
  34. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +28 -20
  35. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  36. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
  37. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +11 -10
  38. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  39. package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +1 -0
  40. package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -1
  41. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +5 -6
  42. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  43. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +5 -4
  44. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  45. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +3 -2
  46. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  47. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +5 -4
  48. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  49. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +20 -12
  50. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  51. package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +4 -2
  52. package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -1
  53. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +5 -5
  54. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  55. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +7 -7
  56. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  57. package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +1 -1
  58. package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -1
  59. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +5 -5
  60. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +1 -1
  61. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +6 -2
  62. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  63. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +6 -6
  64. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  65. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +2 -2
  66. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  67. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +1 -1
  68. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
  69. package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +2 -2
  70. package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
  71. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +19 -13
  72. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
  73. package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +4 -3
  74. package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
  75. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +1 -1
  76. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  77. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +11 -10
  78. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  79. package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +2 -2
  80. package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
  81. package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +2 -2
  82. package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
  83. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +6 -2
  84. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  85. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +19 -16
  86. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
  87. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +1 -1
  88. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  89. package/dist/cjs/parser/text/TextParser.js +7 -6
  90. package/dist/cjs/parser/text/TextParser.js.map +1 -1
  91. package/dist/cjs/utils/BitUtils.js +2 -2
  92. package/dist/cjs/utils/BitUtils.js.map +1 -1
  93. package/dist/esm/BitmarkParserGenerator.js +1 -0
  94. package/dist/esm/BitmarkParserGenerator.js.map +1 -1
  95. package/dist/esm/ast/BaseBuilder.js +7 -6
  96. package/dist/esm/ast/BaseBuilder.js.map +1 -1
  97. package/dist/esm/ast/Builder.js +165 -160
  98. package/dist/esm/ast/Builder.js.map +1 -1
  99. package/dist/esm/ast/ResourceBuilder.js +68 -67
  100. package/dist/esm/ast/ResourceBuilder.js.map +1 -1
  101. package/dist/esm/breakscaping/Breakscape.js +1 -1
  102. package/dist/esm/config/raw/bits.js +41 -0
  103. package/dist/esm/config/raw/bits.js.map +1 -1
  104. package/dist/esm/config/raw/groups.js +35 -0
  105. package/dist/esm/config/raw/groups.js.map +1 -1
  106. package/dist/esm/config/raw/properties.js +48 -0
  107. package/dist/esm/config/raw/properties.js.map +1 -1
  108. package/dist/esm/generated/build-info.js +1 -1
  109. package/dist/esm/generated/build-info.js.map +1 -1
  110. package/dist/esm/generated/parser/text/text-peggy-parser.js +960 -595
  111. package/dist/esm/generated/parser/text/text-peggy-parser.js.map +1 -1
  112. package/dist/esm/generator/json/JsonGenerator.js +7 -3
  113. package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
  114. package/dist/esm/generator/text/TextGenerator.js +84 -38
  115. package/dist/esm/generator/text/TextGenerator.js.map +1 -1
  116. package/dist/esm/model/ast/NodeType.js +19 -0
  117. package/dist/esm/model/ast/NodeType.js.map +1 -1
  118. package/dist/esm/model/config/enum/PropertyConfigKey.js +10 -0
  119. package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
  120. package/dist/esm/model/enum/BitType.js +7 -0
  121. package/dist/esm/model/enum/BitType.js.map +1 -1
  122. package/dist/esm/model/enum/TextMarkType.js +2 -0
  123. package/dist/esm/model/enum/TextMarkType.js.map +1 -1
  124. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +28 -20
  125. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  126. package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
  127. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +11 -10
  128. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  129. package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +1 -0
  130. package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -1
  131. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +5 -6
  132. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  133. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +5 -4
  134. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  135. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +3 -2
  136. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  137. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +5 -4
  138. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  139. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +20 -12
  140. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  141. package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +4 -2
  142. package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -1
  143. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +5 -5
  144. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  145. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +7 -7
  146. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  147. package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +1 -1
  148. package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -1
  149. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +5 -5
  150. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +1 -1
  151. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +6 -2
  152. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  153. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +6 -6
  154. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  155. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +2 -2
  156. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  157. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +1 -1
  158. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
  159. package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +2 -2
  160. package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
  161. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +19 -13
  162. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
  163. package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +4 -3
  164. package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
  165. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +1 -1
  166. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  167. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +11 -10
  168. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  169. package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +2 -2
  170. package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
  171. package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +2 -2
  172. package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
  173. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +6 -2
  174. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  175. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +19 -16
  176. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
  177. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +1 -1
  178. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  179. package/dist/esm/parser/text/TextParser.js +7 -6
  180. package/dist/esm/parser/text/TextParser.js.map +1 -1
  181. package/dist/esm/utils/BitUtils.js +2 -2
  182. package/dist/esm/utils/BitUtils.js.map +1 -1
  183. package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
  184. package/dist/types/ast/BaseBuilder.d.ts +8 -1
  185. package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
  186. package/dist/types/ast/Builder.d.ts +60 -50
  187. package/dist/types/ast/Builder.d.ts.map +1 -1
  188. package/dist/types/ast/ResourceBuilder.d.ts +21 -22
  189. package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
  190. package/dist/types/config/raw/bits.d.ts.map +1 -1
  191. package/dist/types/config/raw/groups.d.ts.map +1 -1
  192. package/dist/types/config/raw/properties.d.ts.map +1 -1
  193. package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +1 -1
  194. package/dist/types/generator/json/JsonGenerator.d.ts +3 -1
  195. package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
  196. package/dist/types/generator/text/TextGenerator.d.ts +4 -1
  197. package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
  198. package/dist/types/model/ast/NodeType.d.ts +38 -0
  199. package/dist/types/model/ast/NodeType.d.ts.map +1 -1
  200. package/dist/types/model/ast/Nodes.d.ts +10 -0
  201. package/dist/types/model/ast/Nodes.d.ts.map +1 -1
  202. package/dist/types/model/ast/TextNodes.d.ts +26 -9
  203. package/dist/types/model/ast/TextNodes.d.ts.map +1 -1
  204. package/dist/types/model/config/enum/ConfigKey.d.ts +20 -0
  205. package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
  206. package/dist/types/model/config/enum/PropertyConfigKey.d.ts +30 -0
  207. package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
  208. package/dist/types/model/enum/BitType.d.ts +14 -0
  209. package/dist/types/model/enum/BitType.d.ts.map +1 -1
  210. package/dist/types/model/enum/PropertyTag.d.ts +20 -0
  211. package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
  212. package/dist/types/model/enum/TextMarkType.d.ts +4 -0
  213. package/dist/types/model/enum/TextMarkType.d.ts.map +1 -1
  214. package/dist/types/model/json/BitJson.d.ts +10 -0
  215. package/dist/types/model/json/BitJson.d.ts.map +1 -1
  216. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +0 -2
  217. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
  218. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +6 -1
  219. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
  220. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +3 -4
  221. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
  222. package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +1 -1
  223. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts +1 -3
  224. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
  225. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
  226. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts +1 -3
  227. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
  228. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts +1 -3
  229. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
  230. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts +1 -3
  231. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
  232. package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +1 -3
  233. package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +1 -1
  234. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts +1 -3
  235. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
  236. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts +1 -3
  237. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
  238. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts +1 -2
  239. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts.map +1 -1
  240. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts +1 -3
  241. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts.map +1 -1
  242. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts +1 -3
  243. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
  244. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts +1 -3
  245. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
  246. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts +1 -3
  247. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
  248. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts +1 -2
  249. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +1 -1
  250. package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts +1 -3
  251. package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +1 -1
  252. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts +1 -3
  253. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
  254. package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts +1 -3
  255. package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +1 -1
  256. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts +1 -3
  257. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
  258. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +3 -5
  259. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
  260. package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts +1 -3
  261. package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +1 -1
  262. package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts +1 -3
  263. package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +1 -1
  264. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +1 -2
  265. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
  266. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +1 -3
  267. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
  268. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts +1 -3
  269. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
  270. package/dist/types/parser/text/TextParser.d.ts +3 -2
  271. package/dist/types/parser/text/TextParser.d.ts.map +1 -1
  272. package/dist/types/utils/BitUtils.d.ts +2 -1
  273. package/dist/types/utils/BitUtils.d.ts.map +1 -1
  274. package/package.json +1 -1
@@ -55,43 +55,49 @@ class Builder extends BaseBuilder_1.BaseBuilder {
55
55
  buildBit(data) {
56
56
  var _a, _b, _c, _d, _e, _f, _g, _h;
57
57
  const bitConfig = Config_1.Config.getBitConfig(data.bitType);
58
+ const bitType = data.bitType;
58
59
  const textFormat = (_a = TextFormat_1.TextFormat.fromValue(data.textFormat)) !== null && _a !== void 0 ? _a : bitConfig.textFormatDefault;
60
+ const context = {
61
+ bitConfig,
62
+ bitType,
63
+ textFormat,
64
+ };
59
65
  // Validate and convert resources, and ensure it is an array
60
66
  // const resources = ArrayUtils.asArray(resourcesIn);
61
67
  // Set the card node data
62
- const cardNode = this.buildCardNode(data.bitType, textFormat, data);
68
+ const cardNode = this.buildCardNode(context, data);
63
69
  // Add reasonableNumOfChars to the bit only for essay bits (in other cases it will be pushed down the tree)
64
70
  const reasonableNumOfCharsProperty = Config_1.Config.isOfBitType(data.bitType, BitType_1.BitType.essay)
65
71
  ? this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars)
66
72
  : undefined;
67
73
  const convertedExample = Object.assign({}, this.toExample(data.__isDefaultExample, data.example));
68
74
  // NOTE: Node order is important and is defined here
69
- const node = Object.assign(Object.assign({ bitType: data.bitType, bitLevel: data.bitLevel, textFormat, resourceType: ResourceTag_1.ResourceTag.fromValue(data.resourceType), isCommented: data.isCommented,
75
+ const node = Object.assign(Object.assign({ bitType, bitLevel: data.bitLevel, textFormat, resourceType: ResourceTag_1.ResourceTag.fromValue(data.resourceType), isCommented: data.isCommented,
70
76
  // Properties
71
- id: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.id, data.id), internalComment: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.internalComment, data.internalComment), customerId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.customerId, data.customerId), externalId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalId, data.externalId), spaceId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.spaceId, data.spaceId), padletId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.padletId, data.padletId), jupyterId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.jupyterId, data.jupyterId), jupyterExecutionCount: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.jupyterExecutionCount, data.jupyterExecutionCount), isPublic: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isPublic, data.isPublic), aiGenerated: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.aiGenerated, data.aiGenerated), machineTranslated: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.machineTranslated, data.machineTranslated), searchIndex: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.searchIndex, data.searchIndex), analyticsTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.analyticsTag, data.analyticsTag), feedbackEngine: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.feedbackEngine, data.feedbackEngine), feedbackType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.feedbackType, data.feedbackType), disableFeedback: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.disableFeedback, data.disableFeedback), releaseVersion: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseVersion, data.releaseVersion), releaseKind: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseKind, data.releaseKind), releaseDate: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseDate, data.releaseDate), book: this.buildBooks(data.book), ageRange: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.ageRange, data.ageRange), lang: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.lang, data.lang), language: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.language, data.language), publisher: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publisher, data.publisher), publisherName: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publisherName, data.publisherName), theme: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.theme, data.theme), computerLanguage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.computerLanguage, data.computerLanguage), target: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.target, data.target), slug: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.slug, data.slug), tag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tag, data.tag), reductionTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.reductionTag, data.reductionTag), bubbleTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bubbleTag, data.bubbleTag), levelCEFRp: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelCEFRp, data.levelCEFRp), levelCEFR: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelCEFR, data.levelCEFR), levelILR: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelILR, data.levelILR), levelACTFL: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelACTFL, data.levelACTFL), icon: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.icon, data.icon), iconTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.iconTag, data.iconTag), colorTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.colorTag, data.colorTag), flashcardSet: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.flashcardSet, data.flashcardSet), subtype: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.subtype, data.subtype), bookAlias: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bookAlias, data.bookAlias), coverImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.coverImage, data.coverImage), coverColor: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.coverColor, data.coverColor), publications: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publications, data.publications), author: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.author, data.author), subject: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.subject, data.subject), date: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.date, data.date), dateEnd: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.dateEnd, data.dateEnd), location: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.location, data.location), kind: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.kind, data.kind), hasMarkAsDone: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.hasMarkAsDone, data.hasMarkAsDone), processHandIn: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.processHandIn, data.processHandIn), chatWithBook: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.chatWithBook, data.chatWithBook), chatWithBookBrainKey: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.chatWithBookBrainKey, data.chatWithBookBrainKey), action: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.action, data.action), showInIndex: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.showInIndex, data.showInIndex), refAuthor: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refAuthor, data.refAuthor), refBookTitle: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refBookTitle, data.refBookTitle), refPublisher: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refPublisher, data.refPublisher), citationStyle: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.citationStyle, data.citationStyle), blockId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.blockId, data.blockId), pageNo: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pageNo, data.pageNo), x: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.x, data.x), y: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.y, data.y), width: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.width, data.width), height: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.height, data.height), index: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.index, data.index), classification: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.classification, data.classification), availableClassifications: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.availableClassifications, data.availableClassifications), allowedBit: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.allowedBit, data.allowedBit), tableFixedHeader: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableFixedHeader, data.tableFixedHeader), tableSearch: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableSearch, data.tableSearch), tableSort: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableSort, data.tableSort), tablePagination: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tablePagination, data.tablePagination), tablePaginationLimit: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tablePaginationLimit, data.tablePaginationLimit), tableHeight: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableHeight, data.tableHeight), tableWhitespaceNoWrap: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableWhitespaceNoWrap, data.tableWhitespaceNoWrap), tableAutoWidth: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableAutoWidth, data.tableAutoWidth), tableResizableColumns: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableResizableColumns, data.tableResizableColumns), tableColumnMinWidth: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableColumnMinWidth, data.tableColumnMinWidth), quizCountItems: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quizCountItems, data.quizCountItems), quizStrikethroughSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quizStrikethroughSolutions, data.quizStrikethroughSolutions), codeLineNumbers: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.codeLineNumbers, data.codeLineNumbers), codeMinimap: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.codeMinimap, data.codeMinimap), stripePricingTableId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.stripePricingTableId, data.stripePricingTableId), stripePublishableKey: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.stripePublishableKey, data.stripePublishableKey), thumbImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.thumbImage, data.thumbImage), scormSource: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.scormSource, data.scormSource), posterImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.posterImage, data.posterImage), focusX: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.focusX, data.focusX), focusY: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.focusY, data.focusY), pointerLeft: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pointerLeft, data.pointerLeft), pointerTop: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pointerTop, data.pointerTop), listItemIndent: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.listItemIndent, data.listItemIndent), backgroundWallpaper: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.backgroundWallpaper, data.backgroundWallpaper), hasBookNavigation: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.hasBookNavigation, data.hasBookNavigation), duration: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.duration, data.duration), deeplink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.deeplink, data.deeplink), externalLink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalLink, data.externalLink), externalLinkText: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalLinkText, data.externalLinkText), videoCallLink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.videoCallLink, data.videoCallLink), vendorUrl: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.vendorUrl, data.vendorUrl), search: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.search, data.search), list: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.list, data.list), textReference: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.textReference, data.textReference), isTracked: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isTracked, data.isTracked), isInfoOnly: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isInfoOnly, data.isInfoOnly), imageFirst: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.imageFirst, data.imageFirst), activityType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.activityType, data.activityType), labelTrue: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.labelTrue, data.labelTrue), labelFalse: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.labelFalse, data.labelFalse), content2Buy: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.content2Buy, data.content2Buy), mailingList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.mailingList, data.mailingList), buttonCaption: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.buttonCaption, data.buttonCaption), callToActionUrl: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.callToActionUrl, data.callToActionUrl), caption: this.handleJsonText(data.caption), quotedPerson: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quotedPerson, data.quotedPerson), reasonableNumOfChars: reasonableNumOfCharsProperty, resolved: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolved, data.resolved), resolvedDate: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolvedDate, data.resolvedDate), resolvedBy: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolvedBy, data.resolvedBy), handInAcceptFileType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInAcceptFileType, data.handInAcceptFileType), handInRequirement: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInRequirement, data.handInRequirement), handInInstruction: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInInstruction, data.handInInstruction), maxCreatedBits: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxCreatedBits, data.maxCreatedBits), maxDisplayLevel: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxDisplayLevel, data.maxDisplayLevel), maxTocChapterLevel: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxTocChapterLevel, data.maxTocChapterLevel), page: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.page, data.page), productId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productId, data.productId), product: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.product, data.product), productList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productList, data.productList), productVideo: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productVideo, data.productVideo), productVideoList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productVideoList, data.productVideoList), productFolder: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productFolder, data.productFolder), technicalTerm: this.buildTechnicalTerm(data.technicalTerm), servings: this.buildServings(data.servings), ratingLevelStart: this.buildRatingLevelStartEnd(data.ratingLevelStart), ratingLevelEnd: this.buildRatingLevelStartEnd(data.ratingLevelEnd), ratingLevelSelected: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.ratingLevelSelected, data.ratingLevelSelected), markConfig: this.buildMarkConfigs(data.markConfig), imageSource: this.buildImageSource(data.imageSource), person: this.buildPerson(data.bitType, data.person), bot: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bot, data.bot), referenceProperty: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.property_reference, data.referenceProperty),
77
+ id: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.id, data.id), internalComment: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.internalComment, data.internalComment), customerId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.customerId, data.customerId), customerExternalId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.customerExternalId, data.customerExternalId), externalId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalId, data.externalId), spaceId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.spaceId, data.spaceId), padletId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.padletId, data.padletId), jupyterId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.jupyterId, data.jupyterId), jupyterExecutionCount: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.jupyterExecutionCount, data.jupyterExecutionCount), isPublic: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isPublic, data.isPublic), aiGenerated: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.aiGenerated, data.aiGenerated), machineTranslated: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.machineTranslated, data.machineTranslated), searchIndex: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.searchIndex, data.searchIndex), analyticsTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.analyticsTag, data.analyticsTag), categoryTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.categoryTag, data.categoryTag), topicTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.topicTag, data.topicTag), altLangTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.altLangTag, data.altLangTag), feedbackEngine: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.feedbackEngine, data.feedbackEngine), feedbackType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.feedbackType, data.feedbackType), disableFeedback: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.disableFeedback, data.disableFeedback), diffOp: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffOp, data.diffOp), diffRef: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffRef, data.diffRef), diffContext: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffContext, data.diffContext), diffTime: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.diffTime, data.diffTime), releaseVersion: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseVersion, data.releaseVersion), releaseKind: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseKind, data.releaseKind), releaseDate: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.releaseDate, data.releaseDate), book: this.buildBooks(context, data.book), ageRange: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.ageRange, data.ageRange), lang: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.lang, data.lang), language: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.language, data.language), publisher: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publisher, data.publisher), publisherName: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publisherName, data.publisherName), theme: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.theme, data.theme), computerLanguage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.computerLanguage, data.computerLanguage), target: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.target, data.target), slug: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.slug, data.slug), tag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tag, data.tag), reductionTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.reductionTag, data.reductionTag), bubbleTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bubbleTag, data.bubbleTag), levelCEFRp: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelCEFRp, data.levelCEFRp), levelCEFR: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelCEFR, data.levelCEFR), levelILR: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelILR, data.levelILR), levelACTFL: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.levelACTFL, data.levelACTFL), icon: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.icon, data.icon), iconTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.iconTag, data.iconTag), colorTag: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.colorTag, data.colorTag), flashcardSet: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.flashcardSet, data.flashcardSet), subtype: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.subtype, data.subtype), bookAlias: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bookAlias, data.bookAlias), bookDiff: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bookDiff, data.bookDiff), coverImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.coverImage, data.coverImage), coverColor: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.coverColor, data.coverColor), publications: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.publications, data.publications), author: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.author, data.author), subject: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.subject, data.subject), date: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.date, data.date), dateEnd: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.dateEnd, data.dateEnd), location: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.location, data.location), kind: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.kind, data.kind), hasMarkAsDone: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.hasMarkAsDone, data.hasMarkAsDone), processHandIn: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.processHandIn, data.processHandIn), chatWithBook: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.chatWithBook, data.chatWithBook), chatWithBookBrainKey: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.chatWithBookBrainKey, data.chatWithBookBrainKey), action: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.action, data.action), showInIndex: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.showInIndex, data.showInIndex), refAuthor: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refAuthor, data.refAuthor), refBookTitle: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refBookTitle, data.refBookTitle), refPublisher: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.refPublisher, data.refPublisher), citationStyle: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.citationStyle, data.citationStyle), blockId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.blockId, data.blockId), pageNo: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pageNo, data.pageNo), x: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.x, data.x), y: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.y, data.y), width: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.width, data.width), height: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.height, data.height), index: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.index, data.index), classification: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.classification, data.classification), availableClassifications: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.availableClassifications, data.availableClassifications), allowedBit: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.allowedBit, data.allowedBit), tableFixedHeader: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableFixedHeader, data.tableFixedHeader), tableSearch: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableSearch, data.tableSearch), tableSort: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableSort, data.tableSort), tablePagination: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tablePagination, data.tablePagination), tablePaginationLimit: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tablePaginationLimit, data.tablePaginationLimit), tableHeight: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableHeight, data.tableHeight), tableWhitespaceNoWrap: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableWhitespaceNoWrap, data.tableWhitespaceNoWrap), tableAutoWidth: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableAutoWidth, data.tableAutoWidth), tableResizableColumns: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableResizableColumns, data.tableResizableColumns), tableColumnMinWidth: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.tableColumnMinWidth, data.tableColumnMinWidth), quizCountItems: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quizCountItems, data.quizCountItems), quizStrikethroughSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quizStrikethroughSolutions, data.quizStrikethroughSolutions), codeLineNumbers: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.codeLineNumbers, data.codeLineNumbers), codeMinimap: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.codeMinimap, data.codeMinimap), stripePricingTableId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.stripePricingTableId, data.stripePricingTableId), stripePublishableKey: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.stripePublishableKey, data.stripePublishableKey), thumbImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.thumbImage, data.thumbImage), scormSource: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.scormSource, data.scormSource), posterImage: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.posterImage, data.posterImage), focusX: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.focusX, data.focusX), focusY: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.focusY, data.focusY), pointerLeft: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pointerLeft, data.pointerLeft), pointerTop: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.pointerTop, data.pointerTop), listItemIndent: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.listItemIndent, data.listItemIndent), backgroundWallpaper: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.backgroundWallpaper, data.backgroundWallpaper), hasBookNavigation: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.hasBookNavigation, data.hasBookNavigation), duration: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.duration, data.duration), deeplink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.deeplink, data.deeplink), externalLink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalLink, data.externalLink), externalLinkText: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.externalLinkText, data.externalLinkText), videoCallLink: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.videoCallLink, data.videoCallLink), vendorSurveyId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.vendorSurveyId, data.vendorSurveyId), vendorUrl: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.vendorUrl, data.vendorUrl), search: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.search, data.search), list: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.list, data.list), textReference: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.textReference, data.textReference), isTracked: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isTracked, data.isTracked), isInfoOnly: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.isInfoOnly, data.isInfoOnly), imageFirst: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.imageFirst, data.imageFirst), activityType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.activityType, data.activityType), labelTrue: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.labelTrue, data.labelTrue), labelFalse: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.labelFalse, data.labelFalse), content2Buy: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.content2Buy, data.content2Buy), mailingList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.mailingList, data.mailingList), buttonCaption: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.buttonCaption, data.buttonCaption), callToActionUrl: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.callToActionUrl, data.callToActionUrl), caption: this.handleJsonText(context, true, data.caption), quotedPerson: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.quotedPerson, data.quotedPerson), reasonableNumOfChars: reasonableNumOfCharsProperty, resolved: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolved, data.resolved), resolvedDate: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolvedDate, data.resolvedDate), resolvedBy: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.resolvedBy, data.resolvedBy), handInAcceptFileType: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInAcceptFileType, data.handInAcceptFileType), handInRequirement: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInRequirement, data.handInRequirement), handInInstruction: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.handInInstruction, data.handInInstruction), maxCreatedBits: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxCreatedBits, data.maxCreatedBits), maxDisplayLevel: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxDisplayLevel, data.maxDisplayLevel), maxTocChapterLevel: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.maxTocChapterLevel, data.maxTocChapterLevel), page: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.page, data.page), productId: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productId, data.productId), product: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.product, data.product), productList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productList, data.productList), productVideo: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productVideo, data.productVideo), productVideoList: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productVideoList, data.productVideoList), productFolder: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.productFolder, data.productFolder), technicalTerm: this.buildTechnicalTerm(context, data.technicalTerm), servings: this.buildServings(context, data.servings), ratingLevelStart: this.buildRatingLevelStartEnd(context, data.ratingLevelStart), ratingLevelEnd: this.buildRatingLevelStartEnd(context, data.ratingLevelEnd), ratingLevelSelected: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.ratingLevelSelected, data.ratingLevelSelected), markConfig: this.buildMarkConfigs(context, data.markConfig), imageSource: this.buildImageSource(context, data.imageSource), person: this.buildPerson(context, data.person), bot: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.bot, data.bot), referenceProperty: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.property_reference, data.referenceProperty),
72
78
  // Book data
73
- title: this.handleJsonText(data.title), subtitle: this.handleJsonText(data.subtitle), level: NumberUtils_1.NumberUtils.asNumber(data.level), toc: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.toc, data.toc), progress: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.progress, data.progress), anchor: data.anchor, reference: data.reference, referenceEnd: data.referenceEnd, revealSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.revealSolutions, data.revealSolutions),
79
+ title: this.handleJsonText(context, true, data.title), subtitle: this.handleJsonText(context, true, data.subtitle), level: NumberUtils_1.NumberUtils.asNumber(data.level), toc: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.toc, data.toc), progress: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.progress, data.progress), anchor: data.anchor, reference: data.reference, referenceEnd: data.referenceEnd, revealSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.revealSolutions, data.revealSolutions),
74
80
  // Item, Lead, Hint, Instruction
75
- item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), pageNumber: this.handleJsonText(data.pageNumber), marginNumber: this.handleJsonText(data.marginNumber), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction), partialAnswer: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.partialAnswer, data.partialAnswer), sampleSolution: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.property_sampleSolution, data.sampleSolution), additionalSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.additionalSolutions, data.additionalSolutions) }, this.toExample(data.__isDefaultExample, data.example)), {
81
+ item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), pageNumber: this.handleJsonText(context, true, data.pageNumber), marginNumber: this.handleJsonText(context, true, data.marginNumber), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction), partialAnswer: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.partialAnswer, data.partialAnswer), sampleSolution: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.property_sampleSolution, data.sampleSolution), additionalSolutions: this.toAstProperty(PropertyConfigKey_1.PropertyConfigKey.additionalSolutions, data.additionalSolutions) }, this.toExample(data.__isDefaultExample, data.example)), {
76
82
  // Person
77
- imagePlaceholder: ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(data.bitType, ResourceTag_1.ResourceTag.image, (_b = data.imagePlaceholder) === null || _b === void 0 ? void 0 : _b.image)), resources: ArrayUtils_1.ArrayUtils.asArray(this.resourceBuilder.resourceFromResourceJson(data.bitType, data.resources)),
83
+ imagePlaceholder: ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag_1.ResourceTag.image, (_b = data.imagePlaceholder) === null || _b === void 0 ? void 0 : _b.image)), resources: ArrayUtils_1.ArrayUtils.asArray(this.resourceBuilder.resourceFromResourceJson(context, data.resources)),
78
84
  // Body, Card, Footer, must be after all other properties except the extraProperties and markup / parser
79
- body: this.buildBody(textFormat, data.body), cardNode, footer: this.buildFooter(data.footer),
85
+ body: this.buildBody(context, data.body), cardNode, footer: this.buildFooter(context, data.footer),
80
86
  // Must be after other properties/tags in the AST so key clashes are avoided correctly
81
87
  extraProperties: this.parseExtraProperties(data.extraProperties), markup: data.markup, parser: data.parser,
82
88
  // Private properties
83
89
  __isDefaultExample: (_c = data.__isDefaultExample) !== null && _c !== void 0 ? _c : false });
84
90
  // Push reasonableNumOfChars down the tree for the interview bit
85
91
  if (Config_1.Config.isOfBitType(node.bitType, BitType_1.BitType.interview)) {
86
- this.pushDownTree(undefined, undefined, cardNode, 'questions', PropertyConfigKey_1.PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars);
92
+ this.pushDownTree(context, undefined, undefined, cardNode, 'questions', PropertyConfigKey_1.PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars);
87
93
  }
88
94
  // Push isCaseSensitive down the tree for the cloze, match and match-matrix bits
89
- this.pushDownTree([node.body, ...((_e = (_d = cardNode === null || cardNode === void 0 ? void 0 : cardNode.cardBits) === null || _d === void 0 ? void 0 : _d.map((cardBit) => cardBit.body)) !== null && _e !== void 0 ? _e : [])], [BodyBitType_1.BodyBitType.gap], undefined, undefined, //'isCaseSensitive',
95
+ this.pushDownTree(context, [node.body, ...((_e = (_d = cardNode === null || cardNode === void 0 ? void 0 : cardNode.cardBits) === null || _d === void 0 ? void 0 : _d.map((cardBit) => cardBit.body)) !== null && _e !== void 0 ? _e : [])], [BodyBitType_1.BodyBitType.gap], undefined, undefined, //'isCaseSensitive',
90
96
  PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_f = data.isCaseSensitive) !== null && _f !== void 0 ? _f : true);
91
- this.pushDownTree(undefined, undefined, cardNode, 'pairs', PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_g = data.isCaseSensitive) !== null && _g !== void 0 ? _g : true);
92
- this.pushDownTree(undefined, undefined, cardNode, ['matrix', 'cells'], PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_h = data.isCaseSensitive) !== null && _h !== void 0 ? _h : true);
97
+ this.pushDownTree(context, undefined, undefined, cardNode, 'pairs', PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_g = data.isCaseSensitive) !== null && _g !== void 0 ? _g : true);
98
+ this.pushDownTree(context, undefined, undefined, cardNode, ['matrix', 'cells'], PropertyConfigKey_1.PropertyConfigKey.isCaseSensitive, (_h = data.isCaseSensitive) !== null && _h !== void 0 ? _h : true);
93
99
  // If __isDefaultExample is set at the bit level, push the default example down the tree to the relevant nodes
94
- this.pushExampleDownTree(node.body, cardNode, node.__isDefaultExample, convertedExample.example);
100
+ this.pushExampleDownTree(context, node.body, cardNode, node.__isDefaultExample, convertedExample.example);
95
101
  // Set default values
96
102
  this.setDefaultBitValues(node);
97
103
  // Set the 'isExample' flags
@@ -113,12 +119,12 @@ class Builder extends BaseBuilder_1.BaseBuilder {
113
119
  * @param data - data for the node
114
120
  * @returns
115
121
  */
116
- buildBooks(data) {
122
+ buildBooks(context, data) {
117
123
  if (StringUtils_1.StringUtils.isString(data))
118
124
  return data;
119
125
  if (!Array.isArray(data))
120
126
  return undefined;
121
- const nodes = data.map((d) => this.buildBook(d)).filter((d) => d != null);
127
+ const nodes = data.map((d) => this.buildBook(context, d)).filter((d) => d != null);
122
128
  return nodes.length > 0 ? nodes : undefined;
123
129
  }
124
130
  /**
@@ -127,7 +133,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
127
133
  * @param data - data for the node
128
134
  * @returns
129
135
  */
130
- buildBook(data) {
136
+ buildBook(_context, data) {
131
137
  var _a, _b, _c;
132
138
  if (!data)
133
139
  return undefined;
@@ -150,10 +156,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
150
156
  * @param data - data for the node
151
157
  * @returns
152
158
  */
153
- buildChoices(data) {
159
+ buildChoices(context, data) {
154
160
  if (!Array.isArray(data))
155
161
  return undefined;
156
- const nodes = data.map((d) => this.buildChoice(d)).filter((d) => d != null);
162
+ const nodes = data.map((d) => this.buildChoice(context, d)).filter((d) => d != null);
157
163
  return nodes.length > 0 ? nodes : undefined;
158
164
  }
159
165
  /**
@@ -162,12 +168,12 @@ class Builder extends BaseBuilder_1.BaseBuilder {
162
168
  * @param data - data for the node
163
169
  * @returns
164
170
  */
165
- buildChoice(data) {
171
+ buildChoice(context, data) {
166
172
  var _a;
167
173
  if (!data)
168
174
  return undefined;
169
175
  // NOTE: Node order is important and is defined here
170
- const node = Object.assign({ choice: (_a = data.choice) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
176
+ const node = Object.assign({ choice: (_a = data.choice) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
171
177
  // Remove Unset Optionals
172
178
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
173
179
  ignoreAllFalse: true,
@@ -182,10 +188,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
182
188
  * @param data - data for the node
183
189
  * @returns
184
190
  */
185
- buildResponses(data) {
191
+ buildResponses(context, data) {
186
192
  if (!Array.isArray(data))
187
193
  return undefined;
188
- const nodes = data.map((d) => this.buildResponse(d)).filter((d) => d != null);
194
+ const nodes = data.map((d) => this.buildResponse(context, d)).filter((d) => d != null);
189
195
  return nodes.length > 0 ? nodes : undefined;
190
196
  }
191
197
  /**
@@ -194,12 +200,12 @@ class Builder extends BaseBuilder_1.BaseBuilder {
194
200
  * @param data - data for the node
195
201
  * @returns
196
202
  */
197
- buildResponse(data) {
203
+ buildResponse(context, data) {
198
204
  var _a;
199
205
  if (!data)
200
206
  return undefined;
201
207
  // NOTE: Node order is important and is defined here
202
- const node = Object.assign({ response: (_a = data.response) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
208
+ const node = Object.assign({ response: (_a = data.response) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
203
209
  // Remove Unset Optionals
204
210
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
205
211
  ignoreAllFalse: true,
@@ -214,10 +220,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
214
220
  * @param data - data for the node
215
221
  * @returns
216
222
  */
217
- buildBotResponses(data) {
223
+ buildBotResponses(context, data) {
218
224
  if (!Array.isArray(data))
219
225
  return undefined;
220
- const nodes = data.map((d) => this.botResponse(d)).filter((d) => d != null);
226
+ const nodes = data.map((d) => this.botResponse(context, d)).filter((d) => d != null);
221
227
  return nodes.length > 0 ? nodes : undefined;
222
228
  }
223
229
  /**
@@ -226,7 +232,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
226
232
  * @param data - data for the node
227
233
  * @returns
228
234
  */
229
- botResponse(data) {
235
+ botResponse(context, data) {
230
236
  var _a, _b, _c;
231
237
  if (!data)
232
238
  return undefined;
@@ -235,9 +241,9 @@ class Builder extends BaseBuilder_1.BaseBuilder {
235
241
  response: (_a = data.response) !== null && _a !== void 0 ? _a : '',
236
242
  reaction: (_b = data.reaction) !== null && _b !== void 0 ? _b : '',
237
243
  feedback: (_c = data.feedback) !== null && _c !== void 0 ? _c : '',
238
- item: this.handleJsonText(data.item),
239
- lead: this.handleJsonText(data.lead),
240
- hint: this.handleJsonText(data.hint),
244
+ item: this.handleJsonText(context, true, data.item),
245
+ lead: this.handleJsonText(context, true, data.lead),
246
+ hint: this.handleJsonText(context, true, data.hint),
241
247
  };
242
248
  // Remove Unset Optionals
243
249
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
@@ -254,10 +260,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
254
260
  * @param data - data for the node
255
261
  * @returns
256
262
  */
257
- buildQuizzes(data) {
263
+ buildQuizzes(context, data) {
258
264
  if (!Array.isArray(data))
259
265
  return undefined;
260
- const nodes = data.map((d) => this.buildQuiz(d)).filter((d) => d != null);
266
+ const nodes = data.map((d) => this.buildQuiz(context, d)).filter((d) => d != null);
261
267
  return nodes.length > 0 ? nodes : undefined;
262
268
  }
263
269
  /**
@@ -266,21 +272,21 @@ class Builder extends BaseBuilder_1.BaseBuilder {
266
272
  * @param data - data for the node
267
273
  * @returns
268
274
  */
269
- buildQuiz(data) {
275
+ buildQuiz(context, data) {
270
276
  if (!data)
271
277
  return undefined;
272
278
  const convertedExample = Object.assign({}, this.toExample(data.__isDefaultExample, data.__defaultExample));
273
279
  let choices;
274
280
  let responses;
275
281
  if (data.choices) {
276
- choices = this.buildChoices(data.choices);
282
+ choices = this.buildChoices(context, data.choices);
277
283
  // Push __isDefaultExample down the tree
278
- this.pushExampleDownTreeBoolean(data.__isDefaultExample, convertedExample.example, true, choices);
284
+ this.pushExampleDownTreeBoolean(context, data.__isDefaultExample, convertedExample.example, true, choices);
279
285
  }
280
286
  else if (data.responses) {
281
- responses = this.buildResponses(data.responses);
287
+ responses = this.buildResponses(context, data.responses);
282
288
  // Push __isDefaultExample down the tree
283
- this.pushExampleDownTreeBoolean(data.__isDefaultExample, convertedExample.example, false, responses);
289
+ this.pushExampleDownTreeBoolean(context, data.__isDefaultExample, convertedExample.example, false, responses);
284
290
  }
285
291
  else {
286
292
  // No choices or responses, not a valid quiz
@@ -288,10 +294,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
288
294
  }
289
295
  // NOTE: Node order is important and is defined here
290
296
  const node = {
291
- item: this.handleJsonText(data.item),
292
- lead: this.handleJsonText(data.lead),
293
- hint: this.handleJsonText(data.hint),
294
- instruction: this.handleJsonText(data.instruction),
297
+ item: this.handleJsonText(context, true, data.item),
298
+ lead: this.handleJsonText(context, true, data.lead),
299
+ hint: this.handleJsonText(context, true, data.hint),
300
+ instruction: this.handleJsonText(context, true, data.instruction),
295
301
  isExample: !!data.__defaultExample,
296
302
  choices: choices,
297
303
  responses: responses,
@@ -309,7 +315,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
309
315
  * @param data - data for the node
310
316
  * @returns
311
317
  */
312
- buildHeading(data) {
318
+ buildHeading(_context, data) {
313
319
  var _a, _b, _c;
314
320
  if (!data)
315
321
  return undefined;
@@ -334,10 +340,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
334
340
  * @param data - data for the node
335
341
  * @returns
336
342
  */
337
- buildPairs(bitType, data) {
343
+ buildPairs(context, data) {
338
344
  if (!Array.isArray(data))
339
345
  return undefined;
340
- const nodes = data.map((d) => this.buildPair(bitType, d)).filter((d) => d != null);
346
+ const nodes = data.map((d) => this.buildPair(context, d)).filter((d) => d != null);
341
347
  return nodes.length > 0 ? nodes : undefined;
342
348
  }
343
349
  /**
@@ -346,18 +352,18 @@ class Builder extends BaseBuilder_1.BaseBuilder {
346
352
  * @param data - data for the node
347
353
  * @returns
348
354
  */
349
- buildPair(bitType, data) {
355
+ buildPair(context, data) {
350
356
  var _a, _b, _c, _d;
351
357
  if (!data)
352
358
  return undefined;
353
359
  // Set default example
354
360
  const defaultExample = Array.isArray(data.__valuesAst) && data.__valuesAst.length > 0 ? data.__valuesAst[0] : null;
355
361
  // Process the keyAudio and keyImage resources
356
- const keyAudio = (_a = ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(bitType, ResourceTag_1.ResourceTag.audio, data.keyAudio))) === null || _a === void 0 ? void 0 : _a.audio;
357
- const keyImage = (_b = ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(bitType, ResourceTag_1.ResourceTag.image, data.keyImage))) === null || _b === void 0 ? void 0 : _b.image;
362
+ const keyAudio = (_a = ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag_1.ResourceTag.audio, data.keyAudio))) === null || _a === void 0 ? void 0 : _a.audio;
363
+ const keyImage = (_b = ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag_1.ResourceTag.image, data.keyImage))) === null || _b === void 0 ? void 0 : _b.image;
358
364
  // NOTE: Node order is important and is defined here
359
365
  const node = Object.assign(Object.assign({ key: (_c = data.key) !== null && _c !== void 0 ? _c : '', keyAudio,
360
- keyImage, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { values: (_d = data.values) !== null && _d !== void 0 ? _d : [], __valuesAst: data.__valuesAst });
366
+ keyImage, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { values: (_d = data.values) !== null && _d !== void 0 ? _d : [], __valuesAst: data.__valuesAst });
361
367
  // Remove Unset Optionals
362
368
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
363
369
  ignoreAllFalse: true,
@@ -384,10 +390,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
384
390
  * @param data - data for the node
385
391
  * @returns
386
392
  */
387
- buildMatricies(data) {
393
+ buildMatricies(context, data) {
388
394
  if (!Array.isArray(data))
389
395
  return undefined;
390
- const nodes = data.map((d) => this.buildMatrix(d)).filter((d) => d != null);
396
+ const nodes = data.map((d) => this.buildMatrix(context, d)).filter((d) => d != null);
391
397
  return nodes.length > 0 ? nodes : undefined;
392
398
  }
393
399
  /**
@@ -396,7 +402,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
396
402
  * @param data - data for the node
397
403
  * @returns
398
404
  */
399
- buildMatrix(data) {
405
+ buildMatrix(context, data) {
400
406
  var _a, _b, _c;
401
407
  if (!data)
402
408
  return undefined;
@@ -417,12 +423,12 @@ class Builder extends BaseBuilder_1.BaseBuilder {
417
423
  // NOTE: Node order is important and is defined here
418
424
  const node = {
419
425
  key: (_b = data.key) !== null && _b !== void 0 ? _b : '',
420
- item: this.handleJsonText(data.item),
421
- lead: this.handleJsonText(data.lead),
422
- hint: this.handleJsonText(data.hint),
423
- instruction: this.handleJsonText(data.instruction),
426
+ item: this.handleJsonText(context, true, data.item),
427
+ lead: this.handleJsonText(context, true, data.lead),
428
+ hint: this.handleJsonText(context, true, data.hint),
429
+ instruction: this.handleJsonText(context, true, data.instruction),
424
430
  isExample,
425
- cells: ((_c = data.cells) !== null && _c !== void 0 ? _c : []).map((c) => this.buildMatrixCell(c)).filter((c) => c != null),
431
+ cells: ((_c = data.cells) !== null && _c !== void 0 ? _c : []).map((c) => this.buildMatrixCell(context, c)).filter((c) => c != null),
426
432
  };
427
433
  // Remove Unset Optionals
428
434
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
@@ -438,14 +444,14 @@ class Builder extends BaseBuilder_1.BaseBuilder {
438
444
  * @param data - data for the node
439
445
  * @returns
440
446
  */
441
- buildMatrixCell(data) {
447
+ buildMatrixCell(context, data) {
442
448
  var _a;
443
449
  if (!data)
444
450
  return undefined;
445
451
  // Set default example
446
452
  const defaultExample = Array.isArray(data.__valuesAst) && data.__valuesAst.length > 0 ? data.__valuesAst[0] : null;
447
453
  // NOTE: Node order is important and is defined here
448
- const node = Object.assign(Object.assign({ values: (_a = data.values) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __valuesAst: data.__valuesAst });
454
+ const node = Object.assign(Object.assign({ values: (_a = data.values) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __valuesAst: data.__valuesAst });
449
455
  // Remove Unset Optionals
450
456
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
451
457
  ignoreAllFalse: true,
@@ -460,7 +466,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
460
466
  * @param data - data for the node
461
467
  * @returns
462
468
  */
463
- buildPronunciationTable(bitType, textFormat, dataIn) {
469
+ buildPronunciationTable(context, dataIn) {
464
470
  var _a;
465
471
  if (!dataIn)
466
472
  return undefined;
@@ -469,10 +475,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
469
475
  data: ((_a = dataIn.data) !== null && _a !== void 0 ? _a : []).map((row) => (row !== null && row !== void 0 ? row : []).map((cell) => {
470
476
  var _a;
471
477
  // Process the audio resource
472
- const audio = (_a = ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(bitType, ResourceTag_1.ResourceTag.audio, cell.audio))) === null || _a === void 0 ? void 0 : _a.audio;
478
+ const audio = (_a = ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag_1.ResourceTag.audio, cell.audio))) === null || _a === void 0 ? void 0 : _a.audio;
473
479
  return {
474
- title: this.handleJsonText(cell.title),
475
- body: this.handleJsonText(cell.body, textFormat),
480
+ title: this.handleJsonText(context, true, cell.title),
481
+ body: this.handleJsonText(context, true, cell.body),
476
482
  audio,
477
483
  };
478
484
  })),
@@ -489,14 +495,14 @@ class Builder extends BaseBuilder_1.BaseBuilder {
489
495
  * @param data - data for the node
490
496
  * @returns
491
497
  */
492
- buildTable(textFormat, dataIn) {
498
+ buildTable(context, dataIn) {
493
499
  var _a, _b;
494
500
  if (!dataIn)
495
501
  return undefined;
496
502
  // NOTE: Node order is important and is defined here
497
503
  const node = {
498
- columns: ((_a = dataIn.columns) !== null && _a !== void 0 ? _a : []).map((col) => this.handleJsonText(col, textFormat)),
499
- data: ((_b = dataIn.data) !== null && _b !== void 0 ? _b : []).map((row) => (row !== null && row !== void 0 ? row : []).map((cell) => this.handleJsonText(cell, textFormat))),
504
+ columns: ((_a = dataIn.columns) !== null && _a !== void 0 ? _a : []).map((col) => this.handleJsonText(context, true, col)),
505
+ data: ((_b = dataIn.data) !== null && _b !== void 0 ? _b : []).map((row) => (row !== null && row !== void 0 ? row : []).map((cell) => this.handleJsonText(context, true, cell))),
500
506
  };
501
507
  // Remove Unset Optionals
502
508
  // ObjectUtils.removeUnwantedProperties(node, {
@@ -510,10 +516,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
510
516
  * @param data - data for the node
511
517
  * @returns
512
518
  */
513
- buildQuestions(textFormat, data) {
519
+ buildQuestions(context, data) {
514
520
  if (!Array.isArray(data))
515
521
  return undefined;
516
- const nodes = data.map((d) => this.buildQuestion(textFormat, d)).filter((d) => d != null);
522
+ const nodes = data.map((d) => this.buildQuestion(context, d)).filter((d) => d != null);
517
523
  return nodes.length > 0 ? nodes : undefined;
518
524
  }
519
525
  /**
@@ -522,16 +528,14 @@ class Builder extends BaseBuilder_1.BaseBuilder {
522
528
  * @param data - data for the node
523
529
  * @returns
524
530
  */
525
- buildQuestion(textFormat, data) {
531
+ buildQuestion(context, data) {
526
532
  var _a, _b, _c, _d, _e;
527
533
  if (!data)
528
534
  return undefined;
529
535
  // Set default example
530
536
  const defaultExample = data.__sampleSolutionAst;
531
- // Unused
532
- textFormat;
533
537
  // NOTE: Node order is important and is defined here
534
- const node = Object.assign(Object.assign({ question: (_a = data.question) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = data.partialAnswer) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = data.sampleSolution) !== null && _c !== void 0 ? _c : '', additionalSolutions: ((_d = data.additionalSolutions) !== null && _d !== void 0 ? _d : undefined), reasonableNumOfChars: ((_e = data.reasonableNumOfChars) !== null && _e !== void 0 ? _e : undefined), item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __sampleSolutionAst: data.__sampleSolutionAst });
538
+ const node = Object.assign(Object.assign({ question: (_a = data.question) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = data.partialAnswer) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = data.sampleSolution) !== null && _c !== void 0 ? _c : '', additionalSolutions: ((_d = data.additionalSolutions) !== null && _d !== void 0 ? _d : undefined), reasonableNumOfChars: ((_e = data.reasonableNumOfChars) !== null && _e !== void 0 ? _e : undefined), item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __sampleSolutionAst: data.__sampleSolutionAst });
535
539
  // Remove Unset Optionals
536
540
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
537
541
  ignoreAllFalse: true,
@@ -547,10 +551,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
547
551
  * @param data - data for the node
548
552
  * @returns
549
553
  */
550
- buildIngredients(data) {
554
+ buildIngredients(context, data) {
551
555
  if (!Array.isArray(data))
552
556
  return undefined;
553
- const nodes = data.map((d) => this.buildIngredient(d)).filter((d) => d != null);
557
+ const nodes = data.map((d) => this.buildIngredient(context, d)).filter((d) => d != null);
554
558
  return nodes.length > 0 ? nodes : undefined;
555
559
  }
556
560
  /**
@@ -559,7 +563,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
559
563
  * @param data - data for the node
560
564
  * @returns
561
565
  */
562
- buildIngredient(data) {
566
+ buildIngredient(_context, data) {
563
567
  var _a, _b, _c, _d, _e, _f, _g, _h;
564
568
  if (!data)
565
569
  return undefined;
@@ -594,13 +598,14 @@ class Builder extends BaseBuilder_1.BaseBuilder {
594
598
  * @param data - data for the node
595
599
  * @returns
596
600
  */
597
- buildBody(textFormat, data) {
601
+ buildBody(context, data) {
598
602
  if (!data)
599
603
  return undefined;
600
604
  let body;
601
605
  const bodyBits = [];
602
606
  const placeholders = data.placeholders;
603
607
  const bodyString = data.bodyString;
608
+ const { textFormat } = context;
604
609
  // Handle JSON type body
605
610
  const handleJsonBody = () => {
606
611
  // Attempt to parse a string body as JSON to support the legacy format
@@ -666,6 +671,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
666
671
  // Convert the body string to AST
667
672
  rawBody = this.textParser.toAst(bodyStr, {
668
673
  textFormat,
674
+ isProperty: false,
669
675
  });
670
676
  const replaceBitsRecursive = (bodyText) => {
671
677
  for (let i = 0, len = bodyText.length; i < len; i++) {
@@ -694,16 +700,16 @@ class Builder extends BaseBuilder_1.BaseBuilder {
694
700
  let parsedBit;
695
701
  switch (bodyBit.type) {
696
702
  case BodyBitType_1.BodyBitType.gap:
697
- parsedBit = this.buildGap(bodyBit);
703
+ parsedBit = this.buildGap(context, bodyBit);
698
704
  break;
699
705
  case BodyBitType_1.BodyBitType.mark:
700
- parsedBit = this.buildMark(bodyBit);
706
+ parsedBit = this.buildMark(context, bodyBit);
701
707
  break;
702
708
  case BodyBitType_1.BodyBitType.select:
703
- parsedBit = this.buildSelect(bodyBit);
709
+ parsedBit = this.buildSelect(context, bodyBit);
704
710
  break;
705
711
  case BodyBitType_1.BodyBitType.highlight:
706
- parsedBit = this.buildHighlight(bodyBit);
712
+ parsedBit = this.buildHighlight(context, bodyBit);
707
713
  break;
708
714
  default:
709
715
  // TODO?? Ensure other parts are valid
@@ -749,11 +755,11 @@ class Builder extends BaseBuilder_1.BaseBuilder {
749
755
  * @param data - data for the node
750
756
  * @returns
751
757
  */
752
- buildFooter(data) {
758
+ buildFooter(context, data) {
753
759
  if (!data)
754
760
  return undefined;
755
761
  const node = {
756
- footer: this.handleJsonText(data.footer),
762
+ footer: this.handleJsonText(context, false, data.footer),
757
763
  };
758
764
  return node;
759
765
  }
@@ -763,7 +769,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
763
769
  * @param data - data for the node
764
770
  * @returns
765
771
  */
766
- buildGap(data) {
772
+ buildGap(context, data) {
767
773
  var _a;
768
774
  if (!data)
769
775
  return undefined;
@@ -772,7 +778,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
772
778
  // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
773
779
  data = this.bodyBitCopyFromAttrs(data);
774
780
  // NOTE: Node order is important and is defined here
775
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.gap, solutions: (_a = data.solutions) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __solutionsAst: data.__solutionsAst, attrs: {} });
781
+ const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.gap, solutions: (_a = data.solutions) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __solutionsAst: data.__solutionsAst, attrs: {} });
776
782
  // Remove Unset Optionals
777
783
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
778
784
  ignoreAllFalse: true,
@@ -787,10 +793,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
787
793
  * @param data - data for the node
788
794
  * @returns
789
795
  */
790
- buildMarkConfigs(data) {
796
+ buildMarkConfigs(context, data) {
791
797
  if (!Array.isArray(data))
792
798
  return undefined;
793
- const nodes = data.map((d) => this.buildMarkConfig(d)).filter((d) => d != null);
799
+ const nodes = data.map((d) => this.buildMarkConfig(context, d)).filter((d) => d != null);
794
800
  return nodes.length > 0 ? nodes : undefined;
795
801
  }
796
802
  /**
@@ -799,7 +805,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
799
805
  * @param data - data for the node
800
806
  * @returns
801
807
  */
802
- buildMarkConfig(data) {
808
+ buildMarkConfig(_context, data) {
803
809
  var _a, _b, _c;
804
810
  if (!data)
805
811
  return undefined;
@@ -821,14 +827,14 @@ class Builder extends BaseBuilder_1.BaseBuilder {
821
827
  * @param data - data for the node
822
828
  * @returns
823
829
  */
824
- buildMark(data) {
830
+ buildMark(context, data) {
825
831
  var _a, _b;
826
832
  if (!data)
827
833
  return undefined;
828
834
  // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
829
835
  data = this.bodyBitCopyFromAttrs(data);
830
836
  // NOTE: Node order is important and is defined here
831
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.mark, solution: (_a = data.solution) !== null && _a !== void 0 ? _a : '', mark: (_b = data.mark) !== null && _b !== void 0 ? _b : '', item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true)), { attrs: {} });
837
+ const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.mark, solution: (_a = data.solution) !== null && _a !== void 0 ? _a : '', mark: (_b = data.mark) !== null && _b !== void 0 ? _b : '', item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true)), { attrs: {} });
832
838
  // Remove Unset Optionals
833
839
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
834
840
  ignoreAllFalse: true,
@@ -844,14 +850,14 @@ class Builder extends BaseBuilder_1.BaseBuilder {
844
850
  * @param data - data for the node
845
851
  * @returns
846
852
  */
847
- buildSelect(data) {
853
+ buildSelect(context, data) {
848
854
  var _a, _b, _c;
849
855
  if (!data)
850
856
  return undefined;
851
857
  // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
852
858
  data = this.bodyBitCopyFromAttrs(data);
853
859
  // NOTE: Node order is important and is defined here
854
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.select, options: (_a = this.buildSelectOptions(data.options)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(false, undefined, undefined)), { __hintString: data.__hintString, __instructionString: data.__instructionString, attrs: {} });
860
+ const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.select, options: (_a = this.buildSelectOptions(context, data.options)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(false, undefined, undefined)), { __hintString: data.__hintString, __instructionString: data.__instructionString, attrs: {} });
855
861
  // Remove Unset Optionals
856
862
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
857
863
  ignoreAllFalse: true,
@@ -866,10 +872,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
866
872
  * @param data - data for the node
867
873
  * @returns
868
874
  */
869
- buildSelectOptions(data) {
875
+ buildSelectOptions(context, data) {
870
876
  if (!Array.isArray(data))
871
877
  return undefined;
872
- const nodes = data.map((d) => this.buildSelectOption(d)).filter((d) => d != null);
878
+ const nodes = data.map((d) => this.buildSelectOption(context, d)).filter((d) => d != null);
873
879
  return nodes.length > 0 ? nodes : undefined;
874
880
  }
875
881
  /**
@@ -878,12 +884,12 @@ class Builder extends BaseBuilder_1.BaseBuilder {
878
884
  * @param data - data for the node
879
885
  * @returns
880
886
  */
881
- buildSelectOption(data) {
887
+ buildSelectOption(context, data) {
882
888
  var _a;
883
889
  if (!data)
884
890
  return undefined;
885
891
  // NOTE: Node order is important and is defined here
886
- const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
892
+ const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
887
893
  // Remove Unset Optionals
888
894
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
889
895
  ignoreAllFalse: true,
@@ -898,14 +904,14 @@ class Builder extends BaseBuilder_1.BaseBuilder {
898
904
  * @param data - data for the node
899
905
  * @returns
900
906
  */
901
- buildHighlight(data) {
907
+ buildHighlight(context, data) {
902
908
  var _a, _b, _c;
903
909
  if (!data)
904
910
  return undefined;
905
911
  // Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
906
912
  data = this.bodyBitCopyFromAttrs(data);
907
913
  // NOTE: Node order is important and is defined here
908
- const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.highlight, texts: (_a = this.buildHighlightTexts(data.texts)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(false, undefined, undefined)), { attrs: {} });
914
+ const node = Object.assign(Object.assign({ type: BodyBitType_1.BodyBitType.highlight, texts: (_a = this.buildHighlightTexts(context, data.texts)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(false, undefined, undefined)), { attrs: {} });
909
915
  // Remove Unset Optionals
910
916
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
911
917
  ignoreAllFalse: true,
@@ -920,10 +926,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
920
926
  * @param data - data for the node
921
927
  * @returns
922
928
  */
923
- buildHighlightTexts(data) {
929
+ buildHighlightTexts(context, data) {
924
930
  if (!Array.isArray(data))
925
931
  return undefined;
926
- const nodes = data.map((d) => this.buildHighlightText(d)).filter((d) => d != null);
932
+ const nodes = data.map((d) => this.buildHighlightText(context, d)).filter((d) => d != null);
927
933
  return nodes.length > 0 ? nodes : undefined;
928
934
  }
929
935
  /**
@@ -932,12 +938,12 @@ class Builder extends BaseBuilder_1.BaseBuilder {
932
938
  * @param data - data for the node
933
939
  * @returns
934
940
  */
935
- buildHighlightText(data) {
941
+ buildHighlightText(context, data) {
936
942
  var _a;
937
943
  if (!data)
938
944
  return undefined;
939
945
  // NOTE: Node order is important and is defined here
940
- const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, isHighlighted: !!data.isHighlighted, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
946
+ const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, isHighlighted: !!data.isHighlighted, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
941
947
  // Remove Unset Optionals
942
948
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
943
949
  ignoreAllFalse: true,
@@ -952,10 +958,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
952
958
  * @param data - data for the node
953
959
  * @returns
954
960
  */
955
- buildFlashcards(textFormat, data) {
961
+ buildFlashcards(context, data) {
956
962
  if (!Array.isArray(data))
957
963
  return undefined;
958
- const nodes = data.map((d) => this.buildFlashcard(textFormat, d)).filter((d) => d != null);
964
+ const nodes = data.map((d) => this.buildFlashcard(context, d)).filter((d) => d != null);
959
965
  return nodes.length > 0 ? nodes : undefined;
960
966
  }
961
967
  /**
@@ -964,11 +970,11 @@ class Builder extends BaseBuilder_1.BaseBuilder {
964
970
  * @param data - data for the node
965
971
  * @returns
966
972
  */
967
- buildFlashcard(textFormat, data) {
973
+ buildFlashcard(context, data) {
968
974
  if (!data)
969
975
  return undefined;
970
976
  // NOTE: Node order is important and is defined here
971
- const node = Object.assign({ question: this.handleJsonText(data.question, textFormat), answer: this.handleJsonText(data.answer, textFormat), alternativeAnswers: this.handleJsonText(data.alternativeAnswers, textFormat), item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
977
+ const node = Object.assign({ question: this.handleJsonText(context, true, data.question), answer: this.handleJsonText(context, true, data.answer), alternativeAnswers: this.handleJsonText(context, true, data.alternativeAnswers), item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
972
978
  // Remove Unset Optionals
973
979
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
974
980
  ignoreAllFalse: true,
@@ -983,10 +989,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
983
989
  * @param data - data for the node
984
990
  * @returns
985
991
  */
986
- buildDefinitionList(textFormat, data) {
992
+ buildDefinitionList(context, data) {
987
993
  if (!Array.isArray(data))
988
994
  return undefined;
989
- const nodes = data.map((d) => this.buildDefinitionListItem(textFormat, d)).filter((d) => d != null);
995
+ const nodes = data.map((d) => this.buildDefinitionListItem(context, d)).filter((d) => d != null);
990
996
  return nodes.length > 0 ? nodes : undefined;
991
997
  }
992
998
  /**
@@ -995,11 +1001,11 @@ class Builder extends BaseBuilder_1.BaseBuilder {
995
1001
  * @param data - data for the node
996
1002
  * @returns
997
1003
  */
998
- buildDefinitionListItem(textFormat, data) {
1004
+ buildDefinitionListItem(context, data) {
999
1005
  if (!data)
1000
1006
  return undefined;
1001
1007
  // NOTE: Node order is important and is defined here
1002
- const node = Object.assign({ term: this.handleJsonText(data.term, textFormat), definition: this.handleJsonText(data.definition, textFormat), alternativeDefinitions: this.handleJsonText(data.alternativeDefinitions, textFormat), item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
1008
+ const node = Object.assign({ term: this.handleJsonText(context, true, data.term), definition: this.handleJsonText(context, true, data.definition), alternativeDefinitions: this.handleJsonText(context, true, data.alternativeDefinitions), item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
1003
1009
  // Remove Unset Optionals
1004
1010
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1005
1011
  ignoreAllFalse: true,
@@ -1014,10 +1020,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1014
1020
  * @param data - data for the node
1015
1021
  * @returns
1016
1022
  */
1017
- buildStatements(data) {
1023
+ buildStatements(context, data) {
1018
1024
  if (!Array.isArray(data))
1019
1025
  return undefined;
1020
- const nodes = data.map((d) => this.buildStatement(d)).filter((d) => d != null);
1026
+ const nodes = data.map((d) => this.buildStatement(context, d)).filter((d) => d != null);
1021
1027
  return nodes.length > 0 ? nodes : undefined;
1022
1028
  }
1023
1029
  /**
@@ -1026,12 +1032,12 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1026
1032
  * @param data - data for the node
1027
1033
  * @returns
1028
1034
  */
1029
- buildStatement(data) {
1035
+ buildStatement(context, data) {
1030
1036
  var _a;
1031
1037
  if (!data)
1032
1038
  return undefined;
1033
1039
  // NOTE: Node order is important and is defined here
1034
- const node = Object.assign({ statement: (_a = data.statement) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
1040
+ const node = Object.assign({ statement: (_a = data.statement) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
1035
1041
  // Remove Unset Optionals
1036
1042
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
1037
1043
  ignoreAllFalse: true,
@@ -1046,7 +1052,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1046
1052
  * @param data - data for the node
1047
1053
  * @returns
1048
1054
  */
1049
- buildImageSource(data) {
1055
+ buildImageSource(_context, data) {
1050
1056
  if (!data)
1051
1057
  return undefined;
1052
1058
  const { url, mockupId, size, format, trim } = data;
@@ -1072,7 +1078,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1072
1078
  * @param data - data for the node
1073
1079
  * @returns
1074
1080
  */
1075
- buildPerson(bitType, data) {
1081
+ buildPerson(context, data) {
1076
1082
  var _a;
1077
1083
  if (!data)
1078
1084
  return undefined;
@@ -1082,7 +1088,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1082
1088
  const node = {
1083
1089
  name: name !== null && name !== void 0 ? name : '',
1084
1090
  title: (title !== null && title !== void 0 ? title : undefined),
1085
- avatarImage: (_a = ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(bitType, ResourceTag_1.ResourceTag.image, avatarImage))) === null || _a === void 0 ? void 0 : _a.image,
1091
+ avatarImage: (_a = ArrayUtils_1.ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag_1.ResourceTag.image, avatarImage))) === null || _a === void 0 ? void 0 : _a.image,
1086
1092
  };
1087
1093
  // Remove Unset Optionals
1088
1094
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
@@ -1097,7 +1103,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1097
1103
  * @param data - data for the node
1098
1104
  * @returns
1099
1105
  */
1100
- buildTechnicalTerm(data) {
1106
+ buildTechnicalTerm(_context, data) {
1101
1107
  if (!data)
1102
1108
  return undefined;
1103
1109
  const { technicalTerm, lang } = data;
@@ -1119,7 +1125,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1119
1125
  * @param data - data for the node
1120
1126
  * @returns
1121
1127
  */
1122
- buildServings(data) {
1128
+ buildServings(_context, data) {
1123
1129
  if (!data)
1124
1130
  return undefined;
1125
1131
  const { servings, unit, unitAbbr, decimalPlaces, disableCalculation, hint } = data;
@@ -1145,14 +1151,14 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1145
1151
  * @param data - data for the node
1146
1152
  * @returns
1147
1153
  */
1148
- buildRatingLevelStartEnd(data) {
1154
+ buildRatingLevelStartEnd(context, data) {
1149
1155
  if (!data)
1150
1156
  return undefined;
1151
1157
  const { level, label } = data;
1152
1158
  // NOTE: Node order is important and is defined here
1153
1159
  const node = {
1154
1160
  level: level !== null && level !== void 0 ? level : 0,
1155
- label: this.handleJsonText(label),
1161
+ label: this.handleJsonText(context, true, label),
1156
1162
  };
1157
1163
  // Remove Unset Optionals
1158
1164
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node, {
@@ -1167,12 +1173,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1167
1173
  * @param data - data for the node
1168
1174
  * @returns
1169
1175
  */
1170
- buildCaptionDefinition(textFormat, data) {
1176
+ buildCaptionDefinition(_context, data) {
1171
1177
  var _a, _b;
1172
1178
  if (!data)
1173
1179
  return undefined;
1174
- // Unused
1175
- textFormat;
1176
1180
  // NOTE: Node order is important and is defined here
1177
1181
  const node = {
1178
1182
  // term: this.convertJsonTextToAstText(data.term),
@@ -1193,7 +1197,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1193
1197
  * @param data - data for the node
1194
1198
  * @returns
1195
1199
  */
1196
- buildCaptionDefinitionList(textFormat, data) {
1200
+ buildCaptionDefinitionList(context, data) {
1197
1201
  var _a, _b;
1198
1202
  if (!data)
1199
1203
  return undefined;
@@ -1202,7 +1206,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1202
1206
  columns: (_a = data.columns) !== null && _a !== void 0 ? _a : [],
1203
1207
  definitions: ((_b = data.definitions) !== null && _b !== void 0 ? _b : [])
1204
1208
  .map((d) => {
1205
- return this.buildCaptionDefinition(textFormat, {
1209
+ return this.buildCaptionDefinition(context, {
1206
1210
  term: d.term,
1207
1211
  definition: d.definition,
1208
1212
  });
@@ -1221,10 +1225,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1221
1225
  * @param data - data for the node
1222
1226
  * @returns
1223
1227
  */
1224
- buildCardBits(bitType, textFormat, data) {
1228
+ buildCardBits(context, data) {
1225
1229
  if (!Array.isArray(data))
1226
1230
  return undefined;
1227
- const nodes = data.map((d) => this.buildCardBit(bitType, textFormat, d)).filter((d) => d != null);
1231
+ const nodes = data.map((d) => this.buildCardBit(context, d)).filter((d) => d != null);
1228
1232
  return nodes.length > 0 ? nodes : undefined;
1229
1233
  }
1230
1234
  /**
@@ -1233,9 +1237,10 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1233
1237
  * @param data - data for the node
1234
1238
  * @returns
1235
1239
  */
1236
- buildCardBit(bitType, textFormat, data) {
1240
+ buildCardBit(context, data) {
1237
1241
  if (!data)
1238
1242
  return undefined;
1243
+ const { bitType, textFormat } = context;
1239
1244
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1240
1245
  const node = this.buildBit(Object.assign(Object.assign({}, data), { bitType, textFormat }));
1241
1246
  // // NOTE: Node order is important and is defined here
@@ -1262,26 +1267,26 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1262
1267
  //
1263
1268
  // Private
1264
1269
  //
1265
- buildCardNode(bitType, textFormat, data) {
1270
+ buildCardNode(context, data) {
1266
1271
  const node = {
1267
- questions: this.buildQuestions(textFormat, data.questions),
1272
+ questions: this.buildQuestions(context, data.questions),
1268
1273
  elements: data.elements,
1269
- flashcards: this.buildFlashcards(textFormat, data.flashcards),
1270
- definitions: this.buildDefinitionList(textFormat, data.definitions),
1271
- statement: this.buildStatement(data.statement),
1272
- statements: this.buildStatements(data.statements),
1273
- choices: this.buildChoices(data.choices),
1274
- responses: this.buildResponses(data.responses),
1275
- quizzes: this.buildQuizzes(data.quizzes),
1276
- heading: this.buildHeading(data.heading),
1277
- pairs: this.buildPairs(bitType, data.pairs),
1278
- matrix: this.buildMatricies(data.matrix),
1279
- pronunciationTable: this.buildPronunciationTable(bitType, textFormat, data.pronunciationTable),
1280
- table: this.buildTable(textFormat, data.table),
1281
- botResponses: this.buildBotResponses(data.botResponses),
1282
- ingredients: this.buildIngredients(data.ingredients),
1283
- captionDefinitionList: this.buildCaptionDefinitionList(textFormat, data.captionDefinitionList),
1284
- cardBits: this.buildCardBits(bitType, textFormat, data.cardBits),
1274
+ flashcards: this.buildFlashcards(context, data.flashcards),
1275
+ definitions: this.buildDefinitionList(context, data.definitions),
1276
+ statement: this.buildStatement(context, data.statement),
1277
+ statements: this.buildStatements(context, data.statements),
1278
+ choices: this.buildChoices(context, data.choices),
1279
+ responses: this.buildResponses(context, data.responses),
1280
+ quizzes: this.buildQuizzes(context, data.quizzes),
1281
+ heading: this.buildHeading(context, data.heading),
1282
+ pairs: this.buildPairs(context, data.pairs),
1283
+ matrix: this.buildMatricies(context, data.matrix),
1284
+ pronunciationTable: this.buildPronunciationTable(context, data.pronunciationTable),
1285
+ table: this.buildTable(context, data.table),
1286
+ botResponses: this.buildBotResponses(context, data.botResponses),
1287
+ ingredients: this.buildIngredients(context, data.ingredients),
1288
+ captionDefinitionList: this.buildCaptionDefinitionList(context, data.captionDefinitionList),
1289
+ cardBits: this.buildCardBits(context, data.cardBits),
1285
1290
  };
1286
1291
  // Remove Unset Optionals
1287
1292
  ObjectUtils_1.ObjectUtils.removeUnwantedProperties(node);
@@ -1315,28 +1320,28 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1315
1320
  * @param example
1316
1321
  * @returns true if any of the answers has an example, otherwise undefined
1317
1322
  */
1318
- pushExampleDownTree(body, cardNode, __isDefaultExample, example) {
1323
+ pushExampleDownTree(context, body, cardNode, __isDefaultExample, example) {
1319
1324
  if (__isDefaultExample || example != null) {
1320
1325
  if (cardNode) {
1321
- this.pushExampleDownTreeString(__isDefaultExample, example, cardNode.pairs);
1322
- this.pushExampleDownTreeBoolean(__isDefaultExample, example, false, cardNode.flashcards);
1323
- this.pushExampleDownTreeBoolean(__isDefaultExample, example, false, cardNode.definitions);
1324
- this.pushExampleDownTreeBoolean(__isDefaultExample, example, true, cardNode.choices);
1325
- this.pushExampleDownTreeBoolean(__isDefaultExample, example, false, cardNode.responses, cardNode.statements, cardNode.statement);
1326
+ this.pushExampleDownTreeString(context, __isDefaultExample, example, cardNode.pairs);
1327
+ this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.flashcards);
1328
+ this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.definitions);
1329
+ this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, true, cardNode.choices);
1330
+ this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.responses, cardNode.statements, cardNode.statement);
1326
1331
  if (cardNode.quizzes) {
1327
1332
  for (const quiz of cardNode.quizzes) {
1328
- this.pushExampleDownTreeBoolean(__isDefaultExample, example, true, quiz.choices);
1329
- this.pushExampleDownTreeBoolean(__isDefaultExample, example, false, quiz.responses);
1333
+ this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, true, quiz.choices);
1334
+ this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, quiz.responses);
1330
1335
  }
1331
1336
  }
1332
1337
  if (cardNode.matrix) {
1333
1338
  for (const m of cardNode.matrix) {
1334
- this.pushExampleDownTreeString(__isDefaultExample, example, m.cells);
1339
+ this.pushExampleDownTreeString(context, __isDefaultExample, example, m.cells);
1335
1340
  }
1336
1341
  }
1337
1342
  }
1338
1343
  if (body) {
1339
- this.pushExampleDownTreeBodyBits(__isDefaultExample, example, body);
1344
+ this.pushExampleDownTreeBodyBits(context, __isDefaultExample, example, body);
1340
1345
  }
1341
1346
  }
1342
1347
  }
@@ -1349,7 +1354,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1349
1354
  * @param nodes
1350
1355
  * @returns true if any of the answers has an example, otherwise undefined
1351
1356
  */
1352
- pushExampleDownTreeBoolean(__isDefaultExample, example, onlyCorrect, ...nodes) {
1357
+ pushExampleDownTreeBoolean(_context, __isDefaultExample, example, onlyCorrect, ...nodes) {
1353
1358
  if (!__isDefaultExample && example == null)
1354
1359
  return;
1355
1360
  if (Array.isArray(nodes)) {
@@ -1369,19 +1374,19 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1369
1374
  * @param nodes
1370
1375
  * @returns true if any of the answers has an example, otherwise undefined
1371
1376
  */
1372
- pushExampleDownTreeString(__isDefaultExample, example, ...nodes) {
1377
+ pushExampleDownTreeString(context, __isDefaultExample, example, ...nodes) {
1373
1378
  if (!__isDefaultExample && !example)
1374
1379
  return;
1375
1380
  if (Array.isArray(nodes)) {
1376
1381
  for (const ds of nodes) {
1377
1382
  if (ds) {
1378
1383
  const exampleNodes = Array.isArray(ds) ? ds : [ds];
1379
- BitUtils_1.BitUtils.fillStringExample(exampleNodes, __isDefaultExample, example, false);
1384
+ BitUtils_1.BitUtils.fillStringExample(context.textFormat, exampleNodes, __isDefaultExample, example, false);
1380
1385
  }
1381
1386
  }
1382
1387
  }
1383
1388
  }
1384
- pushExampleDownTreeBodyBits(__isDefaultExample, example, body) {
1389
+ pushExampleDownTreeBodyBits(context, __isDefaultExample, example, body) {
1385
1390
  if (!__isDefaultExample && !example)
1386
1391
  return;
1387
1392
  const bodyBitsJson = this.textParser.extractBodyBits(body === null || body === void 0 ? void 0 : body.body);
@@ -1390,7 +1395,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1390
1395
  switch (part.type) {
1391
1396
  case BodyBitType_1.BodyBitType.gap: {
1392
1397
  const gap = part;
1393
- BitUtils_1.BitUtils.fillStringExample([gap], __isDefaultExample, example, false);
1398
+ BitUtils_1.BitUtils.fillStringExample(context.textFormat, [gap], __isDefaultExample, example, false);
1394
1399
  break;
1395
1400
  }
1396
1401
  case BodyBitType_1.BodyBitType.mark: {
@@ -1423,7 +1428,7 @@ class Builder extends BaseBuilder_1.BaseBuilder {
1423
1428
  * @param path path for the value
1424
1429
  * @param value the value to push down
1425
1430
  */
1426
- pushDownTree(body, bodyBitTypes, cardNode, cardNodePath, path, value) {
1431
+ pushDownTree(_context, body, bodyBitTypes, cardNode, cardNodePath, path, value) {
1427
1432
  if (value === undefined)
1428
1433
  return;
1429
1434
  // Add value to card nodes if required (TODO - nested paths)