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