@gmb/bitmark-parser-generator 1.4.17 → 1.4.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/browser/bitmark-parser-generator.min.js +1 -1
  2. package/dist/browser/bundle-report.html +2 -2
  3. package/dist/cjs/BitmarkParserGenerator.js +2 -13
  4. package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
  5. package/dist/cjs/ast/Builder.js +8 -8
  6. package/dist/cjs/ast/Builder.js.map +1 -1
  7. package/dist/cjs/ast/rules/NodeValidator.js +6 -23
  8. package/dist/cjs/ast/rules/NodeValidator.js.map +1 -1
  9. package/dist/cjs/config/Config.js +57 -86
  10. package/dist/cjs/config/Config.js.map +1 -1
  11. package/dist/cjs/config/raw/bits.js +328 -467
  12. package/dist/cjs/config/raw/bits.js.map +1 -1
  13. package/dist/cjs/config/raw/properties.js +10 -0
  14. package/dist/cjs/config/raw/properties.js.map +1 -1
  15. package/dist/cjs/generated/build-info.js +1 -1
  16. package/dist/cjs/generator/bitmark/BitmarkGenerator.js +9 -11
  17. package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
  18. package/dist/cjs/generator/json/JsonGenerator.js +224 -205
  19. package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
  20. package/dist/cjs/index.js +2 -3
  21. package/dist/cjs/index.js.map +1 -1
  22. package/dist/cjs/info/InfoBuilder.js +10 -33
  23. package/dist/cjs/info/InfoBuilder.js.map +1 -1
  24. package/dist/cjs/model/ast/NodeType.js +4 -0
  25. package/dist/cjs/model/ast/NodeType.js.map +1 -1
  26. package/dist/cjs/model/config/BitConfig.js +8 -7
  27. package/dist/cjs/model/config/BitConfig.js.map +1 -1
  28. package/dist/cjs/model/config/enum/PropertyConfigKey.js +2 -0
  29. package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
  30. package/dist/cjs/model/enum/BitType.js +86 -89
  31. package/dist/cjs/model/enum/BitType.js.map +1 -1
  32. package/dist/cjs/model/enum/PropertyTag.js +2 -0
  33. package/dist/cjs/model/enum/PropertyTag.js.map +1 -1
  34. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +9 -9
  35. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  36. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +6 -6
  37. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  38. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  39. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +4 -4
  40. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  41. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  42. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  43. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +52 -47
  44. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  45. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  46. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  47. package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -1
  48. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  49. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  50. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  51. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
  52. package/dist/cjs/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
  53. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
  54. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  55. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  56. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +15 -17
  57. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  58. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +14 -11
  59. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
  60. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  61. package/dist/cjs/parser/json/JsonParser.js +5 -5
  62. package/dist/cjs/parser/json/JsonParser.js.map +1 -1
  63. package/dist/cjs/utils/ObjectUtils.js +62 -0
  64. package/dist/cjs/utils/ObjectUtils.js.map +1 -1
  65. package/dist/esm/BitmarkParserGenerator.js +2 -13
  66. package/dist/esm/BitmarkParserGenerator.js.map +1 -1
  67. package/dist/esm/ast/Builder.js +9 -9
  68. package/dist/esm/ast/Builder.js.map +1 -1
  69. package/dist/esm/ast/rules/NodeValidator.js +6 -23
  70. package/dist/esm/ast/rules/NodeValidator.js.map +1 -1
  71. package/dist/esm/config/Config.js +57 -86
  72. package/dist/esm/config/Config.js.map +1 -1
  73. package/dist/esm/config/raw/bits.js +329 -468
  74. package/dist/esm/config/raw/bits.js.map +1 -1
  75. package/dist/esm/config/raw/properties.js +10 -0
  76. package/dist/esm/config/raw/properties.js.map +1 -1
  77. package/dist/esm/generated/build-info.js +1 -1
  78. package/dist/esm/generator/bitmark/BitmarkGenerator.js +10 -12
  79. package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
  80. package/dist/esm/generator/json/JsonGenerator.js +225 -206
  81. package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
  82. package/dist/esm/index.js +1 -1
  83. package/dist/esm/index.js.map +1 -1
  84. package/dist/esm/info/InfoBuilder.js +11 -34
  85. package/dist/esm/info/InfoBuilder.js.map +1 -1
  86. package/dist/esm/model/ast/NodeType.js +4 -0
  87. package/dist/esm/model/ast/NodeType.js.map +1 -1
  88. package/dist/esm/model/config/BitConfig.js +8 -7
  89. package/dist/esm/model/config/BitConfig.js.map +1 -1
  90. package/dist/esm/model/config/enum/PropertyConfigKey.js +2 -0
  91. package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
  92. package/dist/esm/model/enum/BitType.js +85 -87
  93. package/dist/esm/model/enum/BitType.js.map +1 -1
  94. package/dist/esm/model/enum/PropertyTag.js +2 -0
  95. package/dist/esm/model/enum/PropertyTag.js.map +1 -1
  96. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +10 -10
  97. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  98. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +6 -6
  99. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  100. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  101. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +5 -5
  102. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  103. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  104. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  105. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +53 -48
  106. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  107. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  108. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  109. package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -1
  110. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  111. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  112. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  113. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
  114. package/dist/esm/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
  115. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
  116. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  117. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  118. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +16 -18
  119. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  120. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +15 -12
  121. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
  122. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  123. package/dist/esm/parser/json/JsonParser.js +6 -6
  124. package/dist/esm/parser/json/JsonParser.js.map +1 -1
  125. package/dist/esm/utils/ObjectUtils.js +59 -0
  126. package/dist/esm/utils/ObjectUtils.js.map +1 -1
  127. package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
  128. package/dist/types/ast/Builder.d.ts +4 -2
  129. package/dist/types/ast/Builder.d.ts.map +1 -1
  130. package/dist/types/ast/rules/NodeValidator.d.ts +0 -1
  131. package/dist/types/ast/rules/NodeValidator.d.ts.map +1 -1
  132. package/dist/types/config/Config.d.ts +16 -28
  133. package/dist/types/config/Config.d.ts.map +1 -1
  134. package/dist/types/config/raw/bits.d.ts.map +1 -1
  135. package/dist/types/config/raw/properties.d.ts.map +1 -1
  136. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +4 -4
  137. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
  138. package/dist/types/generator/json/JsonGenerator.d.ts +22 -22
  139. package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
  140. package/dist/types/generator/text/TextGenerator.d.ts +2 -2
  141. package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
  142. package/dist/types/index.d.ts +2 -2
  143. package/dist/types/index.d.ts.map +1 -1
  144. package/dist/types/info/InfoBuilder.d.ts +3 -4
  145. package/dist/types/info/InfoBuilder.d.ts.map +1 -1
  146. package/dist/types/model/ast/NodeType.d.ts +8 -0
  147. package/dist/types/model/ast/NodeType.d.ts.map +1 -1
  148. package/dist/types/model/ast/Nodes.d.ts +4 -2
  149. package/dist/types/model/ast/Nodes.d.ts.map +1 -1
  150. package/dist/types/model/config/BitConfig.d.ts +5 -4
  151. package/dist/types/model/config/BitConfig.d.ts.map +1 -1
  152. package/dist/types/model/config/_Config.d.ts +3 -5
  153. package/dist/types/model/config/_Config.d.ts.map +1 -1
  154. package/dist/types/model/config/enum/ConfigKey.d.ts +4 -0
  155. package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
  156. package/dist/types/model/config/enum/PropertyConfigKey.d.ts +6 -0
  157. package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
  158. package/dist/types/model/enum/BitType.d.ts +171 -188
  159. package/dist/types/model/enum/BitType.d.ts.map +1 -1
  160. package/dist/types/model/enum/PropertyTag.d.ts +4 -0
  161. package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
  162. package/dist/types/model/json/BitJson.d.ts +2 -0
  163. package/dist/types/model/json/BitJson.d.ts.map +1 -1
  164. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +3 -3
  165. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
  166. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +6 -6
  167. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
  168. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts +2 -2
  169. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
  170. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +2 -2
  171. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
  172. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts +2 -2
  173. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
  174. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts +2 -2
  175. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
  176. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts +2 -2
  177. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
  178. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts +2 -2
  179. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
  180. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts +2 -2
  181. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
  182. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts +2 -2
  183. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts.map +1 -1
  184. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts +2 -2
  185. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
  186. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts +2 -2
  187. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
  188. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts +2 -2
  189. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
  190. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts +2 -2
  191. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +1 -1
  192. package/dist/types/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.d.ts +2 -2
  193. package/dist/types/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.d.ts.map +1 -1
  194. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts +2 -2
  195. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
  196. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts +2 -2
  197. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
  198. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +3 -3
  199. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
  200. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +3 -3
  201. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
  202. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +2 -2
  203. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
  204. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts +2 -2
  205. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
  206. package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
  207. package/dist/types/utils/ObjectUtils.d.ts +9 -0
  208. package/dist/types/utils/ObjectUtils.d.ts.map +1 -1
  209. package/package.json +3 -1
