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