@gmb/bitmark-parser-generator 3.34.0 → 3.36.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 (904) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/bitmark-parser-generator.min.js +1 -1
  3. package/dist/browser/bundle-report.html +2 -2
  4. package/dist/index.cjs +33650 -0
  5. package/dist/index.cjs.map +1 -0
  6. package/dist/index.d.cts +7733 -0
  7. package/dist/index.d.ts +7733 -0
  8. package/dist/index.js +33590 -0
  9. package/dist/index.js.map +1 -0
  10. package/package.json +106 -90
  11. package/dist/cjs/BitmarkParserGenerator.js +0 -776
  12. package/dist/cjs/BitmarkParserGenerator.js.map +0 -1
  13. package/dist/cjs/ast/Ast.js +0 -220
  14. package/dist/cjs/ast/Ast.js.map +0 -1
  15. package/dist/cjs/ast/BaseBuilder.js +0 -193
  16. package/dist/cjs/ast/BaseBuilder.js.map +0 -1
  17. package/dist/cjs/ast/Builder.js +0 -1781
  18. package/dist/cjs/ast/Builder.js.map +0 -1
  19. package/dist/cjs/ast/ResourceBuilder.js +0 -963
  20. package/dist/cjs/ast/ResourceBuilder.js.map +0 -1
  21. package/dist/cjs/ast/rules/NodeValidator.js +0 -184
  22. package/dist/cjs/ast/rules/NodeValidator.js.map +0 -1
  23. package/dist/cjs/ast/writer/FileWriter.js +0 -119
  24. package/dist/cjs/ast/writer/FileWriter.js.map +0 -1
  25. package/dist/cjs/ast/writer/StreamWriter.js +0 -89
  26. package/dist/cjs/ast/writer/StreamWriter.js.map +0 -1
  27. package/dist/cjs/ast/writer/StringWriter.js +0 -115
  28. package/dist/cjs/ast/writer/StringWriter.js.map +0 -1
  29. package/dist/cjs/ast/writer/Writer.js +0 -3
  30. package/dist/cjs/ast/writer/Writer.js.map +0 -1
  31. package/dist/cjs/breakscaping/Breakscape.js +0 -80
  32. package/dist/cjs/breakscaping/Breakscape.js.map +0 -1
  33. package/dist/cjs/breakscaping/BreakscapeLoop.js +0 -305
  34. package/dist/cjs/breakscaping/BreakscapeLoop.js.map +0 -1
  35. package/dist/cjs/breakscaping/BreakscapeOptions.js +0 -3
  36. package/dist/cjs/breakscaping/BreakscapeOptions.js.map +0 -1
  37. package/dist/cjs/breakscaping/BreakscapeRegex.js +0 -213
  38. package/dist/cjs/breakscaping/BreakscapeRegex.js.map +0 -1
  39. package/dist/cjs/breakscaping/RegexConfigs.js +0 -38
  40. package/dist/cjs/breakscaping/RegexConfigs.js.map +0 -1
  41. package/dist/cjs/config/Config.js +0 -352
  42. package/dist/cjs/config/Config.js.map +0 -1
  43. package/dist/cjs/config/ConfigHydrator.js +0 -161
  44. package/dist/cjs/config/ConfigHydrator.js.map +0 -1
  45. package/dist/cjs/config/raw/bits.js +0 -2615
  46. package/dist/cjs/config/raw/bits.js.map +0 -1
  47. package/dist/cjs/config/raw/cardSets.js +0 -549
  48. package/dist/cjs/config/raw/cardSets.js.map +0 -1
  49. package/dist/cjs/config/raw/groups.js +0 -1182
  50. package/dist/cjs/config/raw/groups.js.map +0 -1
  51. package/dist/cjs/config/raw/properties.js +0 -1006
  52. package/dist/cjs/config/raw/properties.js.map +0 -1
  53. package/dist/cjs/config/raw/resources.js +0 -103
  54. package/dist/cjs/config/raw/resources.js.map +0 -1
  55. package/dist/cjs/config/raw/tags.js +0 -48
  56. package/dist/cjs/config/raw/tags.js.map +0 -1
  57. package/dist/cjs/generated/build-info.js +0 -13
  58. package/dist/cjs/generated/build-info.js.map +0 -1
  59. package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +0 -3168
  60. package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +0 -1
  61. package/dist/cjs/generated/parser/text/text-peggy-parser.js +0 -9659
  62. package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +0 -1
  63. package/dist/cjs/generator/AstWalkerGenerator.js +0 -86
  64. package/dist/cjs/generator/AstWalkerGenerator.js.map +0 -1
  65. package/dist/cjs/generator/Generator.js +0 -3
  66. package/dist/cjs/generator/Generator.js.map +0 -1
  67. package/dist/cjs/generator/bitmark/BitmarkFileGenerator.js +0 -49
  68. package/dist/cjs/generator/bitmark/BitmarkFileGenerator.js.map +0 -1
  69. package/dist/cjs/generator/bitmark/BitmarkGenerator.js +0 -2601
  70. package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +0 -1
  71. package/dist/cjs/generator/bitmark/BitmarkStringGenerator.js +0 -51
  72. package/dist/cjs/generator/bitmark/BitmarkStringGenerator.js.map +0 -1
  73. package/dist/cjs/generator/json/JsonFileGenerator.js +0 -53
  74. package/dist/cjs/generator/json/JsonFileGenerator.js.map +0 -1
  75. package/dist/cjs/generator/json/JsonGenerator.js +0 -1584
  76. package/dist/cjs/generator/json/JsonGenerator.js.map +0 -1
  77. package/dist/cjs/generator/json/JsonObjectGenerator.js +0 -51
  78. package/dist/cjs/generator/json/JsonObjectGenerator.js.map +0 -1
  79. package/dist/cjs/generator/json/JsonStringGenerator.js +0 -50
  80. package/dist/cjs/generator/json/JsonStringGenerator.js.map +0 -1
  81. package/dist/cjs/generator/text/TextGenerator.js +0 -1199
  82. package/dist/cjs/generator/text/TextGenerator.js.map +0 -1
  83. package/dist/cjs/index.js +0 -79
  84. package/dist/cjs/index.js.map +0 -1
  85. package/dist/cjs/info/InfoBuilder.js +0 -43
  86. package/dist/cjs/info/InfoBuilder.js.map +0 -1
  87. package/dist/cjs/init/init.js +0 -15
  88. package/dist/cjs/init/init.js.map +0 -1
  89. package/dist/cjs/model/ast/BreakscapedString.js +0 -3
  90. package/dist/cjs/model/ast/BreakscapedString.js.map +0 -1
  91. package/dist/cjs/model/ast/NodeType.js +0 -557
  92. package/dist/cjs/model/ast/NodeType.js.map +0 -1
  93. package/dist/cjs/model/ast/Nodes.js +0 -3
  94. package/dist/cjs/model/ast/Nodes.js.map +0 -1
  95. package/dist/cjs/model/ast/StardardString.js +0 -3
  96. package/dist/cjs/model/ast/StardardString.js.map +0 -1
  97. package/dist/cjs/model/ast/TextNodes.js +0 -3
  98. package/dist/cjs/model/ast/TextNodes.js.map +0 -1
  99. package/dist/cjs/model/config/AbstractTagConfig.js +0 -18
  100. package/dist/cjs/model/config/AbstractTagConfig.js.map +0 -1
  101. package/dist/cjs/model/config/BitConfig.js +0 -72
  102. package/dist/cjs/model/config/BitConfig.js.map +0 -1
  103. package/dist/cjs/model/config/CardSetConfig.js +0 -26
  104. package/dist/cjs/model/config/CardSetConfig.js.map +0 -1
  105. package/dist/cjs/model/config/CardVariantConfig.js +0 -32
  106. package/dist/cjs/model/config/CardVariantConfig.js.map +0 -1
  107. package/dist/cjs/model/config/MarkupTagConfig.js +0 -41
  108. package/dist/cjs/model/config/MarkupTagConfig.js.map +0 -1
  109. package/dist/cjs/model/config/PropertyTagConfig.js +0 -50
  110. package/dist/cjs/model/config/PropertyTagConfig.js.map +0 -1
  111. package/dist/cjs/model/config/ResourceTagConfig.js +0 -42
  112. package/dist/cjs/model/config/ResourceTagConfig.js.map +0 -1
  113. package/dist/cjs/model/config/ResourcesConfig.js +0 -31
  114. package/dist/cjs/model/config/ResourcesConfig.js.map +0 -1
  115. package/dist/cjs/model/config/TagConfig.js +0 -3
  116. package/dist/cjs/model/config/TagConfig.js.map +0 -1
  117. package/dist/cjs/model/config/TagsConfig.js +0 -3
  118. package/dist/cjs/model/config/TagsConfig.js.map +0 -1
  119. package/dist/cjs/model/config/TagsConfigWithInfo.js +0 -3
  120. package/dist/cjs/model/config/TagsConfigWithInfo.js.map +0 -1
  121. package/dist/cjs/model/config/_Config.js +0 -3
  122. package/dist/cjs/model/config/_Config.js.map +0 -1
  123. package/dist/cjs/model/config/enum/CardSetConfigKey.js +0 -28
  124. package/dist/cjs/model/config/enum/CardSetConfigKey.js.map +0 -1
  125. package/dist/cjs/model/config/enum/ConfigKey.js +0 -29
  126. package/dist/cjs/model/config/enum/ConfigKey.js.map +0 -1
  127. package/dist/cjs/model/config/enum/GroupConfigKey.js +0 -57
  128. package/dist/cjs/model/config/enum/GroupConfigKey.js.map +0 -1
  129. package/dist/cjs/model/config/enum/GroupConfigType.js +0 -14
  130. package/dist/cjs/model/config/enum/GroupConfigType.js.map +0 -1
  131. package/dist/cjs/model/config/enum/PropertyConfigKey.js +0 -215
  132. package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +0 -1
  133. package/dist/cjs/model/config/enum/ResourceConfigKey.js +0 -40
  134. package/dist/cjs/model/config/enum/ResourceConfigKey.js.map +0 -1
  135. package/dist/cjs/model/config/enum/TagConfigKey.js +0 -26
  136. package/dist/cjs/model/config/enum/TagConfigKey.js.map +0 -1
  137. package/dist/cjs/model/enum/BitTagType.js +0 -13
  138. package/dist/cjs/model/enum/BitTagType.js.map +0 -1
  139. package/dist/cjs/model/enum/BitType.js +0 -576
  140. package/dist/cjs/model/enum/BitType.js.map +0 -1
  141. package/dist/cjs/model/enum/BitmarkGeneratorOutput.js +0 -2
  142. package/dist/cjs/model/enum/BitmarkGeneratorOutput.js.map +0 -1
  143. package/dist/cjs/model/enum/BitmarkParserType.js +0 -9
  144. package/dist/cjs/model/enum/BitmarkParserType.js.map +0 -1
  145. package/dist/cjs/model/enum/BitmarkVersion.js +0 -12
  146. package/dist/cjs/model/enum/BitmarkVersion.js.map +0 -1
  147. package/dist/cjs/model/enum/BodyBitType.js +0 -14
  148. package/dist/cjs/model/enum/BodyBitType.js.map +0 -1
  149. package/dist/cjs/model/enum/BodyTextFormat.js +0 -14
  150. package/dist/cjs/model/enum/BodyTextFormat.js.map +0 -1
  151. package/dist/cjs/model/enum/CardSetVersion.js +0 -10
  152. package/dist/cjs/model/enum/CardSetVersion.js.map +0 -1
  153. package/dist/cjs/model/enum/Count.js +0 -9
  154. package/dist/cjs/model/enum/Count.js.map +0 -1
  155. package/dist/cjs/model/enum/DeprecatedTextFormat.js +0 -9
  156. package/dist/cjs/model/enum/DeprecatedTextFormat.js.map +0 -1
  157. package/dist/cjs/model/enum/ExampleType.js +0 -11
  158. package/dist/cjs/model/enum/ExampleType.js.map +0 -1
  159. package/dist/cjs/model/enum/PropertyAstKey.js +0 -18
  160. package/dist/cjs/model/enum/PropertyAstKey.js.map +0 -1
  161. package/dist/cjs/model/enum/PropertyFormat.js +0 -14
  162. package/dist/cjs/model/enum/PropertyFormat.js.map +0 -1
  163. package/dist/cjs/model/enum/PropertyJsonKey.js +0 -14
  164. package/dist/cjs/model/enum/PropertyJsonKey.js.map +0 -1
  165. package/dist/cjs/model/enum/PropertyTag.js +0 -8
  166. package/dist/cjs/model/enum/PropertyTag.js.map +0 -1
  167. package/dist/cjs/model/enum/ResourceJsonKey.js +0 -27
  168. package/dist/cjs/model/enum/ResourceJsonKey.js.map +0 -1
  169. package/dist/cjs/model/enum/ResourceTag.js +0 -37
  170. package/dist/cjs/model/enum/ResourceTag.js.map +0 -1
  171. package/dist/cjs/model/enum/Tag.js +0 -21
  172. package/dist/cjs/model/enum/Tag.js.map +0 -1
  173. package/dist/cjs/model/enum/TextFormat.js +0 -16
  174. package/dist/cjs/model/enum/TextFormat.js.map +0 -1
  175. package/dist/cjs/model/enum/TextLocation.js +0 -15
  176. package/dist/cjs/model/enum/TextLocation.js.map +0 -1
  177. package/dist/cjs/model/enum/TextMarkType.js +0 -54
  178. package/dist/cjs/model/enum/TextMarkType.js.map +0 -1
  179. package/dist/cjs/model/enum/TextNodeType.js +0 -35
  180. package/dist/cjs/model/enum/TextNodeType.js.map +0 -1
  181. package/dist/cjs/model/enum/TextSection.js +0 -18
  182. package/dist/cjs/model/enum/TextSection.js.map +0 -1
  183. package/dist/cjs/model/info/enum/InfoFormat.js +0 -11
  184. package/dist/cjs/model/info/enum/InfoFormat.js.map +0 -1
  185. package/dist/cjs/model/info/enum/InfoType.js +0 -12
  186. package/dist/cjs/model/info/enum/InfoType.js.map +0 -1
  187. package/dist/cjs/model/json/BitJson.js +0 -3
  188. package/dist/cjs/model/json/BitJson.js.map +0 -1
  189. package/dist/cjs/model/json/BitWrapperJson.js +0 -3
  190. package/dist/cjs/model/json/BitWrapperJson.js.map +0 -1
  191. package/dist/cjs/model/json/BodyBitJson.js +0 -3
  192. package/dist/cjs/model/json/BodyBitJson.js.map +0 -1
  193. package/dist/cjs/model/json/ParserJson.js +0 -3
  194. package/dist/cjs/model/json/ParserJson.js.map +0 -1
  195. package/dist/cjs/model/json/ResourceJson.js +0 -3
  196. package/dist/cjs/model/json/ResourceJson.js.map +0 -1
  197. package/dist/cjs/model/parser/ParserData.js +0 -3
  198. package/dist/cjs/model/parser/ParserData.js.map +0 -1
  199. package/dist/cjs/model/parser/ParserError.js +0 -3
  200. package/dist/cjs/model/parser/ParserError.js.map +0 -1
  201. package/dist/cjs/model/parser/ParserInfo.js +0 -3
  202. package/dist/cjs/model/parser/ParserInfo.js.map +0 -1
  203. package/dist/cjs/model/parser/ParserLocation.js +0 -3
  204. package/dist/cjs/model/parser/ParserLocation.js.map +0 -1
  205. package/dist/cjs/model/parser/ParserLocationRange.js +0 -3
  206. package/dist/cjs/model/parser/ParserLocationRange.js.map +0 -1
  207. package/dist/cjs/model/parser/TagValidationData.js +0 -3
  208. package/dist/cjs/model/parser/TagValidationData.js.map +0 -1
  209. package/dist/cjs/parser/bitmark/BitmarkParser.js +0 -25
  210. package/dist/cjs/parser/bitmark/BitmarkParser.js.map +0 -1
  211. package/dist/cjs/parser/bitmark/peg/BitmarkPegParser.js +0 -7
  212. package/dist/cjs/parser/bitmark/peg/BitmarkPegParser.js.map +0 -1
  213. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js +0 -614
  214. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js.map +0 -1
  215. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +0 -716
  216. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +0 -1
  217. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js +0 -69
  218. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +0 -1
  219. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +0 -745
  220. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +0 -1
  221. package/dist/cjs/parser/bitmark/peg/PeggyGrammarLocation.js +0 -82
  222. package/dist/cjs/parser/bitmark/peg/PeggyGrammarLocation.js.map +0 -1
  223. package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +0 -260
  224. package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +0 -1
  225. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +0 -50
  226. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +0 -1
  227. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +0 -885
  228. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +0 -1
  229. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +0 -27
  230. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +0 -1
  231. package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +0 -61
  232. package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +0 -1
  233. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +0 -63
  234. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +0 -1
  235. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +0 -161
  236. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +0 -1
  237. package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +0 -55
  238. package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +0 -1
  239. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +0 -31
  240. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +0 -1
  241. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +0 -59
  242. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +0 -1
  243. package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +0 -16
  244. package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +0 -1
  245. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +0 -29
  246. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +0 -1
  247. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +0 -20
  248. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +0 -1
  249. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +0 -45
  250. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +0 -1
  251. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +0 -44
  252. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +0 -1
  253. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +0 -11
  254. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +0 -1
  255. package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +0 -57
  256. package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +0 -1
  257. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +0 -158
  258. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +0 -1
  259. package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +0 -37
  260. package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +0 -1
  261. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +0 -24
  262. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +0 -1
  263. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +0 -163
  264. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +0 -1
  265. package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +0 -27
  266. package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +0 -1
  267. package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +0 -28
  268. package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +0 -1
  269. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +0 -53
  270. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +0 -1
  271. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +0 -203
  272. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +0 -1
  273. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +0 -24
  274. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +0 -1
  275. package/dist/cjs/parser/json/JsonParser.js +0 -270
  276. package/dist/cjs/parser/json/JsonParser.js.map +0 -1
  277. package/dist/cjs/parser/text/TextParser.js +0 -148
  278. package/dist/cjs/parser/text/TextParser.js.map +0 -1
  279. package/dist/cjs/parser/text/peg/TextPegParser.js +0 -7
  280. package/dist/cjs/parser/text/peg/TextPegParser.js.map +0 -1
  281. package/dist/cjs/utils/ArrayUtils.js +0 -43
  282. package/dist/cjs/utils/ArrayUtils.js.map +0 -1
  283. package/dist/cjs/utils/BitUtils.js +0 -75
  284. package/dist/cjs/utils/BitUtils.js.map +0 -1
  285. package/dist/cjs/utils/BooleanUtils.js +0 -62
  286. package/dist/cjs/utils/BooleanUtils.js.map +0 -1
  287. package/dist/cjs/utils/FileUtils.js +0 -75
  288. package/dist/cjs/utils/FileUtils.js.map +0 -1
  289. package/dist/cjs/utils/NumberUtils.js +0 -62
  290. package/dist/cjs/utils/NumberUtils.js.map +0 -1
  291. package/dist/cjs/utils/ObjectUtils.js +0 -417
  292. package/dist/cjs/utils/ObjectUtils.js.map +0 -1
  293. package/dist/cjs/utils/StringUtils.js +0 -183
  294. package/dist/cjs/utils/StringUtils.js.map +0 -1
  295. package/dist/cjs/utils/UrlUtils.js +0 -37
  296. package/dist/cjs/utils/UrlUtils.js.map +0 -1
  297. package/dist/cjs/utils/env/Env.js +0 -131
  298. package/dist/cjs/utils/env/Env.js.map +0 -1
  299. package/dist/cjs/utils/env/Environment.js +0 -15
  300. package/dist/cjs/utils/env/Environment.js.map +0 -1
  301. package/dist/cjs/utils/env/Os.js +0 -14
  302. package/dist/cjs/utils/env/Os.js.map +0 -1
  303. package/dist/cjs/utils/env/Version.js +0 -12
  304. package/dist/cjs/utils/env/Version.js.map +0 -1
  305. package/dist/cjs/utils/env/userAgent.js +0 -88
  306. package/dist/cjs/utils/env/userAgent.js.map +0 -1
  307. package/dist/cjs/utils/polyfill/fs.js +0 -14
  308. package/dist/cjs/utils/polyfill/fs.js.map +0 -1
  309. package/dist/esm/BitmarkParserGenerator.js +0 -735
  310. package/dist/esm/BitmarkParserGenerator.js.map +0 -1
  311. package/dist/esm/ast/Ast.js +0 -217
  312. package/dist/esm/ast/Ast.js.map +0 -1
  313. package/dist/esm/ast/BaseBuilder.js +0 -190
  314. package/dist/esm/ast/BaseBuilder.js.map +0 -1
  315. package/dist/esm/ast/Builder.js +0 -1775
  316. package/dist/esm/ast/Builder.js.map +0 -1
  317. package/dist/esm/ast/ResourceBuilder.js +0 -960
  318. package/dist/esm/ast/ResourceBuilder.js.map +0 -1
  319. package/dist/esm/ast/rules/NodeValidator.js +0 -181
  320. package/dist/esm/ast/rules/NodeValidator.js.map +0 -1
  321. package/dist/esm/ast/writer/FileWriter.js +0 -80
  322. package/dist/esm/ast/writer/FileWriter.js.map +0 -1
  323. package/dist/esm/ast/writer/StreamWriter.js +0 -83
  324. package/dist/esm/ast/writer/StreamWriter.js.map +0 -1
  325. package/dist/esm/ast/writer/StringWriter.js +0 -112
  326. package/dist/esm/ast/writer/StringWriter.js.map +0 -1
  327. package/dist/esm/ast/writer/Writer.js +0 -2
  328. package/dist/esm/ast/writer/Writer.js.map +0 -1
  329. package/dist/esm/breakscaping/Breakscape.js +0 -77
  330. package/dist/esm/breakscaping/Breakscape.js.map +0 -1
  331. package/dist/esm/breakscaping/BreakscapeLoop.js +0 -302
  332. package/dist/esm/breakscaping/BreakscapeLoop.js.map +0 -1
  333. package/dist/esm/breakscaping/BreakscapeOptions.js +0 -2
  334. package/dist/esm/breakscaping/BreakscapeOptions.js.map +0 -1
  335. package/dist/esm/breakscaping/BreakscapeRegex.js +0 -177
  336. package/dist/esm/breakscaping/BreakscapeRegex.js.map +0 -1
  337. package/dist/esm/breakscaping/RegexConfigs.js +0 -35
  338. package/dist/esm/breakscaping/RegexConfigs.js.map +0 -1
  339. package/dist/esm/config/Config.js +0 -349
  340. package/dist/esm/config/Config.js.map +0 -1
  341. package/dist/esm/config/ConfigHydrator.js +0 -158
  342. package/dist/esm/config/ConfigHydrator.js.map +0 -1
  343. package/dist/esm/config/raw/bits.js +0 -2612
  344. package/dist/esm/config/raw/bits.js.map +0 -1
  345. package/dist/esm/config/raw/cardSets.js +0 -546
  346. package/dist/esm/config/raw/cardSets.js.map +0 -1
  347. package/dist/esm/config/raw/groups.js +0 -1179
  348. package/dist/esm/config/raw/groups.js.map +0 -1
  349. package/dist/esm/config/raw/properties.js +0 -1003
  350. package/dist/esm/config/raw/properties.js.map +0 -1
  351. package/dist/esm/config/raw/resources.js +0 -100
  352. package/dist/esm/config/raw/resources.js.map +0 -1
  353. package/dist/esm/config/raw/tags.js +0 -45
  354. package/dist/esm/config/raw/tags.js.map +0 -1
  355. package/dist/esm/generated/build-info.js +0 -10
  356. package/dist/esm/generated/build-info.js.map +0 -1
  357. package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +0 -3163
  358. package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +0 -1
  359. package/dist/esm/generated/parser/text/text-peggy-parser.js +0 -9654
  360. package/dist/esm/generated/parser/text/text-peggy-parser.js.map +0 -1
  361. package/dist/esm/generator/AstWalkerGenerator.js +0 -83
  362. package/dist/esm/generator/AstWalkerGenerator.js.map +0 -1
  363. package/dist/esm/generator/Generator.js +0 -2
  364. package/dist/esm/generator/Generator.js.map +0 -1
  365. package/dist/esm/generator/bitmark/BitmarkFileGenerator.js +0 -46
  366. package/dist/esm/generator/bitmark/BitmarkFileGenerator.js.map +0 -1
  367. package/dist/esm/generator/bitmark/BitmarkGenerator.js +0 -2598
  368. package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +0 -1
  369. package/dist/esm/generator/bitmark/BitmarkStringGenerator.js +0 -48
  370. package/dist/esm/generator/bitmark/BitmarkStringGenerator.js.map +0 -1
  371. package/dist/esm/generator/json/JsonFileGenerator.js +0 -50
  372. package/dist/esm/generator/json/JsonFileGenerator.js.map +0 -1
  373. package/dist/esm/generator/json/JsonGenerator.js +0 -1578
  374. package/dist/esm/generator/json/JsonGenerator.js.map +0 -1
  375. package/dist/esm/generator/json/JsonObjectGenerator.js +0 -48
  376. package/dist/esm/generator/json/JsonObjectGenerator.js.map +0 -1
  377. package/dist/esm/generator/json/JsonStringGenerator.js +0 -47
  378. package/dist/esm/generator/json/JsonStringGenerator.js.map +0 -1
  379. package/dist/esm/generator/text/TextGenerator.js +0 -1196
  380. package/dist/esm/generator/text/TextGenerator.js.map +0 -1
  381. package/dist/esm/index.js +0 -49
  382. package/dist/esm/index.js.map +0 -1
  383. package/dist/esm/info/InfoBuilder.js +0 -40
  384. package/dist/esm/info/InfoBuilder.js.map +0 -1
  385. package/dist/esm/init/init.js +0 -13
  386. package/dist/esm/init/init.js.map +0 -1
  387. package/dist/esm/model/ast/BreakscapedString.js +0 -2
  388. package/dist/esm/model/ast/BreakscapedString.js.map +0 -1
  389. package/dist/esm/model/ast/NodeType.js +0 -554
  390. package/dist/esm/model/ast/NodeType.js.map +0 -1
  391. package/dist/esm/model/ast/Nodes.js +0 -2
  392. package/dist/esm/model/ast/Nodes.js.map +0 -1
  393. package/dist/esm/model/ast/StardardString.js +0 -2
  394. package/dist/esm/model/ast/StardardString.js.map +0 -1
  395. package/dist/esm/model/ast/TextNodes.js +0 -2
  396. package/dist/esm/model/ast/TextNodes.js.map +0 -1
  397. package/dist/esm/model/config/AbstractTagConfig.js +0 -15
  398. package/dist/esm/model/config/AbstractTagConfig.js.map +0 -1
  399. package/dist/esm/model/config/BitConfig.js +0 -69
  400. package/dist/esm/model/config/BitConfig.js.map +0 -1
  401. package/dist/esm/model/config/CardSetConfig.js +0 -23
  402. package/dist/esm/model/config/CardSetConfig.js.map +0 -1
  403. package/dist/esm/model/config/CardVariantConfig.js +0 -29
  404. package/dist/esm/model/config/CardVariantConfig.js.map +0 -1
  405. package/dist/esm/model/config/MarkupTagConfig.js +0 -38
  406. package/dist/esm/model/config/MarkupTagConfig.js.map +0 -1
  407. package/dist/esm/model/config/PropertyTagConfig.js +0 -47
  408. package/dist/esm/model/config/PropertyTagConfig.js.map +0 -1
  409. package/dist/esm/model/config/ResourceTagConfig.js +0 -39
  410. package/dist/esm/model/config/ResourceTagConfig.js.map +0 -1
  411. package/dist/esm/model/config/ResourcesConfig.js +0 -28
  412. package/dist/esm/model/config/ResourcesConfig.js.map +0 -1
  413. package/dist/esm/model/config/TagConfig.js +0 -2
  414. package/dist/esm/model/config/TagConfig.js.map +0 -1
  415. package/dist/esm/model/config/TagsConfig.js +0 -2
  416. package/dist/esm/model/config/TagsConfig.js.map +0 -1
  417. package/dist/esm/model/config/TagsConfigWithInfo.js +0 -2
  418. package/dist/esm/model/config/TagsConfigWithInfo.js.map +0 -1
  419. package/dist/esm/model/config/_Config.js +0 -2
  420. package/dist/esm/model/config/_Config.js.map +0 -1
  421. package/dist/esm/model/config/enum/CardSetConfigKey.js +0 -25
  422. package/dist/esm/model/config/enum/CardSetConfigKey.js.map +0 -1
  423. package/dist/esm/model/config/enum/ConfigKey.js +0 -26
  424. package/dist/esm/model/config/enum/ConfigKey.js.map +0 -1
  425. package/dist/esm/model/config/enum/GroupConfigKey.js +0 -53
  426. package/dist/esm/model/config/enum/GroupConfigKey.js.map +0 -1
  427. package/dist/esm/model/config/enum/GroupConfigType.js +0 -11
  428. package/dist/esm/model/config/enum/GroupConfigType.js.map +0 -1
  429. package/dist/esm/model/config/enum/PropertyConfigKey.js +0 -211
  430. package/dist/esm/model/config/enum/PropertyConfigKey.js.map +0 -1
  431. package/dist/esm/model/config/enum/ResourceConfigKey.js +0 -36
  432. package/dist/esm/model/config/enum/ResourceConfigKey.js.map +0 -1
  433. package/dist/esm/model/config/enum/TagConfigKey.js +0 -22
  434. package/dist/esm/model/config/enum/TagConfigKey.js.map +0 -1
  435. package/dist/esm/model/enum/BitTagType.js +0 -10
  436. package/dist/esm/model/enum/BitTagType.js.map +0 -1
  437. package/dist/esm/model/enum/BitType.js +0 -573
  438. package/dist/esm/model/enum/BitType.js.map +0 -1
  439. package/dist/esm/model/enum/BitmarkGeneratorOutput.js +0 -2
  440. package/dist/esm/model/enum/BitmarkGeneratorOutput.js.map +0 -1
  441. package/dist/esm/model/enum/BitmarkParserType.js +0 -6
  442. package/dist/esm/model/enum/BitmarkParserType.js.map +0 -1
  443. package/dist/esm/model/enum/BitmarkVersion.js +0 -8
  444. package/dist/esm/model/enum/BitmarkVersion.js.map +0 -1
  445. package/dist/esm/model/enum/BodyBitType.js +0 -11
  446. package/dist/esm/model/enum/BodyBitType.js.map +0 -1
  447. package/dist/esm/model/enum/BodyTextFormat.js +0 -11
  448. package/dist/esm/model/enum/BodyTextFormat.js.map +0 -1
  449. package/dist/esm/model/enum/CardSetVersion.js +0 -7
  450. package/dist/esm/model/enum/CardSetVersion.js.map +0 -1
  451. package/dist/esm/model/enum/Count.js +0 -6
  452. package/dist/esm/model/enum/Count.js.map +0 -1
  453. package/dist/esm/model/enum/DeprecatedTextFormat.js +0 -6
  454. package/dist/esm/model/enum/DeprecatedTextFormat.js.map +0 -1
  455. package/dist/esm/model/enum/ExampleType.js +0 -8
  456. package/dist/esm/model/enum/ExampleType.js.map +0 -1
  457. package/dist/esm/model/enum/PropertyAstKey.js +0 -15
  458. package/dist/esm/model/enum/PropertyAstKey.js.map +0 -1
  459. package/dist/esm/model/enum/PropertyFormat.js +0 -11
  460. package/dist/esm/model/enum/PropertyFormat.js.map +0 -1
  461. package/dist/esm/model/enum/PropertyJsonKey.js +0 -11
  462. package/dist/esm/model/enum/PropertyJsonKey.js.map +0 -1
  463. package/dist/esm/model/enum/PropertyTag.js +0 -5
  464. package/dist/esm/model/enum/PropertyTag.js.map +0 -1
  465. package/dist/esm/model/enum/ResourceJsonKey.js +0 -24
  466. package/dist/esm/model/enum/ResourceJsonKey.js.map +0 -1
  467. package/dist/esm/model/enum/ResourceTag.js +0 -34
  468. package/dist/esm/model/enum/ResourceTag.js.map +0 -1
  469. package/dist/esm/model/enum/Tag.js +0 -18
  470. package/dist/esm/model/enum/Tag.js.map +0 -1
  471. package/dist/esm/model/enum/TextFormat.js +0 -13
  472. package/dist/esm/model/enum/TextFormat.js.map +0 -1
  473. package/dist/esm/model/enum/TextLocation.js +0 -12
  474. package/dist/esm/model/enum/TextLocation.js.map +0 -1
  475. package/dist/esm/model/enum/TextMarkType.js +0 -51
  476. package/dist/esm/model/enum/TextMarkType.js.map +0 -1
  477. package/dist/esm/model/enum/TextNodeType.js +0 -32
  478. package/dist/esm/model/enum/TextNodeType.js.map +0 -1
  479. package/dist/esm/model/enum/TextSection.js +0 -15
  480. package/dist/esm/model/enum/TextSection.js.map +0 -1
  481. package/dist/esm/model/info/enum/InfoFormat.js +0 -8
  482. package/dist/esm/model/info/enum/InfoFormat.js.map +0 -1
  483. package/dist/esm/model/info/enum/InfoType.js +0 -9
  484. package/dist/esm/model/info/enum/InfoType.js.map +0 -1
  485. package/dist/esm/model/json/BitJson.js +0 -2
  486. package/dist/esm/model/json/BitJson.js.map +0 -1
  487. package/dist/esm/model/json/BitWrapperJson.js +0 -2
  488. package/dist/esm/model/json/BitWrapperJson.js.map +0 -1
  489. package/dist/esm/model/json/BodyBitJson.js +0 -2
  490. package/dist/esm/model/json/BodyBitJson.js.map +0 -1
  491. package/dist/esm/model/json/ParserJson.js +0 -2
  492. package/dist/esm/model/json/ParserJson.js.map +0 -1
  493. package/dist/esm/model/json/ResourceJson.js +0 -2
  494. package/dist/esm/model/json/ResourceJson.js.map +0 -1
  495. package/dist/esm/model/parser/ParserData.js +0 -2
  496. package/dist/esm/model/parser/ParserData.js.map +0 -1
  497. package/dist/esm/model/parser/ParserError.js +0 -2
  498. package/dist/esm/model/parser/ParserError.js.map +0 -1
  499. package/dist/esm/model/parser/ParserInfo.js +0 -2
  500. package/dist/esm/model/parser/ParserInfo.js.map +0 -1
  501. package/dist/esm/model/parser/ParserLocation.js +0 -2
  502. package/dist/esm/model/parser/ParserLocation.js.map +0 -1
  503. package/dist/esm/model/parser/ParserLocationRange.js +0 -2
  504. package/dist/esm/model/parser/ParserLocationRange.js.map +0 -1
  505. package/dist/esm/model/parser/TagValidationData.js +0 -2
  506. package/dist/esm/model/parser/TagValidationData.js.map +0 -1
  507. package/dist/esm/parser/bitmark/BitmarkParser.js +0 -22
  508. package/dist/esm/parser/bitmark/BitmarkParser.js.map +0 -1
  509. package/dist/esm/parser/bitmark/peg/BitmarkPegParser.js +0 -4
  510. package/dist/esm/parser/bitmark/peg/BitmarkPegParser.js.map +0 -1
  511. package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js +0 -611
  512. package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js.map +0 -1
  513. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +0 -713
  514. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +0 -1
  515. package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js +0 -59
  516. package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +0 -1
  517. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +0 -742
  518. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +0 -1
  519. package/dist/esm/parser/bitmark/peg/PeggyGrammarLocation.js +0 -79
  520. package/dist/esm/parser/bitmark/peg/PeggyGrammarLocation.js.map +0 -1
  521. package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +0 -257
  522. package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +0 -1
  523. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +0 -48
  524. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +0 -1
  525. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +0 -883
  526. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +0 -1
  527. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +0 -25
  528. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +0 -1
  529. package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +0 -58
  530. package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +0 -1
  531. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +0 -61
  532. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +0 -1
  533. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +0 -159
  534. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +0 -1
  535. package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +0 -52
  536. package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +0 -1
  537. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +0 -29
  538. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +0 -1
  539. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +0 -57
  540. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +0 -1
  541. package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +0 -14
  542. package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +0 -1
  543. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +0 -27
  544. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +0 -1
  545. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +0 -18
  546. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +0 -1
  547. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +0 -43
  548. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +0 -1
  549. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +0 -42
  550. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +0 -1
  551. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +0 -9
  552. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +0 -1
  553. package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +0 -55
  554. package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +0 -1
  555. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +0 -156
  556. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +0 -1
  557. package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +0 -35
  558. package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +0 -1
  559. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +0 -22
  560. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +0 -1
  561. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +0 -160
  562. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +0 -1
  563. package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +0 -25
  564. package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +0 -1
  565. package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +0 -26
  566. package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +0 -1
  567. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +0 -50
  568. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +0 -1
  569. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +0 -201
  570. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +0 -1
  571. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +0 -22
  572. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +0 -1
  573. package/dist/esm/parser/json/JsonParser.js +0 -267
  574. package/dist/esm/parser/json/JsonParser.js.map +0 -1
  575. package/dist/esm/parser/text/TextParser.js +0 -145
  576. package/dist/esm/parser/text/TextParser.js.map +0 -1
  577. package/dist/esm/parser/text/peg/TextPegParser.js +0 -4
  578. package/dist/esm/parser/text/peg/TextPegParser.js.map +0 -1
  579. package/dist/esm/utils/ArrayUtils.js +0 -40
  580. package/dist/esm/utils/ArrayUtils.js.map +0 -1
  581. package/dist/esm/utils/BitUtils.js +0 -72
  582. package/dist/esm/utils/BitUtils.js.map +0 -1
  583. package/dist/esm/utils/BooleanUtils.js +0 -59
  584. package/dist/esm/utils/BooleanUtils.js.map +0 -1
  585. package/dist/esm/utils/FileUtils.js +0 -36
  586. package/dist/esm/utils/FileUtils.js.map +0 -1
  587. package/dist/esm/utils/NumberUtils.js +0 -59
  588. package/dist/esm/utils/NumberUtils.js.map +0 -1
  589. package/dist/esm/utils/ObjectUtils.js +0 -411
  590. package/dist/esm/utils/ObjectUtils.js.map +0 -1
  591. package/dist/esm/utils/StringUtils.js +0 -180
  592. package/dist/esm/utils/StringUtils.js.map +0 -1
  593. package/dist/esm/utils/UrlUtils.js +0 -34
  594. package/dist/esm/utils/UrlUtils.js.map +0 -1
  595. package/dist/esm/utils/env/Env.js +0 -127
  596. package/dist/esm/utils/env/Env.js.map +0 -1
  597. package/dist/esm/utils/env/Environment.js +0 -12
  598. package/dist/esm/utils/env/Environment.js.map +0 -1
  599. package/dist/esm/utils/env/Os.js +0 -11
  600. package/dist/esm/utils/env/Os.js.map +0 -1
  601. package/dist/esm/utils/env/Version.js +0 -9
  602. package/dist/esm/utils/env/Version.js.map +0 -1
  603. package/dist/esm/utils/env/userAgent.js +0 -86
  604. package/dist/esm/utils/env/userAgent.js.map +0 -1
  605. package/dist/esm/utils/polyfill/fs.js +0 -10
  606. package/dist/esm/utils/polyfill/fs.js.map +0 -1
  607. package/dist/types/BitmarkParserGenerator.d.ts +0 -478
  608. package/dist/types/BitmarkParserGenerator.d.ts.map +0 -1
  609. package/dist/types/ast/Ast.d.ts +0 -137
  610. package/dist/types/ast/Ast.d.ts.map +0 -1
  611. package/dist/types/ast/BaseBuilder.d.ts +0 -64
  612. package/dist/types/ast/BaseBuilder.d.ts.map +0 -1
  613. package/dist/types/ast/Builder.d.ts +0 -692
  614. package/dist/types/ast/Builder.d.ts.map +0 -1
  615. package/dist/types/ast/ResourceBuilder.d.ts +0 -384
  616. package/dist/types/ast/ResourceBuilder.d.ts.map +0 -1
  617. package/dist/types/ast/rules/NodeValidator.d.ts +0 -28
  618. package/dist/types/ast/rules/NodeValidator.d.ts.map +0 -1
  619. package/dist/types/ast/writer/FileWriter.d.ts +0 -37
  620. package/dist/types/ast/writer/FileWriter.d.ts.map +0 -1
  621. package/dist/types/ast/writer/StreamWriter.d.ts +0 -29
  622. package/dist/types/ast/writer/StreamWriter.d.ts.map +0 -1
  623. package/dist/types/ast/writer/StringWriter.d.ts +0 -30
  624. package/dist/types/ast/writer/StringWriter.d.ts.map +0 -1
  625. package/dist/types/ast/writer/Writer.d.ts +0 -72
  626. package/dist/types/ast/writer/Writer.d.ts.map +0 -1
  627. package/dist/types/breakscaping/Breakscape.d.ts +0 -44
  628. package/dist/types/breakscaping/Breakscape.d.ts.map +0 -1
  629. package/dist/types/breakscaping/BreakscapeLoop.d.ts +0 -142
  630. package/dist/types/breakscaping/BreakscapeLoop.d.ts.map +0 -1
  631. package/dist/types/breakscaping/BreakscapeOptions.d.ts +0 -30
  632. package/dist/types/breakscaping/BreakscapeOptions.d.ts.map +0 -1
  633. package/dist/types/breakscaping/BreakscapeRegex.d.ts +0 -96
  634. package/dist/types/breakscaping/BreakscapeRegex.d.ts.map +0 -1
  635. package/dist/types/breakscaping/RegexConfigs.d.ts +0 -35
  636. package/dist/types/breakscaping/RegexConfigs.d.ts.map +0 -1
  637. package/dist/types/config/Config.d.ts +0 -115
  638. package/dist/types/config/Config.d.ts.map +0 -1
  639. package/dist/types/config/ConfigHydrator.d.ts +0 -16
  640. package/dist/types/config/ConfigHydrator.d.ts.map +0 -1
  641. package/dist/types/config/raw/bits.d.ts +0 -4
  642. package/dist/types/config/raw/bits.d.ts.map +0 -1
  643. package/dist/types/config/raw/cardSets.d.ts +0 -4
  644. package/dist/types/config/raw/cardSets.d.ts.map +0 -1
  645. package/dist/types/config/raw/groups.d.ts +0 -4
  646. package/dist/types/config/raw/groups.d.ts.map +0 -1
  647. package/dist/types/config/raw/properties.d.ts +0 -4
  648. package/dist/types/config/raw/properties.d.ts.map +0 -1
  649. package/dist/types/config/raw/resources.d.ts +0 -4
  650. package/dist/types/config/raw/resources.d.ts.map +0 -1
  651. package/dist/types/config/raw/tags.d.ts +0 -4
  652. package/dist/types/config/raw/tags.d.ts.map +0 -1
  653. package/dist/types/generated/build-info.d.ts +0 -8
  654. package/dist/types/generated/build-info.d.ts.map +0 -1
  655. package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts +0 -12
  656. package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +0 -1
  657. package/dist/types/generated/parser/text/text-peggy-parser.d.ts +0 -12
  658. package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +0 -1
  659. package/dist/types/generator/AstWalkerGenerator.d.ts +0 -32
  660. package/dist/types/generator/AstWalkerGenerator.d.ts.map +0 -1
  661. package/dist/types/generator/Generator.d.ts +0 -6
  662. package/dist/types/generator/Generator.d.ts.map +0 -1
  663. package/dist/types/generator/bitmark/BitmarkFileGenerator.d.ts +0 -41
  664. package/dist/types/generator/bitmark/BitmarkFileGenerator.d.ts.map +0 -1
  665. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +0 -401
  666. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +0 -1
  667. package/dist/types/generator/bitmark/BitmarkStringGenerator.d.ts +0 -31
  668. package/dist/types/generator/bitmark/BitmarkStringGenerator.d.ts.map +0 -1
  669. package/dist/types/generator/json/JsonFileGenerator.d.ts +0 -45
  670. package/dist/types/generator/json/JsonFileGenerator.d.ts.map +0 -1
  671. package/dist/types/generator/json/JsonGenerator.d.ts +0 -357
  672. package/dist/types/generator/json/JsonGenerator.d.ts.map +0 -1
  673. package/dist/types/generator/json/JsonObjectGenerator.d.ts +0 -32
  674. package/dist/types/generator/json/JsonObjectGenerator.d.ts.map +0 -1
  675. package/dist/types/generator/json/JsonStringGenerator.d.ts +0 -30
  676. package/dist/types/generator/json/JsonStringGenerator.d.ts.map +0 -1
  677. package/dist/types/generator/text/TextGenerator.d.ts +0 -228
  678. package/dist/types/generator/text/TextGenerator.d.ts.map +0 -1
  679. package/dist/types/index.d.ts +0 -50
  680. package/dist/types/index.d.ts.map +0 -1
  681. package/dist/types/info/InfoBuilder.d.ts +0 -18
  682. package/dist/types/info/InfoBuilder.d.ts.map +0 -1
  683. package/dist/types/init/init.d.ts +0 -4
  684. package/dist/types/init/init.d.ts.map +0 -1
  685. package/dist/types/model/ast/BreakscapedString.d.ts +0 -4
  686. package/dist/types/model/ast/BreakscapedString.d.ts.map +0 -1
  687. package/dist/types/model/ast/NodeType.d.ts +0 -1093
  688. package/dist/types/model/ast/NodeType.d.ts.map +0 -1
  689. package/dist/types/model/ast/Nodes.d.ts +0 -268
  690. package/dist/types/model/ast/Nodes.d.ts.map +0 -1
  691. package/dist/types/model/ast/StardardString.d.ts +0 -4
  692. package/dist/types/model/ast/StardardString.d.ts.map +0 -1
  693. package/dist/types/model/ast/TextNodes.d.ts +0 -130
  694. package/dist/types/model/ast/TextNodes.d.ts.map +0 -1
  695. package/dist/types/model/config/AbstractTagConfig.d.ts +0 -24
  696. package/dist/types/model/config/AbstractTagConfig.d.ts.map +0 -1
  697. package/dist/types/model/config/BitConfig.d.ts +0 -48
  698. package/dist/types/model/config/BitConfig.d.ts.map +0 -1
  699. package/dist/types/model/config/CardSetConfig.d.ts +0 -14
  700. package/dist/types/model/config/CardSetConfig.d.ts.map +0 -1
  701. package/dist/types/model/config/CardVariantConfig.d.ts +0 -16
  702. package/dist/types/model/config/CardVariantConfig.d.ts.map +0 -1
  703. package/dist/types/model/config/MarkupTagConfig.d.ts +0 -17
  704. package/dist/types/model/config/MarkupTagConfig.d.ts.map +0 -1
  705. package/dist/types/model/config/PropertyTagConfig.d.ts +0 -23
  706. package/dist/types/model/config/PropertyTagConfig.d.ts.map +0 -1
  707. package/dist/types/model/config/ResourceTagConfig.d.ts +0 -18
  708. package/dist/types/model/config/ResourceTagConfig.d.ts.map +0 -1
  709. package/dist/types/model/config/ResourcesConfig.d.ts +0 -14
  710. package/dist/types/model/config/ResourcesConfig.d.ts.map +0 -1
  711. package/dist/types/model/config/TagConfig.d.ts +0 -5
  712. package/dist/types/model/config/TagConfig.d.ts.map +0 -1
  713. package/dist/types/model/config/TagsConfig.d.ts +0 -5
  714. package/dist/types/model/config/TagsConfig.d.ts.map +0 -1
  715. package/dist/types/model/config/TagsConfigWithInfo.d.ts +0 -9
  716. package/dist/types/model/config/TagsConfigWithInfo.d.ts.map +0 -1
  717. package/dist/types/model/config/_Config.d.ts +0 -119
  718. package/dist/types/model/config/_Config.d.ts.map +0 -1
  719. package/dist/types/model/config/enum/CardSetConfigKey.d.ts +0 -43
  720. package/dist/types/model/config/enum/CardSetConfigKey.d.ts.map +0 -1
  721. package/dist/types/model/config/enum/ConfigKey.d.ts +0 -578
  722. package/dist/types/model/config/enum/ConfigKey.d.ts.map +0 -1
  723. package/dist/types/model/config/enum/GroupConfigKey.d.ts +0 -144
  724. package/dist/types/model/config/enum/GroupConfigKey.d.ts.map +0 -1
  725. package/dist/types/model/config/enum/GroupConfigType.d.ts +0 -16
  726. package/dist/types/model/config/enum/GroupConfigType.d.ts.map +0 -1
  727. package/dist/types/model/config/enum/PropertyConfigKey.d.ts +0 -618
  728. package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +0 -1
  729. package/dist/types/model/config/enum/ResourceConfigKey.d.ts +0 -87
  730. package/dist/types/model/config/enum/ResourceConfigKey.d.ts.map +0 -1
  731. package/dist/types/model/config/enum/TagConfigKey.d.ts +0 -51
  732. package/dist/types/model/config/enum/TagConfigKey.d.ts.map +0 -1
  733. package/dist/types/model/enum/BitTagType.d.ts +0 -15
  734. package/dist/types/model/enum/BitTagType.d.ts.map +0 -1
  735. package/dist/types/model/enum/BitType.d.ts +0 -1143
  736. package/dist/types/model/enum/BitType.d.ts.map +0 -1
  737. package/dist/types/model/enum/BitmarkGeneratorOutput.d.ts +0 -1
  738. package/dist/types/model/enum/BitmarkGeneratorOutput.d.ts.map +0 -1
  739. package/dist/types/model/enum/BitmarkParserType.d.ts +0 -7
  740. package/dist/types/model/enum/BitmarkParserType.d.ts.map +0 -1
  741. package/dist/types/model/enum/BitmarkVersion.d.ts +0 -12
  742. package/dist/types/model/enum/BitmarkVersion.d.ts.map +0 -1
  743. package/dist/types/model/enum/BodyBitType.d.ts +0 -25
  744. package/dist/types/model/enum/BodyBitType.d.ts.map +0 -1
  745. package/dist/types/model/enum/BodyTextFormat.d.ts +0 -17
  746. package/dist/types/model/enum/BodyTextFormat.d.ts.map +0 -1
  747. package/dist/types/model/enum/CardSetVersion.d.ts +0 -11
  748. package/dist/types/model/enum/CardSetVersion.d.ts.map +0 -1
  749. package/dist/types/model/enum/Count.d.ts +0 -7
  750. package/dist/types/model/enum/Count.d.ts.map +0 -1
  751. package/dist/types/model/enum/DeprecatedTextFormat.d.ts +0 -7
  752. package/dist/types/model/enum/DeprecatedTextFormat.d.ts.map +0 -1
  753. package/dist/types/model/enum/ExampleType.d.ts +0 -13
  754. package/dist/types/model/enum/ExampleType.d.ts.map +0 -1
  755. package/dist/types/model/enum/PropertyAstKey.d.ts +0 -22
  756. package/dist/types/model/enum/PropertyAstKey.d.ts.map +0 -1
  757. package/dist/types/model/enum/PropertyFormat.d.ts +0 -19
  758. package/dist/types/model/enum/PropertyFormat.d.ts.map +0 -1
  759. package/dist/types/model/enum/PropertyJsonKey.d.ts +0 -10
  760. package/dist/types/model/enum/PropertyJsonKey.d.ts.map +0 -1
  761. package/dist/types/model/enum/PropertyTag.d.ts +0 -419
  762. package/dist/types/model/enum/PropertyTag.d.ts.map +0 -1
  763. package/dist/types/model/enum/ResourceJsonKey.d.ts +0 -45
  764. package/dist/types/model/enum/ResourceJsonKey.d.ts.map +0 -1
  765. package/dist/types/model/enum/ResourceTag.d.ts +0 -63
  766. package/dist/types/model/enum/ResourceTag.d.ts.map +0 -1
  767. package/dist/types/model/enum/Tag.d.ts +0 -33
  768. package/dist/types/model/enum/Tag.d.ts.map +0 -1
  769. package/dist/types/model/enum/TextFormat.d.ts +0 -17
  770. package/dist/types/model/enum/TextFormat.d.ts.map +0 -1
  771. package/dist/types/model/enum/TextLocation.d.ts +0 -16
  772. package/dist/types/model/enum/TextLocation.d.ts.map +0 -1
  773. package/dist/types/model/enum/TextMarkType.d.ts +0 -93
  774. package/dist/types/model/enum/TextMarkType.d.ts.map +0 -1
  775. package/dist/types/model/enum/TextNodeType.d.ts +0 -53
  776. package/dist/types/model/enum/TextNodeType.d.ts.map +0 -1
  777. package/dist/types/model/enum/TextSection.d.ts +0 -27
  778. package/dist/types/model/enum/TextSection.d.ts.map +0 -1
  779. package/dist/types/model/info/enum/InfoFormat.d.ts +0 -13
  780. package/dist/types/model/info/enum/InfoFormat.d.ts.map +0 -1
  781. package/dist/types/model/info/enum/InfoType.d.ts +0 -15
  782. package/dist/types/model/info/enum/InfoType.d.ts.map +0 -1
  783. package/dist/types/model/json/BitJson.d.ts +0 -479
  784. package/dist/types/model/json/BitJson.d.ts.map +0 -1
  785. package/dist/types/model/json/BitWrapperJson.d.ts +0 -8
  786. package/dist/types/model/json/BitWrapperJson.d.ts.map +0 -1
  787. package/dist/types/model/json/BodyBitJson.d.ts +0 -81
  788. package/dist/types/model/json/BodyBitJson.d.ts.map +0 -1
  789. package/dist/types/model/json/ParserJson.d.ts +0 -12
  790. package/dist/types/model/json/ParserJson.d.ts.map +0 -1
  791. package/dist/types/model/json/ResourceJson.d.ts +0 -244
  792. package/dist/types/model/json/ResourceJson.d.ts.map +0 -1
  793. package/dist/types/model/parser/ParserData.d.ts +0 -11
  794. package/dist/types/model/parser/ParserData.d.ts.map +0 -1
  795. package/dist/types/model/parser/ParserError.d.ts +0 -17
  796. package/dist/types/model/parser/ParserError.d.ts.map +0 -1
  797. package/dist/types/model/parser/ParserInfo.d.ts +0 -10
  798. package/dist/types/model/parser/ParserInfo.d.ts.map +0 -1
  799. package/dist/types/model/parser/ParserLocation.d.ts +0 -6
  800. package/dist/types/model/parser/ParserLocation.d.ts.map +0 -1
  801. package/dist/types/model/parser/ParserLocationRange.d.ts +0 -10
  802. package/dist/types/model/parser/ParserLocationRange.d.ts.map +0 -1
  803. package/dist/types/model/parser/TagValidationData.d.ts +0 -24
  804. package/dist/types/model/parser/TagValidationData.d.ts.map +0 -1
  805. package/dist/types/parser/bitmark/BitmarkParser.d.ts +0 -21
  806. package/dist/types/parser/bitmark/BitmarkParser.d.ts.map +0 -1
  807. package/dist/types/parser/bitmark/peg/BitmarkPegParser.d.ts +0 -8
  808. package/dist/types/parser/bitmark/peg/BitmarkPegParser.d.ts.map +0 -1
  809. package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts +0 -108
  810. package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts.map +0 -1
  811. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +0 -137
  812. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +0 -1
  813. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +0 -333
  814. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +0 -1
  815. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +0 -186
  816. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +0 -1
  817. package/dist/types/parser/bitmark/peg/PeggyGrammarLocation.d.ts +0 -61
  818. package/dist/types/parser/bitmark/peg/PeggyGrammarLocation.d.ts.map +0 -1
  819. package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts +0 -37
  820. package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +0 -1
  821. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts +0 -5
  822. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +0 -1
  823. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +0 -7
  824. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +0 -1
  825. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts +0 -5
  826. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +0 -1
  827. package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts +0 -15
  828. package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts.map +0 -1
  829. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts +0 -5
  830. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +0 -1
  831. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts +0 -4
  832. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +0 -1
  833. package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +0 -14
  834. package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +0 -1
  835. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts +0 -6
  836. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +0 -1
  837. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts +0 -5
  838. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +0 -1
  839. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts +0 -4
  840. package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts.map +0 -1
  841. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts +0 -5
  842. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts.map +0 -1
  843. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts +0 -5
  844. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +0 -1
  845. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts +0 -6
  846. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +0 -1
  847. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts +0 -5
  848. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +0 -1
  849. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts +0 -4
  850. package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +0 -1
  851. package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts +0 -5
  852. package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +0 -1
  853. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts +0 -5
  854. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +0 -1
  855. package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts +0 -5
  856. package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +0 -1
  857. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts +0 -5
  858. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +0 -1
  859. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +0 -14
  860. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +0 -1
  861. package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts +0 -5
  862. package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +0 -1
  863. package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts +0 -5
  864. package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +0 -1
  865. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +0 -11
  866. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +0 -1
  867. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +0 -6
  868. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +0 -1
  869. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts +0 -4
  870. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +0 -1
  871. package/dist/types/parser/json/JsonParser.d.ts +0 -59
  872. package/dist/types/parser/json/JsonParser.d.ts.map +0 -1
  873. package/dist/types/parser/text/TextParser.d.ts +0 -55
  874. package/dist/types/parser/text/TextParser.d.ts.map +0 -1
  875. package/dist/types/parser/text/peg/TextPegParser.d.ts +0 -8
  876. package/dist/types/parser/text/peg/TextPegParser.d.ts.map +0 -1
  877. package/dist/types/utils/ArrayUtils.d.ts +0 -25
  878. package/dist/types/utils/ArrayUtils.d.ts.map +0 -1
  879. package/dist/types/utils/BitUtils.d.ts +0 -30
  880. package/dist/types/utils/BitUtils.d.ts.map +0 -1
  881. package/dist/types/utils/BooleanUtils.d.ts +0 -30
  882. package/dist/types/utils/BooleanUtils.d.ts.map +0 -1
  883. package/dist/types/utils/FileUtils.d.ts +0 -12
  884. package/dist/types/utils/FileUtils.d.ts.map +0 -1
  885. package/dist/types/utils/NumberUtils.d.ts +0 -47
  886. package/dist/types/utils/NumberUtils.d.ts.map +0 -1
  887. package/dist/types/utils/ObjectUtils.d.ts +0 -197
  888. package/dist/types/utils/ObjectUtils.d.ts.map +0 -1
  889. package/dist/types/utils/StringUtils.d.ts +0 -77
  890. package/dist/types/utils/StringUtils.d.ts.map +0 -1
  891. package/dist/types/utils/UrlUtils.d.ts +0 -7
  892. package/dist/types/utils/UrlUtils.d.ts.map +0 -1
  893. package/dist/types/utils/env/Env.d.ts +0 -39
  894. package/dist/types/utils/env/Env.d.ts.map +0 -1
  895. package/dist/types/utils/env/Environment.d.ts +0 -21
  896. package/dist/types/utils/env/Environment.d.ts.map +0 -1
  897. package/dist/types/utils/env/Os.d.ts +0 -19
  898. package/dist/types/utils/env/Os.d.ts.map +0 -1
  899. package/dist/types/utils/env/Version.d.ts +0 -10
  900. package/dist/types/utils/env/Version.d.ts.map +0 -1
  901. package/dist/types/utils/env/userAgent.d.ts +0 -11
  902. package/dist/types/utils/env/userAgent.d.ts.map +0 -1
  903. package/dist/types/utils/polyfill/fs.d.ts +0 -6
  904. package/dist/types/utils/polyfill/fs.d.ts.map +0 -1