@@ -221,7 +221,7 @@ class JsonGenerator {
221
221
  if (isBoolean) {
222
222
  // Boolean example
223
223
  defaultExample = true;
224
- if (bit.bitType.root === BitType_1.RootBitType.trueFalse1) {
224
+ if (Config_1.Config.isOfBitType(bit.bitType, BitType_1.BitType.trueFalse1)) {
225
225
  if (((_b = (_a = bit.cardNode) === null || _a === void 0 ? void 0 : _a.statement) === null || _b === void 0 ? void 0 : _b.isCorrect) !== undefined) {
226
226
  defaultExample = bit.cardNode.statement.isCorrect;
227
227
  }
@@ -339,7 +339,7 @@ class JsonGenerator {
339
339
  return;
340
340
  // Create the listItems / sections if not already created
341
341
  let listItems;
342
- if (bitType.alias === BitType_1.AliasBitType.pageFooter) {
342
+ if (bitType === BitType_1.BitType.pageFooter) {
343
343
  if (!this.bitJson.sections)
344
344
  this.bitJson.sections = [];
345
345
  listItems = this.bitJson.sections;
@@ -1689,9 +1689,9 @@ class JsonGenerator {
1689
1689
  return zoomDisabled;
1690
1690
  // The default value in the JSON is hardcoded, because there is currently no good way to set a different
1691
1691
  // default per bit in the BitConfig.
1692
- switch (bitType.alias) {
1693
- case BitType_1.AliasBitType.imageSeparator:
1694
- case BitType_1.AliasBitType.pageBanner:
1692
+ switch (bitType) {
1693
+ case BitType_1.BitType.imageSeparator:
1694
+ case BitType_1.BitType.pageBanner:
1695
1695
  return true;
1696
1696
  }
1697
1697
  return false;
@@ -1854,7 +1854,7 @@ class JsonGenerator {
1854
1854
  */
1855
1855
  createBitJson(bit) {
1856
1856
  const bitJson = {
1857
- type: bit.bitType.alias,
1857
+ type: bit.bitType,
1858
1858
  format: bit.textFormat,
1859
1859
  // Properties
1860
1860
  id: undefined,
@@ -1892,6 +1892,8 @@ class JsonGenerator {
1892
1892
  thumbImage: undefined,
1893
1893
  focusX: undefined,
1894
1894
  focusY: undefined,
1895
+ pointerLeft: undefined,
1896
+ pointerTop: undefined,
1895
1897
  deeplink: undefined,
1896
1898
  externalLink: undefined,
1897
1899
  externalLinkText: undefined,
@@ -1991,207 +1993,224 @@ class JsonGenerator {
1991
1993
  // NOTE: Not all bits have the same default properties.
1992
1994
  // The properties used are a bit random sometimes?
1993
1995
  // It would be better if this functionality was generated from the bit config
1994
- switch (bitType.root) {
1995
- case BitType_1.RootBitType._error:
1996
- case BitType_1.RootBitType._comment:
1997
- delete bitJson.format;
1998
- break;
1999
- case BitType_1.RootBitType.article:
2000
- case BitType_1.RootBitType.sampleSolution:
2001
- case BitType_1.RootBitType.page:
2002
- if (bitJson.body == null)
2003
- bitJson.body = this.bodyDefault;
2004
- break;
2005
- default: // Most bits have these defaults, but there are special cases (not sure if that is by error or design)
2006
- if (bitJson.item == null)
2007
- bitJson.item = this.textDefault;
2008
- if (bitJson.hint == null)
2009
- bitJson.hint = this.textDefault;
2010
- if (bitJson.isExample == null)
2011
- bitJson.isExample = false;
2012
- if (bitJson.example == null)
2013
- bitJson.example = null;
2014
- if (bitJson.body == null)
2015
- bitJson.body = this.bodyDefault;
2016
- // Special case for 'ai' bits
2017
- if (bitType.alias === BitType_1.AliasBitType.articleAi ||
2018
- bitType.alias === BitType_1.AliasBitType.noteAi ||
2019
- bitType.alias === BitType_1.AliasBitType.summaryAi) {
2020
- if (bitJson.AIGenerated == null)
2021
- bitJson.AIGenerated = true;
2022
- }
2023
- // Special case for 'review-...' bits
2024
- if (bitType.root === BitType_1.RootBitType.reviewNote) {
2025
- if (bitJson.resolved == null)
2026
- bitJson.resolved = false;
2027
- if (bitJson.resolvedDate == null)
2028
- bitJson.resolvedDate = '';
2029
- if (bitJson.resolvedBy == null)
2030
- bitJson.resolvedBy = '';
2031
- }
2032
- break;
1996
+ if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType._error, BitType_1.BitType._comment])) {
1997
+ //
1998
+ delete bitJson.format;
1999
+ //
2000
+ }
2001
+ else if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType.article, BitType_1.BitType.sampleSolution, BitType_1.BitType.page])) {
2002
+ //
2003
+ if (bitJson.body == null)
2004
+ bitJson.body = this.bodyDefault;
2005
+ //
2006
+ }
2007
+ else if (Config_1.Config.isOfBitType(bitType, [
2008
+ BitType_1.BitType.cloze,
2009
+ BitType_1.BitType.multipleChoice1,
2010
+ BitType_1.BitType.multipleResponse1,
2011
+ BitType_1.BitType.multipleChoiceText,
2012
+ BitType_1.BitType.highlightText,
2013
+ BitType_1.BitType.clozeAndMultipleChoiceText,
2014
+ BitType_1.BitType.sequence,
2015
+ BitType_1.BitType.mark,
2016
+ BitType_1.BitType.flashcard,
2017
+ ])) {
2033
2018
  // Default, but with no 'example' at the bit level.
2034
- case BitType_1.RootBitType.cloze:
2035
- case BitType_1.RootBitType.multipleChoice1:
2036
- case BitType_1.RootBitType.multipleResponse1:
2037
- case BitType_1.RootBitType.multipleChoiceText:
2038
- case BitType_1.RootBitType.highlightText:
2039
- case BitType_1.RootBitType.clozeAndMultipleChoiceText:
2040
- case BitType_1.RootBitType.sequence:
2041
- case BitType_1.RootBitType.mark:
2042
- case BitType_1.RootBitType.flashcard:
2043
- if (bitJson.item == null)
2044
- bitJson.item = this.textDefault;
2045
- if (bitJson.hint == null)
2046
- bitJson.hint = this.textDefault;
2047
- if (bitJson.instruction == null)
2048
- bitJson.instruction = this.textDefault;
2049
- if (bitJson.isExample == null)
2050
- bitJson.isExample = false;
2051
- if (bitJson.body == null)
2052
- bitJson.body = this.bodyDefault;
2053
- break;
2019
+ if (bitJson.item == null)
2020
+ bitJson.item = this.textDefault;
2021
+ if (bitJson.hint == null)
2022
+ bitJson.hint = this.textDefault;
2023
+ if (bitJson.instruction == null)
2024
+ bitJson.instruction = this.textDefault;
2025
+ if (bitJson.isExample == null)
2026
+ bitJson.isExample = false;
2027
+ if (bitJson.body == null)
2028
+ bitJson.body = this.bodyDefault;
2029
+ //
2030
+ }
2031
+ else if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType.multipleChoice, BitType_1.BitType.multipleResponse])) {
2054
2032
  // Default with a card (and hence a footer possibility)
2055
- case BitType_1.RootBitType.multipleChoice:
2056
- case BitType_1.RootBitType.multipleResponse:
2057
- if (bitJson.item == null)
2058
- bitJson.item = this.textDefault;
2059
- if (bitJson.hint == null)
2060
- bitJson.hint = this.textDefault;
2061
- if (bitJson.instruction == null)
2062
- bitJson.instruction = this.textDefault;
2063
- if (bitJson.isExample == null)
2064
- bitJson.isExample = false;
2065
- if (bitJson.body == null)
2066
- bitJson.body = this.bodyDefault;
2067
- if (bitJson.footer == null)
2068
- bitJson.footer = this.textDefault;
2069
- break;
2070
- case BitType_1.RootBitType.essay:
2071
- if (bitJson.item == null)
2072
- bitJson.item = this.textDefault;
2073
- if (bitJson.hint == null)
2074
- bitJson.hint = this.textDefault;
2075
- if (bitJson.instruction == null)
2076
- bitJson.instruction = this.textDefault;
2077
- if (bitJson.isExample == null)
2078
- bitJson.isExample = false;
2079
- if (bitJson.example == null)
2080
- bitJson.example = null;
2081
- if (bitJson.body == null)
2082
- bitJson.body = this.bodyDefault;
2083
- if (bitJson.partialAnswer == null)
2084
- bitJson.partialAnswer = '';
2085
- // if (bitJson.sampleSolution == null) bitJson.sampleSolution = '';
2086
- break;
2087
- case BitType_1.RootBitType.trueFalse1:
2088
- if (bitJson.item == null)
2089
- bitJson.item = this.textDefault;
2090
- if (bitJson.lead == null)
2091
- bitJson.lead = this.textDefault;
2092
- if (bitJson.hint == null)
2093
- bitJson.hint = this.textDefault;
2094
- if (bitJson.instruction == null)
2095
- bitJson.instruction = this.textDefault;
2096
- if (bitJson.isExample == null)
2097
- bitJson.isExample = false;
2098
- if (bitJson.example == null)
2099
- bitJson.example = null;
2100
- if (bitJson.isCorrect == null)
2101
- bitJson.isCorrect = false;
2102
- if (bitJson.body == null)
2103
- bitJson.body = this.bodyDefault;
2104
- break;
2105
- case BitType_1.RootBitType.trueFalse:
2106
- if (bitJson.item == null)
2107
- bitJson.item = this.textDefault;
2108
- if (bitJson.lead == null)
2109
- bitJson.lead = this.textDefault;
2110
- if (bitJson.hint == null)
2111
- bitJson.hint = this.textDefault;
2112
- if (bitJson.instruction == null)
2113
- bitJson.instruction = this.textDefault;
2114
- if (bitJson.isExample == null)
2115
- bitJson.isExample = false;
2116
- if (bitJson.labelFalse == null)
2117
- bitJson.labelFalse = '';
2118
- if (bitJson.labelTrue == null)
2119
- bitJson.labelTrue = '';
2120
- if (bitJson.body == null)
2121
- bitJson.body = this.bodyDefault;
2122
- break;
2123
- case BitType_1.RootBitType.chapter:
2124
- if (bitJson.item == null)
2125
- bitJson.item = this.textDefault;
2126
- if (bitJson.hint == null)
2127
- bitJson.hint = this.textDefault;
2128
- if (bitJson.isExample == null)
2129
- bitJson.isExample = false;
2130
- if (bitJson.example == null)
2131
- bitJson.example = null;
2132
- if (bitJson.toc == null)
2133
- bitJson.toc = true; // Always set on chapter bits?
2134
- if (bitJson.progress == null)
2135
- bitJson.progress = true; // Always set on chapter bits
2136
- if (bitJson.level == null)
2137
- bitJson.level = 1; // Set level 1 if none set (makes no sense, but in ANTLR parser)
2138
- if (bitJson.body == null)
2139
- bitJson.body = this.bodyDefault;
2140
- break;
2141
- case BitType_1.RootBitType.interview:
2142
- if (bitJson.item == null)
2143
- bitJson.item = this.textDefault;
2144
- if (bitJson.hint == null)
2145
- bitJson.hint = this.textDefault;
2146
- if (bitJson.instruction == null)
2147
- bitJson.instruction = this.textDefault;
2148
- if (bitJson.isExample == null)
2149
- bitJson.isExample = false;
2150
- if (bitJson.body == null)
2151
- bitJson.body = this.bodyDefault;
2152
- if (bitJson.footer == null)
2153
- bitJson.footer = this.textDefault;
2154
- if (bitJson.questions == null)
2155
- bitJson.questions = [];
2156
- break;
2157
- case BitType_1.RootBitType.match:
2158
- if (bitJson.item == null)
2159
- bitJson.item = this.textDefault;
2160
- if (bitJson.heading == null)
2161
- bitJson.heading = {};
2162
- if (bitJson.body == null)
2163
- bitJson.body = this.bodyDefault;
2164
- break;
2165
- case BitType_1.RootBitType.matchMatrix:
2166
- if (bitJson.item == null)
2167
- bitJson.item = this.textDefault;
2168
- if (bitJson.body == null)
2169
- bitJson.body = this.bodyDefault;
2170
- break;
2171
- case BitType_1.RootBitType.learningPathBook:
2172
- case BitType_1.RootBitType.learningPathExternalLink:
2173
- case BitType_1.RootBitType.learningPathVideoCall:
2174
- if (bitJson.item == null)
2175
- bitJson.item = this.textDefault;
2176
- if (bitJson.hint == null)
2177
- bitJson.hint = this.textDefault;
2178
- if (bitJson.isExample == null)
2179
- bitJson.isExample = false;
2180
- if (bitJson.example == null)
2181
- bitJson.example = null;
2182
- if (bitJson.isTracked == null)
2183
- bitJson.isTracked = true;
2184
- if (bitJson.isInfoOnly == null)
2185
- bitJson.isInfoOnly = false;
2186
- if (bitJson.body == null)
2187
- bitJson.body = this.bodyDefault;
2188
- break;
2189
- case BitType_1.RootBitType.pageBuyButton:
2190
- if (bitJson.content2Buy == null)
2191
- bitJson.content2Buy = '';
2192
- if (bitJson.body == null)
2193
- bitJson.body = this.bodyDefault;
2194
- break;
2033
+ if (bitJson.item == null)
2034
+ bitJson.item = this.textDefault;
2035
+ if (bitJson.hint == null)
2036
+ bitJson.hint = this.textDefault;
2037
+ if (bitJson.instruction == null)
2038
+ bitJson.instruction = this.textDefault;
2039
+ if (bitJson.isExample == null)
2040
+ bitJson.isExample = false;
2041
+ if (bitJson.body == null)
2042
+ bitJson.body = this.bodyDefault;
2043
+ if (bitJson.footer == null)
2044
+ bitJson.footer = this.textDefault;
2045
+ //
2046
+ }
2047
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.essay)) {
2048
+ //
2049
+ if (bitJson.item == null)
2050
+ bitJson.item = this.textDefault;
2051
+ if (bitJson.hint == null)
2052
+ bitJson.hint = this.textDefault;
2053
+ if (bitJson.instruction == null)
2054
+ bitJson.instruction = this.textDefault;
2055
+ if (bitJson.isExample == null)
2056
+ bitJson.isExample = false;
2057
+ if (bitJson.example == null)
2058
+ bitJson.example = null;
2059
+ if (bitJson.body == null)
2060
+ bitJson.body = this.bodyDefault;
2061
+ if (bitJson.partialAnswer == null)
2062
+ bitJson.partialAnswer = '';
2063
+ // if (bitJson.sampleSolution == null) bitJson.sampleSolution = '';
2064
+ //
2065
+ }
2066
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.trueFalse1)) {
2067
+ //
2068
+ if (bitJson.item == null)
2069
+ bitJson.item = this.textDefault;
2070
+ if (bitJson.lead == null)
2071
+ bitJson.lead = this.textDefault;
2072
+ if (bitJson.hint == null)
2073
+ bitJson.hint = this.textDefault;
2074
+ if (bitJson.instruction == null)
2075
+ bitJson.instruction = this.textDefault;
2076
+ if (bitJson.isExample == null)
2077
+ bitJson.isExample = false;
2078
+ if (bitJson.example == null)
2079
+ bitJson.example = null;
2080
+ if (bitJson.isCorrect == null)
2081
+ bitJson.isCorrect = false;
2082
+ if (bitJson.body == null)
2083
+ bitJson.body = this.bodyDefault;
2084
+ //
2085
+ }
2086
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.trueFalse)) {
2087
+ //
2088
+ if (bitJson.item == null)
2089
+ bitJson.item = this.textDefault;
2090
+ if (bitJson.lead == null)
2091
+ bitJson.lead = this.textDefault;
2092
+ if (bitJson.hint == null)
2093
+ bitJson.hint = this.textDefault;
2094
+ if (bitJson.instruction == null)
2095
+ bitJson.instruction = this.textDefault;
2096
+ if (bitJson.isExample == null)
2097
+ bitJson.isExample = false;
2098
+ if (bitJson.labelFalse == null)
2099
+ bitJson.labelFalse = '';
2100
+ if (bitJson.labelTrue == null)
2101
+ bitJson.labelTrue = '';
2102
+ if (bitJson.body == null)
2103
+ bitJson.body = this.bodyDefault;
2104
+ //
2105
+ }
2106
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.chapter)) {
2107
+ //
2108
+ if (bitJson.item == null)
2109
+ bitJson.item = this.textDefault;
2110
+ if (bitJson.hint == null)
2111
+ bitJson.hint = this.textDefault;
2112
+ if (bitJson.isExample == null)
2113
+ bitJson.isExample = false;
2114
+ if (bitJson.example == null)
2115
+ bitJson.example = null;
2116
+ if (bitJson.toc == null)
2117
+ bitJson.toc = true; // Always set on chapter bits?
2118
+ if (bitJson.progress == null)
2119
+ bitJson.progress = true; // Always set on chapter bits
2120
+ if (bitJson.level == null)
2121
+ bitJson.level = 1; // Set level 1 if none set (makes no sense, but in ANTLR parser)
2122
+ if (bitJson.body == null)
2123
+ bitJson.body = this.bodyDefault;
2124
+ //
2125
+ }
2126
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.interview)) {
2127
+ //
2128
+ if (bitJson.item == null)
2129
+ bitJson.item = this.textDefault;
2130
+ if (bitJson.hint == null)
2131
+ bitJson.hint = this.textDefault;
2132
+ if (bitJson.instruction == null)
2133
+ bitJson.instruction = this.textDefault;
2134
+ if (bitJson.isExample == null)
2135
+ bitJson.isExample = false;
2136
+ if (bitJson.body == null)
2137
+ bitJson.body = this.bodyDefault;
2138
+ if (bitJson.footer == null)
2139
+ bitJson.footer = this.textDefault;
2140
+ if (bitJson.questions == null)
2141
+ bitJson.questions = [];
2142
+ //
2143
+ }
2144
+ else if (bitType === BitType_1.BitType.matchMatrix) {
2145
+ //
2146
+ if (bitJson.item == null)
2147
+ bitJson.item = this.textDefault;
2148
+ if (bitJson.body == null)
2149
+ bitJson.body = this.bodyDefault;
2150
+ //
2151
+ }
2152
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.match)) {
2153
+ //
2154
+ if (bitJson.item == null)
2155
+ bitJson.item = this.textDefault;
2156
+ if (bitJson.heading == null)
2157
+ bitJson.heading = {};
2158
+ if (bitJson.body == null)
2159
+ bitJson.body = this.bodyDefault;
2160
+ //
2161
+ }
2162
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.learningPathBook)) {
2163
+ //
2164
+ if (bitJson.item == null)
2165
+ bitJson.item = this.textDefault;
2166
+ if (bitJson.hint == null)
2167
+ bitJson.hint = this.textDefault;
2168
+ if (bitJson.isExample == null)
2169
+ bitJson.isExample = false;
2170
+ if (bitJson.example == null)
2171
+ bitJson.example = null;
2172
+ if (bitJson.isTracked == null)
2173
+ bitJson.isTracked = true;
2174
+ if (bitJson.isInfoOnly == null)
2175
+ bitJson.isInfoOnly = false;
2176
+ if (bitJson.body == null)
2177
+ bitJson.body = this.bodyDefault;
2178
+ //
2179
+ }
2180
+ else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.pageBuyButton)) {
2181
+ //
2182
+ if (bitJson.content2Buy == null)
2183
+ bitJson.content2Buy = '';
2184
+ if (bitJson.body == null)
2185
+ bitJson.body = this.bodyDefault;
2186
+ //
2187
+ }
2188
+ else {
2189
+ // Most bits have these defaults, but there are special cases (not sure if that is by error or design)
2190
+ if (bitJson.item == null)
2191
+ bitJson.item = this.textDefault;
2192
+ if (bitJson.hint == null)
2193
+ bitJson.hint = this.textDefault;
2194
+ if (bitJson.isExample == null)
2195
+ bitJson.isExample = false;
2196
+ if (bitJson.example == null)
2197
+ bitJson.example = null;
2198
+ if (bitJson.body == null)
2199
+ bitJson.body = this.bodyDefault;
2200
+ // Special case for 'ai' bits
2201
+ if (bitType === BitType_1.BitType.articleAi || bitType === BitType_1.BitType.noteAi || bitType === BitType_1.BitType.summaryAi) {
2202
+ if (bitJson.AIGenerated == null)
2203
+ bitJson.AIGenerated = true;
2204
+ }
2205
+ // Special case for 'review-...' bits
2206
+ if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.reviewNote)) {
2207
+ if (bitJson.resolved == null)
2208
+ bitJson.resolved = false;
2209
+ if (bitJson.resolvedDate == null)
2210
+ bitJson.resolvedDate = '';
2211
+ if (bitJson.resolvedBy == null)
2212
+ bitJson.resolvedBy = '';
2213
+ }
2195
2214
  }
2196
2215
  // Remove unwanted properties
2197
2216
  // Properties