@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.
- package/README.md +4 -4
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/index.cjs +33650 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7733 -0
- package/dist/index.d.ts +7733 -0
- package/dist/index.js +33590 -0
- package/dist/index.js.map +1 -0
- package/package.json +106 -90
- package/dist/cjs/BitmarkParserGenerator.js +0 -776
- package/dist/cjs/BitmarkParserGenerator.js.map +0 -1
- package/dist/cjs/ast/Ast.js +0 -220
- package/dist/cjs/ast/Ast.js.map +0 -1
- package/dist/cjs/ast/BaseBuilder.js +0 -193
- package/dist/cjs/ast/BaseBuilder.js.map +0 -1
- package/dist/cjs/ast/Builder.js +0 -1781
- package/dist/cjs/ast/Builder.js.map +0 -1
- package/dist/cjs/ast/ResourceBuilder.js +0 -963
- package/dist/cjs/ast/ResourceBuilder.js.map +0 -1
- package/dist/cjs/ast/rules/NodeValidator.js +0 -184
- package/dist/cjs/ast/rules/NodeValidator.js.map +0 -1
- package/dist/cjs/ast/writer/FileWriter.js +0 -119
- package/dist/cjs/ast/writer/FileWriter.js.map +0 -1
- package/dist/cjs/ast/writer/StreamWriter.js +0 -89
- package/dist/cjs/ast/writer/StreamWriter.js.map +0 -1
- package/dist/cjs/ast/writer/StringWriter.js +0 -115
- package/dist/cjs/ast/writer/StringWriter.js.map +0 -1
- package/dist/cjs/ast/writer/Writer.js +0 -3
- package/dist/cjs/ast/writer/Writer.js.map +0 -1
- package/dist/cjs/breakscaping/Breakscape.js +0 -80
- package/dist/cjs/breakscaping/Breakscape.js.map +0 -1
- package/dist/cjs/breakscaping/BreakscapeLoop.js +0 -305
- package/dist/cjs/breakscaping/BreakscapeLoop.js.map +0 -1
- package/dist/cjs/breakscaping/BreakscapeOptions.js +0 -3
- package/dist/cjs/breakscaping/BreakscapeOptions.js.map +0 -1
- package/dist/cjs/breakscaping/BreakscapeRegex.js +0 -213
- package/dist/cjs/breakscaping/BreakscapeRegex.js.map +0 -1
- package/dist/cjs/breakscaping/RegexConfigs.js +0 -38
- package/dist/cjs/breakscaping/RegexConfigs.js.map +0 -1
- package/dist/cjs/config/Config.js +0 -352
- package/dist/cjs/config/Config.js.map +0 -1
- package/dist/cjs/config/ConfigHydrator.js +0 -161
- package/dist/cjs/config/ConfigHydrator.js.map +0 -1
- package/dist/cjs/config/raw/bits.js +0 -2615
- package/dist/cjs/config/raw/bits.js.map +0 -1
- package/dist/cjs/config/raw/cardSets.js +0 -549
- package/dist/cjs/config/raw/cardSets.js.map +0 -1
- package/dist/cjs/config/raw/groups.js +0 -1182
- package/dist/cjs/config/raw/groups.js.map +0 -1
- package/dist/cjs/config/raw/properties.js +0 -1006
- package/dist/cjs/config/raw/properties.js.map +0 -1
- package/dist/cjs/config/raw/resources.js +0 -103
- package/dist/cjs/config/raw/resources.js.map +0 -1
- package/dist/cjs/config/raw/tags.js +0 -48
- package/dist/cjs/config/raw/tags.js.map +0 -1
- package/dist/cjs/generated/build-info.js +0 -13
- package/dist/cjs/generated/build-info.js.map +0 -1
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +0 -3168
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +0 -1
- package/dist/cjs/generated/parser/text/text-peggy-parser.js +0 -9659
- package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +0 -1
- package/dist/cjs/generator/AstWalkerGenerator.js +0 -86
- package/dist/cjs/generator/AstWalkerGenerator.js.map +0 -1
- package/dist/cjs/generator/Generator.js +0 -3
- package/dist/cjs/generator/Generator.js.map +0 -1
- package/dist/cjs/generator/bitmark/BitmarkFileGenerator.js +0 -49
- package/dist/cjs/generator/bitmark/BitmarkFileGenerator.js.map +0 -1
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js +0 -2601
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +0 -1
- package/dist/cjs/generator/bitmark/BitmarkStringGenerator.js +0 -51
- package/dist/cjs/generator/bitmark/BitmarkStringGenerator.js.map +0 -1
- package/dist/cjs/generator/json/JsonFileGenerator.js +0 -53
- package/dist/cjs/generator/json/JsonFileGenerator.js.map +0 -1
- package/dist/cjs/generator/json/JsonGenerator.js +0 -1584
- package/dist/cjs/generator/json/JsonGenerator.js.map +0 -1
- package/dist/cjs/generator/json/JsonObjectGenerator.js +0 -51
- package/dist/cjs/generator/json/JsonObjectGenerator.js.map +0 -1
- package/dist/cjs/generator/json/JsonStringGenerator.js +0 -50
- package/dist/cjs/generator/json/JsonStringGenerator.js.map +0 -1
- package/dist/cjs/generator/text/TextGenerator.js +0 -1199
- package/dist/cjs/generator/text/TextGenerator.js.map +0 -1
- package/dist/cjs/index.js +0 -79
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/info/InfoBuilder.js +0 -43
- package/dist/cjs/info/InfoBuilder.js.map +0 -1
- package/dist/cjs/init/init.js +0 -15
- package/dist/cjs/init/init.js.map +0 -1
- package/dist/cjs/model/ast/BreakscapedString.js +0 -3
- package/dist/cjs/model/ast/BreakscapedString.js.map +0 -1
- package/dist/cjs/model/ast/NodeType.js +0 -557
- package/dist/cjs/model/ast/NodeType.js.map +0 -1
- package/dist/cjs/model/ast/Nodes.js +0 -3
- package/dist/cjs/model/ast/Nodes.js.map +0 -1
- package/dist/cjs/model/ast/StardardString.js +0 -3
- package/dist/cjs/model/ast/StardardString.js.map +0 -1
- package/dist/cjs/model/ast/TextNodes.js +0 -3
- package/dist/cjs/model/ast/TextNodes.js.map +0 -1
- package/dist/cjs/model/config/AbstractTagConfig.js +0 -18
- package/dist/cjs/model/config/AbstractTagConfig.js.map +0 -1
- package/dist/cjs/model/config/BitConfig.js +0 -72
- package/dist/cjs/model/config/BitConfig.js.map +0 -1
- package/dist/cjs/model/config/CardSetConfig.js +0 -26
- package/dist/cjs/model/config/CardSetConfig.js.map +0 -1
- package/dist/cjs/model/config/CardVariantConfig.js +0 -32
- package/dist/cjs/model/config/CardVariantConfig.js.map +0 -1
- package/dist/cjs/model/config/MarkupTagConfig.js +0 -41
- package/dist/cjs/model/config/MarkupTagConfig.js.map +0 -1
- package/dist/cjs/model/config/PropertyTagConfig.js +0 -50
- package/dist/cjs/model/config/PropertyTagConfig.js.map +0 -1
- package/dist/cjs/model/config/ResourceTagConfig.js +0 -42
- package/dist/cjs/model/config/ResourceTagConfig.js.map +0 -1
- package/dist/cjs/model/config/ResourcesConfig.js +0 -31
- package/dist/cjs/model/config/ResourcesConfig.js.map +0 -1
- package/dist/cjs/model/config/TagConfig.js +0 -3
- package/dist/cjs/model/config/TagConfig.js.map +0 -1
- package/dist/cjs/model/config/TagsConfig.js +0 -3
- package/dist/cjs/model/config/TagsConfig.js.map +0 -1
- package/dist/cjs/model/config/TagsConfigWithInfo.js +0 -3
- package/dist/cjs/model/config/TagsConfigWithInfo.js.map +0 -1
- package/dist/cjs/model/config/_Config.js +0 -3
- package/dist/cjs/model/config/_Config.js.map +0 -1
- package/dist/cjs/model/config/enum/CardSetConfigKey.js +0 -28
- package/dist/cjs/model/config/enum/CardSetConfigKey.js.map +0 -1
- package/dist/cjs/model/config/enum/ConfigKey.js +0 -29
- package/dist/cjs/model/config/enum/ConfigKey.js.map +0 -1
- package/dist/cjs/model/config/enum/GroupConfigKey.js +0 -57
- package/dist/cjs/model/config/enum/GroupConfigKey.js.map +0 -1
- package/dist/cjs/model/config/enum/GroupConfigType.js +0 -14
- package/dist/cjs/model/config/enum/GroupConfigType.js.map +0 -1
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +0 -215
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +0 -1
- package/dist/cjs/model/config/enum/ResourceConfigKey.js +0 -40
- package/dist/cjs/model/config/enum/ResourceConfigKey.js.map +0 -1
- package/dist/cjs/model/config/enum/TagConfigKey.js +0 -26
- package/dist/cjs/model/config/enum/TagConfigKey.js.map +0 -1
- package/dist/cjs/model/enum/BitTagType.js +0 -13
- package/dist/cjs/model/enum/BitTagType.js.map +0 -1
- package/dist/cjs/model/enum/BitType.js +0 -576
- package/dist/cjs/model/enum/BitType.js.map +0 -1
- package/dist/cjs/model/enum/BitmarkGeneratorOutput.js +0 -2
- package/dist/cjs/model/enum/BitmarkGeneratorOutput.js.map +0 -1
- package/dist/cjs/model/enum/BitmarkParserType.js +0 -9
- package/dist/cjs/model/enum/BitmarkParserType.js.map +0 -1
- package/dist/cjs/model/enum/BitmarkVersion.js +0 -12
- package/dist/cjs/model/enum/BitmarkVersion.js.map +0 -1
- package/dist/cjs/model/enum/BodyBitType.js +0 -14
- package/dist/cjs/model/enum/BodyBitType.js.map +0 -1
- package/dist/cjs/model/enum/BodyTextFormat.js +0 -14
- package/dist/cjs/model/enum/BodyTextFormat.js.map +0 -1
- package/dist/cjs/model/enum/CardSetVersion.js +0 -10
- package/dist/cjs/model/enum/CardSetVersion.js.map +0 -1
- package/dist/cjs/model/enum/Count.js +0 -9
- package/dist/cjs/model/enum/Count.js.map +0 -1
- package/dist/cjs/model/enum/DeprecatedTextFormat.js +0 -9
- package/dist/cjs/model/enum/DeprecatedTextFormat.js.map +0 -1
- package/dist/cjs/model/enum/ExampleType.js +0 -11
- package/dist/cjs/model/enum/ExampleType.js.map +0 -1
- package/dist/cjs/model/enum/PropertyAstKey.js +0 -18
- package/dist/cjs/model/enum/PropertyAstKey.js.map +0 -1
- package/dist/cjs/model/enum/PropertyFormat.js +0 -14
- package/dist/cjs/model/enum/PropertyFormat.js.map +0 -1
- package/dist/cjs/model/enum/PropertyJsonKey.js +0 -14
- package/dist/cjs/model/enum/PropertyJsonKey.js.map +0 -1
- package/dist/cjs/model/enum/PropertyTag.js +0 -8
- package/dist/cjs/model/enum/PropertyTag.js.map +0 -1
- package/dist/cjs/model/enum/ResourceJsonKey.js +0 -27
- package/dist/cjs/model/enum/ResourceJsonKey.js.map +0 -1
- package/dist/cjs/model/enum/ResourceTag.js +0 -37
- package/dist/cjs/model/enum/ResourceTag.js.map +0 -1
- package/dist/cjs/model/enum/Tag.js +0 -21
- package/dist/cjs/model/enum/Tag.js.map +0 -1
- package/dist/cjs/model/enum/TextFormat.js +0 -16
- package/dist/cjs/model/enum/TextFormat.js.map +0 -1
- package/dist/cjs/model/enum/TextLocation.js +0 -15
- package/dist/cjs/model/enum/TextLocation.js.map +0 -1
- package/dist/cjs/model/enum/TextMarkType.js +0 -54
- package/dist/cjs/model/enum/TextMarkType.js.map +0 -1
- package/dist/cjs/model/enum/TextNodeType.js +0 -35
- package/dist/cjs/model/enum/TextNodeType.js.map +0 -1
- package/dist/cjs/model/enum/TextSection.js +0 -18
- package/dist/cjs/model/enum/TextSection.js.map +0 -1
- package/dist/cjs/model/info/enum/InfoFormat.js +0 -11
- package/dist/cjs/model/info/enum/InfoFormat.js.map +0 -1
- package/dist/cjs/model/info/enum/InfoType.js +0 -12
- package/dist/cjs/model/info/enum/InfoType.js.map +0 -1
- package/dist/cjs/model/json/BitJson.js +0 -3
- package/dist/cjs/model/json/BitJson.js.map +0 -1
- package/dist/cjs/model/json/BitWrapperJson.js +0 -3
- package/dist/cjs/model/json/BitWrapperJson.js.map +0 -1
- package/dist/cjs/model/json/BodyBitJson.js +0 -3
- package/dist/cjs/model/json/BodyBitJson.js.map +0 -1
- package/dist/cjs/model/json/ParserJson.js +0 -3
- package/dist/cjs/model/json/ParserJson.js.map +0 -1
- package/dist/cjs/model/json/ResourceJson.js +0 -3
- package/dist/cjs/model/json/ResourceJson.js.map +0 -1
- package/dist/cjs/model/parser/ParserData.js +0 -3
- package/dist/cjs/model/parser/ParserData.js.map +0 -1
- package/dist/cjs/model/parser/ParserError.js +0 -3
- package/dist/cjs/model/parser/ParserError.js.map +0 -1
- package/dist/cjs/model/parser/ParserInfo.js +0 -3
- package/dist/cjs/model/parser/ParserInfo.js.map +0 -1
- package/dist/cjs/model/parser/ParserLocation.js +0 -3
- package/dist/cjs/model/parser/ParserLocation.js.map +0 -1
- package/dist/cjs/model/parser/ParserLocationRange.js +0 -3
- package/dist/cjs/model/parser/ParserLocationRange.js.map +0 -1
- package/dist/cjs/model/parser/TagValidationData.js +0 -3
- package/dist/cjs/model/parser/TagValidationData.js.map +0 -1
- package/dist/cjs/parser/bitmark/BitmarkParser.js +0 -25
- package/dist/cjs/parser/bitmark/BitmarkParser.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParser.js +0 -7
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParser.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js +0 -614
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +0 -716
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js +0 -69
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +0 -745
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/PeggyGrammarLocation.js +0 -82
- package/dist/cjs/parser/bitmark/peg/PeggyGrammarLocation.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +0 -260
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +0 -50
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +0 -885
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +0 -27
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +0 -61
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +0 -63
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +0 -161
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +0 -55
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +0 -31
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +0 -59
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +0 -16
- package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +0 -29
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +0 -20
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +0 -45
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +0 -44
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +0 -11
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +0 -57
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +0 -158
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +0 -37
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +0 -24
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +0 -163
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +0 -27
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +0 -28
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +0 -53
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +0 -203
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +0 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +0 -24
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +0 -1
- package/dist/cjs/parser/json/JsonParser.js +0 -270
- package/dist/cjs/parser/json/JsonParser.js.map +0 -1
- package/dist/cjs/parser/text/TextParser.js +0 -148
- package/dist/cjs/parser/text/TextParser.js.map +0 -1
- package/dist/cjs/parser/text/peg/TextPegParser.js +0 -7
- package/dist/cjs/parser/text/peg/TextPegParser.js.map +0 -1
- package/dist/cjs/utils/ArrayUtils.js +0 -43
- package/dist/cjs/utils/ArrayUtils.js.map +0 -1
- package/dist/cjs/utils/BitUtils.js +0 -75
- package/dist/cjs/utils/BitUtils.js.map +0 -1
- package/dist/cjs/utils/BooleanUtils.js +0 -62
- package/dist/cjs/utils/BooleanUtils.js.map +0 -1
- package/dist/cjs/utils/FileUtils.js +0 -75
- package/dist/cjs/utils/FileUtils.js.map +0 -1
- package/dist/cjs/utils/NumberUtils.js +0 -62
- package/dist/cjs/utils/NumberUtils.js.map +0 -1
- package/dist/cjs/utils/ObjectUtils.js +0 -417
- package/dist/cjs/utils/ObjectUtils.js.map +0 -1
- package/dist/cjs/utils/StringUtils.js +0 -183
- package/dist/cjs/utils/StringUtils.js.map +0 -1
- package/dist/cjs/utils/UrlUtils.js +0 -37
- package/dist/cjs/utils/UrlUtils.js.map +0 -1
- package/dist/cjs/utils/env/Env.js +0 -131
- package/dist/cjs/utils/env/Env.js.map +0 -1
- package/dist/cjs/utils/env/Environment.js +0 -15
- package/dist/cjs/utils/env/Environment.js.map +0 -1
- package/dist/cjs/utils/env/Os.js +0 -14
- package/dist/cjs/utils/env/Os.js.map +0 -1
- package/dist/cjs/utils/env/Version.js +0 -12
- package/dist/cjs/utils/env/Version.js.map +0 -1
- package/dist/cjs/utils/env/userAgent.js +0 -88
- package/dist/cjs/utils/env/userAgent.js.map +0 -1
- package/dist/cjs/utils/polyfill/fs.js +0 -14
- package/dist/cjs/utils/polyfill/fs.js.map +0 -1
- package/dist/esm/BitmarkParserGenerator.js +0 -735
- package/dist/esm/BitmarkParserGenerator.js.map +0 -1
- package/dist/esm/ast/Ast.js +0 -217
- package/dist/esm/ast/Ast.js.map +0 -1
- package/dist/esm/ast/BaseBuilder.js +0 -190
- package/dist/esm/ast/BaseBuilder.js.map +0 -1
- package/dist/esm/ast/Builder.js +0 -1775
- package/dist/esm/ast/Builder.js.map +0 -1
- package/dist/esm/ast/ResourceBuilder.js +0 -960
- package/dist/esm/ast/ResourceBuilder.js.map +0 -1
- package/dist/esm/ast/rules/NodeValidator.js +0 -181
- package/dist/esm/ast/rules/NodeValidator.js.map +0 -1
- package/dist/esm/ast/writer/FileWriter.js +0 -80
- package/dist/esm/ast/writer/FileWriter.js.map +0 -1
- package/dist/esm/ast/writer/StreamWriter.js +0 -83
- package/dist/esm/ast/writer/StreamWriter.js.map +0 -1
- package/dist/esm/ast/writer/StringWriter.js +0 -112
- package/dist/esm/ast/writer/StringWriter.js.map +0 -1
- package/dist/esm/ast/writer/Writer.js +0 -2
- package/dist/esm/ast/writer/Writer.js.map +0 -1
- package/dist/esm/breakscaping/Breakscape.js +0 -77
- package/dist/esm/breakscaping/Breakscape.js.map +0 -1
- package/dist/esm/breakscaping/BreakscapeLoop.js +0 -302
- package/dist/esm/breakscaping/BreakscapeLoop.js.map +0 -1
- package/dist/esm/breakscaping/BreakscapeOptions.js +0 -2
- package/dist/esm/breakscaping/BreakscapeOptions.js.map +0 -1
- package/dist/esm/breakscaping/BreakscapeRegex.js +0 -177
- package/dist/esm/breakscaping/BreakscapeRegex.js.map +0 -1
- package/dist/esm/breakscaping/RegexConfigs.js +0 -35
- package/dist/esm/breakscaping/RegexConfigs.js.map +0 -1
- package/dist/esm/config/Config.js +0 -349
- package/dist/esm/config/Config.js.map +0 -1
- package/dist/esm/config/ConfigHydrator.js +0 -158
- package/dist/esm/config/ConfigHydrator.js.map +0 -1
- package/dist/esm/config/raw/bits.js +0 -2612
- package/dist/esm/config/raw/bits.js.map +0 -1
- package/dist/esm/config/raw/cardSets.js +0 -546
- package/dist/esm/config/raw/cardSets.js.map +0 -1
- package/dist/esm/config/raw/groups.js +0 -1179
- package/dist/esm/config/raw/groups.js.map +0 -1
- package/dist/esm/config/raw/properties.js +0 -1003
- package/dist/esm/config/raw/properties.js.map +0 -1
- package/dist/esm/config/raw/resources.js +0 -100
- package/dist/esm/config/raw/resources.js.map +0 -1
- package/dist/esm/config/raw/tags.js +0 -45
- package/dist/esm/config/raw/tags.js.map +0 -1
- package/dist/esm/generated/build-info.js +0 -10
- package/dist/esm/generated/build-info.js.map +0 -1
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +0 -3163
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +0 -1
- package/dist/esm/generated/parser/text/text-peggy-parser.js +0 -9654
- package/dist/esm/generated/parser/text/text-peggy-parser.js.map +0 -1
- package/dist/esm/generator/AstWalkerGenerator.js +0 -83
- package/dist/esm/generator/AstWalkerGenerator.js.map +0 -1
- package/dist/esm/generator/Generator.js +0 -2
- package/dist/esm/generator/Generator.js.map +0 -1
- package/dist/esm/generator/bitmark/BitmarkFileGenerator.js +0 -46
- package/dist/esm/generator/bitmark/BitmarkFileGenerator.js.map +0 -1
- package/dist/esm/generator/bitmark/BitmarkGenerator.js +0 -2598
- package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +0 -1
- package/dist/esm/generator/bitmark/BitmarkStringGenerator.js +0 -48
- package/dist/esm/generator/bitmark/BitmarkStringGenerator.js.map +0 -1
- package/dist/esm/generator/json/JsonFileGenerator.js +0 -50
- package/dist/esm/generator/json/JsonFileGenerator.js.map +0 -1
- package/dist/esm/generator/json/JsonGenerator.js +0 -1578
- package/dist/esm/generator/json/JsonGenerator.js.map +0 -1
- package/dist/esm/generator/json/JsonObjectGenerator.js +0 -48
- package/dist/esm/generator/json/JsonObjectGenerator.js.map +0 -1
- package/dist/esm/generator/json/JsonStringGenerator.js +0 -47
- package/dist/esm/generator/json/JsonStringGenerator.js.map +0 -1
- package/dist/esm/generator/text/TextGenerator.js +0 -1196
- package/dist/esm/generator/text/TextGenerator.js.map +0 -1
- package/dist/esm/index.js +0 -49
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/info/InfoBuilder.js +0 -40
- package/dist/esm/info/InfoBuilder.js.map +0 -1
- package/dist/esm/init/init.js +0 -13
- package/dist/esm/init/init.js.map +0 -1
- package/dist/esm/model/ast/BreakscapedString.js +0 -2
- package/dist/esm/model/ast/BreakscapedString.js.map +0 -1
- package/dist/esm/model/ast/NodeType.js +0 -554
- package/dist/esm/model/ast/NodeType.js.map +0 -1
- package/dist/esm/model/ast/Nodes.js +0 -2
- package/dist/esm/model/ast/Nodes.js.map +0 -1
- package/dist/esm/model/ast/StardardString.js +0 -2
- package/dist/esm/model/ast/StardardString.js.map +0 -1
- package/dist/esm/model/ast/TextNodes.js +0 -2
- package/dist/esm/model/ast/TextNodes.js.map +0 -1
- package/dist/esm/model/config/AbstractTagConfig.js +0 -15
- package/dist/esm/model/config/AbstractTagConfig.js.map +0 -1
- package/dist/esm/model/config/BitConfig.js +0 -69
- package/dist/esm/model/config/BitConfig.js.map +0 -1
- package/dist/esm/model/config/CardSetConfig.js +0 -23
- package/dist/esm/model/config/CardSetConfig.js.map +0 -1
- package/dist/esm/model/config/CardVariantConfig.js +0 -29
- package/dist/esm/model/config/CardVariantConfig.js.map +0 -1
- package/dist/esm/model/config/MarkupTagConfig.js +0 -38
- package/dist/esm/model/config/MarkupTagConfig.js.map +0 -1
- package/dist/esm/model/config/PropertyTagConfig.js +0 -47
- package/dist/esm/model/config/PropertyTagConfig.js.map +0 -1
- package/dist/esm/model/config/ResourceTagConfig.js +0 -39
- package/dist/esm/model/config/ResourceTagConfig.js.map +0 -1
- package/dist/esm/model/config/ResourcesConfig.js +0 -28
- package/dist/esm/model/config/ResourcesConfig.js.map +0 -1
- package/dist/esm/model/config/TagConfig.js +0 -2
- package/dist/esm/model/config/TagConfig.js.map +0 -1
- package/dist/esm/model/config/TagsConfig.js +0 -2
- package/dist/esm/model/config/TagsConfig.js.map +0 -1
- package/dist/esm/model/config/TagsConfigWithInfo.js +0 -2
- package/dist/esm/model/config/TagsConfigWithInfo.js.map +0 -1
- package/dist/esm/model/config/_Config.js +0 -2
- package/dist/esm/model/config/_Config.js.map +0 -1
- package/dist/esm/model/config/enum/CardSetConfigKey.js +0 -25
- package/dist/esm/model/config/enum/CardSetConfigKey.js.map +0 -1
- package/dist/esm/model/config/enum/ConfigKey.js +0 -26
- package/dist/esm/model/config/enum/ConfigKey.js.map +0 -1
- package/dist/esm/model/config/enum/GroupConfigKey.js +0 -53
- package/dist/esm/model/config/enum/GroupConfigKey.js.map +0 -1
- package/dist/esm/model/config/enum/GroupConfigType.js +0 -11
- package/dist/esm/model/config/enum/GroupConfigType.js.map +0 -1
- package/dist/esm/model/config/enum/PropertyConfigKey.js +0 -211
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +0 -1
- package/dist/esm/model/config/enum/ResourceConfigKey.js +0 -36
- package/dist/esm/model/config/enum/ResourceConfigKey.js.map +0 -1
- package/dist/esm/model/config/enum/TagConfigKey.js +0 -22
- package/dist/esm/model/config/enum/TagConfigKey.js.map +0 -1
- package/dist/esm/model/enum/BitTagType.js +0 -10
- package/dist/esm/model/enum/BitTagType.js.map +0 -1
- package/dist/esm/model/enum/BitType.js +0 -573
- package/dist/esm/model/enum/BitType.js.map +0 -1
- package/dist/esm/model/enum/BitmarkGeneratorOutput.js +0 -2
- package/dist/esm/model/enum/BitmarkGeneratorOutput.js.map +0 -1
- package/dist/esm/model/enum/BitmarkParserType.js +0 -6
- package/dist/esm/model/enum/BitmarkParserType.js.map +0 -1
- package/dist/esm/model/enum/BitmarkVersion.js +0 -8
- package/dist/esm/model/enum/BitmarkVersion.js.map +0 -1
- package/dist/esm/model/enum/BodyBitType.js +0 -11
- package/dist/esm/model/enum/BodyBitType.js.map +0 -1
- package/dist/esm/model/enum/BodyTextFormat.js +0 -11
- package/dist/esm/model/enum/BodyTextFormat.js.map +0 -1
- package/dist/esm/model/enum/CardSetVersion.js +0 -7
- package/dist/esm/model/enum/CardSetVersion.js.map +0 -1
- package/dist/esm/model/enum/Count.js +0 -6
- package/dist/esm/model/enum/Count.js.map +0 -1
- package/dist/esm/model/enum/DeprecatedTextFormat.js +0 -6
- package/dist/esm/model/enum/DeprecatedTextFormat.js.map +0 -1
- package/dist/esm/model/enum/ExampleType.js +0 -8
- package/dist/esm/model/enum/ExampleType.js.map +0 -1
- package/dist/esm/model/enum/PropertyAstKey.js +0 -15
- package/dist/esm/model/enum/PropertyAstKey.js.map +0 -1
- package/dist/esm/model/enum/PropertyFormat.js +0 -11
- package/dist/esm/model/enum/PropertyFormat.js.map +0 -1
- package/dist/esm/model/enum/PropertyJsonKey.js +0 -11
- package/dist/esm/model/enum/PropertyJsonKey.js.map +0 -1
- package/dist/esm/model/enum/PropertyTag.js +0 -5
- package/dist/esm/model/enum/PropertyTag.js.map +0 -1
- package/dist/esm/model/enum/ResourceJsonKey.js +0 -24
- package/dist/esm/model/enum/ResourceJsonKey.js.map +0 -1
- package/dist/esm/model/enum/ResourceTag.js +0 -34
- package/dist/esm/model/enum/ResourceTag.js.map +0 -1
- package/dist/esm/model/enum/Tag.js +0 -18
- package/dist/esm/model/enum/Tag.js.map +0 -1
- package/dist/esm/model/enum/TextFormat.js +0 -13
- package/dist/esm/model/enum/TextFormat.js.map +0 -1
- package/dist/esm/model/enum/TextLocation.js +0 -12
- package/dist/esm/model/enum/TextLocation.js.map +0 -1
- package/dist/esm/model/enum/TextMarkType.js +0 -51
- package/dist/esm/model/enum/TextMarkType.js.map +0 -1
- package/dist/esm/model/enum/TextNodeType.js +0 -32
- package/dist/esm/model/enum/TextNodeType.js.map +0 -1
- package/dist/esm/model/enum/TextSection.js +0 -15
- package/dist/esm/model/enum/TextSection.js.map +0 -1
- package/dist/esm/model/info/enum/InfoFormat.js +0 -8
- package/dist/esm/model/info/enum/InfoFormat.js.map +0 -1
- package/dist/esm/model/info/enum/InfoType.js +0 -9
- package/dist/esm/model/info/enum/InfoType.js.map +0 -1
- package/dist/esm/model/json/BitJson.js +0 -2
- package/dist/esm/model/json/BitJson.js.map +0 -1
- package/dist/esm/model/json/BitWrapperJson.js +0 -2
- package/dist/esm/model/json/BitWrapperJson.js.map +0 -1
- package/dist/esm/model/json/BodyBitJson.js +0 -2
- package/dist/esm/model/json/BodyBitJson.js.map +0 -1
- package/dist/esm/model/json/ParserJson.js +0 -2
- package/dist/esm/model/json/ParserJson.js.map +0 -1
- package/dist/esm/model/json/ResourceJson.js +0 -2
- package/dist/esm/model/json/ResourceJson.js.map +0 -1
- package/dist/esm/model/parser/ParserData.js +0 -2
- package/dist/esm/model/parser/ParserData.js.map +0 -1
- package/dist/esm/model/parser/ParserError.js +0 -2
- package/dist/esm/model/parser/ParserError.js.map +0 -1
- package/dist/esm/model/parser/ParserInfo.js +0 -2
- package/dist/esm/model/parser/ParserInfo.js.map +0 -1
- package/dist/esm/model/parser/ParserLocation.js +0 -2
- package/dist/esm/model/parser/ParserLocation.js.map +0 -1
- package/dist/esm/model/parser/ParserLocationRange.js +0 -2
- package/dist/esm/model/parser/ParserLocationRange.js.map +0 -1
- package/dist/esm/model/parser/TagValidationData.js +0 -2
- package/dist/esm/model/parser/TagValidationData.js.map +0 -1
- package/dist/esm/parser/bitmark/BitmarkParser.js +0 -22
- package/dist/esm/parser/bitmark/BitmarkParser.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParser.js +0 -4
- package/dist/esm/parser/bitmark/peg/BitmarkPegParser.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js +0 -611
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +0 -713
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js +0 -59
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +0 -742
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/PeggyGrammarLocation.js +0 -79
- package/dist/esm/parser/bitmark/peg/PeggyGrammarLocation.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +0 -257
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +0 -48
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +0 -883
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +0 -25
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +0 -58
- package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +0 -61
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +0 -159
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +0 -52
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +0 -29
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +0 -57
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +0 -14
- package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +0 -27
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +0 -18
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +0 -43
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +0 -42
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +0 -9
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +0 -55
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +0 -156
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +0 -35
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +0 -22
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +0 -160
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +0 -25
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +0 -26
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +0 -50
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +0 -201
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +0 -22
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/json/JsonParser.js +0 -267
- package/dist/esm/parser/json/JsonParser.js.map +0 -1
- package/dist/esm/parser/text/TextParser.js +0 -145
- package/dist/esm/parser/text/TextParser.js.map +0 -1
- package/dist/esm/parser/text/peg/TextPegParser.js +0 -4
- package/dist/esm/parser/text/peg/TextPegParser.js.map +0 -1
- package/dist/esm/utils/ArrayUtils.js +0 -40
- package/dist/esm/utils/ArrayUtils.js.map +0 -1
- package/dist/esm/utils/BitUtils.js +0 -72
- package/dist/esm/utils/BitUtils.js.map +0 -1
- package/dist/esm/utils/BooleanUtils.js +0 -59
- package/dist/esm/utils/BooleanUtils.js.map +0 -1
- package/dist/esm/utils/FileUtils.js +0 -36
- package/dist/esm/utils/FileUtils.js.map +0 -1
- package/dist/esm/utils/NumberUtils.js +0 -59
- package/dist/esm/utils/NumberUtils.js.map +0 -1
- package/dist/esm/utils/ObjectUtils.js +0 -411
- package/dist/esm/utils/ObjectUtils.js.map +0 -1
- package/dist/esm/utils/StringUtils.js +0 -180
- package/dist/esm/utils/StringUtils.js.map +0 -1
- package/dist/esm/utils/UrlUtils.js +0 -34
- package/dist/esm/utils/UrlUtils.js.map +0 -1
- package/dist/esm/utils/env/Env.js +0 -127
- package/dist/esm/utils/env/Env.js.map +0 -1
- package/dist/esm/utils/env/Environment.js +0 -12
- package/dist/esm/utils/env/Environment.js.map +0 -1
- package/dist/esm/utils/env/Os.js +0 -11
- package/dist/esm/utils/env/Os.js.map +0 -1
- package/dist/esm/utils/env/Version.js +0 -9
- package/dist/esm/utils/env/Version.js.map +0 -1
- package/dist/esm/utils/env/userAgent.js +0 -86
- package/dist/esm/utils/env/userAgent.js.map +0 -1
- package/dist/esm/utils/polyfill/fs.js +0 -10
- package/dist/esm/utils/polyfill/fs.js.map +0 -1
- package/dist/types/BitmarkParserGenerator.d.ts +0 -478
- package/dist/types/BitmarkParserGenerator.d.ts.map +0 -1
- package/dist/types/ast/Ast.d.ts +0 -137
- package/dist/types/ast/Ast.d.ts.map +0 -1
- package/dist/types/ast/BaseBuilder.d.ts +0 -64
- package/dist/types/ast/BaseBuilder.d.ts.map +0 -1
- package/dist/types/ast/Builder.d.ts +0 -692
- package/dist/types/ast/Builder.d.ts.map +0 -1
- package/dist/types/ast/ResourceBuilder.d.ts +0 -384
- package/dist/types/ast/ResourceBuilder.d.ts.map +0 -1
- package/dist/types/ast/rules/NodeValidator.d.ts +0 -28
- package/dist/types/ast/rules/NodeValidator.d.ts.map +0 -1
- package/dist/types/ast/writer/FileWriter.d.ts +0 -37
- package/dist/types/ast/writer/FileWriter.d.ts.map +0 -1
- package/dist/types/ast/writer/StreamWriter.d.ts +0 -29
- package/dist/types/ast/writer/StreamWriter.d.ts.map +0 -1
- package/dist/types/ast/writer/StringWriter.d.ts +0 -30
- package/dist/types/ast/writer/StringWriter.d.ts.map +0 -1
- package/dist/types/ast/writer/Writer.d.ts +0 -72
- package/dist/types/ast/writer/Writer.d.ts.map +0 -1
- package/dist/types/breakscaping/Breakscape.d.ts +0 -44
- package/dist/types/breakscaping/Breakscape.d.ts.map +0 -1
- package/dist/types/breakscaping/BreakscapeLoop.d.ts +0 -142
- package/dist/types/breakscaping/BreakscapeLoop.d.ts.map +0 -1
- package/dist/types/breakscaping/BreakscapeOptions.d.ts +0 -30
- package/dist/types/breakscaping/BreakscapeOptions.d.ts.map +0 -1
- package/dist/types/breakscaping/BreakscapeRegex.d.ts +0 -96
- package/dist/types/breakscaping/BreakscapeRegex.d.ts.map +0 -1
- package/dist/types/breakscaping/RegexConfigs.d.ts +0 -35
- package/dist/types/breakscaping/RegexConfigs.d.ts.map +0 -1
- package/dist/types/config/Config.d.ts +0 -115
- package/dist/types/config/Config.d.ts.map +0 -1
- package/dist/types/config/ConfigHydrator.d.ts +0 -16
- package/dist/types/config/ConfigHydrator.d.ts.map +0 -1
- package/dist/types/config/raw/bits.d.ts +0 -4
- package/dist/types/config/raw/bits.d.ts.map +0 -1
- package/dist/types/config/raw/cardSets.d.ts +0 -4
- package/dist/types/config/raw/cardSets.d.ts.map +0 -1
- package/dist/types/config/raw/groups.d.ts +0 -4
- package/dist/types/config/raw/groups.d.ts.map +0 -1
- package/dist/types/config/raw/properties.d.ts +0 -4
- package/dist/types/config/raw/properties.d.ts.map +0 -1
- package/dist/types/config/raw/resources.d.ts +0 -4
- package/dist/types/config/raw/resources.d.ts.map +0 -1
- package/dist/types/config/raw/tags.d.ts +0 -4
- package/dist/types/config/raw/tags.d.ts.map +0 -1
- package/dist/types/generated/build-info.d.ts +0 -8
- package/dist/types/generated/build-info.d.ts.map +0 -1
- package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts +0 -12
- package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +0 -1
- package/dist/types/generated/parser/text/text-peggy-parser.d.ts +0 -12
- package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +0 -1
- package/dist/types/generator/AstWalkerGenerator.d.ts +0 -32
- package/dist/types/generator/AstWalkerGenerator.d.ts.map +0 -1
- package/dist/types/generator/Generator.d.ts +0 -6
- package/dist/types/generator/Generator.d.ts.map +0 -1
- package/dist/types/generator/bitmark/BitmarkFileGenerator.d.ts +0 -41
- package/dist/types/generator/bitmark/BitmarkFileGenerator.d.ts.map +0 -1
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +0 -401
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +0 -1
- package/dist/types/generator/bitmark/BitmarkStringGenerator.d.ts +0 -31
- package/dist/types/generator/bitmark/BitmarkStringGenerator.d.ts.map +0 -1
- package/dist/types/generator/json/JsonFileGenerator.d.ts +0 -45
- package/dist/types/generator/json/JsonFileGenerator.d.ts.map +0 -1
- package/dist/types/generator/json/JsonGenerator.d.ts +0 -357
- package/dist/types/generator/json/JsonGenerator.d.ts.map +0 -1
- package/dist/types/generator/json/JsonObjectGenerator.d.ts +0 -32
- package/dist/types/generator/json/JsonObjectGenerator.d.ts.map +0 -1
- package/dist/types/generator/json/JsonStringGenerator.d.ts +0 -30
- package/dist/types/generator/json/JsonStringGenerator.d.ts.map +0 -1
- package/dist/types/generator/text/TextGenerator.d.ts +0 -228
- package/dist/types/generator/text/TextGenerator.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -50
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/info/InfoBuilder.d.ts +0 -18
- package/dist/types/info/InfoBuilder.d.ts.map +0 -1
- package/dist/types/init/init.d.ts +0 -4
- package/dist/types/init/init.d.ts.map +0 -1
- package/dist/types/model/ast/BreakscapedString.d.ts +0 -4
- package/dist/types/model/ast/BreakscapedString.d.ts.map +0 -1
- package/dist/types/model/ast/NodeType.d.ts +0 -1093
- package/dist/types/model/ast/NodeType.d.ts.map +0 -1
- package/dist/types/model/ast/Nodes.d.ts +0 -268
- package/dist/types/model/ast/Nodes.d.ts.map +0 -1
- package/dist/types/model/ast/StardardString.d.ts +0 -4
- package/dist/types/model/ast/StardardString.d.ts.map +0 -1
- package/dist/types/model/ast/TextNodes.d.ts +0 -130
- package/dist/types/model/ast/TextNodes.d.ts.map +0 -1
- package/dist/types/model/config/AbstractTagConfig.d.ts +0 -24
- package/dist/types/model/config/AbstractTagConfig.d.ts.map +0 -1
- package/dist/types/model/config/BitConfig.d.ts +0 -48
- package/dist/types/model/config/BitConfig.d.ts.map +0 -1
- package/dist/types/model/config/CardSetConfig.d.ts +0 -14
- package/dist/types/model/config/CardSetConfig.d.ts.map +0 -1
- package/dist/types/model/config/CardVariantConfig.d.ts +0 -16
- package/dist/types/model/config/CardVariantConfig.d.ts.map +0 -1
- package/dist/types/model/config/MarkupTagConfig.d.ts +0 -17
- package/dist/types/model/config/MarkupTagConfig.d.ts.map +0 -1
- package/dist/types/model/config/PropertyTagConfig.d.ts +0 -23
- package/dist/types/model/config/PropertyTagConfig.d.ts.map +0 -1
- package/dist/types/model/config/ResourceTagConfig.d.ts +0 -18
- package/dist/types/model/config/ResourceTagConfig.d.ts.map +0 -1
- package/dist/types/model/config/ResourcesConfig.d.ts +0 -14
- package/dist/types/model/config/ResourcesConfig.d.ts.map +0 -1
- package/dist/types/model/config/TagConfig.d.ts +0 -5
- package/dist/types/model/config/TagConfig.d.ts.map +0 -1
- package/dist/types/model/config/TagsConfig.d.ts +0 -5
- package/dist/types/model/config/TagsConfig.d.ts.map +0 -1
- package/dist/types/model/config/TagsConfigWithInfo.d.ts +0 -9
- package/dist/types/model/config/TagsConfigWithInfo.d.ts.map +0 -1
- package/dist/types/model/config/_Config.d.ts +0 -119
- package/dist/types/model/config/_Config.d.ts.map +0 -1
- package/dist/types/model/config/enum/CardSetConfigKey.d.ts +0 -43
- package/dist/types/model/config/enum/CardSetConfigKey.d.ts.map +0 -1
- package/dist/types/model/config/enum/ConfigKey.d.ts +0 -578
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +0 -1
- package/dist/types/model/config/enum/GroupConfigKey.d.ts +0 -144
- package/dist/types/model/config/enum/GroupConfigKey.d.ts.map +0 -1
- package/dist/types/model/config/enum/GroupConfigType.d.ts +0 -16
- package/dist/types/model/config/enum/GroupConfigType.d.ts.map +0 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +0 -618
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +0 -1
- package/dist/types/model/config/enum/ResourceConfigKey.d.ts +0 -87
- package/dist/types/model/config/enum/ResourceConfigKey.d.ts.map +0 -1
- package/dist/types/model/config/enum/TagConfigKey.d.ts +0 -51
- package/dist/types/model/config/enum/TagConfigKey.d.ts.map +0 -1
- package/dist/types/model/enum/BitTagType.d.ts +0 -15
- package/dist/types/model/enum/BitTagType.d.ts.map +0 -1
- package/dist/types/model/enum/BitType.d.ts +0 -1143
- package/dist/types/model/enum/BitType.d.ts.map +0 -1
- package/dist/types/model/enum/BitmarkGeneratorOutput.d.ts +0 -1
- package/dist/types/model/enum/BitmarkGeneratorOutput.d.ts.map +0 -1
- package/dist/types/model/enum/BitmarkParserType.d.ts +0 -7
- package/dist/types/model/enum/BitmarkParserType.d.ts.map +0 -1
- package/dist/types/model/enum/BitmarkVersion.d.ts +0 -12
- package/dist/types/model/enum/BitmarkVersion.d.ts.map +0 -1
- package/dist/types/model/enum/BodyBitType.d.ts +0 -25
- package/dist/types/model/enum/BodyBitType.d.ts.map +0 -1
- package/dist/types/model/enum/BodyTextFormat.d.ts +0 -17
- package/dist/types/model/enum/BodyTextFormat.d.ts.map +0 -1
- package/dist/types/model/enum/CardSetVersion.d.ts +0 -11
- package/dist/types/model/enum/CardSetVersion.d.ts.map +0 -1
- package/dist/types/model/enum/Count.d.ts +0 -7
- package/dist/types/model/enum/Count.d.ts.map +0 -1
- package/dist/types/model/enum/DeprecatedTextFormat.d.ts +0 -7
- package/dist/types/model/enum/DeprecatedTextFormat.d.ts.map +0 -1
- package/dist/types/model/enum/ExampleType.d.ts +0 -13
- package/dist/types/model/enum/ExampleType.d.ts.map +0 -1
- package/dist/types/model/enum/PropertyAstKey.d.ts +0 -22
- package/dist/types/model/enum/PropertyAstKey.d.ts.map +0 -1
- package/dist/types/model/enum/PropertyFormat.d.ts +0 -19
- package/dist/types/model/enum/PropertyFormat.d.ts.map +0 -1
- package/dist/types/model/enum/PropertyJsonKey.d.ts +0 -10
- package/dist/types/model/enum/PropertyJsonKey.d.ts.map +0 -1
- package/dist/types/model/enum/PropertyTag.d.ts +0 -419
- package/dist/types/model/enum/PropertyTag.d.ts.map +0 -1
- package/dist/types/model/enum/ResourceJsonKey.d.ts +0 -45
- package/dist/types/model/enum/ResourceJsonKey.d.ts.map +0 -1
- package/dist/types/model/enum/ResourceTag.d.ts +0 -63
- package/dist/types/model/enum/ResourceTag.d.ts.map +0 -1
- package/dist/types/model/enum/Tag.d.ts +0 -33
- package/dist/types/model/enum/Tag.d.ts.map +0 -1
- package/dist/types/model/enum/TextFormat.d.ts +0 -17
- package/dist/types/model/enum/TextFormat.d.ts.map +0 -1
- package/dist/types/model/enum/TextLocation.d.ts +0 -16
- package/dist/types/model/enum/TextLocation.d.ts.map +0 -1
- package/dist/types/model/enum/TextMarkType.d.ts +0 -93
- package/dist/types/model/enum/TextMarkType.d.ts.map +0 -1
- package/dist/types/model/enum/TextNodeType.d.ts +0 -53
- package/dist/types/model/enum/TextNodeType.d.ts.map +0 -1
- package/dist/types/model/enum/TextSection.d.ts +0 -27
- package/dist/types/model/enum/TextSection.d.ts.map +0 -1
- package/dist/types/model/info/enum/InfoFormat.d.ts +0 -13
- package/dist/types/model/info/enum/InfoFormat.d.ts.map +0 -1
- package/dist/types/model/info/enum/InfoType.d.ts +0 -15
- package/dist/types/model/info/enum/InfoType.d.ts.map +0 -1
- package/dist/types/model/json/BitJson.d.ts +0 -479
- package/dist/types/model/json/BitJson.d.ts.map +0 -1
- package/dist/types/model/json/BitWrapperJson.d.ts +0 -8
- package/dist/types/model/json/BitWrapperJson.d.ts.map +0 -1
- package/dist/types/model/json/BodyBitJson.d.ts +0 -81
- package/dist/types/model/json/BodyBitJson.d.ts.map +0 -1
- package/dist/types/model/json/ParserJson.d.ts +0 -12
- package/dist/types/model/json/ParserJson.d.ts.map +0 -1
- package/dist/types/model/json/ResourceJson.d.ts +0 -244
- package/dist/types/model/json/ResourceJson.d.ts.map +0 -1
- package/dist/types/model/parser/ParserData.d.ts +0 -11
- package/dist/types/model/parser/ParserData.d.ts.map +0 -1
- package/dist/types/model/parser/ParserError.d.ts +0 -17
- package/dist/types/model/parser/ParserError.d.ts.map +0 -1
- package/dist/types/model/parser/ParserInfo.d.ts +0 -10
- package/dist/types/model/parser/ParserInfo.d.ts.map +0 -1
- package/dist/types/model/parser/ParserLocation.d.ts +0 -6
- package/dist/types/model/parser/ParserLocation.d.ts.map +0 -1
- package/dist/types/model/parser/ParserLocationRange.d.ts +0 -10
- package/dist/types/model/parser/ParserLocationRange.d.ts.map +0 -1
- package/dist/types/model/parser/TagValidationData.d.ts +0 -24
- package/dist/types/model/parser/TagValidationData.d.ts.map +0 -1
- package/dist/types/parser/bitmark/BitmarkParser.d.ts +0 -21
- package/dist/types/parser/bitmark/BitmarkParser.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParser.d.ts +0 -8
- package/dist/types/parser/bitmark/peg/BitmarkPegParser.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts +0 -108
- package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +0 -137
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +0 -333
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +0 -186
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/PeggyGrammarLocation.d.ts +0 -61
- package/dist/types/parser/bitmark/peg/PeggyGrammarLocation.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts +0 -37
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +0 -7
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts +0 -15
- package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts +0 -4
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +0 -14
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts +0 -6
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts +0 -4
- package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts +0 -6
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts +0 -4
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +0 -14
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +0 -11
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +0 -6
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts +0 -4
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +0 -1
- package/dist/types/parser/json/JsonParser.d.ts +0 -59
- package/dist/types/parser/json/JsonParser.d.ts.map +0 -1
- package/dist/types/parser/text/TextParser.d.ts +0 -55
- package/dist/types/parser/text/TextParser.d.ts.map +0 -1
- package/dist/types/parser/text/peg/TextPegParser.d.ts +0 -8
- package/dist/types/parser/text/peg/TextPegParser.d.ts.map +0 -1
- package/dist/types/utils/ArrayUtils.d.ts +0 -25
- package/dist/types/utils/ArrayUtils.d.ts.map +0 -1
- package/dist/types/utils/BitUtils.d.ts +0 -30
- package/dist/types/utils/BitUtils.d.ts.map +0 -1
- package/dist/types/utils/BooleanUtils.d.ts +0 -30
- package/dist/types/utils/BooleanUtils.d.ts.map +0 -1
- package/dist/types/utils/FileUtils.d.ts +0 -12
- package/dist/types/utils/FileUtils.d.ts.map +0 -1
- package/dist/types/utils/NumberUtils.d.ts +0 -47
- package/dist/types/utils/NumberUtils.d.ts.map +0 -1
- package/dist/types/utils/ObjectUtils.d.ts +0 -197
- package/dist/types/utils/ObjectUtils.d.ts.map +0 -1
- package/dist/types/utils/StringUtils.d.ts +0 -77
- package/dist/types/utils/StringUtils.d.ts.map +0 -1
- package/dist/types/utils/UrlUtils.d.ts +0 -7
- package/dist/types/utils/UrlUtils.d.ts.map +0 -1
- package/dist/types/utils/env/Env.d.ts +0 -39
- package/dist/types/utils/env/Env.d.ts.map +0 -1
- package/dist/types/utils/env/Environment.d.ts +0 -21
- package/dist/types/utils/env/Environment.d.ts.map +0 -1
- package/dist/types/utils/env/Os.d.ts +0 -19
- package/dist/types/utils/env/Os.d.ts.map +0 -1
- package/dist/types/utils/env/Version.d.ts +0 -10
- package/dist/types/utils/env/Version.d.ts.map +0 -1
- package/dist/types/utils/env/userAgent.d.ts +0 -11
- package/dist/types/utils/env/userAgent.d.ts.map +0 -1
- package/dist/types/utils/polyfill/fs.d.ts +0 -6
- package/dist/types/utils/polyfill/fs.d.ts.map +0 -1
|
@@ -1,1578 +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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import structuredClone from '@ungap/structured-clone';
|
|
22
|
-
import { Ast } from '../../ast/Ast';
|
|
23
|
-
import { Breakscape } from '../../breakscaping/Breakscape';
|
|
24
|
-
import { Config } from '../../config/Config';
|
|
25
|
-
import { NodeType } from '../../model/ast/NodeType';
|
|
26
|
-
import { BitType } from '../../model/enum/BitType';
|
|
27
|
-
import { BitmarkVersion, DEFAULT_BITMARK_VERSION } from '../../model/enum/BitmarkVersion';
|
|
28
|
-
import { BodyBitType } from '../../model/enum/BodyBitType';
|
|
29
|
-
import { ExampleType } from '../../model/enum/ExampleType';
|
|
30
|
-
import { ResourceTag } from '../../model/enum/ResourceTag';
|
|
31
|
-
import { TextFormat } from '../../model/enum/TextFormat';
|
|
32
|
-
import { TextLocation } from '../../model/enum/TextLocation';
|
|
33
|
-
import { TextNodeType } from '../../model/enum/TextNodeType';
|
|
34
|
-
import { TextParser } from '../../parser/text/TextParser';
|
|
35
|
-
import { BooleanUtils } from '../../utils/BooleanUtils';
|
|
36
|
-
import { NumberUtils } from '../../utils/NumberUtils';
|
|
37
|
-
import { AstWalkerGenerator } from '../AstWalkerGenerator';
|
|
38
|
-
import { TextGenerator } from '../text/TextGenerator';
|
|
39
|
-
const MOVE_BODY_RECURSION_LIMIT = 5000;
|
|
40
|
-
const DEFAULT_OPTIONS = {
|
|
41
|
-
// debugGenerationInline: true,
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Generate bitmark JSON from a bitmark AST
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
class JsonGenerator extends AstWalkerGenerator {
|
|
49
|
-
/**
|
|
50
|
-
* Generate bitmark JSON from a bitmark AST
|
|
51
|
-
*
|
|
52
|
-
* @param writer - destination for the output
|
|
53
|
-
* @param options - JSON generation options
|
|
54
|
-
*/
|
|
55
|
-
constructor(writer, options) {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
super();
|
|
58
|
-
this.ast = new Ast();
|
|
59
|
-
this.textParser = new TextParser();
|
|
60
|
-
// State
|
|
61
|
-
this.json = [];
|
|
62
|
-
this.bitWrapperJson = {};
|
|
63
|
-
this.bitJson = {};
|
|
64
|
-
this.textDefault = Breakscape.EMPTY_STRING;
|
|
65
|
-
this.bodyDefault = Breakscape.EMPTY_STRING;
|
|
66
|
-
this.bodyJson = this.bodyDefault;
|
|
67
|
-
this.placeholderIndex = 0;
|
|
68
|
-
// Bind callbacks
|
|
69
|
-
this.enter = this.enter.bind(this);
|
|
70
|
-
this.between = this.between.bind(this);
|
|
71
|
-
this.exit = this.exit.bind(this);
|
|
72
|
-
this.leaf = this.leaf.bind(this);
|
|
73
|
-
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
74
|
-
this.bitmarkVersion = (_a = BitmarkVersion.fromValue(options === null || options === void 0 ? void 0 : options.bitmarkVersion)) !== null && _a !== void 0 ? _a : DEFAULT_BITMARK_VERSION;
|
|
75
|
-
this.textParserVersion = this.textParser.version();
|
|
76
|
-
this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options === null || options === void 0 ? void 0 : options.jsonOptions);
|
|
77
|
-
this.debugGenerationInline = (_b = this.options.debugGenerationInline) !== null && _b !== void 0 ? _b : false;
|
|
78
|
-
this.jsonPrettifySpace = this.options.prettify === true ? 2 : this.options.prettify || undefined;
|
|
79
|
-
// Set defaults according to bitmark version
|
|
80
|
-
if (this.bitmarkVersion === BitmarkVersion.v2) {
|
|
81
|
-
if (this.options.textAsPlainText === undefined) {
|
|
82
|
-
this.options.textAsPlainText = true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
if (this.options.textAsPlainText === undefined) {
|
|
87
|
-
this.options.textAsPlainText = false;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// Create the text generator for generating v2 texts
|
|
91
|
-
this.textGenerator = new TextGenerator(BitmarkVersion.v2, {
|
|
92
|
-
// writeCallback: this.write,
|
|
93
|
-
bodyBitCallback: this.bodyBitCallback,
|
|
94
|
-
debugGenerationInline: this.debugGenerationInline,
|
|
95
|
-
});
|
|
96
|
-
this.writer = writer;
|
|
97
|
-
this.generatePropertyHandlers();
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Generate bitmark markup from bitmark AST
|
|
101
|
-
*
|
|
102
|
-
* @param ast bitmark AST
|
|
103
|
-
*/
|
|
104
|
-
generate(ast) {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
// Reset the state
|
|
107
|
-
this.resetState();
|
|
108
|
-
// Open the writer
|
|
109
|
-
yield this.writer.open();
|
|
110
|
-
// Walk the bitmark AST
|
|
111
|
-
this.walkAndWrite(ast);
|
|
112
|
-
// Write the JSON object to file
|
|
113
|
-
this.write(JSON.stringify(this.json, null, this.jsonPrettifySpace));
|
|
114
|
-
// Close the writer
|
|
115
|
-
yield this.writer.close();
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Generate text from a bitmark text AST synchronously
|
|
120
|
-
*
|
|
121
|
-
* @param ast bitmark text AST
|
|
122
|
-
*/
|
|
123
|
-
generateSync(ast) {
|
|
124
|
-
// Reset the state
|
|
125
|
-
this.resetState();
|
|
126
|
-
// Open the writer
|
|
127
|
-
this.writer.openSync();
|
|
128
|
-
// Walk the bitmark AST
|
|
129
|
-
this.walkAndWrite(ast);
|
|
130
|
-
// Close the writer
|
|
131
|
-
this.writer.closeSync();
|
|
132
|
-
}
|
|
133
|
-
resetState() {
|
|
134
|
-
this.json = [];
|
|
135
|
-
this.bitWrapperJson = {};
|
|
136
|
-
this.bitJson = {};
|
|
137
|
-
this.textDefault = this.options.textAsPlainText ? Breakscape.EMPTY_STRING : [];
|
|
138
|
-
this.bodyDefault = this.options.textAsPlainText ? Breakscape.EMPTY_STRING : [];
|
|
139
|
-
this.bodyJson = this.bodyDefault;
|
|
140
|
-
this.listItem = undefined;
|
|
141
|
-
this.placeholderIndex = 0;
|
|
142
|
-
this.printed = false;
|
|
143
|
-
}
|
|
144
|
-
walkAndWrite(ast) {
|
|
145
|
-
// Walk the bitmark AST
|
|
146
|
-
this.ast.walk(ast, NodeType.bitmarkAst, this, undefined);
|
|
147
|
-
}
|
|
148
|
-
//
|
|
149
|
-
// NODE HANDLERS
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
// Non-Terminal nodes (branches)
|
|
153
|
-
//
|
|
154
|
-
// bitmark
|
|
155
|
-
enter_bitmarkAst(_node, _route) {
|
|
156
|
-
// Reset the JSON
|
|
157
|
-
this.json = [];
|
|
158
|
-
}
|
|
159
|
-
exit_bitmarkAst(_node, _route) {
|
|
160
|
-
// Convert all bitmark text to plain text if required
|
|
161
|
-
if (this.options.textAsPlainText) {
|
|
162
|
-
// Convert all bitmark text to plain text
|
|
163
|
-
this.convertAllBitmarkTextsToStringsForPlainText(this.json);
|
|
164
|
-
}
|
|
165
|
-
// Walk the entire json object and remove all' '_xxx' properties
|
|
166
|
-
// (which are used to store temporary data during the generation process)
|
|
167
|
-
this.removeTemporaryProperties(this.json);
|
|
168
|
-
}
|
|
169
|
-
// bitmarkAst -> bits
|
|
170
|
-
// bitmarkAst -> bits -> bitsValue
|
|
171
|
-
enter_bitsValue(node, _route) {
|
|
172
|
-
var _a, _b;
|
|
173
|
-
const bit = node.value;
|
|
174
|
-
// Reset
|
|
175
|
-
this.bitWrapperJson = {
|
|
176
|
-
//
|
|
177
|
-
};
|
|
178
|
-
this.json.push(this.bitWrapperJson);
|
|
179
|
-
this.bitJson = this.createBitJson(bit);
|
|
180
|
-
this.bitWrapperJson.bit = this.bitJson;
|
|
181
|
-
// Handle example at the root level - this is bit dependent; configuration is in the bit metadata
|
|
182
|
-
// There is same logic here to select the correct default value of the example is the default is
|
|
183
|
-
// required, and this is bit depenedent.
|
|
184
|
-
// This is ugly, but it is even uglier if the defaults at set in the AST.
|
|
185
|
-
const bitConfig = Config.getBitConfig(bit.bitType);
|
|
186
|
-
const textFormat = this.getTextFormat(_route);
|
|
187
|
-
const hasRootExample = !!bitConfig.rootExampleType;
|
|
188
|
-
const isBoolean = bitConfig.rootExampleType === ExampleType.boolean;
|
|
189
|
-
if (hasRootExample) {
|
|
190
|
-
// Calculate the value of the default example
|
|
191
|
-
let defaultExample;
|
|
192
|
-
if (isBoolean) {
|
|
193
|
-
// Boolean example
|
|
194
|
-
defaultExample = true;
|
|
195
|
-
if (Config.isOfBitType(bit.bitType, BitType.trueFalse1)) {
|
|
196
|
-
if (((_b = (_a = bit.cardNode) === null || _a === void 0 ? void 0 : _a.statement) === null || _b === void 0 ? void 0 : _b.isCorrect) !== undefined) {
|
|
197
|
-
defaultExample = bit.cardNode.statement.isCorrect;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
// String example
|
|
203
|
-
// Don't use sampleSolution as the default example for conversation bits
|
|
204
|
-
// See: https://github.com/getMoreBrain/cosmic/issues/7293
|
|
205
|
-
// defaultExample = (ArrayUtils.asSingle(bit.sampleSolution) as string) ?? '';
|
|
206
|
-
defaultExample = 'true';
|
|
207
|
-
}
|
|
208
|
-
const exampleRes = this.toExample(bit, {
|
|
209
|
-
defaultExample,
|
|
210
|
-
isBoolean,
|
|
211
|
-
textFormat,
|
|
212
|
-
});
|
|
213
|
-
this.bitJson.isExample = exampleRes.isExample;
|
|
214
|
-
this.bitJson.example = exampleRes.example;
|
|
215
|
-
}
|
|
216
|
-
else if (bit.isExample) {
|
|
217
|
-
this.bitJson.isExample = true;
|
|
218
|
-
}
|
|
219
|
-
// Reset the placeholder index
|
|
220
|
-
this.placeholderIndex = 0;
|
|
221
|
-
}
|
|
222
|
-
exit_bitsValue(_node, _route) {
|
|
223
|
-
// Move isExample / example to end of bit JSON from beginning
|
|
224
|
-
const isExample = this.bitJson.isExample;
|
|
225
|
-
const example = this.bitJson.example;
|
|
226
|
-
delete this.bitJson.isExample;
|
|
227
|
-
delete this.bitJson.example;
|
|
228
|
-
this.bitJson.isExample = isExample;
|
|
229
|
-
this.bitJson.example = example;
|
|
230
|
-
// Clean up the bit JSON, removing any unwanted values
|
|
231
|
-
this.cleanBitJson(this.bitJson);
|
|
232
|
-
}
|
|
233
|
-
// bitmarkAst -> bits -> bitsValue -> imageSource
|
|
234
|
-
enter_imageSource(node, route) {
|
|
235
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
236
|
-
}
|
|
237
|
-
// bitmarkAst -> bits -> bitsValue -> person
|
|
238
|
-
enter_person(node, route) {
|
|
239
|
-
const bitType = this.getBitType(route);
|
|
240
|
-
let keyOverride = 'person';
|
|
241
|
-
if (Config.isOfBitType(bitType, BitType.conversationLeft1)) {
|
|
242
|
-
// Use the legacy partner property in the JSON for conversation bits, so change to person is backwards compatible
|
|
243
|
-
keyOverride = 'partner';
|
|
244
|
-
}
|
|
245
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false, keyOverride });
|
|
246
|
-
}
|
|
247
|
-
// bitmarkAst -> bits -> bitsValue -> ratingLevelStart
|
|
248
|
-
enter_ratingLevelStart(node, route) {
|
|
249
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
250
|
-
}
|
|
251
|
-
// bitmarkAst -> bits -> bitsValue -> ratingLevelEnd
|
|
252
|
-
enter_ratingLevelEnd(node, route) {
|
|
253
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
254
|
-
}
|
|
255
|
-
// bitmarkAst -> bits -> bitsValue -> productId
|
|
256
|
-
enter_productId(node, route) {
|
|
257
|
-
const productIds = node.value;
|
|
258
|
-
// Ignore item that is not at the correct level
|
|
259
|
-
const parent = this.getParentNode(route);
|
|
260
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
261
|
-
return true;
|
|
262
|
-
const bitType = this.getBitType(route);
|
|
263
|
-
if (bitType === BitType.module) {
|
|
264
|
-
this.addProperty(this.bitJson, 'productId', productIds, { array: true });
|
|
265
|
-
}
|
|
266
|
-
else if (productIds.length > 0) {
|
|
267
|
-
this.addProperty(this.bitJson, 'productId', productIds[productIds.length - 1], { array: false });
|
|
268
|
-
}
|
|
269
|
-
// Stop traversal of this branch
|
|
270
|
-
return false;
|
|
271
|
-
}
|
|
272
|
-
// bitmarkAst -> bits -> bitsValue -> markConfig
|
|
273
|
-
enter_markConfig(_node, _route) {
|
|
274
|
-
// Handler so markConfig is not processed by the default property handler
|
|
275
|
-
// Continue traversal
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
// bitmarkAst -> bits -> bitsValue -> markConfig -> markConfigValue
|
|
279
|
-
enter_markConfigValue(node, route) {
|
|
280
|
-
const markJson = node.value;
|
|
281
|
-
// Ignore item that is not at the correct level
|
|
282
|
-
const parent = this.getParentNode(route);
|
|
283
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.markConfig)
|
|
284
|
-
return true;
|
|
285
|
-
if (!this.bitJson.marks)
|
|
286
|
-
this.bitJson.marks = [];
|
|
287
|
-
this.bitJson.marks.push(markJson);
|
|
288
|
-
// Stop traversal of this branch
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
// bitmarkAst -> bits -> bitsValue -> item
|
|
292
|
-
enter_item(node, route) {
|
|
293
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
294
|
-
}
|
|
295
|
-
// bitmarkAst -> bits -> bitsValue -> lead
|
|
296
|
-
enter_lead(node, route) {
|
|
297
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
298
|
-
}
|
|
299
|
-
// bitmarkAst -> bits -> bitsValue -> pageNumber
|
|
300
|
-
enter_pageNumber(node, route) {
|
|
301
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
302
|
-
}
|
|
303
|
-
// bitmarkAst -> bits -> bitsValue -> marginNumber
|
|
304
|
-
enter_marginNumber(node, route) {
|
|
305
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
306
|
-
}
|
|
307
|
-
// bitmarkAst -> bits -> bitsValue -> hint
|
|
308
|
-
enter_hint(node, route) {
|
|
309
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
310
|
-
}
|
|
311
|
-
// bitmarkAst -> bits -> bitsValue -> instruction
|
|
312
|
-
enter_instruction(node, route) {
|
|
313
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
314
|
-
}
|
|
315
|
-
// bitmarkAst -> bits -> bitsValue -> title
|
|
316
|
-
enter_title(node, route) {
|
|
317
|
-
// // Ignore title that are not at the bit or card node level as they are handled elsewhere
|
|
318
|
-
// const parent = this.getParentNode(route);
|
|
319
|
-
// if (parent?.key !== NodeType.bitsValue && parent?.key !== NodeType.cardNode) return;
|
|
320
|
-
// this.bitJson.title = node.value;
|
|
321
|
-
return this.standardHandler(node, route, [NodeType.bitsValue, NodeType.cardNode], { array: true });
|
|
322
|
-
}
|
|
323
|
-
// bitmarkAst -> bits -> bitsValue -> subtitle
|
|
324
|
-
enter_subtitle(node, route) {
|
|
325
|
-
// this.bitJson.subtitle = node.value;
|
|
326
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
327
|
-
}
|
|
328
|
-
// bitmarkAst -> bits -> bitsValue -> caption
|
|
329
|
-
enter_caption(node, route) {
|
|
330
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
331
|
-
}
|
|
332
|
-
// bitmarkAst -> bits -> bitsValue -> width
|
|
333
|
-
enter_width(node, route) {
|
|
334
|
-
var _a;
|
|
335
|
-
let value = node.value;
|
|
336
|
-
const bitType = this.getBitType(route);
|
|
337
|
-
const parent = this.getParentNode(route);
|
|
338
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.bitsValue && Config.isOfBitType(bitType, BitType.extractorBlock)) {
|
|
339
|
-
value = (_a = NumberUtils.asNumber(value, 0)) !== null && _a !== void 0 ? _a : 0;
|
|
340
|
-
}
|
|
341
|
-
// Add the property
|
|
342
|
-
return this.standardHandler(node, route, undefined, { array: false, valueOverride: value });
|
|
343
|
-
}
|
|
344
|
-
// bitmarkAst -> bits -> bitsValue -> height
|
|
345
|
-
enter_height(node, route) {
|
|
346
|
-
var _a;
|
|
347
|
-
let value = node.value;
|
|
348
|
-
const bitType = this.getBitType(route);
|
|
349
|
-
const parent = this.getParentNode(route);
|
|
350
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.bitsValue && Config.isOfBitType(bitType, BitType.extractorBlock)) {
|
|
351
|
-
value = (_a = NumberUtils.asNumber(value, 0)) !== null && _a !== void 0 ? _a : 0;
|
|
352
|
-
}
|
|
353
|
-
// Add the property
|
|
354
|
-
return this.standardHandler(node, route, undefined, { array: false, valueOverride: value });
|
|
355
|
-
}
|
|
356
|
-
// bitmarkAst -> bits -> bitsValue -> extraProperties
|
|
357
|
-
enter_extraProperties(node, _route) {
|
|
358
|
-
const extraProperties = node.value;
|
|
359
|
-
if (!this.options.excludeUnknownProperties && extraProperties) {
|
|
360
|
-
for (const [key, values] of Object.entries(extraProperties)) {
|
|
361
|
-
let k = key;
|
|
362
|
-
if (Object.prototype.hasOwnProperty.call(this.bitJson, key)) {
|
|
363
|
-
k = `_${key}`;
|
|
364
|
-
}
|
|
365
|
-
this.addProperty(this.bitJson, k, values, { array: true });
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> cardBits -> cardBitsValue
|
|
370
|
-
enter_cardBitsValue(node, route) {
|
|
371
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
372
|
-
const cardBit = node.value;
|
|
373
|
-
// How cardBits are handled depends on the bit type
|
|
374
|
-
const bitType = this.getBitType(route);
|
|
375
|
-
if (!bitType)
|
|
376
|
-
return;
|
|
377
|
-
let listItems;
|
|
378
|
-
if (bitType === BitType.bookReferenceList) {
|
|
379
|
-
if (!this.bitJson.bookReferences)
|
|
380
|
-
this.bitJson.bookReferences = [];
|
|
381
|
-
const bookReference = {};
|
|
382
|
-
this.addProperty(bookReference, 'lang', cardBit.lang, { array: false });
|
|
383
|
-
this.addProperty(bookReference, 'refAuthor', (_a = cardBit.refAuthor) !== null && _a !== void 0 ? _a : [], { array: true });
|
|
384
|
-
this.addProperty(bookReference, 'refBookTitle', (_b = cardBit.refBookTitle) !== null && _b !== void 0 ? _b : [], { array: false });
|
|
385
|
-
this.addProperty(bookReference, 'refPublisher', (_c = cardBit.refPublisher) !== null && _c !== void 0 ? _c : [], { array: true });
|
|
386
|
-
this.addProperty(bookReference, 'refPublicationYear', (_d = cardBit.refPublicationYear) !== null && _d !== void 0 ? _d : [], { array: false });
|
|
387
|
-
this.addProperty(bookReference, 'citationStyle', (_e = cardBit.citationStyle) !== null && _e !== void 0 ? _e : [], { array: false });
|
|
388
|
-
this.bitJson.bookReferences.push(bookReference);
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
391
|
-
// Create the listItems / sections if not already created
|
|
392
|
-
if (bitType === BitType.pageFooter) {
|
|
393
|
-
if (!this.bitJson.sections)
|
|
394
|
-
this.bitJson.sections = [];
|
|
395
|
-
listItems = this.bitJson.sections;
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
if (!this.bitJson.listItems)
|
|
399
|
-
this.bitJson.listItems = [];
|
|
400
|
-
listItems = this.bitJson.listItems;
|
|
401
|
-
}
|
|
402
|
-
// Create this list item
|
|
403
|
-
this.listItem = {
|
|
404
|
-
item: ((_f = cardBit.item) !== null && _f !== void 0 ? _f : []),
|
|
405
|
-
lead: ((_g = cardBit.lead) !== null && _g !== void 0 ? _g : []),
|
|
406
|
-
hint: ((_h = cardBit.hint) !== null && _h !== void 0 ? _h : []),
|
|
407
|
-
instruction: ((_j = cardBit.instruction) !== null && _j !== void 0 ? _j : []),
|
|
408
|
-
// ...this.toItemLeadHintInstruction(node.value),
|
|
409
|
-
body: this.bodyDefault,
|
|
410
|
-
};
|
|
411
|
-
// Delete unwanted properties
|
|
412
|
-
// const nv = node.value;
|
|
413
|
-
// const li: Partial<ListItemJson> = this.listItem;
|
|
414
|
-
listItems.push(this.listItem);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
exit_cardBitsValue(_node, _route) {
|
|
418
|
-
this.listItem = undefined;
|
|
419
|
-
}
|
|
420
|
-
// bitmarkAst -> bits -> bitsValue -> body
|
|
421
|
-
enter_body(node, route) {
|
|
422
|
-
const value = node.value;
|
|
423
|
-
const parent = this.getParentNode(route);
|
|
424
|
-
if (!parent)
|
|
425
|
-
return false;
|
|
426
|
-
const textFormat = this.getTextFormat(route);
|
|
427
|
-
const isBitmarkText = textFormat === TextFormat.bitmarkText;
|
|
428
|
-
this.bodyJson = value.body;
|
|
429
|
-
// Set the correct body property
|
|
430
|
-
if (parent.key === NodeType.bitsValue) {
|
|
431
|
-
// Body is at the bit level
|
|
432
|
-
this.bitJson.body = this.bodyJson;
|
|
433
|
-
const bodyIsBitmarkText = isBitmarkText && this.isBitmarkText(this.bodyJson);
|
|
434
|
-
// Convert the body to plain text if required
|
|
435
|
-
if (this.options.textAsPlainText && bodyIsBitmarkText) {
|
|
436
|
-
const textBody = this.textGenerator.generateSync(this.bodyJson, textFormat, TextLocation.body, {
|
|
437
|
-
noBreakscaping: true,
|
|
438
|
-
});
|
|
439
|
-
this.bitJson.body = (textBody !== null && textBody !== void 0 ? textBody : '').trim();
|
|
440
|
-
}
|
|
441
|
-
else if (bodyIsBitmarkText) {
|
|
442
|
-
// If the body is bitmark text, convert the body bits to move their attributes to the attrs property
|
|
443
|
-
this.bitJson.body = this.moveBodyBitPropertiesToAttrs(this.bodyJson);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
else if (parent.key === NodeType.cardBitsValue) {
|
|
447
|
-
// Body is at the list item (card bit) level
|
|
448
|
-
if (this.listItem)
|
|
449
|
-
this.listItem.body = this.bodyJson;
|
|
450
|
-
}
|
|
451
|
-
// Stop traversal of this branch
|
|
452
|
-
return false;
|
|
453
|
-
}
|
|
454
|
-
bodyBitCallback(bodyBit, _index, _route) {
|
|
455
|
-
// console.log('bodyBitCallback', bodyBit, index, route);
|
|
456
|
-
var _a;
|
|
457
|
-
const placeholder = `{${this.placeholderIndex}}`;
|
|
458
|
-
this.placeholderIndex++;
|
|
459
|
-
this.bitJson.placeholders = (_a = this.bitJson.placeholders) !== null && _a !== void 0 ? _a : {};
|
|
460
|
-
this.bitJson.placeholders[placeholder] = bodyBit;
|
|
461
|
-
return placeholder;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Move all properties of body bits to the attrs property.
|
|
465
|
-
* This function is called recursively to process all body bits in the body tree.
|
|
466
|
-
*
|
|
467
|
-
* NOTE: Internally, the body bit is stored as it appears in bitmark v2, but in v3 all the properties
|
|
468
|
-
* should be in the `attrs` property. The properies are only moved to 'attrs' for the JSON output
|
|
469
|
-
*
|
|
470
|
-
* The original body bit is not modified.
|
|
471
|
-
* The function returns a new body bit with the properties moved.
|
|
472
|
-
*
|
|
473
|
-
* @param nodes the body to process, or the subtree to process
|
|
474
|
-
* @param recursion leave as default, used for recursion only
|
|
475
|
-
* @returns
|
|
476
|
-
*/
|
|
477
|
-
moveBodyBitPropertiesToAttrs(nodes, recursion = 0) {
|
|
478
|
-
if (recursion === 0) {
|
|
479
|
-
nodes = structuredClone(nodes);
|
|
480
|
-
}
|
|
481
|
-
else if (recursion > MOVE_BODY_RECURSION_LIMIT) {
|
|
482
|
-
throw new Error('Recursion limit exceeded');
|
|
483
|
-
}
|
|
484
|
-
for (const node of nodes) {
|
|
485
|
-
if (node.type !== BodyBitType.text && BodyBitType.values().includes(node.type)) {
|
|
486
|
-
const bodyBit = node;
|
|
487
|
-
bodyBit.attrs = {};
|
|
488
|
-
// Move all properties except type to the attrs property
|
|
489
|
-
for (const [key, value] of Object.entries(bodyBit)) {
|
|
490
|
-
if (key === 'type' || key === 'attrs')
|
|
491
|
-
continue;
|
|
492
|
-
bodyBit.attrs[key] = value;
|
|
493
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
494
|
-
delete bodyBit[key];
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
else if (Array.isArray(node.content)) {
|
|
498
|
-
recursion++;
|
|
499
|
-
this.moveBodyBitPropertiesToAttrs(node.content, recursion);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
return nodes;
|
|
503
|
-
}
|
|
504
|
-
// bitmarkAst -> bits -> bitsValue -> footer
|
|
505
|
-
enter_footer(node, route) {
|
|
506
|
-
return this.standardHandler(node, route, undefined, { array: true, valueOverride: node.value.footer });
|
|
507
|
-
}
|
|
508
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> elements
|
|
509
|
-
enter_elements(node, route) {
|
|
510
|
-
return this.standardHandler(node, route, undefined, { array: true });
|
|
511
|
-
}
|
|
512
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards
|
|
513
|
-
enter_flashcards(node, route) {
|
|
514
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true, keyOverride: 'cards' });
|
|
515
|
-
}
|
|
516
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions
|
|
517
|
-
enter_definitions(node, route) {
|
|
518
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
519
|
-
}
|
|
520
|
-
// bitmarkAst -> bits -> bitsValue -> statement
|
|
521
|
-
enter_statement(node, route) {
|
|
522
|
-
var _a, _b;
|
|
523
|
-
const statement = node.value;
|
|
524
|
-
// Ignore statement that is not at the cardNode level as it is handled elsewhere
|
|
525
|
-
const parent = this.getParentNode(route);
|
|
526
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.cardNode)
|
|
527
|
-
return;
|
|
528
|
-
if (statement) {
|
|
529
|
-
this.bitJson.statement = (_a = statement.statement) !== null && _a !== void 0 ? _a : '';
|
|
530
|
-
this.bitJson.isCorrect = (_b = statement.isCorrect) !== null && _b !== void 0 ? _b : false;
|
|
531
|
-
this.bitJson.example = statement.example;
|
|
532
|
-
this.bitJson.isExample = statement.isExample;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> statements -> statementsValue
|
|
536
|
-
enter_statements(node, route) {
|
|
537
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
538
|
-
}
|
|
539
|
-
// bitmarkAst -> bits -> bitsValue -> choices
|
|
540
|
-
// X bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> choices
|
|
541
|
-
// X bitmarkAst -> bits -> bitsValue -> cardNode -> feedbacks -> feedbacksValue -> choices
|
|
542
|
-
enter_choices(node, route) {
|
|
543
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
544
|
-
}
|
|
545
|
-
// bitmarkAst -> bits -> bitsValue -> responses
|
|
546
|
-
// X bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> responses
|
|
547
|
-
enter_responses(node, route) {
|
|
548
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
549
|
-
}
|
|
550
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> feedbacks
|
|
551
|
-
enter_feedbacks(node, route) {
|
|
552
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
553
|
-
}
|
|
554
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes
|
|
555
|
-
enter_quizzes(node, route) {
|
|
556
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
557
|
-
}
|
|
558
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> heading
|
|
559
|
-
enter_heading(node, route) {
|
|
560
|
-
return this.standardHandler(node, route, undefined, { array: false });
|
|
561
|
-
}
|
|
562
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> pairs
|
|
563
|
-
enter_pairs(node, route) {
|
|
564
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
565
|
-
}
|
|
566
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> matrix
|
|
567
|
-
enter_matrix(node, route) {
|
|
568
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
569
|
-
}
|
|
570
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> pronunciationTable
|
|
571
|
-
enter_pronunciationTable(node, route) {
|
|
572
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: false });
|
|
573
|
-
}
|
|
574
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> table
|
|
575
|
-
enter_table(node, route) {
|
|
576
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: false });
|
|
577
|
-
}
|
|
578
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> questions
|
|
579
|
-
enter_questions(node, route) {
|
|
580
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
581
|
-
}
|
|
582
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses
|
|
583
|
-
enter_botResponses(node, route) {
|
|
584
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true, keyOverride: 'responses' });
|
|
585
|
-
}
|
|
586
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> ingredients -> ingredientsValue
|
|
587
|
-
enter_ingredients(node, route) {
|
|
588
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: true });
|
|
589
|
-
}
|
|
590
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList
|
|
591
|
-
enter_captionDefinitionList(node, route) {
|
|
592
|
-
return this.standardHandler(node, route, NodeType.cardNode, { array: false });
|
|
593
|
-
}
|
|
594
|
-
// bitmarkAst -> bits -> bitsValue -> backgroundWallpaper
|
|
595
|
-
enter_backgroundWallpaper(node, route) {
|
|
596
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
597
|
-
}
|
|
598
|
-
// bitmarkAst -> bits -> bitsValue -> imagePlaceholder
|
|
599
|
-
enter_imagePlaceholder(node, route) {
|
|
600
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
601
|
-
}
|
|
602
|
-
// bitmarkAst -> bits -> bitsValue -> resources
|
|
603
|
-
enter_resources(node, route) {
|
|
604
|
-
var _a, _b;
|
|
605
|
-
const resources = node.value;
|
|
606
|
-
const bitType = this.getBitType(route);
|
|
607
|
-
const resourceType = this.getResourceType(route);
|
|
608
|
-
if (!resources || !bitType)
|
|
609
|
-
return true;
|
|
610
|
-
let resourceJson;
|
|
611
|
-
const bitConfig = Config.getBitConfig(bitType);
|
|
612
|
-
const bitResourcesConfig = Config.getBitResourcesConfig(bitType, resourceType);
|
|
613
|
-
const comboMap = bitResourcesConfig.comboResourceTagTypesMap;
|
|
614
|
-
if (bitResourcesConfig.comboResourceTagTypesMap.size > 0) {
|
|
615
|
-
// The resource is a combo resource
|
|
616
|
-
// Extract the resource types from the combo resource
|
|
617
|
-
// NOTE: There should only ever be one combo resource per bit, but the code can handle multiple
|
|
618
|
-
// except for overwriting resourceJson
|
|
619
|
-
for (const [comboTagType, resourceTags] of comboMap.entries()) {
|
|
620
|
-
// Create the combo resource wrapper
|
|
621
|
-
const wrapper = {
|
|
622
|
-
type: comboTagType,
|
|
623
|
-
__typeAlias: comboTagType,
|
|
624
|
-
};
|
|
625
|
-
// For each of the resources in this combo resource, find the actual resource and add it to the JSON
|
|
626
|
-
for (const rt of resourceTags) {
|
|
627
|
-
const r = resources.find((r) => r.__typeAlias === rt);
|
|
628
|
-
// Extract everything except the type from the resource
|
|
629
|
-
if (r) {
|
|
630
|
-
const tagConfig = Config.getTagConfigForTag(bitConfig.tags, r.__typeAlias);
|
|
631
|
-
const key = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.jsonKey) !== null && _a !== void 0 ? _a : r.__typeAlias;
|
|
632
|
-
const tag = (_b = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.tag) !== null && _b !== void 0 ? _b : r.__typeAlias;
|
|
633
|
-
const json = r.__typeAlias === tag ? r : undefined;
|
|
634
|
-
if (json) {
|
|
635
|
-
for (const [k, v] of Object.entries(json)) {
|
|
636
|
-
if (k !== 'type') {
|
|
637
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
638
|
-
wrapper[key] = v;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
resourceJson = wrapper;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
else if (Config.isOfBitType(bitType, [BitType.imagesLogoGrave, BitType.prototypeImages])) {
|
|
648
|
-
// The resource is a logo-grave / prototpye-images resource
|
|
649
|
-
const images = [];
|
|
650
|
-
for (const r of resources) {
|
|
651
|
-
if (r.type === ResourceTag.image) {
|
|
652
|
-
images.push(r);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
if (bitType === BitType.imagesLogoGrave) {
|
|
656
|
-
this.bitJson.logos = images;
|
|
657
|
-
}
|
|
658
|
-
else {
|
|
659
|
-
this.bitJson.images = images;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
else {
|
|
663
|
-
// This is a standard resource. If there is more than one resource, use the first one.
|
|
664
|
-
// There should not be more than one because of validation
|
|
665
|
-
if (resources.length >= 1) {
|
|
666
|
-
resourceJson = resources[0]; // this.parseResourceToJson(bitType, resources[0]);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
this.bitJson.resource = resourceJson;
|
|
670
|
-
return false;
|
|
671
|
-
}
|
|
672
|
-
// bitmarkAst -> bits -> bitsValue -> level
|
|
673
|
-
leaf_level(node, route) {
|
|
674
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
675
|
-
}
|
|
676
|
-
// bitmarkAst -> bits -> bitsValue -> book (array)
|
|
677
|
-
enter_book(node, route) {
|
|
678
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
|
|
679
|
-
}
|
|
680
|
-
// bitmarkAst -> bits -> bitsValue -> book (single)
|
|
681
|
-
leaf_book(node, route) {
|
|
682
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
683
|
-
}
|
|
684
|
-
// bitmarkAst -> bits -> bitsValue -> anchor
|
|
685
|
-
leaf_anchor(node, route) {
|
|
686
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
687
|
-
}
|
|
688
|
-
// bitmarkAst -> bits -> bitsValue -> reference
|
|
689
|
-
leaf_reference(node, route) {
|
|
690
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
691
|
-
}
|
|
692
|
-
// bitmarkAst -> bits -> bitsValue -> referenceEnd
|
|
693
|
-
leaf_referenceEnd(node, route) {
|
|
694
|
-
return this.standardHandler(node, route, NodeType.bitsValue, { array: false });
|
|
695
|
-
}
|
|
696
|
-
// bitmarkAst -> bits -> bitsValue -> markup
|
|
697
|
-
leaf_markup(node, _route) {
|
|
698
|
-
const bitmark = node.value;
|
|
699
|
-
if (bitmark)
|
|
700
|
-
this.bitWrapperJson.bitmark = bitmark;
|
|
701
|
-
// Stop traversal of this branch
|
|
702
|
-
return false;
|
|
703
|
-
}
|
|
704
|
-
// bitmarkAst -> bits -> bitsValue -> * -> internalComment
|
|
705
|
-
enter_internalComment(_node, _route) {
|
|
706
|
-
// Stop traversal of this branch, handled in enter_parser()
|
|
707
|
-
return false;
|
|
708
|
-
}
|
|
709
|
-
// bitmarkAst -> bits -> bitsValue -> parser
|
|
710
|
-
enter_parser(node, route) {
|
|
711
|
-
const parser = node.value;
|
|
712
|
-
const bitType = this.getBitType(route);
|
|
713
|
-
const parent = this.getParentNode(route);
|
|
714
|
-
if (parser && bitType) {
|
|
715
|
-
const { version, excessResources: parserExcessResources, warnings, errors } = parser, parserRest = __rest(parser, ["version", "excessResources", "warnings", "errors"]);
|
|
716
|
-
const bitmarkVersion = `${this.bitmarkVersion}`;
|
|
717
|
-
const textParserVersion = this.textParserVersion;
|
|
718
|
-
// Parse resources to JSON from AST
|
|
719
|
-
let excessResources;
|
|
720
|
-
if (Array.isArray(parserExcessResources) && parserExcessResources.length > 0) {
|
|
721
|
-
excessResources = [];
|
|
722
|
-
for (const r of parserExcessResources) {
|
|
723
|
-
excessResources.push(r);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
// Extract internal comments from the AST and add to the parser
|
|
727
|
-
const internalComments = this.getInternalComments(route);
|
|
728
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType.bitsValue) {
|
|
729
|
-
// Bit level parser information
|
|
730
|
-
this.bitWrapperJson.parser = Object.assign(Object.assign({ version,
|
|
731
|
-
bitmarkVersion,
|
|
732
|
-
textParserVersion,
|
|
733
|
-
internalComments }, parserRest), { warnings,
|
|
734
|
-
errors,
|
|
735
|
-
excessResources });
|
|
736
|
-
if (!this.options.enableWarnings) {
|
|
737
|
-
// Remove warnings if not enabled
|
|
738
|
-
delete this.bitWrapperJson.parser.warnings;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
else {
|
|
742
|
-
// Top level parser information (not specific to a bit)
|
|
743
|
-
// TODO - not sure where this error can be written
|
|
744
|
-
// this.bitWrapperJson.parser = {
|
|
745
|
-
// errors,
|
|
746
|
-
// };
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
// bitmarkAst -> errors
|
|
751
|
-
// protected enter_errors(node: NodeInfo, _route: NodeInfo[],
|
|
752
|
-
// context: Context): void {
|
|
753
|
-
// const errors = node.value as ParserError[] | undefined;
|
|
754
|
-
// if (errors && errors.length > 0) {
|
|
755
|
-
// // Complete bit is invalid
|
|
756
|
-
// // TODO - not sure where this error can be written
|
|
757
|
-
// // this.bitWrapperJson.parser = {
|
|
758
|
-
// // errors,
|
|
759
|
-
// // };
|
|
760
|
-
// }
|
|
761
|
-
// }
|
|
762
|
-
//
|
|
763
|
-
// Generated Node Handlers
|
|
764
|
-
//
|
|
765
|
-
/**
|
|
766
|
-
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
767
|
-
*/
|
|
768
|
-
generatePropertyHandlers() {
|
|
769
|
-
var _a;
|
|
770
|
-
const propertiesConfig = Config.getRawPropertiesConfig();
|
|
771
|
-
for (const propertyConfig of Object.values(propertiesConfig)) {
|
|
772
|
-
const astKey = (_a = propertyConfig.astKey) !== null && _a !== void 0 ? _a : propertyConfig.tag;
|
|
773
|
-
const funcName = `enter_${astKey}`;
|
|
774
|
-
// Skip if the function already exists, allows for custom handlers
|
|
775
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
776
|
-
if (typeof this[funcName] === 'function') {
|
|
777
|
-
continue;
|
|
778
|
-
}
|
|
779
|
-
// Skip 'example' property as it is non-standard and handled elsewhere
|
|
780
|
-
if (astKey === 'example')
|
|
781
|
-
continue;
|
|
782
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
783
|
-
this[funcName] = (node, route) => {
|
|
784
|
-
var _a;
|
|
785
|
-
const value = node.value;
|
|
786
|
-
if (value == null)
|
|
787
|
-
return;
|
|
788
|
-
// if (key === 'progress') debugger;
|
|
789
|
-
// Ignore any property that is not at the bit level as that will be handled by a different handler
|
|
790
|
-
const parent = this.getParentNode(route);
|
|
791
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType.bitsValue)
|
|
792
|
-
return;
|
|
793
|
-
// Convert key as needed
|
|
794
|
-
const jsonKey = (_a = propertyConfig.jsonKey) !== null && _a !== void 0 ? _a : propertyConfig.tag;
|
|
795
|
-
// Add the property
|
|
796
|
-
this.addProperty(this.bitJson, jsonKey, value, { array: !propertyConfig.single });
|
|
797
|
-
};
|
|
798
|
-
// Bind this
|
|
799
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
800
|
-
this[funcName] = this[funcName].bind(this);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
// // END NODE HANDLERS
|
|
804
|
-
//
|
|
805
|
-
// HELPER FUNCTIONS
|
|
806
|
-
//
|
|
807
|
-
/**
|
|
808
|
-
* Default handler for properties.
|
|
809
|
-
*
|
|
810
|
-
* @param node the node
|
|
811
|
-
* @param route the route to the node
|
|
812
|
-
* @param parentNodeTypes the parent node types for which to handle the node
|
|
813
|
-
* @returns
|
|
814
|
-
*/
|
|
815
|
-
standardHandler(node, route, parentNodeTypes, options) {
|
|
816
|
-
var _a, _b;
|
|
817
|
-
// Ignore items not at the nodeType level
|
|
818
|
-
if (parentNodeTypes) {
|
|
819
|
-
const nodeTypeArray = Array.isArray(parentNodeTypes) ? parentNodeTypes : [parentNodeTypes];
|
|
820
|
-
const parent = this.getParentNode(route);
|
|
821
|
-
if (!(parent === null || parent === void 0 ? void 0 : parent.key) || !nodeTypeArray.includes(parent === null || parent === void 0 ? void 0 : parent.key))
|
|
822
|
-
return true;
|
|
823
|
-
}
|
|
824
|
-
// Add the property
|
|
825
|
-
this.addProperty(this.bitJson, (_a = options.keyOverride) !== null && _a !== void 0 ? _a : node.key, (_b = options.valueOverride) !== null && _b !== void 0 ? _b : node.value, options);
|
|
826
|
-
// Stop traversal of this branch
|
|
827
|
-
return false;
|
|
828
|
-
}
|
|
829
|
-
addProperty(
|
|
830
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
831
|
-
target, name, values, options) {
|
|
832
|
-
if (values !== undefined) {
|
|
833
|
-
let finalValue;
|
|
834
|
-
if (!Array.isArray(values))
|
|
835
|
-
values = [values];
|
|
836
|
-
const valuesArr = values;
|
|
837
|
-
// if (valuesArr.length > 0) {
|
|
838
|
-
if (!options.array && valuesArr.length >= 1) {
|
|
839
|
-
finalValue = valuesArr[valuesArr.length - 1];
|
|
840
|
-
}
|
|
841
|
-
else {
|
|
842
|
-
finalValue = valuesArr;
|
|
843
|
-
}
|
|
844
|
-
// }
|
|
845
|
-
if (options.allowNull || finalValue != null) {
|
|
846
|
-
target[name] = finalValue;
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
toExample(node, options) {
|
|
851
|
-
const { isExample, example, __isDefaultExample } = node;
|
|
852
|
-
const { defaultExample, isBoolean } = options;
|
|
853
|
-
if (!isExample) {
|
|
854
|
-
return {
|
|
855
|
-
isExample: false,
|
|
856
|
-
example: null,
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
|
-
let exampleValue;
|
|
860
|
-
if (__isDefaultExample) {
|
|
861
|
-
exampleValue = isBoolean
|
|
862
|
-
? BooleanUtils.toBoolean(defaultExample)
|
|
863
|
-
: this.convertBreakscapedStringToJsonText(defaultExample, options.textFormat, TextLocation.tag);
|
|
864
|
-
}
|
|
865
|
-
else {
|
|
866
|
-
exampleValue = isBoolean
|
|
867
|
-
? BooleanUtils.toBoolean(example)
|
|
868
|
-
: this.convertBreakscapedStringToJsonText(example, options.textFormat, TextLocation.tag);
|
|
869
|
-
}
|
|
870
|
-
return {
|
|
871
|
-
isExample: true,
|
|
872
|
-
example: exampleValue,
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* Get the bit type from any node
|
|
877
|
-
*
|
|
878
|
-
* @param route the route to the current node
|
|
879
|
-
* @returns the bit type
|
|
880
|
-
*/
|
|
881
|
-
getBitType(route) {
|
|
882
|
-
for (const node of route) {
|
|
883
|
-
if (node.key === NodeType.bitsValue) {
|
|
884
|
-
const n = node.value;
|
|
885
|
-
return n === null || n === void 0 ? void 0 : n.bitType;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
return undefined;
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* Get the text format from any node
|
|
892
|
-
*
|
|
893
|
-
* @param route the route to the current node
|
|
894
|
-
* @returns the text format
|
|
895
|
-
*/
|
|
896
|
-
getTextFormat(route) {
|
|
897
|
-
var _a;
|
|
898
|
-
const bitType = this.getBitType(route);
|
|
899
|
-
if (bitType) {
|
|
900
|
-
const bitConfig = Config.getBitConfig(bitType);
|
|
901
|
-
for (const node of route) {
|
|
902
|
-
if (node.key === NodeType.bitsValue) {
|
|
903
|
-
const n = node.value;
|
|
904
|
-
return (_a = TextFormat.fromValue(n === null || n === void 0 ? void 0 : n.textFormat)) !== null && _a !== void 0 ? _a : bitConfig.textFormatDefault;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return TextFormat.bitmarkText;
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* Get the bit resourceType atttachment from any node
|
|
912
|
-
*
|
|
913
|
-
* @param route the route to the current node
|
|
914
|
-
* @returns the bit type
|
|
915
|
-
*/
|
|
916
|
-
getResourceType(route) {
|
|
917
|
-
for (const node of route) {
|
|
918
|
-
if (node.key === NodeType.bitsValue) {
|
|
919
|
-
const n = node.value;
|
|
920
|
-
return n === null || n === void 0 ? void 0 : n.resourceType;
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
return undefined;
|
|
924
|
-
}
|
|
925
|
-
/**
|
|
926
|
-
* Get the internal comments from any node
|
|
927
|
-
*
|
|
928
|
-
* @param route the route to the current node
|
|
929
|
-
* @returns the text format
|
|
930
|
-
*/
|
|
931
|
-
getInternalComments(route) {
|
|
932
|
-
const bitType = this.getBitType(route);
|
|
933
|
-
if (bitType) {
|
|
934
|
-
for (const node of route) {
|
|
935
|
-
if (node.key === NodeType.bitsValue) {
|
|
936
|
-
const n = node.value;
|
|
937
|
-
return n.internalComment;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
return undefined;
|
|
942
|
-
}
|
|
943
|
-
/**
|
|
944
|
-
* Convert the text from the AST to the JSON format:
|
|
945
|
-
* Input:
|
|
946
|
-
* - breakscaped string
|
|
947
|
-
* Output:
|
|
948
|
-
* - text: plain text
|
|
949
|
-
* - json: bitmark text JSON
|
|
950
|
-
* - Bitmark v2: breakscaped string
|
|
951
|
-
* - Bitmark v3: bitmark text JSON (TextAst)
|
|
952
|
-
*
|
|
953
|
-
* In the case of Bitmark v2 type texts, there is nothing to do but cast the type.
|
|
954
|
-
*
|
|
955
|
-
* @param text
|
|
956
|
-
* @returns
|
|
957
|
-
*/
|
|
958
|
-
convertBreakscapedStringToJsonText(text, format, textLocation) {
|
|
959
|
-
if (!text)
|
|
960
|
-
undefined;
|
|
961
|
-
const isBitmarkText = format === TextFormat.bitmarkText;
|
|
962
|
-
if (!isBitmarkText) {
|
|
963
|
-
// Not bitmark text, so plain text, so unbreakscape only the start of bit tags
|
|
964
|
-
return text || '';
|
|
965
|
-
}
|
|
966
|
-
const asPlainText = this.options.textAsPlainText;
|
|
967
|
-
if (asPlainText) {
|
|
968
|
-
return text || '';
|
|
969
|
-
}
|
|
970
|
-
// Use the text parser to parse the text
|
|
971
|
-
const textAst = this.textParser.toAst(text, {
|
|
972
|
-
format,
|
|
973
|
-
location: textLocation,
|
|
974
|
-
});
|
|
975
|
-
return textAst;
|
|
976
|
-
}
|
|
977
|
-
/**
|
|
978
|
-
* Concatenates a plain JSON text with a JsonText that may be plain (v2) or BitmarkText (v3)
|
|
979
|
-
* Returns the combined text.
|
|
980
|
-
*
|
|
981
|
-
* @param text the text to concatenate
|
|
982
|
-
* @param textPlain the plain text to concatenate
|
|
983
|
-
*/
|
|
984
|
-
concatenatePlainTextWithJsonTexts(text, extraBreaks, textPlain) {
|
|
985
|
-
var _a;
|
|
986
|
-
if (Array.isArray(text)) {
|
|
987
|
-
textPlain = textPlain.trim();
|
|
988
|
-
if (textPlain) {
|
|
989
|
-
const splitText = textPlain.split('\n');
|
|
990
|
-
const content = [];
|
|
991
|
-
for (let i = 0; i < extraBreaks; i++) {
|
|
992
|
-
content.push({
|
|
993
|
-
type: TextNodeType.hardBreak,
|
|
994
|
-
});
|
|
995
|
-
}
|
|
996
|
-
for (let i = 0; i < splitText.length; i++) {
|
|
997
|
-
const t = splitText[i];
|
|
998
|
-
if (t) {
|
|
999
|
-
content.push({
|
|
1000
|
-
text: t,
|
|
1001
|
-
type: TextNodeType.text,
|
|
1002
|
-
});
|
|
1003
|
-
}
|
|
1004
|
-
// Add a hard break after each paragraph, except the last one
|
|
1005
|
-
if (i < splitText.length - 1) {
|
|
1006
|
-
content.push({
|
|
1007
|
-
type: TextNodeType.hardBreak,
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
// Add the content to the final paragraph, or create a new one if there none
|
|
1012
|
-
const lastNode = text[text.length - 1];
|
|
1013
|
-
if (lastNode && lastNode.type === TextNodeType.paragraph) {
|
|
1014
|
-
lastNode.content = [...((_a = lastNode.content) !== null && _a !== void 0 ? _a : []), ...content];
|
|
1015
|
-
}
|
|
1016
|
-
else {
|
|
1017
|
-
text.push({
|
|
1018
|
-
type: TextNodeType.paragraph,
|
|
1019
|
-
content,
|
|
1020
|
-
attrs: {},
|
|
1021
|
-
});
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
return text;
|
|
1025
|
-
}
|
|
1026
|
-
return `${text !== null && text !== void 0 ? text : ''}${'\n'.repeat(extraBreaks)}${textPlain !== null && textPlain !== void 0 ? textPlain : ''}`;
|
|
1027
|
-
}
|
|
1028
|
-
/**
|
|
1029
|
-
* Check if an object is bitmark text
|
|
1030
|
-
* The check looks for a special tag on the array (__tag: 'text')
|
|
1031
|
-
*
|
|
1032
|
-
* @param obj object that might be bitmark text
|
|
1033
|
-
* @returns
|
|
1034
|
-
*/
|
|
1035
|
-
isBitmarkText(obj) {
|
|
1036
|
-
if (obj == null)
|
|
1037
|
-
return false;
|
|
1038
|
-
if (!Array.isArray(obj))
|
|
1039
|
-
return false;
|
|
1040
|
-
// Check for the hidden text tag
|
|
1041
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1042
|
-
if (obj.__tag === 'text')
|
|
1043
|
-
return true;
|
|
1044
|
-
return false;
|
|
1045
|
-
}
|
|
1046
|
-
//
|
|
1047
|
-
// WRITE FUNCTIONS
|
|
1048
|
-
//
|
|
1049
|
-
writeInlineDebug(key, state) {
|
|
1050
|
-
let tag = key;
|
|
1051
|
-
if (state.open) {
|
|
1052
|
-
tag = `<${key}>`;
|
|
1053
|
-
}
|
|
1054
|
-
else if (state.close) {
|
|
1055
|
-
tag = `</${key}>`;
|
|
1056
|
-
}
|
|
1057
|
-
else if (state.single) {
|
|
1058
|
-
tag = `<${key} />`;
|
|
1059
|
-
}
|
|
1060
|
-
this.writeString(tag);
|
|
1061
|
-
}
|
|
1062
|
-
writeString(s) {
|
|
1063
|
-
if (s != null)
|
|
1064
|
-
this.write(`${s}`);
|
|
1065
|
-
}
|
|
1066
|
-
/**
|
|
1067
|
-
* Create a new bit json object.
|
|
1068
|
-
* - This function defines the order of the properties in the json.
|
|
1069
|
-
*
|
|
1070
|
-
* @param bit
|
|
1071
|
-
* @returns
|
|
1072
|
-
*/
|
|
1073
|
-
createBitJson(bit) {
|
|
1074
|
-
const format = bit.textFormat;
|
|
1075
|
-
const bitJson = {
|
|
1076
|
-
type: bit.isCommented ? BitType._comment : bit.bitType,
|
|
1077
|
-
originalType: bit.isCommented ? bit.bitType : undefined,
|
|
1078
|
-
format,
|
|
1079
|
-
bitLevel: bit.bitLevel,
|
|
1080
|
-
};
|
|
1081
|
-
return bitJson;
|
|
1082
|
-
}
|
|
1083
|
-
/**
|
|
1084
|
-
* Remove wanted properties from bit json object.
|
|
1085
|
-
* - This function defines the defaults for properties in the json.
|
|
1086
|
-
*
|
|
1087
|
-
* TODO: All these defaults should come from the config and be set in the Builder.
|
|
1088
|
-
*
|
|
1089
|
-
* @param bit
|
|
1090
|
-
* @returns
|
|
1091
|
-
*/
|
|
1092
|
-
cleanBitJson(bitJson) {
|
|
1093
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1094
|
-
const bitType = Config.getBitType(bitJson.type);
|
|
1095
|
-
const bitConfig = Config.getBitConfig(bitType);
|
|
1096
|
-
// const textFormat = bitJson.format;
|
|
1097
|
-
// const plainText = this.options.textAsPlainText;
|
|
1098
|
-
// Clear 'originalType' if not set
|
|
1099
|
-
if (bitJson.originalType == null)
|
|
1100
|
-
bitJson.originalType = undefined;
|
|
1101
|
-
// Clear 'item' which may be an empty string if 'lead' was set but item not
|
|
1102
|
-
// Only necessary because '.article' does not include a default value for 'item'
|
|
1103
|
-
// which is totally inconsistent, but maybe is wanted.
|
|
1104
|
-
if (!bitJson.item)
|
|
1105
|
-
bitJson.item = undefined;
|
|
1106
|
-
// Add default properties to the bit.
|
|
1107
|
-
// NOTE: Not all bits have the same default properties.
|
|
1108
|
-
// The properties used are a bit random sometimes?
|
|
1109
|
-
// It would be better if this functionality was generated from the bit config
|
|
1110
|
-
if (Config.isOfBitType(bitType, [BitType._error, BitType._comment])) {
|
|
1111
|
-
// Special case for _error and _comment bits
|
|
1112
|
-
delete bitJson.format;
|
|
1113
|
-
delete bitJson.item;
|
|
1114
|
-
delete bitJson.lead;
|
|
1115
|
-
delete bitJson.pageNumber;
|
|
1116
|
-
delete bitJson.marginNumber;
|
|
1117
|
-
delete bitJson.hint;
|
|
1118
|
-
delete bitJson.instruction;
|
|
1119
|
-
//
|
|
1120
|
-
}
|
|
1121
|
-
else {
|
|
1122
|
-
let isTopLevelExample = false;
|
|
1123
|
-
let isTopLevelExampleValue = false;
|
|
1124
|
-
// Most bits have these defaults, but there are special cases (not sure if that is by error or design)
|
|
1125
|
-
if (Config.isOfBitType(bitType, [BitType.page])) {
|
|
1126
|
-
// Bits without item, lead, etc
|
|
1127
|
-
if (bitJson.item == null || ((_a = bitJson.item) === null || _a === void 0 ? void 0 : _a.length) === 0)
|
|
1128
|
-
delete bitJson.item;
|
|
1129
|
-
if (bitJson.lead == null || ((_b = bitJson.lead) === null || _b === void 0 ? void 0 : _b.length) === 0)
|
|
1130
|
-
delete bitJson.lead;
|
|
1131
|
-
if (bitJson.pageNumber == null || ((_c = bitJson.pageNumber) === null || _c === void 0 ? void 0 : _c.length) === 0)
|
|
1132
|
-
delete bitJson.pageNumber;
|
|
1133
|
-
if (bitJson.marginNumber == null || ((_d = bitJson.marginNumber) === null || _d === void 0 ? void 0 : _d.length) === 0)
|
|
1134
|
-
delete bitJson.marginNumber;
|
|
1135
|
-
if (bitJson.hint == null || ((_e = bitJson.hint) === null || _e === void 0 ? void 0 : _e.length) === 0)
|
|
1136
|
-
delete bitJson.hint;
|
|
1137
|
-
if (bitJson.instruction == null || ((_f = bitJson.instruction) === null || _f === void 0 ? void 0 : _f.length) === 0)
|
|
1138
|
-
delete bitJson.instruction;
|
|
1139
|
-
}
|
|
1140
|
-
else {
|
|
1141
|
-
// Majority of bits
|
|
1142
|
-
if (bitJson.item == null)
|
|
1143
|
-
bitJson.item = this.textDefault;
|
|
1144
|
-
if (bitJson.lead == null)
|
|
1145
|
-
bitJson.lead = this.textDefault;
|
|
1146
|
-
if (bitJson.hint == null)
|
|
1147
|
-
bitJson.hint = this.textDefault;
|
|
1148
|
-
if (bitJson.instruction == null)
|
|
1149
|
-
bitJson.instruction = this.textDefault;
|
|
1150
|
-
if (bitJson.pageNumber == null)
|
|
1151
|
-
bitJson.pageNumber = this.textDefault;
|
|
1152
|
-
if (bitJson.marginNumber == null)
|
|
1153
|
-
bitJson.marginNumber = this.textDefault;
|
|
1154
|
-
}
|
|
1155
|
-
if (bitJson.body == null)
|
|
1156
|
-
bitJson.body = this.bodyDefault;
|
|
1157
|
-
if (Config.isOfBitType(bitType, [BitType.article])) {
|
|
1158
|
-
//
|
|
1159
|
-
}
|
|
1160
|
-
if (Config.isOfBitType(bitType, [BitType.example])) {
|
|
1161
|
-
// With 'example' value at the bit level.
|
|
1162
|
-
isTopLevelExample = true;
|
|
1163
|
-
isTopLevelExampleValue = true;
|
|
1164
|
-
}
|
|
1165
|
-
if (Config.isOfBitType(bitType, [
|
|
1166
|
-
BitType.multipleChoice1,
|
|
1167
|
-
BitType.multipleResponse1,
|
|
1168
|
-
BitType.multipleChoiceText,
|
|
1169
|
-
BitType.highlightText,
|
|
1170
|
-
BitType.gapText,
|
|
1171
|
-
BitType.gapTextInstructionGrouped,
|
|
1172
|
-
BitType.clozeAndMultipleChoiceText,
|
|
1173
|
-
BitType.sequence,
|
|
1174
|
-
BitType.mark,
|
|
1175
|
-
BitType.flashcard,
|
|
1176
|
-
BitType.definitionList,
|
|
1177
|
-
])) {
|
|
1178
|
-
// With no 'example' value at the bit level.
|
|
1179
|
-
isTopLevelExample = true;
|
|
1180
|
-
if (bitJson.body == null)
|
|
1181
|
-
bitJson.body = this.bodyDefault;
|
|
1182
|
-
}
|
|
1183
|
-
if (Config.isOfBitType(bitType, [BitType.sequence])) {
|
|
1184
|
-
// With 'example' value at the bit level.
|
|
1185
|
-
isTopLevelExample = true;
|
|
1186
|
-
isTopLevelExampleValue = true;
|
|
1187
|
-
if (bitJson.body == null)
|
|
1188
|
-
bitJson.body = this.bodyDefault;
|
|
1189
|
-
}
|
|
1190
|
-
if (Config.isOfBitType(bitType, BitType.cloze)) {
|
|
1191
|
-
// With no 'example' value at the bit level.
|
|
1192
|
-
isTopLevelExample = true;
|
|
1193
|
-
if (Config.isOfBitType(bitType, BitType.clozeSolutionGrouped)) {
|
|
1194
|
-
// Solution grouped
|
|
1195
|
-
if (bitJson.quizCountItems == null)
|
|
1196
|
-
bitJson.quizCountItems = true;
|
|
1197
|
-
if (bitJson.quizStrikethroughSolutions == null)
|
|
1198
|
-
bitJson.quizStrikethroughSolutions = true;
|
|
1199
|
-
}
|
|
1200
|
-
else if (Config.isOfBitType(bitType, BitType.clozeInstructionGrouped)) {
|
|
1201
|
-
// Instruction grouped
|
|
1202
|
-
if (bitJson.quizCountItems == null)
|
|
1203
|
-
bitJson.quizCountItems = true;
|
|
1204
|
-
if (bitJson.quizStrikethroughSolutions == null)
|
|
1205
|
-
bitJson.quizStrikethroughSolutions = false;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
if (Config.isOfBitType(bitType, [BitType.multipleChoice, BitType.multipleResponse])) {
|
|
1209
|
-
// Default with a card (and hence a footer possibility)
|
|
1210
|
-
isTopLevelExample = true;
|
|
1211
|
-
if (bitJson.body == null)
|
|
1212
|
-
bitJson.body = this.bodyDefault;
|
|
1213
|
-
if (bitJson.footer == null)
|
|
1214
|
-
bitJson.footer = this.textDefault;
|
|
1215
|
-
}
|
|
1216
|
-
if (Config.isOfBitType(bitType, BitType.essay)) {
|
|
1217
|
-
// With 'example' value at the bit level.
|
|
1218
|
-
isTopLevelExample = true;
|
|
1219
|
-
isTopLevelExampleValue = true;
|
|
1220
|
-
if (bitJson.body == null)
|
|
1221
|
-
bitJson.body = this.bodyDefault;
|
|
1222
|
-
if (bitJson.partialAnswer == null)
|
|
1223
|
-
bitJson.partialAnswer = '';
|
|
1224
|
-
// if (bitJson.sampleSolution == null) bitJson.sampleSolution = '';
|
|
1225
|
-
}
|
|
1226
|
-
if (Config.isOfBitType(bitType, BitType.trueFalse1)) {
|
|
1227
|
-
// With 'example' value at the bit level.
|
|
1228
|
-
isTopLevelExample = true;
|
|
1229
|
-
isTopLevelExampleValue = true;
|
|
1230
|
-
if (bitJson.isCorrect == null)
|
|
1231
|
-
bitJson.isCorrect = false;
|
|
1232
|
-
if (bitJson.body == null)
|
|
1233
|
-
bitJson.body = this.bodyDefault;
|
|
1234
|
-
}
|
|
1235
|
-
if (Config.isOfBitType(bitType, BitType.trueFalse)) {
|
|
1236
|
-
// With no 'example' value at the bit level.
|
|
1237
|
-
isTopLevelExample = true;
|
|
1238
|
-
if (bitJson.labelFalse == null)
|
|
1239
|
-
bitJson.labelFalse = '';
|
|
1240
|
-
if (bitJson.labelTrue == null)
|
|
1241
|
-
bitJson.labelTrue = '';
|
|
1242
|
-
if (bitJson.body == null)
|
|
1243
|
-
bitJson.body = this.bodyDefault;
|
|
1244
|
-
}
|
|
1245
|
-
if (Config.isOfBitType(bitType, BitType.chapter)) {
|
|
1246
|
-
//
|
|
1247
|
-
if (bitJson.toc == null)
|
|
1248
|
-
bitJson.toc = true; // Always set on chapter bits?
|
|
1249
|
-
if (bitJson.progress == null)
|
|
1250
|
-
bitJson.progress = true; // Always set on chapter bits
|
|
1251
|
-
if (bitJson.level == null)
|
|
1252
|
-
bitJson.level = 1; // Set level 1 if none set (makes no sense, but in ANTLR parser)
|
|
1253
|
-
if (bitJson.body == null)
|
|
1254
|
-
bitJson.body = this.bodyDefault;
|
|
1255
|
-
//
|
|
1256
|
-
}
|
|
1257
|
-
if (Config.isOfBitType(bitType, BitType.interview)) {
|
|
1258
|
-
// With no 'example' value at the bit level.
|
|
1259
|
-
isTopLevelExample = true;
|
|
1260
|
-
if (bitJson.body == null)
|
|
1261
|
-
bitJson.body = this.bodyDefault;
|
|
1262
|
-
if (bitJson.footer == null)
|
|
1263
|
-
bitJson.footer = this.textDefault;
|
|
1264
|
-
if (bitJson.questions == null)
|
|
1265
|
-
bitJson.questions = [];
|
|
1266
|
-
}
|
|
1267
|
-
if (bitType === BitType.matchMatrix) {
|
|
1268
|
-
// With no 'example' value at the bit level.
|
|
1269
|
-
isTopLevelExample = true;
|
|
1270
|
-
}
|
|
1271
|
-
if (Config.isOfBitType(bitType, BitType.match)) {
|
|
1272
|
-
// With no 'example' value at the bit level.
|
|
1273
|
-
isTopLevelExample = true;
|
|
1274
|
-
if (bitJson.heading == null)
|
|
1275
|
-
bitJson.heading = {};
|
|
1276
|
-
}
|
|
1277
|
-
if (Config.isOfBitType(bitType, BitType.learningPathBook)) {
|
|
1278
|
-
//
|
|
1279
|
-
if (bitJson.isTracked == null)
|
|
1280
|
-
bitJson.isTracked = true;
|
|
1281
|
-
if (bitJson.isInfoOnly == null)
|
|
1282
|
-
bitJson.isInfoOnly = false;
|
|
1283
|
-
//
|
|
1284
|
-
}
|
|
1285
|
-
if (Config.isOfBitType(bitType, BitType.table)) {
|
|
1286
|
-
//
|
|
1287
|
-
// if (bitJson.content2Buy == null) bitJson.content2Buy = '';
|
|
1288
|
-
if (bitJson.tableFixedHeader == null)
|
|
1289
|
-
bitJson.tableFixedHeader = false;
|
|
1290
|
-
if (bitJson.tableHeaderWhitespaceNoWrap == null)
|
|
1291
|
-
bitJson.tableHeaderWhitespaceNoWrap = true;
|
|
1292
|
-
if (bitJson.tableSearch == null)
|
|
1293
|
-
bitJson.tableSearch = false;
|
|
1294
|
-
if (bitJson.tableSort == null)
|
|
1295
|
-
bitJson.tableSort = false;
|
|
1296
|
-
if (bitJson.tablePagination == null)
|
|
1297
|
-
bitJson.tablePagination = false;
|
|
1298
|
-
if (bitJson.tablePaginationLimit == null)
|
|
1299
|
-
bitJson.tablePaginationLimit = 0;
|
|
1300
|
-
if (bitJson.tableHeight == null)
|
|
1301
|
-
bitJson.tableHeight = 0;
|
|
1302
|
-
if (bitJson.tableWhitespaceNoWrap == null)
|
|
1303
|
-
bitJson.tableWhitespaceNoWrap = false;
|
|
1304
|
-
if (bitJson.tableAutoWidth == null)
|
|
1305
|
-
bitJson.tableAutoWidth = true;
|
|
1306
|
-
if (bitJson.tableResizableColumns == null)
|
|
1307
|
-
bitJson.tableResizableColumns = false;
|
|
1308
|
-
if (bitJson.tableColumnMinWidth == null)
|
|
1309
|
-
bitJson.tableColumnMinWidth = 0;
|
|
1310
|
-
//
|
|
1311
|
-
}
|
|
1312
|
-
if (Config.isOfBitType(bitType, BitType.bookReference)) {
|
|
1313
|
-
//
|
|
1314
|
-
if (bitJson.refAuthor == null)
|
|
1315
|
-
bitJson.refAuthor = [];
|
|
1316
|
-
if (bitJson.refBookTitle == null)
|
|
1317
|
-
bitJson.refBookTitle = '';
|
|
1318
|
-
if (bitJson.refPublisher == null)
|
|
1319
|
-
bitJson.refPublisher = [];
|
|
1320
|
-
if (bitJson.refPublicationYear == null)
|
|
1321
|
-
bitJson.refPublicationYear = '';
|
|
1322
|
-
//
|
|
1323
|
-
}
|
|
1324
|
-
// Page bits
|
|
1325
|
-
if (Config.isOfBitType(bitType, [
|
|
1326
|
-
BitType.pageBanner,
|
|
1327
|
-
BitType.pageBuyButton,
|
|
1328
|
-
BitType.pageBuyButtonAlt,
|
|
1329
|
-
BitType.pageBuyButtonPromotion,
|
|
1330
|
-
BitType.pageFooter,
|
|
1331
|
-
BitType.pageOpenBook,
|
|
1332
|
-
BitType.pagePerson,
|
|
1333
|
-
BitType.pageProduct,
|
|
1334
|
-
BitType.pageProductList,
|
|
1335
|
-
BitType.pageProductVideo,
|
|
1336
|
-
BitType.pageProductVideoList,
|
|
1337
|
-
BitType.pageSectionFolder,
|
|
1338
|
-
BitType.pageSubscribe,
|
|
1339
|
-
BitType.pageSubpage,
|
|
1340
|
-
])) {
|
|
1341
|
-
//
|
|
1342
|
-
if (bitJson.slug == null)
|
|
1343
|
-
bitJson.slug = '';
|
|
1344
|
-
if (bitJson.body == null)
|
|
1345
|
-
bitJson.body = this.bodyDefault;
|
|
1346
|
-
if (Config.isOfBitType(bitType, BitType.pageBuyButton)) {
|
|
1347
|
-
if (bitJson.content2Buy == null)
|
|
1348
|
-
bitJson.content2Buy = '';
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
// Special case for 'toc-resource' bits
|
|
1352
|
-
if (Config.isOfBitType(bitType, BitType.tocResource)) {
|
|
1353
|
-
if (bitJson.tocResource == null)
|
|
1354
|
-
bitJson.tocResource = [];
|
|
1355
|
-
}
|
|
1356
|
-
// Special case for 'toc-content' bits
|
|
1357
|
-
if (Config.isOfBitType(bitType, BitType.tocContent)) {
|
|
1358
|
-
if (bitJson.tocContent == null)
|
|
1359
|
-
bitJson.tocContent = [];
|
|
1360
|
-
}
|
|
1361
|
-
// Special case for 'book' bits
|
|
1362
|
-
if (Config.isOfBitType(bitType, BitType.book)) {
|
|
1363
|
-
if (bitJson.maxTocChapterLevel == null)
|
|
1364
|
-
bitJson.maxTocChapterLevel = -1;
|
|
1365
|
-
if (bitJson.hasMarkAsDone == null)
|
|
1366
|
-
bitJson.hasMarkAsDone = false;
|
|
1367
|
-
if (bitJson.processHandIn == null)
|
|
1368
|
-
bitJson.processHandIn = false;
|
|
1369
|
-
if (bitJson.isPublic == null)
|
|
1370
|
-
bitJson.isPublic = false;
|
|
1371
|
-
if (bitJson.chatWithBook == null)
|
|
1372
|
-
bitJson.chatWithBook = false;
|
|
1373
|
-
if (bitJson.chatWithBookBrainKey == null)
|
|
1374
|
-
bitJson.chatWithBookBrainKey = '';
|
|
1375
|
-
}
|
|
1376
|
-
// Special case for 'ai' bits
|
|
1377
|
-
if (bitType === BitType.articleAi || bitType === BitType.noteAi || bitType === BitType.summaryAi) {
|
|
1378
|
-
if (bitJson.aiGenerated == null)
|
|
1379
|
-
bitJson.aiGenerated = true;
|
|
1380
|
-
}
|
|
1381
|
-
// Special case for '-responsive...' bits
|
|
1382
|
-
if (Config.isOfBitType(bitType, [BitType.articleResponsive, BitType.pageArticleResponsive])) {
|
|
1383
|
-
if (bitJson.imageFirst == null)
|
|
1384
|
-
bitJson.imageFirst = true;
|
|
1385
|
-
}
|
|
1386
|
-
// Special case for 'review-...' bits
|
|
1387
|
-
if (Config.isOfBitType(bitType, BitType.reviewNote)) {
|
|
1388
|
-
if (bitJson.resolved == null)
|
|
1389
|
-
bitJson.resolved = false;
|
|
1390
|
-
if (bitJson.resolvedDate == null)
|
|
1391
|
-
bitJson.resolvedDate = '';
|
|
1392
|
-
if (bitJson.resolvedBy == null)
|
|
1393
|
-
bitJson.resolvedBy = '';
|
|
1394
|
-
}
|
|
1395
|
-
// Special case for 'images-logos-grave' / 'prototype-images' / etc bits
|
|
1396
|
-
if (Config.isOfBitType(bitType, [BitType.imagesLogoGrave, BitType.prototypeImages])) {
|
|
1397
|
-
if (bitType === BitType.imagesLogoGrave) {
|
|
1398
|
-
if (bitJson.logos == null) {
|
|
1399
|
-
bitJson.logos = [];
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
else {
|
|
1403
|
-
if (bitJson.images == null)
|
|
1404
|
-
bitJson.images = [];
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
// Special case for 'stepImageScreenshotWithPointer' / surveyMatrix / etc bits
|
|
1408
|
-
if (Config.isOfBitType(bitType, [BitType.stepImageScreenshotWithPointer, BitType.surveyMatrix])) {
|
|
1409
|
-
if (bitJson.pointerTop == null)
|
|
1410
|
-
bitJson.pointerTop = '';
|
|
1411
|
-
if (bitJson.pointerLeft == null)
|
|
1412
|
-
bitJson.pointerLeft = '';
|
|
1413
|
-
if (Config.isOfBitType(bitType, [BitType.surveyMatrix])) {
|
|
1414
|
-
if (bitJson.buttonCaption == null)
|
|
1415
|
-
bitJson.buttonCaption = '';
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
if (Config.isOfBitType(bitType, [BitType.listItem])) {
|
|
1419
|
-
if (bitJson.listItemIndent == null)
|
|
1420
|
-
bitJson.listItemIndent = 0;
|
|
1421
|
-
}
|
|
1422
|
-
// Special case for 'survey-rating-*' bits
|
|
1423
|
-
if (Config.isOfBitType(bitType, BitType.surveyRating)) {
|
|
1424
|
-
//
|
|
1425
|
-
if (bitJson.ratingLevelStart == null) {
|
|
1426
|
-
bitJson.ratingLevelStart = {
|
|
1427
|
-
level: 0,
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
if (bitJson.ratingLevelEnd == null) {
|
|
1431
|
-
bitJson.ratingLevelEnd = {
|
|
1432
|
-
level: 0,
|
|
1433
|
-
};
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
// Special case for 'vendor-stripe-pricing-table' bits
|
|
1437
|
-
if (Config.isOfBitType(bitType, BitType.vendorStripePricingTable)) {
|
|
1438
|
-
if (bitJson.stripePricingTableId == null)
|
|
1439
|
-
bitJson.stripePricingTableId = '';
|
|
1440
|
-
if (bitJson.stripePublishableKey == null)
|
|
1441
|
-
bitJson.stripePublishableKey = '';
|
|
1442
|
-
}
|
|
1443
|
-
// Special case for 'call-to-action' bits
|
|
1444
|
-
if (Config.isOfBitType(bitType, BitType.callToAction)) {
|
|
1445
|
-
if (bitJson.buttonCaption == null)
|
|
1446
|
-
bitJson.buttonCaption = '';
|
|
1447
|
-
if (bitJson.callToActionUrl == null)
|
|
1448
|
-
bitJson.callToActionUrl = '';
|
|
1449
|
-
}
|
|
1450
|
-
// Special case for 'hand-in-file' bits
|
|
1451
|
-
if (Config.isOfBitType(bitType, BitType.handInFile)) {
|
|
1452
|
-
if (bitJson.handInAcceptFileType == null)
|
|
1453
|
-
bitJson.handInAcceptFileType = [];
|
|
1454
|
-
}
|
|
1455
|
-
// Special case for 'hand-in-submit' bits
|
|
1456
|
-
if (Config.isOfBitType(bitType, BitType.handInSubmit)) {
|
|
1457
|
-
if (bitJson.handInRequirement == null)
|
|
1458
|
-
bitJson.handInRequirement = [];
|
|
1459
|
-
if (bitJson.handInInstruction == null)
|
|
1460
|
-
bitJson.handInInstruction = '';
|
|
1461
|
-
if (bitJson.buttonCaption == null)
|
|
1462
|
-
bitJson.buttonCaption = '';
|
|
1463
|
-
}
|
|
1464
|
-
// Special case for 'module' bits
|
|
1465
|
-
if (Config.isOfBitType(bitType, BitType.module)) {
|
|
1466
|
-
if (bitJson.hasBookNavigation == null)
|
|
1467
|
-
bitJson.hasBookNavigation = true;
|
|
1468
|
-
}
|
|
1469
|
-
// Special case for 'container' bits
|
|
1470
|
-
if (Config.isOfBitType(bitType, BitType.container)) {
|
|
1471
|
-
if (bitJson.allowedBit == null)
|
|
1472
|
-
bitJson.allowedBit = [];
|
|
1473
|
-
}
|
|
1474
|
-
// Special case for 'quiz' bits
|
|
1475
|
-
if (bitConfig.quizBit) {
|
|
1476
|
-
if (bitJson.revealSolutions == null)
|
|
1477
|
-
bitJson.revealSolutions = false;
|
|
1478
|
-
}
|
|
1479
|
-
// Special case for 'platform-path' bits
|
|
1480
|
-
if (Config.isOfBitType(bitType, BitType.platformPath)) {
|
|
1481
|
-
if (bitJson.path == null)
|
|
1482
|
-
bitJson.path = '';
|
|
1483
|
-
}
|
|
1484
|
-
// Remove top level example if it is not required
|
|
1485
|
-
if (isTopLevelExample) {
|
|
1486
|
-
if (bitJson.isExample == null)
|
|
1487
|
-
bitJson.isExample = false;
|
|
1488
|
-
}
|
|
1489
|
-
else {
|
|
1490
|
-
// Remove example
|
|
1491
|
-
delete bitJson.isExample;
|
|
1492
|
-
delete bitJson.example;
|
|
1493
|
-
}
|
|
1494
|
-
if (isTopLevelExampleValue) {
|
|
1495
|
-
if (bitJson.example == null)
|
|
1496
|
-
bitJson.example = null;
|
|
1497
|
-
}
|
|
1498
|
-
else {
|
|
1499
|
-
// Remove example value
|
|
1500
|
-
delete bitJson.example;
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
return bitJson;
|
|
1504
|
-
}
|
|
1505
|
-
/**
|
|
1506
|
-
* Convert any bitmark texts to strings.
|
|
1507
|
-
*/
|
|
1508
|
-
convertAllBitmarkTextsToStringsForPlainText(json) {
|
|
1509
|
-
if (!this.options.textAsPlainText)
|
|
1510
|
-
return;
|
|
1511
|
-
const obj = json;
|
|
1512
|
-
for (const key in obj) {
|
|
1513
|
-
const val = obj[key];
|
|
1514
|
-
if (this.isBitmarkText(val)) {
|
|
1515
|
-
const s = this.textGenerator.generateSync(val, TextFormat.bitmarkText, TextLocation.tag, {
|
|
1516
|
-
noBreakscaping: true,
|
|
1517
|
-
});
|
|
1518
|
-
obj[key] = (s !== null && s !== void 0 ? s : '').trim();
|
|
1519
|
-
}
|
|
1520
|
-
else if (typeof obj[key] === 'object') {
|
|
1521
|
-
this.convertAllBitmarkTextsToStringsForPlainText(obj[key]);
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
/**
|
|
1526
|
-
* Remove any property with a key starting with an double underscore.
|
|
1527
|
-
*
|
|
1528
|
-
* @param json
|
|
1529
|
-
*/
|
|
1530
|
-
removeTemporaryProperties(json) {
|
|
1531
|
-
const obj = json;
|
|
1532
|
-
for (const key in obj) {
|
|
1533
|
-
if (key.startsWith('__')) {
|
|
1534
|
-
delete obj[key];
|
|
1535
|
-
}
|
|
1536
|
-
else if (typeof obj[key] === 'object') {
|
|
1537
|
-
this.removeTemporaryProperties(obj[key]);
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
//
|
|
1542
|
-
// Writer interface
|
|
1543
|
-
//
|
|
1544
|
-
/**
|
|
1545
|
-
* Writes a string value to the output.
|
|
1546
|
-
* @param value - The string value to be written.
|
|
1547
|
-
*/
|
|
1548
|
-
write(value) {
|
|
1549
|
-
this.writer.write(value);
|
|
1550
|
-
return this;
|
|
1551
|
-
}
|
|
1552
|
-
/**
|
|
1553
|
-
* Writes a new line to the output. The line is indented automatically. The line is ended with the endOfLineString.
|
|
1554
|
-
* @param value - The line to write. When omitted, only the endOfLineString is written.
|
|
1555
|
-
*/
|
|
1556
|
-
writeLine(value) {
|
|
1557
|
-
this.writer.writeLine(value);
|
|
1558
|
-
return this;
|
|
1559
|
-
}
|
|
1560
|
-
/**
|
|
1561
|
-
* Writes a collection of lines to the output. Each line is indented automatically and ended with the endOfLineString.
|
|
1562
|
-
* @param values - The lines to write.
|
|
1563
|
-
* @param delimiter - An optional delimiter to be written at the end of each line, except for the last one.
|
|
1564
|
-
*/
|
|
1565
|
-
writeLines(values, delimiter) {
|
|
1566
|
-
this.writer.writeLines(values, delimiter);
|
|
1567
|
-
return this;
|
|
1568
|
-
}
|
|
1569
|
-
/**
|
|
1570
|
-
* Writes a single whitespace character to the output.
|
|
1571
|
-
*/
|
|
1572
|
-
writeWhiteSpace() {
|
|
1573
|
-
this.writer.writeWhiteSpace();
|
|
1574
|
-
return this;
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
export { JsonGenerator };
|
|
1578
|
-
//# sourceMappingURL=JsonGenerator.js.map
|