@@ -1,2601 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BitmarkGenerator = void 0;
13
- const Ast_1 = require("../../ast/Ast");
14
- const StringWriter_1 = require("../../ast/writer/StringWriter");
15
- const Breakscape_1 = require("../../breakscaping/Breakscape");
16
- const Config_1 = require("../../config/Config");
17
- const NodeType_1 = require("../../model/ast/NodeType");
18
- const BitType_1 = require("../../model/enum/BitType");
19
- const BitmarkVersion_1 = require("../../model/enum/BitmarkVersion");
20
- const BodyBitType_1 = require("../../model/enum/BodyBitType");
21
- const CardSetVersion_1 = require("../../model/enum/CardSetVersion");
22
- const PropertyFormat_1 = require("../../model/enum/PropertyFormat");
23
- const PropertyTag_1 = require("../../model/enum/PropertyTag");
24
- const ResourceTag_1 = require("../../model/enum/ResourceTag");
25
- const TextFormat_1 = require("../../model/enum/TextFormat");
26
- const TextLocation_1 = require("../../model/enum/TextLocation");
27
- const BooleanUtils_1 = require("../../utils/BooleanUtils");
28
- const ObjectUtils_1 = require("../../utils/ObjectUtils");
29
- const StringUtils_1 = require("../../utils/StringUtils");
30
- const AstWalkerGenerator_1 = require("../AstWalkerGenerator");
31
- const TextGenerator_1 = require("../text/TextGenerator");
32
- const DEFAULT_OPTIONS = {
33
- debugGenerationInline: false,
34
- };
35
- const DEFAULT_SPACES_AROUND_VALUES = 1;
36
- const MAX_SPACES_AROUND_VALUES = 10;
37
- /**
38
- * Generate bitmark markup from a bitmark AST
39
- *
40
- * NOTE: Newlines - a newline is written BEFORE each content that requries a newline
41
- *
42
- */
43
- class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
44
- /**
45
- * Generate bitmark markup from a bitmark AST
46
- *
47
- * @param writer - destination for the output
48
- * @param bitmarkVersion - The version of bitmark to output.
49
- * If not specified, the version will default to 3.
50
- *
51
- * Specifying the version will set defaults for other options.
52
- * - Bitmark v2:
53
- * - cardSetVersion: 1
54
- * - Bitmark v3:
55
- * - cardSetVersion: 2
56
- *
57
- * @param options - bitmark generation options
58
- */
59
- constructor(writer, options) {
60
- var _a, _b;
61
- super();
62
- this.ast = new Ast_1.Ast();
63
- // State
64
- this.bitType = BitType_1.BitType._error;
65
- this.textFormat = TextFormat_1.TextFormat.bitmarkText;
66
- this.isBodyBitmarkText = false;
67
- this.isCardAllowed = false;
68
- this.firstBit = true;
69
- this.hasCardSet = false;
70
- this.hasFooter = false;
71
- this.inTag = true;
72
- // Keep TS happy
73
- this.inTag;
74
- // Bind callbacks
75
- this.enter = this.enter.bind(this);
76
- this.between = this.between.bind(this);
77
- this.exit = this.exit.bind(this);
78
- this.leaf = this.leaf.bind(this);
79
- this.write = this.write.bind(this);
80
- this.bodyBitCallback = this.bodyBitCallback.bind(this);
81
- // Set options
82
- this.bitmarkVersion = (_a = BitmarkVersion_1.BitmarkVersion.fromValue(options === null || options === void 0 ? void 0 : options.bitmarkVersion)) !== null && _a !== void 0 ? _a : BitmarkVersion_1.DEFAULT_BITMARK_VERSION;
83
- this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options === null || options === void 0 ? void 0 : options.bitmarkOptions);
84
- this.debugGenerationInline = (_b = this.options.debugGenerationInline) !== null && _b !== void 0 ? _b : false;
85
- // Set defaults according to bitmark version
86
- if (this.bitmarkVersion === BitmarkVersion_1.BitmarkVersion.v2) {
87
- if (this.options.cardSetVersion === undefined) {
88
- this.options.cardSetVersion = CardSetVersion_1.CardSetVersion.v1;
89
- }
90
- }
91
- else {
92
- if (this.options.cardSetVersion === undefined) {
93
- this.options.cardSetVersion = CardSetVersion_1.CardSetVersion.v2;
94
- }
95
- }
96
- // Calculate the prettify space
97
- this.prettifySpace = this.options.prettifyJson === true ? 2 : this.options.prettifyJson || undefined;
98
- // Calculate the spaces around values
99
- this.spacesAroundValues = this.calcSpacesAroundValues();
100
- this.spacesAroundValuesStr = ' '.repeat(this.spacesAroundValues);
101
- // Create the text generator
102
- this.textGenerator = new TextGenerator_1.TextGenerator(this.bitmarkVersion, {
103
- writeCallback: this.write,
104
- bodyBitCallback: this.bodyBitCallback,
105
- debugGenerationInline: this.debugGenerationInline,
106
- });
107
- this.mainWriter = writer;
108
- this.partWriter = new StringWriter_1.StringWriter();
109
- this.writer = this.mainWriter;
110
- this.generateResourceHandlers();
111
- this.generatePropertyHandlers();
112
- }
113
- /**
114
- * Generate bitmark markup from bitmark AST
115
- *
116
- * @param ast bitmark AST
117
- */
118
- generate(ast) {
119
- return __awaiter(this, void 0, void 0, function* () {
120
- // Reset the state
121
- this.resetState();
122
- // Open the writer
123
- yield this.writer.open();
124
- // Walk the bitmark AST
125
- this.walkAndWrite(ast);
126
- // Ensure a blank line at end of file
127
- this.writeLine();
128
- // Close the writer
129
- yield this.writer.close();
130
- });
131
- }
132
- /**
133
- * Generate text from a bitmark text AST synchronously
134
- *
135
- * @param ast bitmark text AST
136
- */
137
- generateSync(ast) {
138
- // Reset the state
139
- this.resetState();
140
- // Open the writer
141
- this.writer.openSync();
142
- // Walk the bitmark AST
143
- this.walkAndWrite(ast);
144
- // Close the writer
145
- this.writer.closeSync();
146
- }
147
- resetState() {
148
- this.bitType = BitType_1.BitType._error;
149
- this.textFormat = TextFormat_1.TextFormat.bitmarkText;
150
- this.isBodyBitmarkText = false;
151
- this.isCardAllowed = false;
152
- this.firstBit = true;
153
- this.hasCardSet = false;
154
- this.hasFooter = false;
155
- this.inTag = true;
156
- this.printed = false;
157
- }
158
- walkAndWrite(ast) {
159
- // Walk the bitmark AST
160
- this.ast.walk(ast, NodeType_1.NodeType.bitmarkAst, this, undefined);
161
- // Ensure a blank line at end of file
162
- this.writeLine();
163
- }
164
- //
165
- // NODE HANDLERS
166
- //
167
- //
168
- // Non-Terminal nodes (branches)
169
- //
170
- // bitmark
171
- // bitmarkAst -> bits -> bitsValue
172
- enter_bitsValue(node, _route) {
173
- var _a;
174
- const bit = node.value;
175
- const bitConfig = Config_1.Config.getBitConfig(bit.bitType);
176
- const bitResourcesConfig = Config_1.Config.getBitResourcesConfig(bit.bitType, bit.resourceType);
177
- // Set state variables
178
- this.bitType = bit.bitType;
179
- this.textFormat = (_a = bit.textFormat) !== null && _a !== void 0 ? _a : bitConfig.textFormatDefault;
180
- this.isBodyBitmarkText = this.textFormat === TextFormat_1.TextFormat.bitmarkText;
181
- this.isCardAllowed = this.calculateIsCardAllowed();
182
- this.hasCardSet = this.haveValidCardSet(bit);
183
- this.hasFooter = this.haveValidFooter(bit);
184
- // Separate the bits with 3 newlines
185
- if (!this.firstBit) {
186
- this.writeNL();
187
- this.writeNL();
188
- this.writeNL();
189
- }
190
- // Write the bit tag opening
191
- this.writeOPD(bit.bitLevel);
192
- if (bit.isCommented)
193
- this.writeString('|');
194
- this.writeTagKey(bit.bitType);
195
- if (bit.textFormat) {
196
- const write = this.isWriteTextFormat(bit.textFormat, bitConfig.textFormatDefault);
197
- if (write) {
198
- this.writeColon();
199
- this.writeTagKey(bit.textFormat);
200
- }
201
- }
202
- // Use the bitConfig to see if we need to write the resourceType attachment
203
- let resourceType;
204
- if (bitConfig.resourceAttachmentAllowed && bit.resources && bit.resources.length > 0) {
205
- const comboMap = bitResourcesConfig.comboResourceTagTypesMap;
206
- if (bitResourcesConfig.comboResourceTagTypesMap.size > 0) {
207
- // The resource is a combo resource
208
- // Extract the resource types from the combo resource
209
- // NOTE: There should only ever be one combo resource per bit, but the code can handle multiple
210
- // except for overwriting resourceJson
211
- for (const comboTagType of comboMap.keys()) {
212
- resourceType = comboTagType;
213
- }
214
- }
215
- else {
216
- // Get the resourceType from the first resource and write it as the attachment resourceType
217
- resourceType = bit.resources[0].type;
218
- }
219
- }
220
- if (resourceType) {
221
- this.writeAmpersand();
222
- this.writeTagKey(resourceType);
223
- }
224
- this.writeCL();
225
- // this.writeNL();
226
- // Continue traversal
227
- return true;
228
- }
229
- exit_bitsValue(_node, _route) {
230
- this.firstBit = false;
231
- }
232
- // bitmarkAst -> bits -> bitsValue -> internalComment
233
- enter_internalComment(node, route) {
234
- const internalComment = node.value;
235
- // Ignore values that are not at the bit level as they might be handled elsewhere
236
- const parent = this.getParentNode(route);
237
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
238
- return true;
239
- for (let i = 0; i < internalComment.length; i++) {
240
- const comment = internalComment[i];
241
- this.writeNL();
242
- this.writeProperty('internalComment', comment, {
243
- format: PropertyFormat_1.PropertyFormat.plainText,
244
- single: false,
245
- ignoreEmpty: true,
246
- });
247
- }
248
- // Stop traversal of this branch
249
- return false;
250
- }
251
- // bitmarkAst -> bits -> bitsValue -> labelTrue / labelFalse
252
- enter_labelTrue(node, route) {
253
- const value = node.value;
254
- // Ignore example that is not at the bit level as it are handled elsewhere
255
- const parent = this.getParentNode(route);
256
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
257
- return true;
258
- const bit = parent === null || parent === void 0 ? void 0 : parent.value;
259
- if (bit) {
260
- const haveTrue = value != '';
261
- const haveFalse = bit.labelFalse && bit.labelFalse[0] != '';
262
- if (haveTrue || haveFalse) {
263
- this.writeNL();
264
- }
265
- if (haveTrue)
266
- this.writeProperty(PropertyTag_1.PropertyTag.labelTrue, value, {
267
- format: PropertyFormat_1.PropertyFormat.plainText,
268
- single: true,
269
- ignoreEmpty: true,
270
- });
271
- if (haveFalse)
272
- this.writeProperty(PropertyTag_1.PropertyTag.labelFalse, bit.labelFalse, {
273
- format: PropertyFormat_1.PropertyFormat.plainText,
274
- single: true,
275
- ignoreEmpty: true,
276
- });
277
- }
278
- // Stop traversal of this branch
279
- return false;
280
- }
281
- enter_labelFalse(_node, _route) {
282
- // Handled above in enter_labelTrue(), but this function needed to block automatic property handling
283
- return true;
284
- }
285
- // bitmarkAst -> bits -> bitsValue -> imageSource
286
- enter_imageSource(node, route) {
287
- const imageSource = node.value;
288
- // Ignore values that are not at the bit level as they might be handled elsewhere
289
- const parent = this.getParentNode(route);
290
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
291
- return true;
292
- const { url, mockupId, size, format, trim } = imageSource;
293
- this.writeNL();
294
- this.writeProperty('imageSource', url, {
295
- format: PropertyFormat_1.PropertyFormat.plainText,
296
- single: true,
297
- ignoreEmpty: true,
298
- });
299
- if (url) {
300
- if (mockupId)
301
- this.writeProperty('mockupId', mockupId, {
302
- format: PropertyFormat_1.PropertyFormat.plainText,
303
- single: true,
304
- ignoreEmpty: true,
305
- });
306
- if (size)
307
- this.writeProperty('size', size, {
308
- format: PropertyFormat_1.PropertyFormat.plainText,
309
- single: true,
310
- ignoreEmpty: true,
311
- });
312
- if (format)
313
- this.writeProperty('format', format, {
314
- format: PropertyFormat_1.PropertyFormat.plainText,
315
- single: true,
316
- ignoreEmpty: true,
317
- });
318
- if (BooleanUtils_1.BooleanUtils.isBoolean(trim))
319
- this.writeProperty('trim', trim, {
320
- format: PropertyFormat_1.PropertyFormat.plainText,
321
- single: true,
322
- ignoreEmpty: true,
323
- });
324
- }
325
- // Stop traversal of this branch
326
- return false;
327
- }
328
- // bitmarkAst -> bits -> bitsValue -> technicalTerm
329
- enter_technicalTerm(node, route) {
330
- const nodeValue = node.value;
331
- // Ignore values that are not at the bit level as they might be handled elsewhere
332
- const parent = this.getParentNode(route);
333
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
334
- return true;
335
- const { technicalTerm, lang } = nodeValue;
336
- this.writeNL();
337
- this.writeProperty('technicalTerm', technicalTerm, {
338
- format: PropertyFormat_1.PropertyFormat.plainText,
339
- single: true,
340
- ignoreEmpty: true,
341
- });
342
- if (lang != null) {
343
- this.writeProperty('lang', lang, {
344
- format: PropertyFormat_1.PropertyFormat.plainText,
345
- single: true,
346
- ignoreEmpty: true,
347
- });
348
- }
349
- // Stop traversal of this branch
350
- return false;
351
- }
352
- // bitmarkAst -> bits -> bitsValue -> servings
353
- enter_servings(node, route) {
354
- const nodeValue = node.value;
355
- // Ignore values that are not at the bit level as they might be handled elsewhere
356
- const parent = this.getParentNode(route);
357
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
358
- return true;
359
- const { servings, unit, unitAbbr, decimalPlaces, disableCalculation, hint } = nodeValue;
360
- this.writeNL();
361
- this.writeProperty('servings', servings, {
362
- format: PropertyFormat_1.PropertyFormat.plainText,
363
- single: true,
364
- ignoreEmpty: true,
365
- });
366
- if (unit != null) {
367
- this.writeProperty('unit', unit, {
368
- format: PropertyFormat_1.PropertyFormat.plainText,
369
- single: true,
370
- ignoreEmpty: true,
371
- });
372
- }
373
- if (unitAbbr != null) {
374
- this.writeProperty('unitAbbr', unitAbbr, {
375
- format: PropertyFormat_1.PropertyFormat.plainText,
376
- single: true,
377
- ignoreEmpty: true,
378
- });
379
- }
380
- if (decimalPlaces != null) {
381
- this.writeProperty('decimalPlaces', decimalPlaces, {
382
- format: PropertyFormat_1.PropertyFormat.plainText,
383
- single: true,
384
- ignoreEmpty: true,
385
- });
386
- }
387
- if (disableCalculation != null) {
388
- this.writeProperty('disableCalculation', disableCalculation, {
389
- format: PropertyFormat_1.PropertyFormat.plainText,
390
- single: true,
391
- ignoreEmpty: true,
392
- });
393
- }
394
- if (hint != null) {
395
- this.writeOPQ();
396
- this.writeTextOrValue(hint, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
397
- this.writeCL();
398
- }
399
- return false;
400
- }
401
- // bitmarkAst -> bits -> bitsValue -> person
402
- enter_person(node, route) {
403
- const person = node.value;
404
- // Ignore values that are not at the bit level as they might be handled elsewhere
405
- const parent = this.getParentNode(route);
406
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
407
- return true;
408
- const { name, title, avatarImage } = person;
409
- this.writeNL();
410
- this.writeProperty('person', name, {
411
- format: PropertyFormat_1.PropertyFormat.plainText,
412
- single: true,
413
- ignoreEmpty: true,
414
- });
415
- if (title) {
416
- this.writeProperty('title', title, {
417
- format: PropertyFormat_1.PropertyFormat.plainText,
418
- single: true,
419
- ignoreEmpty: true,
420
- });
421
- }
422
- if (avatarImage) {
423
- this.writeResource(ResourceTag_1.ResourceTag.image, avatarImage.image.src);
424
- }
425
- // Stop traversal of this branch
426
- return false;
427
- }
428
- // bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> term -> text
429
- // bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> definition -> text
430
- // bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> alternativeDefinitions
431
- // -> alternativeDefinitionsValue -> text
432
- // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> question -> text
433
- // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> answer -> text
434
- // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers ->
435
- // -> alternativeAnswersValue -> text
436
- enter_text(node, route) {
437
- const parent = this.getParentNode(route);
438
- if (!parent ||
439
- (parent.key !== NodeType_1.NodeType.term &&
440
- parent.key !== NodeType_1.NodeType.definition &&
441
- parent.key !== NodeType_1.NodeType.alternativeDefinitionsValue &&
442
- parent.key !== NodeType_1.NodeType.question &&
443
- parent.key !== NodeType_1.NodeType.answer &&
444
- parent.key !== NodeType_1.NodeType.alternativeAnswersValue)) {
445
- return true;
446
- }
447
- if (node.value) {
448
- this.writeNL();
449
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
450
- }
451
- // Stop traversal of this branch
452
- return false;
453
- }
454
- leaf_text(node, route) {
455
- const parent = this.getParentNode(route);
456
- if (!parent ||
457
- (parent.key !== NodeType_1.NodeType.term &&
458
- parent.key !== NodeType_1.NodeType.definition &&
459
- parent.key !== NodeType_1.NodeType.alternativeDefinitionsValue &&
460
- parent.key !== NodeType_1.NodeType.question &&
461
- parent.key !== NodeType_1.NodeType.answer &&
462
- parent.key !== NodeType_1.NodeType.alternativeAnswersValue &&
463
- parent.key !== NodeType_1.NodeType.reason)) {
464
- return true;
465
- }
466
- if (StringUtils_1.StringUtils.isString(node.value)) {
467
- this.writeNL();
468
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
469
- }
470
- // Stop traversal of this branch
471
- return false;
472
- }
473
- // bitmarkAst -> bits -> bitsValue -> * -> term -> icon
474
- // bitmarkAst -> bits -> bitsValue -> * -> definition -> icon
475
- // bitmarkAst -> bits -> bitsValue -> * -> alternativeDefinitionsValue -> icon
476
- enter_icon(node, route) {
477
- const resource = node.value;
478
- const parent = this.getParentNode(route);
479
- if (!parent)
480
- return true;
481
- if (parent.key !== NodeType_1.NodeType.term &&
482
- parent.key !== NodeType_1.NodeType.definition &&
483
- parent.key !== NodeType_1.NodeType.alternativeDefinitionsValue &&
484
- parent.key !== NodeType_1.NodeType.question &&
485
- parent.key !== NodeType_1.NodeType.answer &&
486
- parent.key !== NodeType_1.NodeType.alternativeAnswersValue) {
487
- // Continue traversal of this branch
488
- return true;
489
- }
490
- // This is a resource, so handle it with the common code
491
- this.writeNL();
492
- this.writeResource(ResourceTag_1.ResourceTag.icon, resource.image.src);
493
- // this.writePropertyStyleResource(ResourceTag.icon, resource as ResourceJson);
494
- // Continue traversal of this branch (for the chained properties)
495
- return true;
496
- }
497
- leaf_iconValue(node, _route) {
498
- // Handle as a standard icon property
499
- this.writeNL();
500
- this.writeProperty('icon', node.value, {
501
- format: PropertyFormat_1.PropertyFormat.plainText,
502
- single: true,
503
- ignoreEmpty: true,
504
- });
505
- // Stop traversal of this branch
506
- return false;
507
- }
508
- // bitmarkAst -> bits -> bitsValue -> ratingLevelStart
509
- enter_ratingLevelStart(node, route) {
510
- this.enterRatingLevelStartEndCommon(node, route);
511
- // Stop traversal of this branch
512
- return false;
513
- }
514
- // bitmarkAst -> bits -> bitsValue -> ratingLevelEnd
515
- enter_ratingLevelEnd(node, route) {
516
- this.enterRatingLevelStartEndCommon(node, route);
517
- // Stop traversal of this branch
518
- return false;
519
- }
520
- // Common code for ratingLevelStart and ratingLevelEnd
521
- enterRatingLevelStartEndCommon(node, route) {
522
- const n = node.value;
523
- // Ignore values that are not at the bit level as they might be handled elsewhere
524
- const parent = this.getParentNode(route);
525
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
526
- return true;
527
- const { level, label } = n;
528
- const levelKey = node.key === NodeType_1.NodeType.ratingLevelStart ? PropertyTag_1.PropertyTag.ratingLevelStart : PropertyTag_1.PropertyTag.ratingLevelEnd;
529
- this.writeNL();
530
- this.writeProperty(levelKey, level, {
531
- format: PropertyFormat_1.PropertyFormat.plainText,
532
- single: true,
533
- ignoreEmpty: true,
534
- });
535
- if (label) {
536
- this.writeProperty('label', label, {
537
- format: PropertyFormat_1.PropertyFormat.bitmarkText,
538
- single: true,
539
- ignoreEmpty: true,
540
- });
541
- }
542
- return false;
543
- }
544
- // bitmarkAst -> bits -> bitsValue -> markConfig
545
- enter_markConfig(_node, _route) {
546
- // Handler so markConfig is not processed by the default property handler
547
- // Continue traversal
548
- return true;
549
- }
550
- // bitmarkAst -> bits -> bitsValue -> markConfig -> markConfigValue
551
- enter_markConfigValue(node, route) {
552
- const markConfig = node.value;
553
- // Ignore values that are not at the correct level as they might be handled elsewhere
554
- const parent = this.getParentNode(route);
555
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.markConfig)
556
- return true;
557
- const { mark, color, emphasis } = markConfig;
558
- if (mark) {
559
- this.writeNL();
560
- this.writeProperty('mark', mark, {
561
- format: PropertyFormat_1.PropertyFormat.plainText,
562
- single: true,
563
- ignoreEmpty: true,
564
- });
565
- if (color) {
566
- this.writeProperty('color', color, {
567
- format: PropertyFormat_1.PropertyFormat.plainText,
568
- single: true,
569
- ignoreEmpty: true,
570
- });
571
- }
572
- if (emphasis) {
573
- this.writeProperty('emphasis', emphasis, {
574
- format: PropertyFormat_1.PropertyFormat.plainText,
575
- single: true,
576
- ignoreEmpty: true,
577
- });
578
- }
579
- }
580
- // Stop traversal of this branch
581
- return false;
582
- }
583
- // bitmarkAst -> bits -> bitsValue -> partialAnswer
584
- enter_partialAnswer(node, _route) {
585
- if (node.value) {
586
- this.writeNL();
587
- this.writeProperty('partialAnswer', node.value, {
588
- format: PropertyFormat_1.PropertyFormat.plainText,
589
- single: true,
590
- ignoreEmpty: true,
591
- });
592
- }
593
- // Stop traversal of this branch
594
- return false;
595
- }
596
- // bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> partialAnswer
597
- leaf_partialAnswer(node, _route) {
598
- if (node.value) {
599
- this.writeNL();
600
- this.writeProperty('partialAnswer', node.value, {
601
- format: PropertyFormat_1.PropertyFormat.plainText,
602
- single: true,
603
- ignoreEmpty: true,
604
- });
605
- }
606
- // Stop traversal of this branch
607
- return false;
608
- }
609
- // bitmarkAst -> bits -> bitsValue -> sampleSolution
610
- // bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> sampleSolution
611
- enter_sampleSolution(node, _route) {
612
- if (node.value) {
613
- this.writeNL();
614
- this.writeProperty('sampleSolution', node.value, {
615
- format: PropertyFormat_1.PropertyFormat.plainText,
616
- single: true,
617
- ignoreEmpty: true,
618
- });
619
- }
620
- // Stop traversal of this branch
621
- return false;
622
- }
623
- leaf_sampleSolution(node, _route) {
624
- if (node.value) {
625
- this.writeNL();
626
- this.writeProperty('sampleSolution', node.value, {
627
- format: PropertyFormat_1.PropertyFormat.plainText,
628
- single: true,
629
- ignoreEmpty: true,
630
- });
631
- }
632
- // Stop traversal of this branch
633
- return false;
634
- }
635
- // bitmarkAst -> bits -> bitsValue -> reasonableNumOfChars
636
- // bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> reasonableNumOfChars
637
- leaf_reasonableNumOfChars(node, _route) {
638
- this.writeNL();
639
- this.writeProperty('reasonableNumOfChars', node.value, {
640
- format: PropertyFormat_1.PropertyFormat.plainText,
641
- single: true,
642
- ignoreEmpty: true,
643
- });
644
- }
645
- // bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> additionalSolutions -> additionalSolutionsValue
646
- leaf_additionalSolutionsValue(node, route) {
647
- // Ignore values that are not at the bit level as they might be handled elsewhere
648
- const parent = this.getParentNode(route, 2);
649
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.questionsValue)
650
- return;
651
- this.writeNL();
652
- this.writeProperty('additionalSolutions', node.value, {
653
- format: PropertyFormat_1.PropertyFormat.plainText,
654
- single: false,
655
- });
656
- }
657
- // bitmarkAst -> bits -> bitsValue -> item
658
- enter_item(node, route) {
659
- var _a, _b, _c;
660
- const item = node.value;
661
- const parent = this.getParentNode(route);
662
- if (this.isEmptyText(item))
663
- return false; // Ignore empty
664
- if (!this.isEmptyText((_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.lead))
665
- return true; // Will be handled by lead
666
- if (!this.isEmptyText((_b = parent === null || parent === void 0 ? void 0 : parent.value) === null || _b === void 0 ? void 0 : _b.pageNumber))
667
- return true; // Will be handled by pageNumber
668
- if (!this.isEmptyText((_c = parent === null || parent === void 0 ? void 0 : parent.value) === null || _c === void 0 ? void 0 : _c.marginNumber))
669
- return true; // Will be handled by marginNumber
670
- this.writeNL_IfNotChain(route);
671
- this.writeOPC();
672
- this.writeTextOrValue(item, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
673
- this.writeCL();
674
- return true;
675
- }
676
- // bitmarkAst -> bits -> bitsValue -> lead
677
- enter_lead(node, route) {
678
- var _a, _b, _c, _d;
679
- const lead = node.value;
680
- const parent = this.getParentNode(route);
681
- if (this.isEmptyText(lead))
682
- return false; // Ignore empty
683
- if (!this.isEmptyText((_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.pageNumber))
684
- return true; // Will be handled by pageNumber
685
- if (!this.isEmptyText((_b = parent === null || parent === void 0 ? void 0 : parent.value) === null || _b === void 0 ? void 0 : _b.marginNumber))
686
- return true; // Will be handled by marginNumber
687
- this.writeNL_IfNotChain(route);
688
- this.writeOPC();
689
- this.writeTextOrValue((_d = (_c = parent === null || parent === void 0 ? void 0 : parent.value) === null || _c === void 0 ? void 0 : _c.item) !== null && _d !== void 0 ? _d : '', TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
690
- this.writeCL();
691
- this.writeOPC();
692
- this.writeTextOrValue(lead, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
693
- this.writeCL();
694
- return true;
695
- }
696
- // bitmarkAst -> bits -> bitsValue -> pageNumber
697
- enter_pageNumber(node, route) {
698
- var _a, _b, _c, _d, _e;
699
- const pageNumber = node.value;
700
- const parent = this.getParentNode(route);
701
- if (this.isEmptyText(pageNumber))
702
- return false; // Ignore empty
703
- if (!this.isEmptyText((_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.marginNumber))
704
- return true; // Will be handled by marginNumber
705
- this.writeNL_IfNotChain(route);
706
- this.writeOPC();
707
- this.writeTextOrValue((_c = (_b = parent === null || parent === void 0 ? void 0 : parent.value) === null || _b === void 0 ? void 0 : _b.item) !== null && _c !== void 0 ? _c : '', TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
708
- this.writeCL();
709
- this.writeOPC();
710
- this.writeTextOrValue((_e = (_d = parent === null || parent === void 0 ? void 0 : parent.value) === null || _d === void 0 ? void 0 : _d.lead) !== null && _e !== void 0 ? _e : '', TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
711
- this.writeCL();
712
- this.writeOPC();
713
- this.writeTextOrValue(pageNumber !== null && pageNumber !== void 0 ? pageNumber : '', TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
714
- this.writeCL();
715
- return true;
716
- }
717
- // bitmarkAst -> bits -> bitsValue -> marginNumber
718
- enter_marginNumber(node, route) {
719
- var _a, _b, _c, _d, _e, _f;
720
- const marginNumber = node.value;
721
- const parent = this.getParentNode(route);
722
- if (this.isEmptyText(marginNumber))
723
- return false; // Ignore empty
724
- this.writeNL_IfNotChain(route);
725
- this.writeOPC();
726
- this.writeTextOrValue((_b = (_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b : '', TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
727
- this.writeCL();
728
- this.writeOPC();
729
- this.writeTextOrValue((_d = (_c = parent === null || parent === void 0 ? void 0 : parent.value) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d : '', TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
730
- this.writeCL();
731
- this.writeOPC();
732
- this.writeTextOrValue((_f = (_e = parent === null || parent === void 0 ? void 0 : parent.value) === null || _e === void 0 ? void 0 : _e.pageNumber) !== null && _f !== void 0 ? _f : '', TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
733
- this.writeCL();
734
- this.writeOPC();
735
- this.writeTextOrValue(marginNumber, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
736
- this.writeCL();
737
- return true;
738
- }
739
- // bitmarkAst -> bits -> bitsValue -> body
740
- enter_body(node, route) {
741
- var _a;
742
- // Ignore values that are not at the bit level as they might be handled elsewhere
743
- const parent = this.getParentNode(route);
744
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.cardBitsValue)
745
- return true;
746
- this.inTag = false;
747
- // Always write a NL before the body content if there is any (see Handle body)
748
- const body = node.value;
749
- // Handle body
750
- if (this.textFormat === TextFormat_1.TextFormat.json) {
751
- const json = (_a = body.body) !== null && _a !== void 0 ? _a : null;
752
- if (Array.isArray(json) || ObjectUtils_1.ObjectUtils.isObject(json)) {
753
- const text = JSON.stringify(json, null, this.prettifySpace);
754
- if (text) {
755
- this.writePlainTextDivider();
756
- this.writeNL();
757
- this.writeTextOrValue(text, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.body);
758
- }
759
- }
760
- }
761
- else if (this.isBodyBitmarkText) {
762
- // handle bitmark text
763
- const plainTextDividerAllowed = !(this.hasCardSet || this.hasFooter);
764
- this.writeNL();
765
- // The text generator will write to the writer
766
- const b = (Array.isArray(body.body) ? body.body : []);
767
- this.writeTextOrValue(b, this.textFormat, TextLocation_1.TextLocation.body, {
768
- plainTextDividerAllowed,
769
- });
770
- }
771
- else {
772
- // handle plain text
773
- this.writePlainTextDivider();
774
- this.writeNL();
775
- const s = (StringUtils_1.StringUtils.isString(body.body) ? body.body : '');
776
- this.writeTextOrValue(`${s}`, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.body);
777
- }
778
- // Stop traversal of this branch
779
- return false;
780
- }
781
- exit_body(_node, _route) {
782
- this.inTag = true;
783
- }
784
- bodyBitCallback(bodyBit, _index, _route) {
785
- // console.log('bodyBitCallback', bodyBit, index, route);
786
- var _a;
787
- // Walk the body bit AST
788
- const nodeType = (_a = NodeType_1.NodeType.fromValue(bodyBit.type)) !== null && _a !== void 0 ? _a : NodeType_1.NodeType.bodyBit;
789
- this.ast.walk(bodyBit, nodeType, this, undefined);
790
- return ''; // Return empty string as we are writing to the writer
791
- }
792
- // bodyBit -> gap
793
- enter_gap(node, _route) {
794
- const gap = node.value;
795
- if (gap.solutions && gap.solutions.length === 0) {
796
- // If there are no solutions, we need to write the special cloze gap [_] to indicate this
797
- this.writeOPU();
798
- this.writeCL();
799
- }
800
- else {
801
- for (const solution of gap.solutions) {
802
- this.writeOPU();
803
- this.writeTextOrValue(solution, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
804
- this.writeCL();
805
- }
806
- }
807
- // Continue traversal
808
- return true;
809
- }
810
- // bodyBit -> mark
811
- enter_mark(node, _route) {
812
- const mark = node.value;
813
- this.writeOPE();
814
- this.writeTextOrValue(mark.solution, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
815
- this.writeCL();
816
- // Continue traversal
817
- return true;
818
- }
819
- // bodyBit -> select
820
- enter_select(_node, _route) {
821
- // Continue traversal
822
- return true;
823
- }
824
- // bodyBit -> highlight
825
- enter_highlight(_node, _route) {
826
- // Continue traversal
827
- return true;
828
- }
829
- // bitmarkAst -> bits -> footer
830
- enter_footer(node, route) {
831
- const parent = this.getParentNode(route);
832
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
833
- return true;
834
- const footer = node.value;
835
- // Handle footer
836
- if (this.textFormat === TextFormat_1.TextFormat.json) {
837
- // Json footer?!
838
- // Not valid, ignore
839
- }
840
- else if (footer.footer && footer.footer.length > 0) {
841
- if (this.isBodyBitmarkText) {
842
- // handle bitmark text
843
- this.writeNL();
844
- this.writeTextOrValue('==== footer ====', TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.body);
845
- this.writeNL();
846
- // The text generator will write to the writer
847
- this.writeTextOrValue(footer.footer, this.textFormat, TextLocation_1.TextLocation.body, {
848
- plainTextDividerAllowed: true, // Always allowed for the footer.
849
- });
850
- }
851
- else {
852
- // Plain text footer?!
853
- // Not valid, ignore (plain text cannot have a card set / footer marker, so cannot have a footer!
854
- }
855
- }
856
- // Stop traversal of this branch
857
- return false;
858
- }
859
- // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> solutions
860
- enter_solutions(node, route) {
861
- const parent = this.getParentNode(route);
862
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
863
- return true;
864
- const solutions = node.value;
865
- if (solutions && solutions.length === 0) {
866
- // If there are no solutions, we need to write the special cloze gap [_] to indicate this
867
- this.writeOPU();
868
- this.writeCL();
869
- }
870
- // Continue traversal
871
- return true;
872
- }
873
- // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> solution
874
- leaf_solution(node, route) {
875
- var _a;
876
- const parent = this.getParentNode(route);
877
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
878
- return;
879
- const solution = node.value;
880
- // Ignore values that are not at the correct level as they might be handled elsewhere
881
- const bodyPartsValue = (_a = this.getParentNode(route, 2)) === null || _a === void 0 ? void 0 : _a.value;
882
- if ((bodyPartsValue === null || bodyPartsValue === void 0 ? void 0 : bodyPartsValue.type) !== BodyBitType_1.BodyBitType.mark)
883
- return;
884
- if (solution) {
885
- this.writeOPE();
886
- this.writeTextOrValue(solution, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
887
- this.writeCL();
888
- }
889
- }
890
- // bitmarkAst -> bits -> bitsValue -> body -> bodyBit -> mark -> mark
891
- leaf_mark(node, route) {
892
- const root = route[0];
893
- if ((root === null || root === void 0 ? void 0 : root.key) !== NodeType_1.NodeType.mark)
894
- return;
895
- const mark = node.value;
896
- if (mark) {
897
- this.writeProperty('mark', mark, {
898
- format: PropertyFormat_1.PropertyFormat.plainText,
899
- single: true,
900
- ignoreEmpty: true,
901
- });
902
- }
903
- }
904
- // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> options -> optionsValue
905
- enter_optionsValue(node, _route) {
906
- const selectOption = node.value;
907
- if (selectOption.isCorrect) {
908
- this.writeOPP();
909
- }
910
- else {
911
- this.writeOPM();
912
- }
913
- this.writeTextOrValue(selectOption.text, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
914
- this.writeCL();
915
- // Continue traversal
916
- return true;
917
- }
918
- // bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> texts -> textsValue
919
- enter_textsValue(node, _route) {
920
- const highlightText = node.value;
921
- if (highlightText.isCorrect) {
922
- this.writeOPP();
923
- }
924
- else {
925
- this.writeOPM();
926
- }
927
- this.writeTextOrValue(highlightText.text, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
928
- this.writeCL();
929
- // Continue traversal
930
- return true;
931
- }
932
- // bitmarkAst -> bits -> bitsValue -> cardNode
933
- enter_cardNode(_node, _route) {
934
- // Ignore cards if not allowed
935
- if (!this.isCardAllowed)
936
- return true;
937
- this.writeCardSetStart();
938
- // Continue traversal
939
- return true;
940
- }
941
- between_cardNode(_node, _left, _right, _route) {
942
- // Ignore cards if not allowed
943
- if (!this.isCardAllowed)
944
- return;
945
- this.writeCardSetCardDivider();
946
- }
947
- exit_cardNode(_node, _route) {
948
- // Ignore cards if not allowed
949
- if (!this.isCardAllowed)
950
- return;
951
- this.writeCardSetEnd();
952
- if (this.options.cardSetVersion === CardSetVersion_1.CardSetVersion.v1) {
953
- // this.writeNL();
954
- }
955
- }
956
- // bitmarkAst -> bits -> bitsValue -> cardNode -> elements
957
- enter_elements(_node, _route) {
958
- //
959
- }
960
- between_elements(_node, _left, _right, _route) {
961
- this.writeCardSetVariantDivider();
962
- }
963
- // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards
964
- between_flashcards(_node, _left, _right, _route) {
965
- this.writeCardSetCardDivider();
966
- }
967
- // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue
968
- between_flashcardsValue(_node, _left, right, _route) {
969
- var _a;
970
- // Ignore cards if not allowed
971
- if (!this.isCardAllowed)
972
- return;
973
- if (right.key === NodeType_1.NodeType.answer) {
974
- this.writeCardSetSideDivider();
975
- }
976
- else if (right.key === NodeType_1.NodeType.alternativeAnswers && ((_a = right.value) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
977
- this.writeCardSetVariantDivider();
978
- }
979
- }
980
- // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers
981
- between_alternativeAnswers(_node, _route) {
982
- this.writeCardSetVariantDivider();
983
- }
984
- // bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> alternativeDefintions
985
- between_alternativeDefinitions(_node, _route) {
986
- this.writeCardSetVariantDivider();
987
- }
988
- // bitmarkAst -> bits -> bitsValue -> cardNode -> statements
989
- enter_statements(_node, _route) {
990
- //
991
- }
992
- between_statements(_node, _left, _right, _route) {
993
- const isTrueFalse1 = this.isOfBitType(BitType_1.BitType.trueFalse1);
994
- if (!isTrueFalse1) {
995
- this.writeCardSetCardDivider();
996
- }
997
- }
998
- // bitmarkAst -> bits -> bitsValue -> cardNode -> statements -> statementsValue
999
- enter_statementsValue(node, _route) {
1000
- const statement = node.value;
1001
- this.writeNL();
1002
- if (statement.isCorrect) {
1003
- this.writeOPP();
1004
- }
1005
- else {
1006
- this.writeOPM();
1007
- }
1008
- this.writeTextOrValue(statement.statement, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1009
- this.writeCL();
1010
- // Continue traversal
1011
- return true;
1012
- }
1013
- // bitmarkAst -> bits -> bitsValue -> choices -> choicesValue
1014
- // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> choices -> choicesValue
1015
- // bitmarkAst -> bits -> bitsValue -> cardNode -> feedbacks -> feedbacksValue -> choices -> choicesValue
1016
- enter_choicesValue(node, _route) {
1017
- const choice = node.value;
1018
- this.writeNL();
1019
- if (choice.isCorrect || choice.requireReason) {
1020
- this.writeOPP();
1021
- }
1022
- else {
1023
- this.writeOPM();
1024
- }
1025
- this.writeTextOrValue(choice.choice, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1026
- this.writeCL();
1027
- // Continue traversal
1028
- return true;
1029
- }
1030
- // bitmarkAst -> bits -> bitsValue -> responses -> responsesValue
1031
- // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> responses -> responsesValue
1032
- enter_responsesValue(node, _route) {
1033
- const response = node.value;
1034
- this.writeNL();
1035
- if (response.isCorrect) {
1036
- this.writeOPP();
1037
- }
1038
- else {
1039
- this.writeOPM();
1040
- }
1041
- this.writeTextOrValue(response.response, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1042
- this.writeCL();
1043
- // Continue traversal
1044
- return true;
1045
- }
1046
- // bitmarkAst -> bits -> bitsValue -> cardNode -> feedbacks
1047
- between_feedbacks(_node, _left, _right, _route) {
1048
- this.writeCardSetCardDivider();
1049
- }
1050
- // bitmarkAst -> bits -> bitsValue -> cardNode -> feedbacks -> feedbacksValue -> reason
1051
- enter_reason(_node, _route) {
1052
- this.writeCardSetSideDivider();
1053
- // Continue traversal
1054
- return true;
1055
- }
1056
- // bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes
1057
- enter_quizzes(_node, _route) {
1058
- //
1059
- }
1060
- between_quizzes(_node, _left, _right, _route) {
1061
- this.writeCardSetCardDivider();
1062
- }
1063
- // bitmarkAst -> bits -> bitsValue -> cardNode -> heading
1064
- enter_heading(_node, _route) {
1065
- //
1066
- }
1067
- between_heading(_node, _left, _right, _route) {
1068
- // Ignore cards if not allowed
1069
- if (!this.isCardAllowed)
1070
- return;
1071
- this.writeCardSetSideDivider();
1072
- }
1073
- // bitmarkAst -> bits -> bitsValue -> cardNode -> heading -> forValues
1074
- enter_forValues(_node, _route) {
1075
- //
1076
- }
1077
- between_forValues(_node, _left, _right, _route) {
1078
- // Ignore cards if not allowed
1079
- if (!this.isCardAllowed)
1080
- return;
1081
- this.writeCardSetSideDivider();
1082
- }
1083
- // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs
1084
- enter_pairs(_node, _route) {
1085
- //
1086
- }
1087
- between_pairs(_node, _left, _right, _route) {
1088
- this.writeCardSetCardDivider();
1089
- }
1090
- // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> keyAudio
1091
- enter_keyAudio(node, _route) {
1092
- const resource = node.value;
1093
- // This is a resource, so handle it with the common code
1094
- this.writeNL();
1095
- this.writeResource(ResourceTag_1.ResourceTag.audio, resource.audio.src);
1096
- // Stop traversal of this branch
1097
- return false;
1098
- }
1099
- // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> keyImage
1100
- enter_keyImage(node, _route) {
1101
- const resource = node.value;
1102
- // This is a resource, so handle it with the common code
1103
- this.writeNL();
1104
- this.writeResource(ResourceTag_1.ResourceTag.image, resource.image.src);
1105
- // Stop traversal of this branch
1106
- return false;
1107
- }
1108
- // bitmarkAst -> bits -> bitsValue -> cardNode -> matrix
1109
- enter_matrix(_node, _route) {
1110
- //
1111
- }
1112
- between_matrix(_node, _left, _right, _route) {
1113
- this.writeCardSetCardDivider();
1114
- }
1115
- // bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> values
1116
- // bitmarkAst -> bits -> bitsValue -> cardNode -> matrix -> matrixValue -> cells -> cellsValue -> values
1117
- enter_values(_node, _route) {
1118
- // Ignore cards if not allowed
1119
- if (!this.isCardAllowed)
1120
- return;
1121
- this.writeCardSetSideDivider();
1122
- }
1123
- between_values(_node, _left, _right, _route) {
1124
- // Ignore cards if not allowed
1125
- if (!this.isCardAllowed)
1126
- return;
1127
- this.writeCardSetVariantDivider();
1128
- }
1129
- // bitmarkAst -> bits -> bitsValue -> cardNode -> pronunciationTable
1130
- between_pronunciationTable(_node, _left, _right, route) {
1131
- const parent = this.getParentNode(route);
1132
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.cardNode)
1133
- return;
1134
- // Ignore cards if not allowed
1135
- if (!this.isCardAllowed)
1136
- return;
1137
- this.writeCardSetCardDivider();
1138
- }
1139
- // bitmarkAst -> bits -> bitsValue -> cardNode -> table
1140
- between_table(_node, _left, _right, route) {
1141
- const parent = this.getParentNode(route);
1142
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.cardNode)
1143
- return;
1144
- // Ignore cards if not allowed
1145
- if (!this.isCardAllowed)
1146
- return;
1147
- this.writeCardSetCardDivider();
1148
- }
1149
- // bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data
1150
- // bitmarkAst -> bits -> bitsValue -> cardNode -> pronunciationTable -> data
1151
- between_data(_node, _left, _right, route) {
1152
- const parent = this.getParentNode(route);
1153
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.table && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.pronunciationTable)
1154
- return;
1155
- this.writeCardSetCardDivider();
1156
- }
1157
- // bitmarkAst -> bits -> bitsValue -> cardNode -> table -> columns
1158
- // bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> columns
1159
- between_columns(_node, _left, _right, route) {
1160
- const parent = this.getParentNode(route);
1161
- const parentKey = parent === null || parent === void 0 ? void 0 : parent.key;
1162
- if (parentKey !== NodeType_1.NodeType.table && parentKey !== NodeType_1.NodeType.captionDefinitionList)
1163
- return;
1164
- // Ignore cards if not allowed
1165
- if (!this.isCardAllowed)
1166
- return;
1167
- this.writeCardSetSideDivider();
1168
- }
1169
- // bitmarkAst -> bits -> bitsValue -> cardNode -> table -> columns -> columnsValue
1170
- // bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> columns -> columnsValue
1171
- leaf_columnsValue(node, _route) {
1172
- this.writeNL();
1173
- this.writeOPHASH();
1174
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1175
- this.writeCL();
1176
- }
1177
- enter_columnsValue(node, _route) {
1178
- this.writeNL();
1179
- this.writeOPHASH();
1180
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
1181
- this.writeCL();
1182
- }
1183
- // bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data -> dataValue
1184
- // bitmarkAst -> bits -> bitsValue -> cardNode -> pronunciationTable -> data -> dataValue
1185
- between_dataValue(_node, _left, _right, route) {
1186
- const parent = this.getParentNode(route, 2);
1187
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.table && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.pronunciationTable)
1188
- return;
1189
- // Ignore cards if not allowed
1190
- if (!this.isCardAllowed)
1191
- return;
1192
- this.writeCardSetSideDivider();
1193
- }
1194
- // bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data -> dataValue -> dataValueValue
1195
- leaf_dataValueValue(node, route) {
1196
- const parent = this.getParentNode(route, 3);
1197
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.table)
1198
- return;
1199
- this.writeNL();
1200
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
1201
- }
1202
- // bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data -> dataValue -> dataValueValue
1203
- // bitmarkAst -> bits -> bitsValue -> cardNode -> pronunciationTable -> data -> dataValue -> dataValueValue
1204
- enter_dataValueValue(node, route) {
1205
- const parent = this.getParentNode(route, 3);
1206
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.table && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.pronunciationTable)
1207
- return;
1208
- if (node.value) {
1209
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.pronunciationTable) {
1210
- // Pronunciation Table
1211
- const cell = node.value;
1212
- if (cell.title) {
1213
- this.writeNL();
1214
- this.writeOP();
1215
- this.writeHash();
1216
- this.writeTextOrValue(cell.title, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
1217
- this.writeCL();
1218
- }
1219
- if (cell.audio) {
1220
- this.writeNL();
1221
- this.writeResource(ResourceTag_1.ResourceTag.audio, cell.audio.audio.src);
1222
- }
1223
- if (cell.body) {
1224
- this.writeNL();
1225
- this.writeTextOrValue(cell.body, this.textFormat, TextLocation_1.TextLocation.body);
1226
- }
1227
- // Stop traversal of this branch
1228
- return false;
1229
- }
1230
- else {
1231
- // Table
1232
- this.writeNL();
1233
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
1234
- }
1235
- }
1236
- }
1237
- // bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList
1238
- between_captionDefinitionList(_node, _left, _right, route) {
1239
- const parent = this.getParentNode(route);
1240
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.cardNode)
1241
- return;
1242
- this.writeCardSetCardDivider();
1243
- }
1244
- // bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue -> term
1245
- leaf_term(node, route) {
1246
- const parent = this.getParentNode(route);
1247
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.definitionsValue)
1248
- return true;
1249
- if (node.value) {
1250
- this.writeNL();
1251
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
1252
- }
1253
- // Stop traversal of this branch
1254
- return false;
1255
- }
1256
- // bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue -> definition
1257
- leaf_definition(node, route) {
1258
- const parent = this.getParentNode(route);
1259
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.definitionsValue)
1260
- return true;
1261
- if (node.value) {
1262
- this.writeNL();
1263
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
1264
- }
1265
- // Stop traversal of this branch
1266
- return false;
1267
- }
1268
- // bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions
1269
- // bitmarkAst -> bits -> bitsValue -> cardNode -> definitions
1270
- between_definitions(_node, _left, _right, route) {
1271
- const parent = this.getParentNode(route);
1272
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.cardNode && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.captionDefinitionList)
1273
- return;
1274
- this.writeCardSetCardDivider();
1275
- }
1276
- // bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue
1277
- between_definitionsValue(_node, _left, right, route) {
1278
- var _a;
1279
- const parent = this.getParentNode(route);
1280
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.definitions)
1281
- return;
1282
- // Ignore cards if not allowed
1283
- if (!this.isCardAllowed)
1284
- return;
1285
- if (right.key === NodeType_1.NodeType.definition) {
1286
- this.writeCardSetSideDivider();
1287
- }
1288
- else if (right.key === NodeType_1.NodeType.alternativeDefinitions && ((_a = right.value) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1289
- this.writeCardSetVariantDivider();
1290
- }
1291
- }
1292
- // bitmarkAst -> bits -> bitsValue -> cardNode -> questions
1293
- enter_questions(_node, _route) {
1294
- //
1295
- }
1296
- between_questions(_node, _left, _right, _route) {
1297
- this.writeCardSetCardDivider();
1298
- }
1299
- // bitmarkAst -> bits -> bitsValue -> cardNode -> ingredients
1300
- enter_ingredients(_node, _route) {
1301
- //
1302
- }
1303
- between_ingredients(_node, _left, _right, _route) {
1304
- this.writeCardSetCardDivider();
1305
- }
1306
- // bitmarkAst -> bits -> bitsValue -> cardNode -> ingredients -> ingredientsValue
1307
- enter_ingredientsValue(node, _route) {
1308
- const ingredient = node.value;
1309
- if (ingredient.title != null) {
1310
- this.writeNL();
1311
- this.writeOPHASH();
1312
- this.writeTextOrValue(ingredient.title, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
1313
- this.writeCL();
1314
- // this.writeNL();
1315
- }
1316
- if (ingredient.ingredient != null) {
1317
- this.writeNL();
1318
- // [+] / [-]
1319
- if (ingredient.checked) {
1320
- this.writeOPP();
1321
- }
1322
- else {
1323
- this.writeOPM();
1324
- }
1325
- this.writeCL();
1326
- // [!43]
1327
- if (ingredient.quantity != null) {
1328
- this.writeOPB();
1329
- this.writeTextOrValue(`${ingredient.quantity}`, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1330
- this.writeCL();
1331
- }
1332
- // [@unit:kilograms]
1333
- if (ingredient.unit != null)
1334
- this.writeProperty('unit', ingredient.unit, {
1335
- format: PropertyFormat_1.PropertyFormat.plainText,
1336
- single: true,
1337
- ignoreEmpty: true,
1338
- });
1339
- // [@unitAbbr:kg]
1340
- if (ingredient.unitAbbr != null)
1341
- this.writeProperty('unitAbbr', ingredient.unitAbbr, {
1342
- format: PropertyFormat_1.PropertyFormat.plainText,
1343
- single: true,
1344
- ignoreEmpty: true,
1345
- });
1346
- // [@decimalPlaces:1]
1347
- if (ingredient.decimalPlaces != null)
1348
- this.writeProperty('decimalPlaces', ingredient.decimalPlaces, {
1349
- format: PropertyFormat_1.PropertyFormat.plainText,
1350
- single: true,
1351
- ignoreEmpty: true,
1352
- });
1353
- // [@disableCalculation]
1354
- if (ingredient.disableCalculation)
1355
- this.writeProperty('disableCalculation', true, {
1356
- format: PropertyFormat_1.PropertyFormat.plainText,
1357
- single: true,
1358
- ignoreEmpty: true,
1359
- });
1360
- // item
1361
- this.writeNL();
1362
- this.writeTextOrValue(ingredient.ingredient, this.textFormat, TextLocation_1.TextLocation.body);
1363
- }
1364
- // Continue traversal of this branch (item, lead, etc)
1365
- return true;
1366
- }
1367
- // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses
1368
- enter_botResponses(_node, _route) {
1369
- //
1370
- }
1371
- between_botResponses(_node, _left, _right, _route) {
1372
- this.writeCardSetCardDivider();
1373
- }
1374
- // bitmarkAst -> bits -> bitsValue -> cardNode -> cardBits
1375
- enter_cardBits(_node, _route) {
1376
- //
1377
- }
1378
- between_cardBits(_node, _left, _right, _route) {
1379
- this.writeCardSetCardDivider();
1380
- }
1381
- // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
1382
- leaf_response(node, route) {
1383
- const parent = this.getParentNode(route);
1384
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.botResponsesValue)
1385
- return;
1386
- this.writeNL();
1387
- this.writeOPB();
1388
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1389
- this.writeCL();
1390
- }
1391
- // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> reaction
1392
- leaf_reaction(node, route) {
1393
- const parent = this.getParentNode(route);
1394
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.botResponsesValue)
1395
- return;
1396
- this.writeNL();
1397
- this.writeProperty('reaction', node.value, {
1398
- format: PropertyFormat_1.PropertyFormat.plainText,
1399
- single: true,
1400
- ignoreEmpty: true,
1401
- });
1402
- }
1403
- // bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> feedback
1404
- leaf_feedback(node, route) {
1405
- const parent = this.getParentNode(route);
1406
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.botResponsesValue)
1407
- return;
1408
- const feedback = node.value;
1409
- if (feedback) {
1410
- this.writeNL();
1411
- this.writeTextOrValue(feedback, this.textFormat, TextLocation_1.TextLocation.body);
1412
- }
1413
- }
1414
- // bitmarkAst -> bits -> bitsValue -> backgroundWallpaper
1415
- enter_backgroundWallpaper(node, _route) {
1416
- const resource = node.value;
1417
- // This is a resource, so handle it with the common code
1418
- this.writeNL();
1419
- this.writePropertyStyleResource(node.key, resource);
1420
- // Continue traversal
1421
- return true;
1422
- }
1423
- // bitmarkAst -> bits -> bitsValue -> imagePlaceholder
1424
- enter_imagePlaceholder(node, _route) {
1425
- const resource = node.value;
1426
- // This is a resource, so handle it with the common code
1427
- this.writeNL();
1428
- this.writePropertyStyleResource(node.key, resource);
1429
- // Continue traversal
1430
- return true;
1431
- }
1432
- exit_imagePlaceholder(_node, _route) {
1433
- // this.writeNL();
1434
- }
1435
- // bitmarkAst -> bits -> bitsValue -> posterImage
1436
- // bitmarkAst -> bits -> bitsValue -> resource -> * -> posterImage
1437
- enter_posterImage(node, route) {
1438
- const parent = this.getParentNode(route);
1439
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.bitsValue) {
1440
- // Bit poster image
1441
- const posterImage = node.value;
1442
- if (posterImage) {
1443
- this.writeProperty('posterImage', posterImage, {
1444
- format: PropertyFormat_1.PropertyFormat.plainText,
1445
- single: true,
1446
- ignoreEmpty: true,
1447
- });
1448
- }
1449
- }
1450
- else {
1451
- // Resource poster image
1452
- const posterImage = node.value;
1453
- if (posterImage && posterImage.src) {
1454
- this.writeProperty('posterImage', posterImage.src, {
1455
- format: PropertyFormat_1.PropertyFormat.plainText,
1456
- single: true,
1457
- ignoreEmpty: true,
1458
- });
1459
- }
1460
- }
1461
- // Continue traversal
1462
- return true;
1463
- }
1464
- // bitmarkAst -> bits -> bitsValue -> resource -> thumbnails
1465
- // [src1x,src2x,src3x,src4x,width,height,alt,zoomDisabled,caption]
1466
- enter_thumbnails(node, _route) {
1467
- const thumbnails = node.value;
1468
- if (Array.isArray(thumbnails)) {
1469
- const thumbnailKeys = ['src1x', 'src2x', 'src3x', 'src4x'];
1470
- for (let i = 0; i < thumbnails.length; i++) {
1471
- // Can only handle 4 thumbnails
1472
- if (i === thumbnailKeys.length)
1473
- break;
1474
- const thumbnail = thumbnails[i];
1475
- const key = thumbnailKeys[i];
1476
- this.writeProperty(key, thumbnail.src, {
1477
- format: PropertyFormat_1.PropertyFormat.plainText,
1478
- single: true,
1479
- ignoreEmpty: true,
1480
- });
1481
- }
1482
- }
1483
- // Stop traversal of this branch
1484
- return false;
1485
- }
1486
- // bitmarkAst -> bits -> bitsValue -> bitType
1487
- // bitmarkAst -> bits -> bitsValue -> textFormat
1488
- // bitmarkAst -> bits -> level
1489
- leaf_level(node, route) {
1490
- // Ensure this is at the bit level
1491
- const parent = this.getParentNode(route);
1492
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
1493
- return true;
1494
- // Ensure this is a chapter bit
1495
- if (!Config_1.Config.isOfBitType(this.bitType, [BitType_1.BitType.chapter]))
1496
- return true;
1497
- const level = node.value;
1498
- const bit = parent === null || parent === void 0 ? void 0 : parent.value;
1499
- if (level > 0 && bit.title == null) {
1500
- // If the level is set, but there is no title, this is a [.chapter] bit with an empty title.
1501
- // We need to write an empty title tag at the correct level.
1502
- this.writeNL();
1503
- this.writeOP();
1504
- for (let i = 0; i < +level; i++)
1505
- this.writeHash();
1506
- this.writeCL();
1507
- }
1508
- // Stop traversal of this branch
1509
- return false;
1510
- }
1511
- // bitmarkAst -> bits -> title
1512
- enter_title(node, route) {
1513
- // Ensure this is at the bit level
1514
- const parent = this.getParentNode(route);
1515
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
1516
- return true;
1517
- const value = node.value;
1518
- const title = value;
1519
- const bit = parent === null || parent === void 0 ? void 0 : parent.value;
1520
- const level = bit.level || 1;
1521
- if (level && title) {
1522
- this.writeNL();
1523
- this.writeOP();
1524
- for (let i = 0; i < +level; i++)
1525
- this.writeHash();
1526
- this.writeTextOrValue(title, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
1527
- this.writeCL();
1528
- }
1529
- // Stop traversal of this branch
1530
- return false;
1531
- }
1532
- // bitmarkAst -> bits -> subtitle
1533
- enter_subtitle(node, route) {
1534
- // Ensure this is at the bit level
1535
- const parent = this.getParentNode(route);
1536
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
1537
- return true;
1538
- const value = node.value;
1539
- const subtitle = value;
1540
- const level = 2;
1541
- if (level && subtitle) {
1542
- this.writeNL();
1543
- this.writeOP();
1544
- for (let i = 0; i < level; i++)
1545
- this.writeHash();
1546
- this.writeTextOrValue(subtitle, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
1547
- this.writeCL();
1548
- }
1549
- // Stop traversal of this branch
1550
- return false;
1551
- }
1552
- // bitmarkAst -> bits -> bitsValue -> book (array)
1553
- // bitmarkAst -> bits -> bitsValue -> book (array) -> bookValue
1554
- enter_book(_node, _route) {
1555
- // Block standard property handling
1556
- }
1557
- enter_bookValue(node, _route) {
1558
- const book = node.value;
1559
- // const parent = this.getParentNode(route);
1560
- // const bit = parent?.value as Bit;
1561
- if (book) {
1562
- this.writeNL();
1563
- this.writeProperty('book', book.book, {
1564
- format: PropertyFormat_1.PropertyFormat.plainText,
1565
- single: true,
1566
- ignoreEmpty: false,
1567
- });
1568
- if (book.reference) {
1569
- this.writeOPRANGLE();
1570
- this.writeTextOrValue(book.reference, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1571
- this.writeCL();
1572
- if (book.referenceEnd) {
1573
- this.writeOPRANGLE();
1574
- this.writeTextOrValue(book.referenceEnd, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1575
- this.writeCL();
1576
- }
1577
- }
1578
- }
1579
- // Stop traversal of this branch
1580
- return false;
1581
- }
1582
- // bitmarkAst -> bits -> bitsValue -> book (single)
1583
- leaf_book(node, route) {
1584
- const parent = this.getParentNode(route);
1585
- const bit = parent === null || parent === void 0 ? void 0 : parent.value;
1586
- if (bit && node.value) {
1587
- this.writeNL();
1588
- this.writeProperty('book', node.value, {
1589
- format: PropertyFormat_1.PropertyFormat.plainText,
1590
- single: true,
1591
- ignoreEmpty: false,
1592
- });
1593
- if (bit.reference) {
1594
- this.writeOPRANGLE();
1595
- this.writeTextOrValue(bit.reference, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1596
- this.writeCL();
1597
- if (bit.referenceEnd) {
1598
- this.writeOPRANGLE();
1599
- this.writeTextOrValue(bit.referenceEnd, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1600
- this.writeCL();
1601
- }
1602
- }
1603
- }
1604
- }
1605
- // bitmarkAst -> bits -> bitsValue -> anchor
1606
- leaf_anchor(node, _route) {
1607
- if (node.value) {
1608
- this.writeNL();
1609
- this.writeOPDANGLE();
1610
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1611
- this.writeCL();
1612
- }
1613
- }
1614
- // bitmarkAst -> bits -> bitsValue -> reference
1615
- leaf_reference(node, route) {
1616
- const parent = this.getParentNode(route);
1617
- const bit = parent === null || parent === void 0 ? void 0 : parent.value;
1618
- if (bit && node.value) {
1619
- // Only write reference if it is not chained to 'book'
1620
- if (!bit.book) {
1621
- this.writeNL();
1622
- this.writeOPRANGLE();
1623
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1624
- this.writeCL();
1625
- }
1626
- }
1627
- }
1628
- // * -> itemLead --> item
1629
- // * -> itemLead --> lead
1630
- // * -> hint
1631
- enter_hint(node, route) {
1632
- const value = node.value;
1633
- const text = value;
1634
- if (!this.isEmptyText(text)) {
1635
- this.writeNL_IfNotChain(route);
1636
- this.writeOPQ();
1637
- this.writeTextOrValue(text, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
1638
- this.writeCL();
1639
- }
1640
- // Stop traversal of this branch
1641
- return false;
1642
- }
1643
- // bitmarkAst -> bits -> bitsValue -> * -> instruction
1644
- enter_instruction(node, route) {
1645
- const value = node.value;
1646
- const text = value;
1647
- if (!this.isEmptyText(text)) {
1648
- this.writeNL_IfNotChain(route);
1649
- this.writeOPB();
1650
- this.writeTextOrValue(text, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
1651
- this.writeCL();
1652
- }
1653
- // Stop traversal of this branch
1654
- return false;
1655
- }
1656
- // bitmarkAst -> bits -> bitsValue -> * -> lang
1657
- enter_lang(node, _route) {
1658
- if (!node.value)
1659
- return;
1660
- this.writeNL();
1661
- this.writeProperty('lang', node.value, {
1662
- format: PropertyFormat_1.PropertyFormat.boolean,
1663
- single: true,
1664
- ignoreEmpty: true,
1665
- });
1666
- }
1667
- // bitmarkAst -> bits -> bitsValue -> * -> refAuthor
1668
- enter_refAuthor(node, _route) {
1669
- if (!node.value)
1670
- return;
1671
- this.writeNL();
1672
- this.writeProperty('refAuthor', node.value, {
1673
- format: PropertyFormat_1.PropertyFormat.plainText,
1674
- single: false,
1675
- ignoreEmpty: true,
1676
- });
1677
- }
1678
- // bitmarkAst -> bits -> bitsValue -> * -> refBookTitle
1679
- enter_refBookTitle(node, _route) {
1680
- if (!node.value)
1681
- return;
1682
- this.writeNL();
1683
- this.writeProperty('refBookTitle', node.value, {
1684
- format: PropertyFormat_1.PropertyFormat.plainText,
1685
- single: true,
1686
- ignoreEmpty: true,
1687
- });
1688
- }
1689
- // bitmarkAst -> bits -> bitsValue -> * -> refPublisher
1690
- enter_refPublisher(node, _route) {
1691
- if (!node.value)
1692
- return;
1693
- this.writeNL();
1694
- this.writeProperty('refPublisher', node.value, {
1695
- format: PropertyFormat_1.PropertyFormat.plainText,
1696
- single: false,
1697
- ignoreEmpty: true,
1698
- });
1699
- }
1700
- // bitmarkAst -> bits -> bitsValue -> * -> refPublicationYear
1701
- enter_refPublicationYear(node, _route) {
1702
- if (!node.value)
1703
- return;
1704
- this.writeNL();
1705
- this.writeProperty('refPublicationYear', node.value, {
1706
- format: PropertyFormat_1.PropertyFormat.plainText,
1707
- single: true,
1708
- ignoreEmpty: true,
1709
- });
1710
- }
1711
- // bitmarkAst -> bits -> bitsValue -> * -> citationStyle
1712
- enter_citationStyle(node, _route) {
1713
- if (!node.value)
1714
- return;
1715
- this.writeNL();
1716
- this.writeProperty('citationStyle', node.value, {
1717
- format: PropertyFormat_1.PropertyFormat.plainText,
1718
- single: true,
1719
- ignoreEmpty: true,
1720
- });
1721
- }
1722
- // bitmarkAst -> bits -> bitsValue -> * -> isExample / example
1723
- leaf_isExample(node, route) {
1724
- var _a;
1725
- const isExample = node.value;
1726
- if (!isExample)
1727
- return;
1728
- const parent = this.getParentNode(route);
1729
- const example = (_a = parent === null || parent === void 0 ? void 0 : parent.value.example) !== null && _a !== void 0 ? _a : null;
1730
- // const __isDefaultExample = parent?.value.__isDefaultExample ?? false;
1731
- if (example != null && example !== '') {
1732
- // Write a newline if not in a chain
1733
- this.writeNL_IfNotChain(route);
1734
- this.writeOPA();
1735
- this.writeString('example');
1736
- this.writeColon();
1737
- if (example === true) {
1738
- this.writeString(' true ');
1739
- }
1740
- else if (example === false) {
1741
- this.writeString(' false ');
1742
- }
1743
- else if (Array.isArray(example)) {
1744
- // TextAst
1745
- this.writeTextOrValue(example, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
1746
- }
1747
- else {
1748
- // String
1749
- this.writeTextOrValue(example, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1750
- }
1751
- this.writeCL();
1752
- }
1753
- else {
1754
- // Don't write example if it is null.
1755
- // this.writeOPA();
1756
- // this.writeString('example');
1757
- // this.writeCL();
1758
- }
1759
- }
1760
- // bitmarkAst -> bits -> bitsValue -> elements -> elementsValue
1761
- leaf_elementsValue(node, _route) {
1762
- if (node.value) {
1763
- this.writeNL();
1764
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
1765
- }
1766
- }
1767
- // bitmarkAst -> bits -> bitsValue -> body -> bodyValue -> gap -> solutions -> solution
1768
- // ? -> solutions -> solution
1769
- leaf_solutionsValue(node, route) {
1770
- const parent = this.getParentNode(route, 2);
1771
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
1772
- return;
1773
- if (node.value != null) {
1774
- this.writeOPU();
1775
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1776
- this.writeCL();
1777
- }
1778
- }
1779
- // bitmarkAst -> bits -> bitsValue-> body -> bodyValue -> select -> options -> prefix
1780
- // bitmarkAst -> bits -> bitsValue-> body -> bodyValue -> highlight -> options -> prefix
1781
- leaf_prefix(node, _route) {
1782
- if (node.value) {
1783
- this.writeOPPRE();
1784
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1785
- this.writeCL();
1786
- }
1787
- }
1788
- // bitmarkAst -> bits -> bitsValue-> body -> bodyValue -> select -> options -> postfix
1789
- // bitmarkAst -> bits -> bitsValue-> body -> bodyValue -> highlight -> options -> postfix
1790
- leaf_postfix(node, _route) {
1791
- if (node.value) {
1792
- this.writeOPPOST();
1793
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1794
- this.writeCL();
1795
- }
1796
- }
1797
- // bitmarkAst -> bits -> bitsValue -> * -> isCaseSensitive
1798
- leaf_isCaseSensitive(node, _route) {
1799
- this.writeProperty('isCaseSensitive', node.value, {
1800
- format: PropertyFormat_1.PropertyFormat.boolean,
1801
- single: true,
1802
- ignoreFalse: false,
1803
- ignoreTrue: true,
1804
- });
1805
- }
1806
- // bitmarkAst -> bits -> bitsValue -> * -> isCorrect
1807
- // bitmarkAst -> bits -> bitsValue -> heading -> forKeys
1808
- leaf_forKeys(node, _route) {
1809
- this.writeNL();
1810
- this.writeOPHASH();
1811
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1812
- this.writeCL();
1813
- }
1814
- // bitmarkAst -> bits -> bitsValue -> heading -> forValues
1815
- leaf_forValues(node, _route) {
1816
- this.writeNL();
1817
- this.writeOPHASH();
1818
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1819
- this.writeCL();
1820
- }
1821
- // bitmarkAst -> bits -> bitsValue -> heading -> forValuesValue
1822
- leaf_forValuesValue(node, _route) {
1823
- this.writeNL();
1824
- this.writeOPHASH();
1825
- this.writeTextOrValue(node.value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
1826
- this.writeCL();
1827
- }
1828
- // bitmarkAst -> bits -> bitsValue -> pairs -> pairsValue -> key
1829
- // bitmarkAst -> bits -> bitsValue -> matrix -> matrixValue -> key
1830
- leaf_key(node, _route) {
1831
- if (node.value) {
1832
- this.writeNL();
1833
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
1834
- }
1835
- }
1836
- // bitmarkAst -> bits -> bitsValue -> pairs -> pairsValue -> values -> valuesValue
1837
- // bitmarkAst -> bits -> bitsValue -> matrix -> matrixValue -> cells -> cellsValue -> values -> valuesValue
1838
- leaf_valuesValue(node, _route) {
1839
- if (node.value) {
1840
- this.writeNL();
1841
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
1842
- }
1843
- }
1844
- // bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> question
1845
- // bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> question
1846
- leaf_question(node, route) {
1847
- // Ignore responses that are not at the questionsValue level as they are handled elsewhere
1848
- const parent = this.getParentNode(route);
1849
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.questionsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.flashcardsValue)
1850
- return;
1851
- if (node.value) {
1852
- this.writeNL();
1853
- this.writeTextOrValue(node.value, this.textFormat, TextLocation_1.TextLocation.body);
1854
- }
1855
- }
1856
- // bitmarkAst -> bits -> bitsValue -> statements -> text
1857
- // bitmarkAst -> bits -> bitsValue -> resource -> ...
1858
- // bitmarkAst -> bits -> bitsValue -> resource -> posterImage -> ...
1859
- // bitmarkAst -> bits -> bitsValue -> resource -> thumbnails -> thumbnailsValue -> ...
1860
- // [src1x,src2x,src3x,src4x,width,height,alt,zoomDisabled,caption]
1861
- leaf_src1x(node, _route) {
1862
- this.writeProperty('src1x', node.value, {
1863
- format: PropertyFormat_1.PropertyFormat.plainText,
1864
- single: true,
1865
- ignoreEmpty: true,
1866
- });
1867
- }
1868
- leaf_src2x(node, _route) {
1869
- this.writeProperty('src2x', node.value, {
1870
- format: PropertyFormat_1.PropertyFormat.plainText,
1871
- single: true,
1872
- ignoreEmpty: true,
1873
- });
1874
- }
1875
- leaf_src3x(node, _route) {
1876
- this.writeProperty('src3x', node.value, {
1877
- format: PropertyFormat_1.PropertyFormat.plainText,
1878
- single: true,
1879
- ignoreEmpty: true,
1880
- });
1881
- }
1882
- leaf_src4x(node, _route) {
1883
- this.writeProperty('src4x', node.value, {
1884
- format: PropertyFormat_1.PropertyFormat.plainText,
1885
- single: true,
1886
- ignoreEmpty: true,
1887
- });
1888
- }
1889
- leaf_width(node, _route) {
1890
- this.writeProperty('width', node.value, {
1891
- format: PropertyFormat_1.PropertyFormat.plainText,
1892
- single: true,
1893
- ignoreEmpty: true,
1894
- });
1895
- }
1896
- leaf_height(node, _route) {
1897
- this.writeProperty('height', node.value, {
1898
- format: PropertyFormat_1.PropertyFormat.plainText,
1899
- single: true,
1900
- ignoreEmpty: true,
1901
- });
1902
- }
1903
- leaf_alt(node, _route) {
1904
- this.writeProperty('alt', node.value, {
1905
- format: PropertyFormat_1.PropertyFormat.plainText,
1906
- single: true,
1907
- ignoreEmpty: true,
1908
- });
1909
- }
1910
- leaf_zoomDisabled(node, _route) {
1911
- if (Config_1.Config.isOfBitType(this.bitType, [
1912
- BitType_1.BitType.imageSeparator,
1913
- BitType_1.BitType.pageBanner,
1914
- BitType_1.BitType.imagesLogoGrave,
1915
- BitType_1.BitType.prototypeImages,
1916
- ])) {
1917
- this.writeProperty('zoomDisabled', node.value, {
1918
- format: PropertyFormat_1.PropertyFormat.boolean,
1919
- single: true,
1920
- ignoreFalse: false,
1921
- ignoreTrue: true,
1922
- });
1923
- }
1924
- else {
1925
- this.writeProperty('zoomDisabled', node.value, {
1926
- format: PropertyFormat_1.PropertyFormat.boolean,
1927
- single: true,
1928
- ignoreFalse: true,
1929
- ignoreTrue: false,
1930
- });
1931
- }
1932
- }
1933
- leaf_license(node, _route) {
1934
- this.writeProperty('license', node.value, {
1935
- format: PropertyFormat_1.PropertyFormat.plainText,
1936
- single: true,
1937
- ignoreEmpty: true,
1938
- });
1939
- }
1940
- leaf_copyright(node, _route) {
1941
- this.writeProperty('copyright', node.value, {
1942
- format: PropertyFormat_1.PropertyFormat.plainText,
1943
- single: true,
1944
- ignoreEmpty: true,
1945
- });
1946
- }
1947
- leaf_provider(_node, _route) {
1948
- // provider is included in the url (it is the domain) and should not be written as a property
1949
- // this.writeProperty('provider', node.value);
1950
- }
1951
- leaf_showInIndex(node, route) {
1952
- if (node.value == null)
1953
- return;
1954
- this.writeNL_IfNotChain(route);
1955
- this.writeProperty('showInIndex', node.value, {
1956
- format: PropertyFormat_1.PropertyFormat.boolean,
1957
- single: true,
1958
- ignoreEmpty: true,
1959
- ignoreFalse: true,
1960
- });
1961
- }
1962
- enter_caption(node, route) {
1963
- const value = node.value;
1964
- this.writeNL_IfNotChain(route);
1965
- this.writeProperty('caption', value, {
1966
- format: PropertyFormat_1.PropertyFormat.bitmarkText,
1967
- single: true, // ??
1968
- ignoreEmpty: true,
1969
- });
1970
- // Stop traversal of this branch
1971
- return false;
1972
- }
1973
- leaf_search(node, route) {
1974
- const value = node.value;
1975
- if (!value)
1976
- return;
1977
- this.writeNL_IfNotChain(route);
1978
- this.writeProperty('search', value, {
1979
- format: PropertyFormat_1.PropertyFormat.plainText,
1980
- single: true,
1981
- ignoreEmpty: true,
1982
- });
1983
- }
1984
- // bitmarkAst -> bits -> bitsValue -> resource -> ...
1985
- // bitmarkAst -> bits -> bitsValue -> resource -> posterImage -> ...
1986
- // bitmarkAst -> bits -> bitsValue -> resource -> thumbnails -> thumbnailsValue -> ...
1987
- // [duration,mute,autoplay,allowSubtitles,showSubtitles]
1988
- leaf_duration(node, route) {
1989
- // Ignore duration that IS at the bit level as there is a key clash with resource...duration / bit.duration
1990
- const parent = this.getParentNode(route);
1991
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.bitsValue)
1992
- return;
1993
- this.writeProperty('duration', node.value, {
1994
- format: PropertyFormat_1.PropertyFormat.plainText,
1995
- single: true,
1996
- ignoreEmpty: true,
1997
- });
1998
- }
1999
- leaf_mute(node, _route) {
2000
- this.writeProperty('mute', node.value, {
2001
- format: PropertyFormat_1.PropertyFormat.boolean,
2002
- single: true,
2003
- ignoreEmpty: true,
2004
- });
2005
- }
2006
- leaf_autoplay(node, _route) {
2007
- this.writeProperty('autoplay', node.value, {
2008
- format: PropertyFormat_1.PropertyFormat.boolean,
2009
- single: true,
2010
- ignoreEmpty: true,
2011
- });
2012
- }
2013
- leaf_allowSubtitles(node, _route) {
2014
- this.writeProperty('allowSubtitles', node.value, {
2015
- format: PropertyFormat_1.PropertyFormat.boolean,
2016
- single: true,
2017
- ignoreEmpty: true,
2018
- });
2019
- }
2020
- leaf_showSubtitles(node, _route) {
2021
- this.writeProperty('showSubtitles', node.value, {
2022
- format: PropertyFormat_1.PropertyFormat.boolean,
2023
- single: true,
2024
- ignoreEmpty: true,
2025
- });
2026
- }
2027
- //
2028
- // Resources
2029
- //
2030
- //
2031
- // Generated Node Handlers
2032
- //
2033
- /**
2034
- * Generate the handlers for resources, as they are mostly the same, but not quite
2035
- */
2036
- generateResourceHandlers() {
2037
- for (const tag of ResourceTag_1.ResourceTag.keys()) {
2038
- // skip unknown
2039
- if (tag === ResourceTag_1.ResourceTag.keyFromValue(ResourceTag_1.ResourceTag.unknown))
2040
- continue;
2041
- const enterFuncName = `enter_${tag}`;
2042
- // Skip if the function already exists, allows for custom handlers
2043
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2044
- if (typeof this[enterFuncName] === 'function') {
2045
- continue;
2046
- }
2047
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2048
- this[enterFuncName] = (node, route) => {
2049
- const resource = node.value;
2050
- if (resource == null)
2051
- return false;
2052
- // Ignore any property that is not at the bit level as that will be handled by a different handler
2053
- const parent = this.getParentNode(route);
2054
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.resourcesValue)
2055
- return true;
2056
- // Get the resource alias
2057
- const alias = ResourceTag_1.ResourceTag.fromValue(parent.value.__typeAlias);
2058
- const type = alias !== null && alias !== void 0 ? alias : ResourceTag_1.ResourceTag.fromValue(parent.value.type);
2059
- if (!type)
2060
- return false;
2061
- // url / src / href / app
2062
- const url = resource.url || resource.src || resource.body || '';
2063
- // Write the resource
2064
- this.writeNL();
2065
- this.writeResource(type, url);
2066
- // Continue traversal
2067
- return true;
2068
- };
2069
- // Bind this
2070
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2071
- this[enterFuncName] = this[enterFuncName].bind(this);
2072
- }
2073
- }
2074
- /**
2075
- * Generate the handlers for properties, as they are mostly the same, but not quite
2076
- */
2077
- generatePropertyHandlers() {
2078
- var _a;
2079
- const propertiesConfig = Config_1.Config.getRawPropertiesConfig();
2080
- for (const propertyConfig of Object.values(propertiesConfig)) {
2081
- const astKey = (_a = propertyConfig.astKey) !== null && _a !== void 0 ? _a : propertyConfig.tag;
2082
- const enterFuncName = `enter_${astKey}`;
2083
- // Skip if the function already exists, allows for custom handlers
2084
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2085
- if (typeof this[enterFuncName] === 'function') {
2086
- continue;
2087
- }
2088
- // Skip 'example' property as it is non-standard and handled elsewhere
2089
- if (astKey === 'example')
2090
- continue;
2091
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2092
- this[enterFuncName] = (node, route) => {
2093
- var _a, _b;
2094
- const value = node.value;
2095
- if (value == null)
2096
- return;
2097
- // Ignore any property that is not at the bit level as that will be handled by a different handler
2098
- const parent = this.getParentNode(route);
2099
- if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
2100
- return;
2101
- // Write the property
2102
- this.writeNL_IfNotChain(route); // Only if NOT in chain
2103
- this.writeProperty(propertyConfig.tag, node.value, {
2104
- format: (_a = propertyConfig.format) !== null && _a !== void 0 ? _a : PropertyFormat_1.PropertyFormat.plainText,
2105
- single: (_b = propertyConfig.single) !== null && _b !== void 0 ? _b : false,
2106
- ignoreFalse: propertyConfig.defaultValue === 'false',
2107
- ignoreTrue: propertyConfig.defaultValue === 'true',
2108
- });
2109
- };
2110
- // Bind this
2111
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2112
- this[enterFuncName] = this[enterFuncName].bind(this);
2113
- }
2114
- }
2115
- // END NODE HANDLERS
2116
- //
2117
- // UTILITY FUNCTIONS
2118
- //
2119
- /**
2120
- * Check if in a chain.
2121
- *
2122
- * Return false if at the root of the bit or a card bit, otherwise true.
2123
- * This is useful to determine if a newline should be written before certain properties.
2124
- *
2125
- * @param route
2126
- * @returns
2127
- */
2128
- isChain(route) {
2129
- const parent = this.getParentNode(route);
2130
- // Root of bit
2131
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.bitsValue)
2132
- return false;
2133
- // Root of card bits
2134
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.cardBitsValue)
2135
- return false;
2136
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.feedbacksValue)
2137
- return false;
2138
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.quizzesValue)
2139
- return false;
2140
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.pairsValue)
2141
- return false;
2142
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.matrixValue)
2143
- return false;
2144
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.definitionsValue)
2145
- return false;
2146
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.questionsValue)
2147
- return false;
2148
- // Root of sub-card bits
2149
- if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.reason)
2150
- return false;
2151
- return true;
2152
- }
2153
- haveValidCardSet(bit) {
2154
- const bitConfig = Config_1.Config.getBitConfig(bit.bitType);
2155
- if (!bitConfig)
2156
- return false;
2157
- // There is no easy way to determine if a card set is valid, so we will just check if the bit has a card set
2158
- // and if so, assume it is valid.
2159
- // This information is used for automatically generating the '==== text ====' divider, so this will not be
2160
- // generated for any bit that has a card set unless this function is improved, however, a bit that has a
2161
- // card set in the configuration does not make any sense without a card set, so this is a reasonable behaviour.
2162
- return !!bitConfig.cardSet;
2163
- }
2164
- haveValidFooter(bit) {
2165
- const footer = bit.footer;
2166
- if (!footer)
2167
- return false;
2168
- const textFormat = bit.textFormat;
2169
- // Handle footer
2170
- if (textFormat === TextFormat_1.TextFormat.json) {
2171
- // Json footer?!
2172
- // Not valid, ignore
2173
- return false;
2174
- }
2175
- else if (footer.footer && footer.footer.length > 0) {
2176
- if (this.isBodyBitmarkText) {
2177
- // handle bitmark text
2178
- return true;
2179
- }
2180
- else {
2181
- // Plain text footer?!
2182
- // Not valid, ignore (plain text cannot have a card set / footer marker, so cannot have a footer!
2183
- return false;
2184
- }
2185
- }
2186
- return false;
2187
- }
2188
- /**
2189
- * Calculate the number of spaces around values from the options.
2190
- *
2191
- * This function should only be called from the constructor.
2192
- * Otherwise use this.spacesAroundValues.
2193
- *
2194
- * @returns
2195
- */
2196
- calcSpacesAroundValues() {
2197
- const val = this.options.spacesAroundValues;
2198
- let spaces = DEFAULT_SPACES_AROUND_VALUES;
2199
- if (val != null) {
2200
- if (val === true) {
2201
- spaces = DEFAULT_SPACES_AROUND_VALUES;
2202
- }
2203
- else if (val === false) {
2204
- spaces = 0;
2205
- }
2206
- else {
2207
- spaces = val;
2208
- }
2209
- }
2210
- spaces = Math.min(Math.max(spaces, 0), MAX_SPACES_AROUND_VALUES);
2211
- return spaces;
2212
- }
2213
- // END UTILITY FUNCTIONS
2214
- //
2215
- // WRITE FUNCTIONS
2216
- //
2217
- /**
2218
- * Helper function to write a tag key, breakscaping appropriately.
2219
- * Use only to write a tag key.
2220
- *
2221
- * @param s
2222
- */
2223
- writeTagKey(s) {
2224
- if (s != null) {
2225
- this.write(Breakscape_1.Breakscape.breakscape(`${s}`, {
2226
- format: TextFormat_1.TextFormat.plainText,
2227
- location: TextLocation_1.TextLocation.tag,
2228
- }));
2229
- }
2230
- }
2231
- /**
2232
- * Write text or value, handling:
2233
- * - the format and location (i.e. conversion to text and breakscaping).
2234
- * - the spaces around values (if tag value).
2235
- *
2236
- * @param text
2237
- * @param format
2238
- * @param location
2239
- * @param options
2240
- */
2241
- writeTextOrValue(text, format, location, options) {
2242
- const isTagValue = location === TextLocation_1.TextLocation.tag;
2243
- const s = typeof text === 'string' ? text : undefined;
2244
- const ast = Array.isArray(text) ? text : undefined;
2245
- const spaces = isTagValue ? this.spacesAroundValuesStr : '';
2246
- // For plain strings use TextFormat.text, otherwise keep the requested format for breakscaping.
2247
- const breakscapeFormat = format === TextFormat_1.TextFormat.bitmarkText ? format : TextFormat_1.TextFormat.plainText;
2248
- /** Wrap a piece of text in the required padding (only for tag values). */
2249
- const wrap = (content) => (isTagValue ? `${spaces}${content}${spaces}` : content);
2250
- /**
2251
- * Capture everything written by `action` into `partWriter`,
2252
- * then restore the original writer and return the trimmed text.
2253
- */
2254
- const writeToPartWriter = (action) => {
2255
- const originalWriter = this.writer;
2256
- this.writer = this.partWriter;
2257
- this.partWriter.openSync();
2258
- action();
2259
- this.partWriter.closeSync();
2260
- const result = this.partWriter.getString().trim();
2261
- this.writer = originalWriter;
2262
- return result;
2263
- };
2264
- /* String */
2265
- if (s != null) {
2266
- const writeString = () => this.write(Breakscape_1.Breakscape.breakscape(s, {
2267
- format: breakscapeFormat,
2268
- location,
2269
- }));
2270
- if (isTagValue) {
2271
- const written = writeToPartWriter(writeString);
2272
- if (written)
2273
- this.write(wrap(written));
2274
- }
2275
- else {
2276
- writeString(); // already writes directly to main writer
2277
- }
2278
- return; // nothing more to do for string input
2279
- }
2280
- /* AST */
2281
- if (ast != null) {
2282
- const generateAst = () => this.textGenerator.generateSync(ast, format, location, options);
2283
- if (isTagValue) {
2284
- const written = writeToPartWriter(generateAst);
2285
- if (written)
2286
- this.write(wrap(written));
2287
- }
2288
- else {
2289
- generateAst();
2290
- }
2291
- }
2292
- }
2293
- writeString(s) {
2294
- if (s != null)
2295
- this.write(`${s}`);
2296
- }
2297
- writeOPBUL() {
2298
- this.write('[•');
2299
- }
2300
- writeOPESC() {
2301
- this.write('[^');
2302
- }
2303
- writeOPRANGLE() {
2304
- this.write('[►');
2305
- }
2306
- writeOPDANGLE() {
2307
- this.write('[▼');
2308
- }
2309
- writeOPD(level) {
2310
- this.write(`[${'.'.repeat(level)}`);
2311
- }
2312
- writeOPU() {
2313
- this.write('[_');
2314
- }
2315
- writeOPE() {
2316
- this.write('[=');
2317
- }
2318
- writeOPB() {
2319
- this.write('[!');
2320
- }
2321
- writeOPQ() {
2322
- this.write('[?');
2323
- }
2324
- writeOPA() {
2325
- this.write('[@');
2326
- }
2327
- writeOPP() {
2328
- this.write('[+');
2329
- }
2330
- writeOPM() {
2331
- this.write('[-');
2332
- }
2333
- writeOPS() {
2334
- this.write('[\\');
2335
- }
2336
- writeOPR() {
2337
- this.write('[*');
2338
- }
2339
- writeOPC() {
2340
- this.write('[%');
2341
- }
2342
- writeOPAMP() {
2343
- this.write('[&');
2344
- }
2345
- writeOPDOLLAR() {
2346
- this.write('[$');
2347
- }
2348
- writeOPHASH() {
2349
- this.write('[#');
2350
- }
2351
- writeOPPRE() {
2352
- this.write("['");
2353
- }
2354
- writeOPPOST() {
2355
- this.write('['); // TODO - not sure what symbol is for postfix
2356
- }
2357
- writeOP() {
2358
- this.write('[');
2359
- }
2360
- writeCL() {
2361
- // HACK to fix breakscaping when string ends with a ^ (must add a space) if
2362
- // options.spacesAroundValues is 0
2363
- if (this.spacesAroundValues === 0) {
2364
- this.writer.getLastWrite().endsWith('^') ? this.write(' ]') : this.write(']');
2365
- }
2366
- else {
2367
- this.write(']');
2368
- }
2369
- }
2370
- writeAmpersand() {
2371
- this.write('&');
2372
- }
2373
- writeColon() {
2374
- this.write(':');
2375
- }
2376
- // protected writeDoubleColon(): void {
2377
- // this.write('::');
2378
- // }
2379
- writeHash() {
2380
- this.write('#');
2381
- }
2382
- writeSpacesAroundValues() {
2383
- this.write(this.spacesAroundValuesStr);
2384
- }
2385
- writePlainTextDivider() {
2386
- this.writeNL();
2387
- this.write('==== text ====');
2388
- }
2389
- writeCardSetStart() {
2390
- this.writeNL();
2391
- if (this.options.cardSetVersion === CardSetVersion_1.CardSetVersion.v1) {
2392
- this.write('===');
2393
- }
2394
- else {
2395
- this.write('====');
2396
- }
2397
- }
2398
- writeCardSetEnd() {
2399
- this.writeNL();
2400
- if (this.options.cardSetVersion === CardSetVersion_1.CardSetVersion.v1) {
2401
- this.write('===');
2402
- }
2403
- else {
2404
- // this.write('==== footer ===='); // Written by the footer
2405
- }
2406
- }
2407
- writeCardSetCardDivider() {
2408
- this.writeNL();
2409
- if (this.options.cardSetVersion === CardSetVersion_1.CardSetVersion.v1) {
2410
- this.write('===');
2411
- }
2412
- else {
2413
- this.write('====');
2414
- }
2415
- }
2416
- writeCardSetSideDivider() {
2417
- this.writeNL();
2418
- if (this.options.cardSetVersion === CardSetVersion_1.CardSetVersion.v1) {
2419
- this.write('==');
2420
- }
2421
- else {
2422
- this.write('--');
2423
- }
2424
- }
2425
- writeCardSetVariantDivider() {
2426
- this.writeNL();
2427
- if (this.options.cardSetVersion === CardSetVersion_1.CardSetVersion.v1) {
2428
- this.write('--');
2429
- }
2430
- else {
2431
- this.write('++');
2432
- }
2433
- }
2434
- writeNL_IfNotChain(route) {
2435
- if (!this.isChain(route)) {
2436
- this.writeNL();
2437
- }
2438
- }
2439
- writeNL() {
2440
- if (this.options.debugGenerationInline) {
2441
- this.write('\\n');
2442
- return;
2443
- }
2444
- this.write('\n');
2445
- }
2446
- writePropertyStyleResource(key, resource, deprecated_writeAsProperty = false) {
2447
- var _a;
2448
- if (key && resource) {
2449
- const resourceTag = (_a = ResourceTag_1.ResourceTag.keyFromValue(resource.type)) !== null && _a !== void 0 ? _a : '';
2450
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2451
- const resourceData = resource[resourceTag];
2452
- const src = resourceData ? resourceData.src || resourceData.url || resourceData.body || '' : '';
2453
- if (deprecated_writeAsProperty) {
2454
- this.writeOPA();
2455
- }
2456
- else {
2457
- this.writeOPAMP();
2458
- }
2459
- this.writeTagKey(key);
2460
- this.writeColon();
2461
- this.writeTextOrValue(src, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
2462
- if (resource.type === ResourceTag_1.ResourceTag.article) {
2463
- // this.writeNL();
2464
- }
2465
- this.writeCL();
2466
- }
2467
- }
2468
- writeResource(type, value) {
2469
- // const resourceAsArticle = resource as ArticleResource;
2470
- if (type) {
2471
- // Standard case
2472
- this.writeOPAMP();
2473
- this.writeTagKey(type);
2474
- this.writeColon();
2475
- this.writeTextOrValue(value, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
2476
- if (type === ResourceTag_1.ResourceTag.article) {
2477
- // this.writeNL();
2478
- }
2479
- this.writeCL();
2480
- }
2481
- }
2482
- writeProperty(name, values, options) {
2483
- let valuesArray;
2484
- if (values !== undefined) {
2485
- const isBitmarkText = options.format === PropertyFormat_1.PropertyFormat.bitmarkText;
2486
- if (isBitmarkText) {
2487
- // Write bitmark text
2488
- if (options.ignoreEmpty && isBitmarkText && this.isEmptyText(values))
2489
- return;
2490
- this.writeOPA();
2491
- this.writeTagKey(name);
2492
- this.writeColon();
2493
- this.writeTextOrValue(values, TextFormat_1.TextFormat.bitmarkText, TextLocation_1.TextLocation.tag);
2494
- this.writeCL();
2495
- }
2496
- else {
2497
- // Write any other property type
2498
- if (!Array.isArray(values)) {
2499
- valuesArray = [values];
2500
- }
2501
- else {
2502
- valuesArray = values;
2503
- }
2504
- if (valuesArray.length > 0) {
2505
- if (options.single)
2506
- valuesArray = valuesArray.slice(valuesArray.length - 1);
2507
- for (const val of valuesArray) {
2508
- if (val !== undefined) {
2509
- if (options.ignoreFalse && val === false)
2510
- continue;
2511
- if (options.ignoreTrue && val === true)
2512
- continue;
2513
- if (options.ignoreEmpty && val === '')
2514
- continue;
2515
- this.writeOPA();
2516
- this.writeTagKey(name);
2517
- this.writeColon();
2518
- this.writeTextOrValue(`${val}`, TextFormat_1.TextFormat.plainText, TextLocation_1.TextLocation.tag);
2519
- this.writeCL();
2520
- // propertyIndex++;
2521
- }
2522
- }
2523
- }
2524
- } // isBitmarkText
2525
- }
2526
- }
2527
- writeInlineDebug(key, state) {
2528
- let tag = key;
2529
- if (state.open) {
2530
- tag = `<${key}>`;
2531
- }
2532
- else if (state.close) {
2533
- tag = `</${key}>`;
2534
- }
2535
- else if (state.single) {
2536
- tag = `<${key} />`;
2537
- }
2538
- this.writeString(tag);
2539
- }
2540
- //
2541
- // Helper functions
2542
- //
2543
- isEmptyText(text) {
2544
- if (!text)
2545
- return true;
2546
- if (Array.isArray(text))
2547
- return text.length === 0;
2548
- return true; // true as not valid TextAst?
2549
- }
2550
- isWriteTextFormat(bitsValue, textFormatDefault) {
2551
- const isDefault = TextFormat_1.TextFormat.fromValue(bitsValue) === textFormatDefault;
2552
- const writeFormat = !isDefault || this.options.explicitTextFormat;
2553
- return !!writeFormat;
2554
- }
2555
- calculateIsCardAllowed() {
2556
- return this.isBodyBitmarkText && !this.isOfBitType1();
2557
- }
2558
- isOfBitType1() {
2559
- return this.isOfBitType([BitType_1.BitType.trueFalse1, BitType_1.BitType.multipleChoice1, BitType_1.BitType.multipleResponse1]);
2560
- }
2561
- isOfBitType(baseBitType) {
2562
- return Config_1.Config.isOfBitType(this.bitType, baseBitType);
2563
- }
2564
- //
2565
- // Writer interface
2566
- //
2567
- /**
2568
- * Writes a string value to the output.
2569
- * @param value - The string value to be written.
2570
- */
2571
- write(value) {
2572
- this.writer.write(value);
2573
- return this;
2574
- }
2575
- /**
2576
- * Writes a new line to the output. The line is indented automatically. The line is ended with the endOfLineString.
2577
- * @param value - The line to write. When omitted, only the endOfLineString is written.
2578
- */
2579
- writeLine(value) {
2580
- this.writer.writeLine(value);
2581
- return this;
2582
- }
2583
- /**
2584
- * Writes a collection of lines to the output. Each line is indented automatically and ended with the endOfLineString.
2585
- * @param values - The lines to write.
2586
- * @param delimiter - An optional delimiter to be written at the end of each line, except for the last one.
2587
- */
2588
- writeLines(values, delimiter) {
2589
- this.writer.writeLines(values, delimiter);
2590
- return this;
2591
- }
2592
- /**
2593
- * Writes a single whitespace character to the output.
2594
- */
2595
- writeWhiteSpace() {
2596
- this.writer.writeWhiteSpace();
2597
- return this;
2598
- }
2599
- }
2600
- exports.BitmarkGenerator = BitmarkGenerator;
2601
- //# sourceMappingURL=BitmarkGenerator.js.map