@gmb/bitmark-parser-generator 1.35.0 → 2.0.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/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/cjs/BitmarkParserGenerator.js +8 -3
- package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
- package/dist/cjs/ast/Ast.js +1 -0
- package/dist/cjs/ast/Ast.js.map +1 -1
- package/dist/cjs/ast/BaseBuilder.js +91 -54
- package/dist/cjs/ast/BaseBuilder.js.map +1 -1
- package/dist/cjs/ast/Builder.js +776 -389
- package/dist/cjs/ast/Builder.js.map +1 -1
- package/dist/cjs/ast/ResourceBuilder.js +516 -252
- package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
- package/dist/cjs/ast/rules/NodeValidator.js +61 -22
- package/dist/cjs/ast/rules/NodeValidator.js.map +1 -1
- package/dist/cjs/breakscaping/Breakscape.js +96 -71
- package/dist/cjs/breakscaping/Breakscape.js.map +1 -1
- package/dist/cjs/config/raw/bits.js +14 -5
- package/dist/cjs/config/raw/bits.js.map +1 -1
- package/dist/cjs/config/raw/properties.js +7 -2
- package/dist/cjs/config/raw/properties.js.map +1 -1
- package/dist/cjs/generated/build-info.js +1 -1
- package/dist/cjs/generated/build-info.js.map +1 -1
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +1 -0
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
- package/dist/cjs/generator/AstWalkerGenerator.js +4 -1
- package/dist/cjs/generator/AstWalkerGenerator.js.map +1 -1
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js +959 -338
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +308 -1982
- package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
- package/dist/cjs/generator/text/TextGenerator.js +26 -8
- package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/ast/NodeType.js +27 -8
- package/dist/cjs/model/ast/NodeType.js.map +1 -1
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +1 -0
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/cjs/model/enum/BitType.js +1 -2
- package/dist/cjs/model/enum/BitType.js.map +1 -1
- package/dist/cjs/model/enum/PropertyFormat.js +3 -1
- package/dist/cjs/model/enum/PropertyFormat.js.map +1 -1
- package/dist/cjs/model/enum/TextFormat.js +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js +9 -3
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +49 -131
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +7 -31
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +255 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +175 -129
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +8 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +61 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +11 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +21 -17
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +50 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +2 -15
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +4 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +5 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +23 -7
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +3 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +19 -8
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +4 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +4 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +14 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +37 -21
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +3 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/json/JsonParser.js +73 -765
- package/dist/cjs/parser/json/JsonParser.js.map +1 -1
- package/dist/cjs/parser/text/TextParser.js +61 -2
- package/dist/cjs/parser/text/TextParser.js.map +1 -1
- package/dist/cjs/utils/BitUtils.js +15 -13
- package/dist/cjs/utils/BitUtils.js.map +1 -1
- package/dist/esm/BitmarkParserGenerator.js +8 -3
- package/dist/esm/BitmarkParserGenerator.js.map +1 -1
- package/dist/esm/ast/Ast.js +1 -0
- package/dist/esm/ast/Ast.js.map +1 -1
- package/dist/esm/ast/BaseBuilder.js +91 -54
- package/dist/esm/ast/BaseBuilder.js.map +1 -1
- package/dist/esm/ast/Builder.js +776 -389
- package/dist/esm/ast/Builder.js.map +1 -1
- package/dist/esm/ast/ResourceBuilder.js +516 -252
- package/dist/esm/ast/ResourceBuilder.js.map +1 -1
- package/dist/esm/ast/rules/NodeValidator.js +61 -22
- package/dist/esm/ast/rules/NodeValidator.js.map +1 -1
- package/dist/esm/breakscaping/Breakscape.js +96 -71
- package/dist/esm/breakscaping/Breakscape.js.map +1 -1
- package/dist/esm/config/raw/bits.js +14 -5
- package/dist/esm/config/raw/bits.js.map +1 -1
- package/dist/esm/config/raw/properties.js +7 -2
- package/dist/esm/config/raw/properties.js.map +1 -1
- package/dist/esm/generated/build-info.js +1 -1
- package/dist/esm/generated/build-info.js.map +1 -1
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +1 -0
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
- package/dist/esm/generator/AstWalkerGenerator.js +4 -1
- package/dist/esm/generator/AstWalkerGenerator.js.map +1 -1
- package/dist/esm/generator/bitmark/BitmarkGenerator.js +959 -338
- package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +308 -1982
- package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
- package/dist/esm/generator/text/TextGenerator.js +26 -8
- package/dist/esm/generator/text/TextGenerator.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/ast/NodeType.js +27 -8
- package/dist/esm/model/ast/NodeType.js.map +1 -1
- package/dist/esm/model/config/enum/PropertyConfigKey.js +1 -0
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/esm/model/enum/BitType.js +1 -2
- package/dist/esm/model/enum/BitType.js.map +1 -1
- package/dist/esm/model/enum/PropertyFormat.js +3 -1
- package/dist/esm/model/enum/PropertyFormat.js.map +1 -1
- package/dist/esm/model/enum/TextFormat.js +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js +9 -3
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +49 -131
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +7 -31
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +252 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +175 -129
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +8 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +58 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +11 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +21 -17
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +47 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +2 -15
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +4 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +5 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +23 -7
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +3 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +19 -8
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +4 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +4 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +14 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +37 -21
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +3 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/json/JsonParser.js +73 -765
- package/dist/esm/parser/json/JsonParser.js.map +1 -1
- package/dist/esm/parser/text/TextParser.js +61 -2
- package/dist/esm/parser/text/TextParser.js.map +1 -1
- package/dist/esm/utils/BitUtils.js +15 -13
- package/dist/esm/utils/BitUtils.js.map +1 -1
- package/dist/types/BitmarkParserGenerator.d.ts +8 -0
- package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
- package/dist/types/ast/Ast.d.ts.map +1 -1
- package/dist/types/ast/BaseBuilder.d.ts +31 -21
- package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
- package/dist/types/ast/Builder.d.ts +279 -441
- package/dist/types/ast/Builder.d.ts.map +1 -1
- package/dist/types/ast/ResourceBuilder.d.ts +177 -164
- package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
- package/dist/types/ast/rules/NodeValidator.d.ts +3 -2
- package/dist/types/ast/rules/NodeValidator.d.ts.map +1 -1
- package/dist/types/breakscaping/Breakscape.d.ts +6 -5
- package/dist/types/breakscaping/Breakscape.d.ts.map +1 -1
- package/dist/types/config/raw/bits.d.ts.map +1 -1
- package/dist/types/config/raw/properties.d.ts.map +1 -1
- package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +1 -1
- package/dist/types/generator/AstWalkerGenerator.d.ts.map +1 -1
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +89 -55
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
- package/dist/types/generator/json/JsonGenerator.d.ts +88 -108
- package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
- package/dist/types/generator/text/TextGenerator.d.ts +14 -2
- package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/model/ast/NodeType.d.ts +48 -16
- package/dist/types/model/ast/NodeType.d.ts.map +1 -1
- package/dist/types/model/ast/Nodes.d.ts +64 -440
- package/dist/types/model/ast/Nodes.d.ts.map +1 -1
- package/dist/types/model/config/enum/ConfigKey.d.ts +2 -0
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +3 -0
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
- package/dist/types/model/enum/BitType.d.ts +2 -4
- package/dist/types/model/enum/BitType.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyFormat.d.ts +4 -2
- package/dist/types/model/enum/PropertyFormat.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyTag.d.ts +2 -0
- package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
- package/dist/types/model/json/BitJson.d.ts +32 -20
- package/dist/types/model/json/BitJson.d.ts.map +1 -1
- package/dist/types/model/json/BodyBitJson.d.ts +16 -12
- package/dist/types/model/json/BodyBitJson.d.ts.map +1 -1
- package/dist/types/model/json/ResourceJson.d.ts +2 -22
- package/dist/types/model/json/ResourceJson.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts +3 -2
- package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +2 -15
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +83 -71
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts +37 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts +15 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +16 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +5 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/json/JsonParser.d.ts +9 -72
- package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
- package/dist/types/parser/text/TextParser.d.ts +16 -1
- package/dist/types/parser/text/TextParser.d.ts.map +1 -1
- package/dist/types/utils/BitUtils.d.ts +8 -8
- package/dist/types/utils/BitUtils.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -12,7 +12,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.buildCards = buildCards;
|
|
15
|
-
const Builder_1 = require("../../../../ast/Builder");
|
|
16
15
|
const Breakscape_1 = require("../../../../breakscaping/Breakscape");
|
|
17
16
|
const Config_1 = require("../../../../config/Config");
|
|
18
17
|
const CardSetConfigKey_1 = require("../../../../model/config/enum/CardSetConfigKey");
|
|
@@ -22,7 +21,6 @@ const ResourceTag_1 = require("../../../../model/enum/ResourceTag");
|
|
|
22
21
|
const NumberUtils_1 = require("../../../../utils/NumberUtils");
|
|
23
22
|
const BitmarkPegParserValidator_1 = require("../BitmarkPegParserValidator");
|
|
24
23
|
const BitmarkPegParserTypes_1 = require("../BitmarkPegParserTypes");
|
|
25
|
-
const builder = new Builder_1.Builder();
|
|
26
24
|
function buildCards(context, bitType, textFormat, parsedCardSet, statementV1, statementsV1, choicesV1, responsesV1) {
|
|
27
25
|
var _a;
|
|
28
26
|
if (context.DEBUG_CARD_SET)
|
|
@@ -70,7 +68,7 @@ function buildCards(context, bitType, textFormat, parsedCardSet, statementV1, st
|
|
|
70
68
|
break;
|
|
71
69
|
case CardSetConfigKey_1.CardSetConfigKey._clozeList:
|
|
72
70
|
case CardSetConfigKey_1.CardSetConfigKey._exampleBitList:
|
|
73
|
-
result = parseCardBits(context, bitType, processedCardSet);
|
|
71
|
+
result = parseCardBits(context, bitType, textFormat, processedCardSet);
|
|
74
72
|
break;
|
|
75
73
|
case CardSetConfigKey_1.CardSetConfigKey._captionDefinitionsList:
|
|
76
74
|
// ==> captionDefinitionsList
|
|
@@ -85,6 +83,7 @@ function buildCards(context, bitType, textFormat, parsedCardSet, statementV1, st
|
|
|
85
83
|
return result;
|
|
86
84
|
}
|
|
87
85
|
function processCardSet(context, bitType, textFormat, parsedCardSet) {
|
|
86
|
+
var _a;
|
|
88
87
|
const processedCardSet = {
|
|
89
88
|
cards: [],
|
|
90
89
|
internalComments: [],
|
|
@@ -122,7 +121,7 @@ function processCardSet(context, bitType, textFormat, parsedCardSet) {
|
|
|
122
121
|
// Validate the cardBody
|
|
123
122
|
tags.cardBody = BitmarkPegParserValidator_1.BitmarkPegParserValidator.checkCardBody(context, BitmarkPegParserTypes_1.BitContentLevel.Card, bitType, tags.cardBody, processedCard.no, processedSide.no, processedVariant.no);
|
|
124
123
|
// Reduce the card body parts to a breakscaped string
|
|
125
|
-
tags.cardBodyStr =
|
|
124
|
+
tags.cardBodyStr = (_a = tags.cardBody) === null || _a === void 0 ? void 0 : _a.bodyString;
|
|
126
125
|
processedVariant.data = tags;
|
|
127
126
|
// Add any internal comments
|
|
128
127
|
if (tags.internalComments)
|
|
@@ -135,10 +134,12 @@ function processCardSet(context, bitType, textFormat, parsedCardSet) {
|
|
|
135
134
|
return processedCardSet;
|
|
136
135
|
}
|
|
137
136
|
function parseFlashcardLike(context, bitType, cardSet) {
|
|
137
|
+
var _a;
|
|
138
138
|
const flashcards = [];
|
|
139
139
|
const definitions = [];
|
|
140
|
-
let question =
|
|
141
|
-
let
|
|
140
|
+
let question = [];
|
|
141
|
+
let questionString = '';
|
|
142
|
+
let answer = [];
|
|
142
143
|
let alternativeAnswers = [];
|
|
143
144
|
let cardIndex = 0;
|
|
144
145
|
let variantIndex = 0;
|
|
@@ -147,24 +148,25 @@ function parseFlashcardLike(context, bitType, cardSet) {
|
|
|
147
148
|
const onlyOneCardAllowed = bitType === BitType_1.BitType.flashcard1;
|
|
148
149
|
for (const card of cardSet.cards) {
|
|
149
150
|
// Reset the question and answers
|
|
150
|
-
question =
|
|
151
|
-
answer =
|
|
151
|
+
question = [];
|
|
152
|
+
answer = [];
|
|
152
153
|
alternativeAnswers = [];
|
|
153
154
|
variantIndex = 0;
|
|
154
155
|
extraTags = {};
|
|
155
156
|
for (const side of card.sides) {
|
|
156
157
|
for (const content of side.variants) {
|
|
157
|
-
const
|
|
158
|
+
const _b = content.data, { cardBody } = _b, tags = __rest(_b, ["cardBody"]);
|
|
158
159
|
extraTags = Object.assign(Object.assign({}, extraTags), tags);
|
|
159
160
|
if (variantIndex === 0) {
|
|
160
161
|
questionVariant = content;
|
|
161
|
-
question =
|
|
162
|
+
question = cardBody === null || cardBody === void 0 ? void 0 : cardBody.body;
|
|
163
|
+
questionString = ((_a = cardBody === null || cardBody === void 0 ? void 0 : cardBody.bodyString) !== null && _a !== void 0 ? _a : '');
|
|
162
164
|
}
|
|
163
165
|
else if (variantIndex === 1) {
|
|
164
|
-
answer =
|
|
166
|
+
answer = cardBody === null || cardBody === void 0 ? void 0 : cardBody.body;
|
|
165
167
|
}
|
|
166
168
|
else {
|
|
167
|
-
alternativeAnswers.push(
|
|
169
|
+
alternativeAnswers.push(cardBody === null || cardBody === void 0 ? void 0 : cardBody.body);
|
|
168
170
|
}
|
|
169
171
|
variantIndex++;
|
|
170
172
|
}
|
|
@@ -172,14 +174,19 @@ function parseFlashcardLike(context, bitType, cardSet) {
|
|
|
172
174
|
// Add the flashcard
|
|
173
175
|
if (cardIndex === 0 || !onlyOneCardAllowed) {
|
|
174
176
|
if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.definitionList)) {
|
|
175
|
-
// .
|
|
176
|
-
|
|
177
|
+
// .definition-list
|
|
178
|
+
const dl = Object.assign({ term: question, definition: answer, alternativeDefinitions: alternativeAnswers }, extraTags);
|
|
179
|
+
if (dl)
|
|
180
|
+
definitions.push(dl);
|
|
177
181
|
}
|
|
178
182
|
else {
|
|
179
183
|
// .flashcard
|
|
180
184
|
// if (question) {
|
|
181
|
-
|
|
182
|
-
answer,
|
|
185
|
+
const fc = Object.assign({ question,
|
|
186
|
+
answer,
|
|
187
|
+
alternativeAnswers }, extraTags);
|
|
188
|
+
if (fc)
|
|
189
|
+
flashcards.push(fc);
|
|
183
190
|
// } else {
|
|
184
191
|
// context.addWarning('Ignoring card with empty question', questionVariant);
|
|
185
192
|
// }
|
|
@@ -187,7 +194,7 @@ function parseFlashcardLike(context, bitType, cardSet) {
|
|
|
187
194
|
}
|
|
188
195
|
else {
|
|
189
196
|
// Only one card allowed, add a warning and ignore the card
|
|
190
|
-
context.addWarning(`Bit '${bitType}' should only contain one card. Ignore subsequent card: '${
|
|
197
|
+
context.addWarning(`Bit '${bitType}' should only contain one card. Ignore subsequent card: '${questionString}'`, questionVariant);
|
|
191
198
|
break;
|
|
192
199
|
}
|
|
193
200
|
cardIndex++;
|
|
@@ -205,7 +212,7 @@ function parseElements(_context, _bitType, cardSet) {
|
|
|
205
212
|
for (const content of side.variants) {
|
|
206
213
|
const tags = content.data;
|
|
207
214
|
// if (tags.cardBody) {
|
|
208
|
-
elements.push((_a = tags.cardBodyStr) !== null && _a !== void 0 ? _a :
|
|
215
|
+
elements.push((_a = tags.cardBodyStr) !== null && _a !== void 0 ? _a : '');
|
|
209
216
|
// } else {
|
|
210
217
|
// context.addWarning('Ignoring card with empty element', content);
|
|
211
218
|
// }
|
|
@@ -217,19 +224,23 @@ function parseElements(_context, _bitType, cardSet) {
|
|
|
217
224
|
};
|
|
218
225
|
}
|
|
219
226
|
function parseStatements(_context, _bitType, cardSet, statementV1, statementsV1) {
|
|
227
|
+
var _a;
|
|
220
228
|
const statements = [];
|
|
221
229
|
for (const card of cardSet.cards) {
|
|
222
230
|
for (const side of card.sides) {
|
|
223
231
|
for (const content of side.variants) {
|
|
224
|
-
const
|
|
232
|
+
const _b = content.data, { statements: chainedStatements, statement: _ignore } = _b, tags = __rest(_b, ["statements", "statement"]);
|
|
233
|
+
// Remove statement from rest, tags
|
|
234
|
+
_ignore;
|
|
225
235
|
// Re-build the statement, adding any tags that were not in the True/False chain
|
|
226
236
|
// These tags are actually not in the correct place, but we can still interpret them and fix the data.
|
|
227
237
|
// As .true-false only has one statement per card, we can just add the extra tags to the statement.
|
|
228
238
|
if (Array.isArray(chainedStatements)) {
|
|
229
239
|
for (const s of chainedStatements) {
|
|
230
240
|
// if (s.text) {
|
|
231
|
-
const statement =
|
|
232
|
-
|
|
241
|
+
const statement = Object.assign({ statement: (_a = s.statement) !== null && _a !== void 0 ? _a : '', isCorrect: s.isCorrect, item: s.item, lead: s.lead, hint: s.hint, instruction: s.instruction, example: s.example }, tags);
|
|
242
|
+
if (statement)
|
|
243
|
+
statements.push(statement);
|
|
233
244
|
// } else {
|
|
234
245
|
// context.addWarning('Ignoring card with empty statement', content);
|
|
235
246
|
// }
|
|
@@ -260,24 +271,31 @@ function parseQuiz(_context, bitType, cardSet, choicesV1, responsesV1) {
|
|
|
260
271
|
let exampleCard;
|
|
261
272
|
for (const card of cardSet.cards) {
|
|
262
273
|
isDefaultExampleCard = false;
|
|
263
|
-
exampleCard =
|
|
274
|
+
exampleCard = undefined;
|
|
264
275
|
for (const side of card.sides) {
|
|
265
276
|
for (const content of side.variants) {
|
|
266
|
-
const _a = content.data, {
|
|
277
|
+
const _a = content.data, { __isDefaultExample, example } = _a, tags = __rest(_a, ["__isDefaultExample", "example"]);
|
|
267
278
|
// Example
|
|
268
|
-
isDefaultExampleCard =
|
|
279
|
+
isDefaultExampleCard = __isDefaultExample === true ? true : isDefaultExampleCard;
|
|
269
280
|
exampleCard = example ? example : exampleCard;
|
|
270
281
|
// Insert choices / responses
|
|
271
282
|
if (tags.trueFalse && tags.trueFalse.length > 0) {
|
|
272
283
|
const responsesOrChoices = [];
|
|
273
|
-
const builderFunc = insertResponses ? builder.response : builder.choice;
|
|
274
284
|
for (const tf of tags.trueFalse) {
|
|
275
|
-
const {
|
|
276
|
-
const
|
|
285
|
+
const { __isDefaultExample: isDefaultExampleTf, example: exampleTf } = tf, tfTags = __rest(tf, ["__isDefaultExample", "example"]);
|
|
286
|
+
const __isDefaultExample = isDefaultExampleTf || isDefaultExampleCard;
|
|
277
287
|
const example = exampleTf || exampleCard;
|
|
278
|
-
const response =
|
|
279
|
-
|
|
280
|
-
|
|
288
|
+
const response = {
|
|
289
|
+
isCorrect: tfTags.isCorrect,
|
|
290
|
+
__isDefaultExample,
|
|
291
|
+
example,
|
|
292
|
+
};
|
|
293
|
+
if (insertResponses)
|
|
294
|
+
response.response = tfTags.text;
|
|
295
|
+
else
|
|
296
|
+
response.choice = tfTags.text;
|
|
297
|
+
if (response)
|
|
298
|
+
responsesOrChoices.push(response);
|
|
281
299
|
}
|
|
282
300
|
if (insertResponses)
|
|
283
301
|
tags.responses = responsesOrChoices;
|
|
@@ -285,8 +303,9 @@ function parseQuiz(_context, bitType, cardSet, choicesV1, responsesV1) {
|
|
|
285
303
|
tags.choices = responsesOrChoices;
|
|
286
304
|
}
|
|
287
305
|
// if (tags.choices || tags.responses) {
|
|
288
|
-
const quiz =
|
|
289
|
-
|
|
306
|
+
const quiz = Object.assign(Object.assign({}, tags), { choices: tags.choices, responses: tags.responses, __isDefaultExample: isDefaultExampleCard, __defaultExample: exampleCard });
|
|
307
|
+
if (quiz)
|
|
308
|
+
quizzes.push(quiz);
|
|
290
309
|
// } else {
|
|
291
310
|
// context.addWarning('Ignoring card with empty quiz', content);
|
|
292
311
|
// }
|
|
@@ -295,16 +314,18 @@ function parseQuiz(_context, bitType, cardSet, choicesV1, responsesV1) {
|
|
|
295
314
|
}
|
|
296
315
|
// Add a quiz for the V1 choices / responses
|
|
297
316
|
if (insertChoices && Array.isArray(choicesV1) && choicesV1.length > 0) {
|
|
298
|
-
const quiz =
|
|
317
|
+
const quiz = {
|
|
299
318
|
choices: choicesV1,
|
|
300
|
-
}
|
|
301
|
-
|
|
319
|
+
};
|
|
320
|
+
if (quiz)
|
|
321
|
+
quizzes.push(quiz);
|
|
302
322
|
}
|
|
303
323
|
if (insertResponses && Array.isArray(responsesV1) && responsesV1.length > 0) {
|
|
304
|
-
const quiz =
|
|
324
|
+
const quiz = {
|
|
305
325
|
responses: responsesV1,
|
|
306
|
-
}
|
|
307
|
-
|
|
326
|
+
};
|
|
327
|
+
if (quiz)
|
|
328
|
+
quizzes.push(quiz);
|
|
308
329
|
}
|
|
309
330
|
return {
|
|
310
331
|
quizzes: quizzes.length > 0 ? quizzes : undefined,
|
|
@@ -318,8 +339,9 @@ function parseQuestions(_context, _bitType, cardSet) {
|
|
|
318
339
|
for (const content of side.variants) {
|
|
319
340
|
const tags = content.data;
|
|
320
341
|
// if (tags.cardBody) {
|
|
321
|
-
const q =
|
|
322
|
-
|
|
342
|
+
const q = Object.assign({ question: (_a = tags.cardBodyStr) !== null && _a !== void 0 ? _a : '' }, tags);
|
|
343
|
+
if (q)
|
|
344
|
+
questions.push(q);
|
|
323
345
|
// }
|
|
324
346
|
// else {
|
|
325
347
|
// context.addWarning('Ignoring card with empty body text', content);
|
|
@@ -331,7 +353,7 @@ function parseQuestions(_context, _bitType, cardSet) {
|
|
|
331
353
|
questions: questions.length > 0 ? questions : undefined,
|
|
332
354
|
};
|
|
333
355
|
}
|
|
334
|
-
function parseMatchPairs(_context,
|
|
356
|
+
function parseMatchPairs(_context, bitType, cardSet) {
|
|
335
357
|
let sideIdx = 0;
|
|
336
358
|
let isHeading = false;
|
|
337
359
|
let heading;
|
|
@@ -340,6 +362,7 @@ function parseMatchPairs(_context, _bitType, cardSet) {
|
|
|
340
362
|
let forValues = [];
|
|
341
363
|
let pairKey = undefined;
|
|
342
364
|
let pairValues = [];
|
|
365
|
+
let _pairValuesAst = [];
|
|
343
366
|
let keyAudio = undefined;
|
|
344
367
|
let keyImage = undefined;
|
|
345
368
|
let extraTags = {};
|
|
@@ -354,28 +377,29 @@ function parseMatchPairs(_context, _bitType, cardSet) {
|
|
|
354
377
|
forValues = [];
|
|
355
378
|
pairKey = undefined;
|
|
356
379
|
pairValues = [];
|
|
380
|
+
_pairValuesAst = [];
|
|
357
381
|
keyAudio = undefined;
|
|
358
382
|
keyImage = undefined;
|
|
359
383
|
sideIdx = 0;
|
|
360
384
|
extraTags = {};
|
|
361
385
|
isDefaultExampleCard = false;
|
|
362
|
-
exampleCard =
|
|
386
|
+
exampleCard = undefined;
|
|
363
387
|
for (const side of card.sides) {
|
|
364
388
|
for (const content of side.variants) {
|
|
365
389
|
// variant = content;
|
|
366
|
-
const _a = content.data, { cardBodyStr, title, resources,
|
|
390
|
+
const _a = content.data, { cardBody, cardBodyStr, title, resources, __isDefaultExample, example } = _a, tags = __rest(_a, ["cardBody", "cardBodyStr", "title", "resources", "__isDefaultExample", "example"]);
|
|
367
391
|
// Example
|
|
368
|
-
isDefaultExampleCard =
|
|
392
|
+
isDefaultExampleCard = __isDefaultExample === true ? true : isDefaultExampleCard;
|
|
369
393
|
exampleCard = example ? example : exampleCard;
|
|
370
394
|
// Get the 'heading' which is the [#title] at level 1
|
|
371
|
-
const heading = title && title[1];
|
|
395
|
+
const heading = title && title[1].titleString;
|
|
372
396
|
if (heading != null)
|
|
373
397
|
isHeading = true;
|
|
374
398
|
if (sideIdx === 0) {
|
|
375
399
|
// First side
|
|
376
400
|
forKeys = heading;
|
|
377
401
|
if (heading != null) {
|
|
378
|
-
isDefaultExampleCardSet =
|
|
402
|
+
isDefaultExampleCardSet = __isDefaultExample === true ? true : isDefaultExampleCardSet;
|
|
379
403
|
exampleCardSet = example ? example : exampleCardSet;
|
|
380
404
|
}
|
|
381
405
|
else if (Array.isArray(resources) && resources.length > 0) {
|
|
@@ -383,10 +407,10 @@ function parseMatchPairs(_context, _bitType, cardSet) {
|
|
|
383
407
|
const resource = resources[0];
|
|
384
408
|
// console.log('WARNING: Match card has resource on first side', tags.resource);
|
|
385
409
|
if (resource.type === ResourceTag_1.ResourceTag.audio) {
|
|
386
|
-
keyAudio = resource;
|
|
410
|
+
keyAudio = resource.audio;
|
|
387
411
|
}
|
|
388
412
|
else if (resource.type === ResourceTag_1.ResourceTag.image) {
|
|
389
|
-
keyImage = resource;
|
|
413
|
+
keyImage = resource.image;
|
|
390
414
|
}
|
|
391
415
|
}
|
|
392
416
|
else {
|
|
@@ -396,17 +420,19 @@ function parseMatchPairs(_context, _bitType, cardSet) {
|
|
|
396
420
|
}
|
|
397
421
|
else {
|
|
398
422
|
// Subsequent sides
|
|
399
|
-
forValues.push(heading !== null && heading !== void 0 ? heading :
|
|
423
|
+
forValues.push(heading !== null && heading !== void 0 ? heading : '');
|
|
400
424
|
if (heading != null) {
|
|
401
|
-
isDefaultExampleCardSet =
|
|
425
|
+
isDefaultExampleCardSet = __isDefaultExample === true ? true : isDefaultExampleCardSet;
|
|
402
426
|
exampleCardSet = example ? example : exampleCardSet;
|
|
403
427
|
}
|
|
404
428
|
else if (title == null) {
|
|
405
429
|
// If not a heading, it is a pair
|
|
406
|
-
const value = cardBodyStr !== null && cardBodyStr !== void 0 ? cardBodyStr :
|
|
430
|
+
const value = cardBodyStr !== null && cardBodyStr !== void 0 ? cardBodyStr : '';
|
|
431
|
+
const valueAst = cardBody === null || cardBody === void 0 ? void 0 : cardBody.body;
|
|
407
432
|
pairValues.push(value);
|
|
433
|
+
_pairValuesAst.push(valueAst);
|
|
408
434
|
if ((isDefaultExampleCardSet || isDefaultExampleCard) && !exampleCard)
|
|
409
|
-
exampleCard =
|
|
435
|
+
exampleCard = valueAst;
|
|
410
436
|
}
|
|
411
437
|
// Fix: https://github.com/getMoreBrain/cosmic/issues/5454
|
|
412
438
|
delete tags.item;
|
|
@@ -418,22 +444,37 @@ function parseMatchPairs(_context, _bitType, cardSet) {
|
|
|
418
444
|
sideIdx++;
|
|
419
445
|
}
|
|
420
446
|
if (isHeading) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
forValues
|
|
424
|
-
|
|
447
|
+
let forValuesFinal = forValues;
|
|
448
|
+
if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.matchMatrix)) {
|
|
449
|
+
// forValues is an array of values
|
|
450
|
+
forValuesFinal = forValues;
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
// Standard match, forValues is a single value
|
|
454
|
+
if (forValues.length >= 1) {
|
|
455
|
+
forValuesFinal = forValues[forValues.length - 1];
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
forValuesFinal = '';
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
heading = {
|
|
462
|
+
forKeys: forKeys !== null && forKeys !== void 0 ? forKeys : '',
|
|
463
|
+
forValues: forValuesFinal,
|
|
464
|
+
};
|
|
425
465
|
}
|
|
426
466
|
else {
|
|
427
467
|
// if (pairKey || keyAudio || keyImage) {
|
|
428
|
-
// Calculate final example and
|
|
468
|
+
// Calculate final example and __isDefaultExample
|
|
429
469
|
if (isDefaultExampleCard)
|
|
430
470
|
exampleCardSet = undefined;
|
|
431
|
-
const
|
|
471
|
+
const __isDefaultExample = isDefaultExampleCard || isDefaultExampleCardSet;
|
|
432
472
|
const example = exampleCard || exampleCardSet;
|
|
433
|
-
const pair =
|
|
434
|
-
keyImage, values: pairValues }, extraTags), {
|
|
435
|
-
example })
|
|
436
|
-
|
|
473
|
+
const pair = Object.assign(Object.assign({ key: pairKey !== null && pairKey !== void 0 ? pairKey : '', keyAudio,
|
|
474
|
+
keyImage, values: pairValues, __valuesAst: _pairValuesAst }, extraTags), { __isDefaultExample,
|
|
475
|
+
example });
|
|
476
|
+
if (pair)
|
|
477
|
+
pairs.push(pair);
|
|
437
478
|
// } else {
|
|
438
479
|
// context.addWarning('Ignoring card with empty body text', variant);
|
|
439
480
|
// }
|
|
@@ -455,6 +496,7 @@ function parseMatchMatrix(_context, _bitType, cardSet) {
|
|
|
455
496
|
const matrix = [];
|
|
456
497
|
let matrixCells = [];
|
|
457
498
|
let matrixCellValues = [];
|
|
499
|
+
let _matrixCellValuesAst = [];
|
|
458
500
|
let matrixCellTags = {};
|
|
459
501
|
let isDefaultExampleCardSet = false;
|
|
460
502
|
let exampleCardSet;
|
|
@@ -477,27 +519,29 @@ function parseMatchMatrix(_context, _bitType, cardSet) {
|
|
|
477
519
|
// keyImage = undefined;
|
|
478
520
|
matrixCells = [];
|
|
479
521
|
matrixCellValues = [];
|
|
522
|
+
_matrixCellValuesAst = [];
|
|
480
523
|
sideIdx = 0;
|
|
481
524
|
isDefaultExampleCard = false;
|
|
482
|
-
exampleCard =
|
|
525
|
+
exampleCard = undefined;
|
|
483
526
|
isCaseSensitiveMatrix = undefined;
|
|
484
527
|
for (const side of card.sides) {
|
|
485
528
|
matrixCellValues = [];
|
|
529
|
+
_matrixCellValuesAst = [];
|
|
486
530
|
matrixCellTags = {};
|
|
487
531
|
isDefaultExampleSide = false;
|
|
488
|
-
exampleSide =
|
|
532
|
+
exampleSide = undefined;
|
|
489
533
|
isCaseSensitiveCell = undefined;
|
|
490
534
|
for (const content of side.variants) {
|
|
491
535
|
// variant = content;
|
|
492
536
|
const tags = content.data;
|
|
493
|
-
const { title, cardBodyStr,
|
|
537
|
+
const { title, cardBody, cardBodyStr, __isDefaultExample, example, isCaseSensitive } = tags, restTags = __rest(tags, ["title", "cardBody", "cardBodyStr", "__isDefaultExample", "example", "isCaseSensitive"]);
|
|
494
538
|
// Example
|
|
495
|
-
isDefaultExampleSide =
|
|
539
|
+
isDefaultExampleSide = __isDefaultExample === true ? true : isDefaultExampleSide;
|
|
496
540
|
exampleSide = example ? example : exampleSide;
|
|
497
541
|
// Merge the tags into the matrix cell tags
|
|
498
542
|
Object.assign(matrixCellTags, restTags);
|
|
499
543
|
// Get the 'heading' which is the [#title] at level 1
|
|
500
|
-
const heading = title && title[1];
|
|
544
|
+
const heading = title && title[1].titleString;
|
|
501
545
|
if (heading != null)
|
|
502
546
|
isHeading = true;
|
|
503
547
|
if (sideIdx === 0) {
|
|
@@ -511,14 +555,14 @@ function parseMatchMatrix(_context, _bitType, cardSet) {
|
|
|
511
555
|
// } else if (tags.resource.type === ResourceTag.image) {
|
|
512
556
|
// keyImage = tags.resource as ImageResource;
|
|
513
557
|
// }
|
|
514
|
-
isDefaultExampleCardSet =
|
|
558
|
+
isDefaultExampleCardSet = __isDefaultExample === true ? true : isDefaultExampleCardSet;
|
|
515
559
|
exampleCardSet = example ? example : exampleCardSet;
|
|
516
560
|
}
|
|
517
561
|
else {
|
|
518
562
|
// If not a heading or resource, it is a matrix
|
|
519
563
|
matrixKey = cardBodyStr;
|
|
520
564
|
matrixKeyTags = restTags;
|
|
521
|
-
isDefaultExampleCard =
|
|
565
|
+
isDefaultExampleCard = __isDefaultExample === true ? true : isDefaultExampleCard;
|
|
522
566
|
exampleCard = example ? example : exampleCard;
|
|
523
567
|
isCaseSensitiveMatrix = isCaseSensitive != null ? isCaseSensitive : isCaseSensitiveMatrix;
|
|
524
568
|
}
|
|
@@ -527,48 +571,51 @@ function parseMatchMatrix(_context, _bitType, cardSet) {
|
|
|
527
571
|
// Subsequent sides
|
|
528
572
|
forValues.push(heading !== null && heading !== void 0 ? heading : Breakscape_1.Breakscape.EMPTY_STRING);
|
|
529
573
|
if (heading != null) {
|
|
530
|
-
isDefaultExampleCardSet =
|
|
574
|
+
isDefaultExampleCardSet = __isDefaultExample === true ? true : isDefaultExampleCardSet;
|
|
531
575
|
exampleCardSet = example ? example : exampleCardSet;
|
|
532
576
|
}
|
|
533
577
|
else if (tags.title == null) {
|
|
534
578
|
// If not a heading, it is a matrix cell value
|
|
535
579
|
const value = cardBodyStr !== null && cardBodyStr !== void 0 ? cardBodyStr : Breakscape_1.Breakscape.EMPTY_STRING;
|
|
580
|
+
const valueAst = cardBody === null || cardBody === void 0 ? void 0 : cardBody.body;
|
|
536
581
|
matrixCellValues.push(value);
|
|
582
|
+
_matrixCellValuesAst.push(valueAst);
|
|
537
583
|
if ((isDefaultExampleCardSet || isDefaultExampleSide) && !exampleSide)
|
|
538
|
-
exampleSide =
|
|
584
|
+
exampleSide = valueAst;
|
|
539
585
|
isCaseSensitiveCell = isCaseSensitive != null ? isCaseSensitive : isCaseSensitiveMatrix;
|
|
540
586
|
}
|
|
541
587
|
}
|
|
542
588
|
}
|
|
543
589
|
// Finished looping variants, create matrix cell
|
|
544
590
|
if (sideIdx > 0) {
|
|
545
|
-
// Calculate final example and
|
|
591
|
+
// Calculate final example and __isDefaultExample
|
|
546
592
|
if (isDefaultExampleSide)
|
|
547
593
|
exampleCard = exampleCardSet = undefined;
|
|
548
594
|
if (isDefaultExampleCard)
|
|
549
595
|
exampleCardSet = undefined;
|
|
550
|
-
const
|
|
596
|
+
const __isDefaultExample = isDefaultExampleSide || isDefaultExampleCard || isDefaultExampleCardSet;
|
|
551
597
|
const example = exampleSide || exampleCard || exampleCardSet;
|
|
552
|
-
const matrixCell =
|
|
553
|
-
|
|
554
|
-
|
|
598
|
+
const matrixCell = Object.assign(Object.assign({ values: matrixCellValues, __valuesAst: _matrixCellValuesAst }, matrixCellTags), { __isDefaultExample: __isDefaultExample, example, isCaseSensitive: isCaseSensitiveCell });
|
|
599
|
+
if (matrixCell)
|
|
600
|
+
matrixCells.push(matrixCell);
|
|
555
601
|
}
|
|
556
602
|
sideIdx++;
|
|
557
603
|
}
|
|
558
604
|
if (isHeading) {
|
|
559
|
-
heading =
|
|
605
|
+
heading = {
|
|
560
606
|
forKeys: forKeys !== null && forKeys !== void 0 ? forKeys : Breakscape_1.Breakscape.EMPTY_STRING,
|
|
561
607
|
forValues,
|
|
562
|
-
}
|
|
608
|
+
};
|
|
563
609
|
}
|
|
564
610
|
else {
|
|
565
611
|
// if (matrixKey) {
|
|
566
|
-
const m =
|
|
612
|
+
const m = Object.assign({ key: matrixKey !== null && matrixKey !== void 0 ? matrixKey : Breakscape_1.Breakscape.EMPTY_STRING,
|
|
567
613
|
// item: matrixItem ?? Breakscape.EMPTY_STRING,
|
|
568
614
|
// keyAudio,
|
|
569
615
|
// keyImage,
|
|
570
|
-
cells: matrixCells }, matrixKeyTags)
|
|
571
|
-
|
|
616
|
+
cells: matrixCells }, matrixKeyTags);
|
|
617
|
+
if (m)
|
|
618
|
+
matrix.push(m);
|
|
572
619
|
// } else {
|
|
573
620
|
// context.addWarning('Ignoring card with empty body text', variant);
|
|
574
621
|
// }
|
|
@@ -594,15 +641,15 @@ function parseTable(_context, _bitType, cardSet) {
|
|
|
594
641
|
const tags = content.data;
|
|
595
642
|
const { title, cardBodyStr } = tags;
|
|
596
643
|
// Get the 'heading' which is the [#title] at level 1
|
|
597
|
-
const heading = title && title[1];
|
|
644
|
+
const heading = title && title[1].titleString;
|
|
598
645
|
if (cardIdx === 0 && heading != null)
|
|
599
646
|
isHeading = true;
|
|
600
647
|
if (isHeading) {
|
|
601
|
-
columns.push(heading !== null && heading !== void 0 ? heading :
|
|
648
|
+
columns.push(heading !== null && heading !== void 0 ? heading : '');
|
|
602
649
|
}
|
|
603
650
|
else {
|
|
604
651
|
// If not a heading, it is a row cell value
|
|
605
|
-
const value = cardBodyStr !== null && cardBodyStr !== void 0 ? cardBodyStr :
|
|
652
|
+
const value = cardBodyStr !== null && cardBodyStr !== void 0 ? cardBodyStr : '';
|
|
606
653
|
rowValues.push(value);
|
|
607
654
|
}
|
|
608
655
|
}
|
|
@@ -612,10 +659,10 @@ function parseTable(_context, _bitType, cardSet) {
|
|
|
612
659
|
}
|
|
613
660
|
cardIdx++;
|
|
614
661
|
}
|
|
615
|
-
const table =
|
|
662
|
+
const table = {
|
|
616
663
|
columns,
|
|
617
|
-
rows,
|
|
618
|
-
}
|
|
664
|
+
data: rows,
|
|
665
|
+
};
|
|
619
666
|
return { table };
|
|
620
667
|
}
|
|
621
668
|
function parseBotActionResponses(_context, _bitType, cardSet) {
|
|
@@ -623,9 +670,10 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
|
|
|
623
670
|
for (const card of cardSet.cards) {
|
|
624
671
|
for (const side of card.sides) {
|
|
625
672
|
for (const content of side.variants) {
|
|
626
|
-
const _a = content.data, {
|
|
627
|
-
const botResponse =
|
|
628
|
-
|
|
673
|
+
const _a = content.data, { __instructionString, reaction, cardBodyStr: feedback } = _a, tags = __rest(_a, ["__instructionString", "reaction", "cardBodyStr"]);
|
|
674
|
+
const botResponse = Object.assign({ response: __instructionString !== null && __instructionString !== void 0 ? __instructionString : Breakscape_1.Breakscape.EMPTY_STRING, reaction: reaction !== null && reaction !== void 0 ? reaction : Breakscape_1.Breakscape.EMPTY_STRING, feedback: feedback !== null && feedback !== void 0 ? feedback : Breakscape_1.Breakscape.EMPTY_STRING }, tags);
|
|
675
|
+
if (botResponse)
|
|
676
|
+
botResponses.push(botResponse);
|
|
629
677
|
}
|
|
630
678
|
}
|
|
631
679
|
}
|
|
@@ -638,26 +686,32 @@ function parseIngredients(_context, _bitType, cardSet) {
|
|
|
638
686
|
for (const card of cardSet.cards) {
|
|
639
687
|
for (const side of card.sides) {
|
|
640
688
|
for (const content of side.variants) {
|
|
641
|
-
const _a = content.data, { title: titleArray,
|
|
689
|
+
const _a = content.data, { title: titleArray, __instructionString, unit, unitAbbr, decimalPlaces, disableCalculation, cardBodyStr, cardBody } = _a, tags = __rest(_a, ["title", "__instructionString", "unit", "unitAbbr", "decimalPlaces", "disableCalculation", "cardBodyStr", "cardBody"]);
|
|
642
690
|
// Extract 'title' from title array (if present)
|
|
643
691
|
// Extract 'quantity' from either then unchained instruction, or from the select (otherwise use 0)
|
|
644
692
|
// Extract checked from the select options (if present, otherwise checked is false))
|
|
645
|
-
const title = Array.isArray(titleArray) && titleArray.length > 0
|
|
693
|
+
const title = Array.isArray(titleArray) && titleArray.length > 0
|
|
694
|
+
? titleArray[titleArray.length - 1].titleString
|
|
695
|
+
: undefined;
|
|
646
696
|
let checked = false;
|
|
647
|
-
let quantity = NumberUtils_1.NumberUtils.asNumber(
|
|
648
|
-
if (cardBody && cardBody.
|
|
649
|
-
const select = cardBody.
|
|
697
|
+
let quantity = NumberUtils_1.NumberUtils.asNumber(__instructionString);
|
|
698
|
+
if (cardBody && cardBody.bodyBits) {
|
|
699
|
+
const select = cardBody.bodyBits.find((c) => c.type === BodyBitType_1.BodyBitType.select);
|
|
650
700
|
if (select) {
|
|
651
|
-
quantity = select.
|
|
652
|
-
if (select.
|
|
653
|
-
checked = select.
|
|
701
|
+
quantity = select.__instructionString ? NumberUtils_1.NumberUtils.asNumber(select.__instructionString) : quantity;
|
|
702
|
+
if (select.options && select.options.length > 0) {
|
|
703
|
+
checked = select.options[0].isCorrect;
|
|
654
704
|
}
|
|
655
705
|
}
|
|
656
706
|
}
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
707
|
+
const ingredient = Object.assign({ title,
|
|
708
|
+
checked,
|
|
709
|
+
// TS compiler very weird. It doesn't recognize that cardBodyStr is a string|undefined, even if cast!
|
|
710
|
+
// Casting to 'any' to avoid the error
|
|
711
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
712
|
+
item: cardBodyStr, quantity, unit: unit !== null && unit !== void 0 ? unit : Breakscape_1.Breakscape.EMPTY_STRING, unitAbbr: unitAbbr !== null && unitAbbr !== void 0 ? unitAbbr : Breakscape_1.Breakscape.EMPTY_STRING, decimalPlaces: decimalPlaces !== null && decimalPlaces !== void 0 ? decimalPlaces : 1, disableCalculation: disableCalculation }, tags);
|
|
713
|
+
if (ingredient)
|
|
714
|
+
ingredients.push(ingredient);
|
|
661
715
|
}
|
|
662
716
|
}
|
|
663
717
|
}
|
|
@@ -680,15 +734,15 @@ function parseCaptionDefinitionsList(_context, _bitType, cardSet) {
|
|
|
680
734
|
const tags = content.data;
|
|
681
735
|
const { title, cardBodyStr } = tags;
|
|
682
736
|
// Get the 'heading' which is the [#title] at level 1
|
|
683
|
-
const heading = title && title[1];
|
|
737
|
+
const heading = title && title[1].titleString;
|
|
684
738
|
if (cardIdx === 0 && heading != null)
|
|
685
739
|
isHeading = true;
|
|
686
740
|
if (isHeading) {
|
|
687
|
-
columns.push(heading !== null && heading !== void 0 ? heading :
|
|
741
|
+
columns.push(heading !== null && heading !== void 0 ? heading : '');
|
|
688
742
|
}
|
|
689
743
|
else {
|
|
690
744
|
// If not a heading, it is a row cell value
|
|
691
|
-
const value = cardBodyStr !== null && cardBodyStr !== void 0 ? cardBodyStr :
|
|
745
|
+
const value = cardBodyStr !== null && cardBodyStr !== void 0 ? cardBodyStr : '';
|
|
692
746
|
rowValues.push(value);
|
|
693
747
|
}
|
|
694
748
|
}
|
|
@@ -698,24 +752,29 @@ function parseCaptionDefinitionsList(_context, _bitType, cardSet) {
|
|
|
698
752
|
}
|
|
699
753
|
cardIdx++;
|
|
700
754
|
}
|
|
701
|
-
const captionDefinitionList =
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
755
|
+
const captionDefinitionList = columns.length > 0
|
|
756
|
+
? {
|
|
757
|
+
columns,
|
|
758
|
+
definitions: rows
|
|
759
|
+
.map((row) => {
|
|
760
|
+
const col = {
|
|
761
|
+
term: row[0],
|
|
762
|
+
definition: row[1],
|
|
763
|
+
};
|
|
764
|
+
return col;
|
|
765
|
+
})
|
|
766
|
+
.filter((d) => d != null),
|
|
767
|
+
}
|
|
768
|
+
: undefined;
|
|
710
769
|
return { captionDefinitionList };
|
|
711
770
|
}
|
|
712
|
-
function parseCardBits(_context, _bitType, cardSet) {
|
|
771
|
+
function parseCardBits(_context, _bitType, _textFormat, cardSet) {
|
|
713
772
|
const cardBits = [];
|
|
714
773
|
for (const card of cardSet.cards) {
|
|
715
774
|
for (const side of card.sides) {
|
|
716
775
|
for (const content of side.variants) {
|
|
717
776
|
const _a = content.data, { cardBody: body } = _a, rest = __rest(_a, ["cardBody"]);
|
|
718
|
-
const cardBit =
|
|
777
|
+
const cardBit = Object.assign({ body }, rest);
|
|
719
778
|
if (cardBit)
|
|
720
779
|
cardBits.push(cardBit);
|
|
721
780
|
}
|
|
@@ -725,17 +784,4 @@ function parseCardBits(_context, _bitType, cardSet) {
|
|
|
725
784
|
cardBits: cardBits.length > 0 ? cardBits : undefined,
|
|
726
785
|
};
|
|
727
786
|
}
|
|
728
|
-
function cardBodyToBreakscapedString(cardBody) {
|
|
729
|
-
let bodyStr = '';
|
|
730
|
-
if (cardBody && cardBody.bodyParts) {
|
|
731
|
-
for (const bodyPart of cardBody.bodyParts) {
|
|
732
|
-
if (bodyPart.type === BodyBitType_1.BodyBitType.text) {
|
|
733
|
-
const asText = bodyPart;
|
|
734
|
-
const bodyTextPart = asText.data.bodyText;
|
|
735
|
-
bodyStr += bodyTextPart;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
return bodyStr;
|
|
740
|
-
}
|
|
741
787
|
//# sourceMappingURL=CardContentProcessor.js.map
|