@gmb/bitmark-parser-generator 3.7.0 → 3.10.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 +1 -0
- package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
- package/dist/cjs/ast/BaseBuilder.js +7 -6
- package/dist/cjs/ast/BaseBuilder.js.map +1 -1
- package/dist/cjs/ast/Builder.js +165 -160
- package/dist/cjs/ast/Builder.js.map +1 -1
- package/dist/cjs/ast/ResourceBuilder.js +68 -67
- package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
- package/dist/cjs/breakscaping/Breakscape.js +1 -1
- package/dist/cjs/config/raw/bits.js +41 -0
- package/dist/cjs/config/raw/bits.js.map +1 -1
- package/dist/cjs/config/raw/groups.js +35 -0
- package/dist/cjs/config/raw/groups.js.map +1 -1
- package/dist/cjs/config/raw/properties.js +48 -0
- 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/text/text-peggy-parser.js +960 -595
- package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +7 -3
- package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
- package/dist/cjs/generator/text/TextGenerator.js +84 -38
- package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
- package/dist/cjs/model/ast/NodeType.js +19 -0
- package/dist/cjs/model/ast/NodeType.js.map +1 -1
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +10 -0
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/cjs/model/enum/BitType.js +7 -0
- package/dist/cjs/model/enum/BitType.js.map +1 -1
- package/dist/cjs/model/enum/TextMarkType.js +2 -0
- package/dist/cjs/model/enum/TextMarkType.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +28 -20
- 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 +11 -10
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +5 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +5 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +3 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +5 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +20 -12
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +4 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +7 -7
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +6 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +6 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +19 -13
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +4 -3
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +11 -10
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +6 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +19 -16
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/text/TextParser.js +7 -6
- package/dist/cjs/parser/text/TextParser.js.map +1 -1
- package/dist/cjs/utils/BitUtils.js +2 -2
- package/dist/cjs/utils/BitUtils.js.map +1 -1
- package/dist/esm/BitmarkParserGenerator.js +1 -0
- package/dist/esm/BitmarkParserGenerator.js.map +1 -1
- package/dist/esm/ast/BaseBuilder.js +7 -6
- package/dist/esm/ast/BaseBuilder.js.map +1 -1
- package/dist/esm/ast/Builder.js +165 -160
- package/dist/esm/ast/Builder.js.map +1 -1
- package/dist/esm/ast/ResourceBuilder.js +68 -67
- package/dist/esm/ast/ResourceBuilder.js.map +1 -1
- package/dist/esm/breakscaping/Breakscape.js +1 -1
- package/dist/esm/config/raw/bits.js +41 -0
- package/dist/esm/config/raw/bits.js.map +1 -1
- package/dist/esm/config/raw/groups.js +35 -0
- package/dist/esm/config/raw/groups.js.map +1 -1
- package/dist/esm/config/raw/properties.js +48 -0
- 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/text/text-peggy-parser.js +960 -595
- package/dist/esm/generated/parser/text/text-peggy-parser.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +7 -3
- package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
- package/dist/esm/generator/text/TextGenerator.js +84 -38
- package/dist/esm/generator/text/TextGenerator.js.map +1 -1
- package/dist/esm/model/ast/NodeType.js +19 -0
- package/dist/esm/model/ast/NodeType.js.map +1 -1
- package/dist/esm/model/config/enum/PropertyConfigKey.js +10 -0
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/esm/model/enum/BitType.js +7 -0
- package/dist/esm/model/enum/BitType.js.map +1 -1
- package/dist/esm/model/enum/TextMarkType.js +2 -0
- package/dist/esm/model/enum/TextMarkType.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +28 -20
- 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 +11 -10
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +5 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +5 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +3 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +5 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +20 -12
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +4 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +7 -7
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +6 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +6 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +19 -13
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +4 -3
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +11 -10
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +6 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +19 -16
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/text/TextParser.js +7 -6
- package/dist/esm/parser/text/TextParser.js.map +1 -1
- package/dist/esm/utils/BitUtils.js +2 -2
- package/dist/esm/utils/BitUtils.js.map +1 -1
- package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
- package/dist/types/ast/BaseBuilder.d.ts +8 -1
- package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
- package/dist/types/ast/Builder.d.ts +60 -50
- package/dist/types/ast/Builder.d.ts.map +1 -1
- package/dist/types/ast/ResourceBuilder.d.ts +21 -22
- package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
- package/dist/types/config/raw/bits.d.ts.map +1 -1
- package/dist/types/config/raw/groups.d.ts.map +1 -1
- package/dist/types/config/raw/properties.d.ts.map +1 -1
- package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +1 -1
- package/dist/types/generator/json/JsonGenerator.d.ts +3 -1
- package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
- package/dist/types/generator/text/TextGenerator.d.ts +4 -1
- package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
- package/dist/types/model/ast/NodeType.d.ts +38 -0
- package/dist/types/model/ast/NodeType.d.ts.map +1 -1
- package/dist/types/model/ast/Nodes.d.ts +10 -0
- package/dist/types/model/ast/Nodes.d.ts.map +1 -1
- package/dist/types/model/ast/TextNodes.d.ts +26 -9
- package/dist/types/model/ast/TextNodes.d.ts.map +1 -1
- package/dist/types/model/config/enum/ConfigKey.d.ts +20 -0
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +30 -0
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
- package/dist/types/model/enum/BitType.d.ts +14 -0
- package/dist/types/model/enum/BitType.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyTag.d.ts +20 -0
- package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
- package/dist/types/model/enum/TextMarkType.d.ts +4 -0
- package/dist/types/model/enum/TextMarkType.d.ts.map +1 -1
- package/dist/types/model/json/BitJson.d.ts +10 -0
- package/dist/types/model/json/BitJson.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +0 -2
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +6 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +3 -4
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts +1 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts +1 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +3 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +1 -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 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts +1 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/text/TextParser.d.ts +3 -2
- package/dist/types/parser/text/TextParser.d.ts.map +1 -1
- package/dist/types/utils/BitUtils.d.ts +2 -1
- package/dist/types/utils/BitUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/esm/ast/Builder.js
CHANGED
|
@@ -49,43 +49,49 @@ class Builder extends BaseBuilder {
|
|
|
49
49
|
buildBit(data) {
|
|
50
50
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
51
51
|
const bitConfig = Config.getBitConfig(data.bitType);
|
|
52
|
+
const bitType = data.bitType;
|
|
52
53
|
const textFormat = (_a = TextFormat.fromValue(data.textFormat)) !== null && _a !== void 0 ? _a : bitConfig.textFormatDefault;
|
|
54
|
+
const context = {
|
|
55
|
+
bitConfig,
|
|
56
|
+
bitType,
|
|
57
|
+
textFormat,
|
|
58
|
+
};
|
|
53
59
|
// Validate and convert resources, and ensure it is an array
|
|
54
60
|
// const resources = ArrayUtils.asArray(resourcesIn);
|
|
55
61
|
// Set the card node data
|
|
56
|
-
const cardNode = this.buildCardNode(
|
|
62
|
+
const cardNode = this.buildCardNode(context, data);
|
|
57
63
|
// Add reasonableNumOfChars to the bit only for essay bits (in other cases it will be pushed down the tree)
|
|
58
64
|
const reasonableNumOfCharsProperty = Config.isOfBitType(data.bitType, BitType.essay)
|
|
59
65
|
? this.toAstProperty(PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars)
|
|
60
66
|
: undefined;
|
|
61
67
|
const convertedExample = Object.assign({}, this.toExample(data.__isDefaultExample, data.example));
|
|
62
68
|
// NOTE: Node order is important and is defined here
|
|
63
|
-
const node = Object.assign(Object.assign({ bitType
|
|
69
|
+
const node = Object.assign(Object.assign({ bitType, bitLevel: data.bitLevel, textFormat, resourceType: ResourceTag.fromValue(data.resourceType), isCommented: data.isCommented,
|
|
64
70
|
// Properties
|
|
65
|
-
id: this.toAstProperty(PropertyConfigKey.id, data.id), internalComment: this.toAstProperty(PropertyConfigKey.internalComment, data.internalComment), customerId: this.toAstProperty(PropertyConfigKey.customerId, data.customerId), externalId: this.toAstProperty(PropertyConfigKey.externalId, data.externalId), spaceId: this.toAstProperty(PropertyConfigKey.spaceId, data.spaceId), padletId: this.toAstProperty(PropertyConfigKey.padletId, data.padletId), jupyterId: this.toAstProperty(PropertyConfigKey.jupyterId, data.jupyterId), jupyterExecutionCount: this.toAstProperty(PropertyConfigKey.jupyterExecutionCount, data.jupyterExecutionCount), isPublic: this.toAstProperty(PropertyConfigKey.isPublic, data.isPublic), aiGenerated: this.toAstProperty(PropertyConfigKey.aiGenerated, data.aiGenerated), machineTranslated: this.toAstProperty(PropertyConfigKey.machineTranslated, data.machineTranslated), searchIndex: this.toAstProperty(PropertyConfigKey.searchIndex, data.searchIndex), analyticsTag: this.toAstProperty(PropertyConfigKey.analyticsTag, data.analyticsTag), feedbackEngine: this.toAstProperty(PropertyConfigKey.feedbackEngine, data.feedbackEngine), feedbackType: this.toAstProperty(PropertyConfigKey.feedbackType, data.feedbackType), disableFeedback: this.toAstProperty(PropertyConfigKey.disableFeedback, data.disableFeedback), releaseVersion: this.toAstProperty(PropertyConfigKey.releaseVersion, data.releaseVersion), releaseKind: this.toAstProperty(PropertyConfigKey.releaseKind, data.releaseKind), releaseDate: this.toAstProperty(PropertyConfigKey.releaseDate, data.releaseDate), book: this.buildBooks(data.book), ageRange: this.toAstProperty(PropertyConfigKey.ageRange, data.ageRange), lang: this.toAstProperty(PropertyConfigKey.lang, data.lang), language: this.toAstProperty(PropertyConfigKey.language, data.language), publisher: this.toAstProperty(PropertyConfigKey.publisher, data.publisher), publisherName: this.toAstProperty(PropertyConfigKey.publisherName, data.publisherName), theme: this.toAstProperty(PropertyConfigKey.theme, data.theme), computerLanguage: this.toAstProperty(PropertyConfigKey.computerLanguage, data.computerLanguage), target: this.toAstProperty(PropertyConfigKey.target, data.target), slug: this.toAstProperty(PropertyConfigKey.slug, data.slug), tag: this.toAstProperty(PropertyConfigKey.tag, data.tag), reductionTag: this.toAstProperty(PropertyConfigKey.reductionTag, data.reductionTag), bubbleTag: this.toAstProperty(PropertyConfigKey.bubbleTag, data.bubbleTag), levelCEFRp: this.toAstProperty(PropertyConfigKey.levelCEFRp, data.levelCEFRp), levelCEFR: this.toAstProperty(PropertyConfigKey.levelCEFR, data.levelCEFR), levelILR: this.toAstProperty(PropertyConfigKey.levelILR, data.levelILR), levelACTFL: this.toAstProperty(PropertyConfigKey.levelACTFL, data.levelACTFL), icon: this.toAstProperty(PropertyConfigKey.icon, data.icon), iconTag: this.toAstProperty(PropertyConfigKey.iconTag, data.iconTag), colorTag: this.toAstProperty(PropertyConfigKey.colorTag, data.colorTag), flashcardSet: this.toAstProperty(PropertyConfigKey.flashcardSet, data.flashcardSet), subtype: this.toAstProperty(PropertyConfigKey.subtype, data.subtype), bookAlias: this.toAstProperty(PropertyConfigKey.bookAlias, data.bookAlias), coverImage: this.toAstProperty(PropertyConfigKey.coverImage, data.coverImage), coverColor: this.toAstProperty(PropertyConfigKey.coverColor, data.coverColor), publications: this.toAstProperty(PropertyConfigKey.publications, data.publications), author: this.toAstProperty(PropertyConfigKey.author, data.author), subject: this.toAstProperty(PropertyConfigKey.subject, data.subject), date: this.toAstProperty(PropertyConfigKey.date, data.date), dateEnd: this.toAstProperty(PropertyConfigKey.dateEnd, data.dateEnd), location: this.toAstProperty(PropertyConfigKey.location, data.location), kind: this.toAstProperty(PropertyConfigKey.kind, data.kind), hasMarkAsDone: this.toAstProperty(PropertyConfigKey.hasMarkAsDone, data.hasMarkAsDone), processHandIn: this.toAstProperty(PropertyConfigKey.processHandIn, data.processHandIn), chatWithBook: this.toAstProperty(PropertyConfigKey.chatWithBook, data.chatWithBook), chatWithBookBrainKey: this.toAstProperty(PropertyConfigKey.chatWithBookBrainKey, data.chatWithBookBrainKey), action: this.toAstProperty(PropertyConfigKey.action, data.action), showInIndex: this.toAstProperty(PropertyConfigKey.showInIndex, data.showInIndex), refAuthor: this.toAstProperty(PropertyConfigKey.refAuthor, data.refAuthor), refBookTitle: this.toAstProperty(PropertyConfigKey.refBookTitle, data.refBookTitle), refPublisher: this.toAstProperty(PropertyConfigKey.refPublisher, data.refPublisher), citationStyle: this.toAstProperty(PropertyConfigKey.citationStyle, data.citationStyle), blockId: this.toAstProperty(PropertyConfigKey.blockId, data.blockId), pageNo: this.toAstProperty(PropertyConfigKey.pageNo, data.pageNo), x: this.toAstProperty(PropertyConfigKey.x, data.x), y: this.toAstProperty(PropertyConfigKey.y, data.y), width: this.toAstProperty(PropertyConfigKey.width, data.width), height: this.toAstProperty(PropertyConfigKey.height, data.height), index: this.toAstProperty(PropertyConfigKey.index, data.index), classification: this.toAstProperty(PropertyConfigKey.classification, data.classification), availableClassifications: this.toAstProperty(PropertyConfigKey.availableClassifications, data.availableClassifications), allowedBit: this.toAstProperty(PropertyConfigKey.allowedBit, data.allowedBit), tableFixedHeader: this.toAstProperty(PropertyConfigKey.tableFixedHeader, data.tableFixedHeader), tableSearch: this.toAstProperty(PropertyConfigKey.tableSearch, data.tableSearch), tableSort: this.toAstProperty(PropertyConfigKey.tableSort, data.tableSort), tablePagination: this.toAstProperty(PropertyConfigKey.tablePagination, data.tablePagination), tablePaginationLimit: this.toAstProperty(PropertyConfigKey.tablePaginationLimit, data.tablePaginationLimit), tableHeight: this.toAstProperty(PropertyConfigKey.tableHeight, data.tableHeight), tableWhitespaceNoWrap: this.toAstProperty(PropertyConfigKey.tableWhitespaceNoWrap, data.tableWhitespaceNoWrap), tableAutoWidth: this.toAstProperty(PropertyConfigKey.tableAutoWidth, data.tableAutoWidth), tableResizableColumns: this.toAstProperty(PropertyConfigKey.tableResizableColumns, data.tableResizableColumns), tableColumnMinWidth: this.toAstProperty(PropertyConfigKey.tableColumnMinWidth, data.tableColumnMinWidth), quizCountItems: this.toAstProperty(PropertyConfigKey.quizCountItems, data.quizCountItems), quizStrikethroughSolutions: this.toAstProperty(PropertyConfigKey.quizStrikethroughSolutions, data.quizStrikethroughSolutions), codeLineNumbers: this.toAstProperty(PropertyConfigKey.codeLineNumbers, data.codeLineNumbers), codeMinimap: this.toAstProperty(PropertyConfigKey.codeMinimap, data.codeMinimap), stripePricingTableId: this.toAstProperty(PropertyConfigKey.stripePricingTableId, data.stripePricingTableId), stripePublishableKey: this.toAstProperty(PropertyConfigKey.stripePublishableKey, data.stripePublishableKey), thumbImage: this.toAstProperty(PropertyConfigKey.thumbImage, data.thumbImage), scormSource: this.toAstProperty(PropertyConfigKey.scormSource, data.scormSource), posterImage: this.toAstProperty(PropertyConfigKey.posterImage, data.posterImage), focusX: this.toAstProperty(PropertyConfigKey.focusX, data.focusX), focusY: this.toAstProperty(PropertyConfigKey.focusY, data.focusY), pointerLeft: this.toAstProperty(PropertyConfigKey.pointerLeft, data.pointerLeft), pointerTop: this.toAstProperty(PropertyConfigKey.pointerTop, data.pointerTop), listItemIndent: this.toAstProperty(PropertyConfigKey.listItemIndent, data.listItemIndent), backgroundWallpaper: this.toAstProperty(PropertyConfigKey.backgroundWallpaper, data.backgroundWallpaper), hasBookNavigation: this.toAstProperty(PropertyConfigKey.hasBookNavigation, data.hasBookNavigation), duration: this.toAstProperty(PropertyConfigKey.duration, data.duration), deeplink: this.toAstProperty(PropertyConfigKey.deeplink, data.deeplink), externalLink: this.toAstProperty(PropertyConfigKey.externalLink, data.externalLink), externalLinkText: this.toAstProperty(PropertyConfigKey.externalLinkText, data.externalLinkText), videoCallLink: this.toAstProperty(PropertyConfigKey.videoCallLink, data.videoCallLink), vendorUrl: this.toAstProperty(PropertyConfigKey.vendorUrl, data.vendorUrl), search: this.toAstProperty(PropertyConfigKey.search, data.search), list: this.toAstProperty(PropertyConfigKey.list, data.list), textReference: this.toAstProperty(PropertyConfigKey.textReference, data.textReference), isTracked: this.toAstProperty(PropertyConfigKey.isTracked, data.isTracked), isInfoOnly: this.toAstProperty(PropertyConfigKey.isInfoOnly, data.isInfoOnly), imageFirst: this.toAstProperty(PropertyConfigKey.imageFirst, data.imageFirst), activityType: this.toAstProperty(PropertyConfigKey.activityType, data.activityType), labelTrue: this.toAstProperty(PropertyConfigKey.labelTrue, data.labelTrue), labelFalse: this.toAstProperty(PropertyConfigKey.labelFalse, data.labelFalse), content2Buy: this.toAstProperty(PropertyConfigKey.content2Buy, data.content2Buy), mailingList: this.toAstProperty(PropertyConfigKey.mailingList, data.mailingList), buttonCaption: this.toAstProperty(PropertyConfigKey.buttonCaption, data.buttonCaption), callToActionUrl: this.toAstProperty(PropertyConfigKey.callToActionUrl, data.callToActionUrl), caption: this.handleJsonText(data.caption), quotedPerson: this.toAstProperty(PropertyConfigKey.quotedPerson, data.quotedPerson), reasonableNumOfChars: reasonableNumOfCharsProperty, resolved: this.toAstProperty(PropertyConfigKey.resolved, data.resolved), resolvedDate: this.toAstProperty(PropertyConfigKey.resolvedDate, data.resolvedDate), resolvedBy: this.toAstProperty(PropertyConfigKey.resolvedBy, data.resolvedBy), handInAcceptFileType: this.toAstProperty(PropertyConfigKey.handInAcceptFileType, data.handInAcceptFileType), handInRequirement: this.toAstProperty(PropertyConfigKey.handInRequirement, data.handInRequirement), handInInstruction: this.toAstProperty(PropertyConfigKey.handInInstruction, data.handInInstruction), maxCreatedBits: this.toAstProperty(PropertyConfigKey.maxCreatedBits, data.maxCreatedBits), maxDisplayLevel: this.toAstProperty(PropertyConfigKey.maxDisplayLevel, data.maxDisplayLevel), maxTocChapterLevel: this.toAstProperty(PropertyConfigKey.maxTocChapterLevel, data.maxTocChapterLevel), page: this.toAstProperty(PropertyConfigKey.page, data.page), productId: this.toAstProperty(PropertyConfigKey.productId, data.productId), product: this.toAstProperty(PropertyConfigKey.product, data.product), productList: this.toAstProperty(PropertyConfigKey.productList, data.productList), productVideo: this.toAstProperty(PropertyConfigKey.productVideo, data.productVideo), productVideoList: this.toAstProperty(PropertyConfigKey.productVideoList, data.productVideoList), productFolder: this.toAstProperty(PropertyConfigKey.productFolder, data.productFolder), technicalTerm: this.buildTechnicalTerm(data.technicalTerm), servings: this.buildServings(data.servings), ratingLevelStart: this.buildRatingLevelStartEnd(data.ratingLevelStart), ratingLevelEnd: this.buildRatingLevelStartEnd(data.ratingLevelEnd), ratingLevelSelected: this.toAstProperty(PropertyConfigKey.ratingLevelSelected, data.ratingLevelSelected), markConfig: this.buildMarkConfigs(data.markConfig), imageSource: this.buildImageSource(data.imageSource), person: this.buildPerson(data.bitType, data.person), bot: this.toAstProperty(PropertyConfigKey.bot, data.bot), referenceProperty: this.toAstProperty(PropertyConfigKey.property_reference, data.referenceProperty),
|
|
71
|
+
id: this.toAstProperty(PropertyConfigKey.id, data.id), internalComment: this.toAstProperty(PropertyConfigKey.internalComment, data.internalComment), customerId: this.toAstProperty(PropertyConfigKey.customerId, data.customerId), customerExternalId: this.toAstProperty(PropertyConfigKey.customerExternalId, data.customerExternalId), externalId: this.toAstProperty(PropertyConfigKey.externalId, data.externalId), spaceId: this.toAstProperty(PropertyConfigKey.spaceId, data.spaceId), padletId: this.toAstProperty(PropertyConfigKey.padletId, data.padletId), jupyterId: this.toAstProperty(PropertyConfigKey.jupyterId, data.jupyterId), jupyterExecutionCount: this.toAstProperty(PropertyConfigKey.jupyterExecutionCount, data.jupyterExecutionCount), isPublic: this.toAstProperty(PropertyConfigKey.isPublic, data.isPublic), aiGenerated: this.toAstProperty(PropertyConfigKey.aiGenerated, data.aiGenerated), machineTranslated: this.toAstProperty(PropertyConfigKey.machineTranslated, data.machineTranslated), searchIndex: this.toAstProperty(PropertyConfigKey.searchIndex, data.searchIndex), analyticsTag: this.toAstProperty(PropertyConfigKey.analyticsTag, data.analyticsTag), categoryTag: this.toAstProperty(PropertyConfigKey.categoryTag, data.categoryTag), topicTag: this.toAstProperty(PropertyConfigKey.topicTag, data.topicTag), altLangTag: this.toAstProperty(PropertyConfigKey.altLangTag, data.altLangTag), feedbackEngine: this.toAstProperty(PropertyConfigKey.feedbackEngine, data.feedbackEngine), feedbackType: this.toAstProperty(PropertyConfigKey.feedbackType, data.feedbackType), disableFeedback: this.toAstProperty(PropertyConfigKey.disableFeedback, data.disableFeedback), diffOp: this.toAstProperty(PropertyConfigKey.diffOp, data.diffOp), diffRef: this.toAstProperty(PropertyConfigKey.diffRef, data.diffRef), diffContext: this.toAstProperty(PropertyConfigKey.diffContext, data.diffContext), diffTime: this.toAstProperty(PropertyConfigKey.diffTime, data.diffTime), releaseVersion: this.toAstProperty(PropertyConfigKey.releaseVersion, data.releaseVersion), releaseKind: this.toAstProperty(PropertyConfigKey.releaseKind, data.releaseKind), releaseDate: this.toAstProperty(PropertyConfigKey.releaseDate, data.releaseDate), book: this.buildBooks(context, data.book), ageRange: this.toAstProperty(PropertyConfigKey.ageRange, data.ageRange), lang: this.toAstProperty(PropertyConfigKey.lang, data.lang), language: this.toAstProperty(PropertyConfigKey.language, data.language), publisher: this.toAstProperty(PropertyConfigKey.publisher, data.publisher), publisherName: this.toAstProperty(PropertyConfigKey.publisherName, data.publisherName), theme: this.toAstProperty(PropertyConfigKey.theme, data.theme), computerLanguage: this.toAstProperty(PropertyConfigKey.computerLanguage, data.computerLanguage), target: this.toAstProperty(PropertyConfigKey.target, data.target), slug: this.toAstProperty(PropertyConfigKey.slug, data.slug), tag: this.toAstProperty(PropertyConfigKey.tag, data.tag), reductionTag: this.toAstProperty(PropertyConfigKey.reductionTag, data.reductionTag), bubbleTag: this.toAstProperty(PropertyConfigKey.bubbleTag, data.bubbleTag), levelCEFRp: this.toAstProperty(PropertyConfigKey.levelCEFRp, data.levelCEFRp), levelCEFR: this.toAstProperty(PropertyConfigKey.levelCEFR, data.levelCEFR), levelILR: this.toAstProperty(PropertyConfigKey.levelILR, data.levelILR), levelACTFL: this.toAstProperty(PropertyConfigKey.levelACTFL, data.levelACTFL), icon: this.toAstProperty(PropertyConfigKey.icon, data.icon), iconTag: this.toAstProperty(PropertyConfigKey.iconTag, data.iconTag), colorTag: this.toAstProperty(PropertyConfigKey.colorTag, data.colorTag), flashcardSet: this.toAstProperty(PropertyConfigKey.flashcardSet, data.flashcardSet), subtype: this.toAstProperty(PropertyConfigKey.subtype, data.subtype), bookAlias: this.toAstProperty(PropertyConfigKey.bookAlias, data.bookAlias), bookDiff: this.toAstProperty(PropertyConfigKey.bookDiff, data.bookDiff), coverImage: this.toAstProperty(PropertyConfigKey.coverImage, data.coverImage), coverColor: this.toAstProperty(PropertyConfigKey.coverColor, data.coverColor), publications: this.toAstProperty(PropertyConfigKey.publications, data.publications), author: this.toAstProperty(PropertyConfigKey.author, data.author), subject: this.toAstProperty(PropertyConfigKey.subject, data.subject), date: this.toAstProperty(PropertyConfigKey.date, data.date), dateEnd: this.toAstProperty(PropertyConfigKey.dateEnd, data.dateEnd), location: this.toAstProperty(PropertyConfigKey.location, data.location), kind: this.toAstProperty(PropertyConfigKey.kind, data.kind), hasMarkAsDone: this.toAstProperty(PropertyConfigKey.hasMarkAsDone, data.hasMarkAsDone), processHandIn: this.toAstProperty(PropertyConfigKey.processHandIn, data.processHandIn), chatWithBook: this.toAstProperty(PropertyConfigKey.chatWithBook, data.chatWithBook), chatWithBookBrainKey: this.toAstProperty(PropertyConfigKey.chatWithBookBrainKey, data.chatWithBookBrainKey), action: this.toAstProperty(PropertyConfigKey.action, data.action), showInIndex: this.toAstProperty(PropertyConfigKey.showInIndex, data.showInIndex), refAuthor: this.toAstProperty(PropertyConfigKey.refAuthor, data.refAuthor), refBookTitle: this.toAstProperty(PropertyConfigKey.refBookTitle, data.refBookTitle), refPublisher: this.toAstProperty(PropertyConfigKey.refPublisher, data.refPublisher), citationStyle: this.toAstProperty(PropertyConfigKey.citationStyle, data.citationStyle), blockId: this.toAstProperty(PropertyConfigKey.blockId, data.blockId), pageNo: this.toAstProperty(PropertyConfigKey.pageNo, data.pageNo), x: this.toAstProperty(PropertyConfigKey.x, data.x), y: this.toAstProperty(PropertyConfigKey.y, data.y), width: this.toAstProperty(PropertyConfigKey.width, data.width), height: this.toAstProperty(PropertyConfigKey.height, data.height), index: this.toAstProperty(PropertyConfigKey.index, data.index), classification: this.toAstProperty(PropertyConfigKey.classification, data.classification), availableClassifications: this.toAstProperty(PropertyConfigKey.availableClassifications, data.availableClassifications), allowedBit: this.toAstProperty(PropertyConfigKey.allowedBit, data.allowedBit), tableFixedHeader: this.toAstProperty(PropertyConfigKey.tableFixedHeader, data.tableFixedHeader), tableSearch: this.toAstProperty(PropertyConfigKey.tableSearch, data.tableSearch), tableSort: this.toAstProperty(PropertyConfigKey.tableSort, data.tableSort), tablePagination: this.toAstProperty(PropertyConfigKey.tablePagination, data.tablePagination), tablePaginationLimit: this.toAstProperty(PropertyConfigKey.tablePaginationLimit, data.tablePaginationLimit), tableHeight: this.toAstProperty(PropertyConfigKey.tableHeight, data.tableHeight), tableWhitespaceNoWrap: this.toAstProperty(PropertyConfigKey.tableWhitespaceNoWrap, data.tableWhitespaceNoWrap), tableAutoWidth: this.toAstProperty(PropertyConfigKey.tableAutoWidth, data.tableAutoWidth), tableResizableColumns: this.toAstProperty(PropertyConfigKey.tableResizableColumns, data.tableResizableColumns), tableColumnMinWidth: this.toAstProperty(PropertyConfigKey.tableColumnMinWidth, data.tableColumnMinWidth), quizCountItems: this.toAstProperty(PropertyConfigKey.quizCountItems, data.quizCountItems), quizStrikethroughSolutions: this.toAstProperty(PropertyConfigKey.quizStrikethroughSolutions, data.quizStrikethroughSolutions), codeLineNumbers: this.toAstProperty(PropertyConfigKey.codeLineNumbers, data.codeLineNumbers), codeMinimap: this.toAstProperty(PropertyConfigKey.codeMinimap, data.codeMinimap), stripePricingTableId: this.toAstProperty(PropertyConfigKey.stripePricingTableId, data.stripePricingTableId), stripePublishableKey: this.toAstProperty(PropertyConfigKey.stripePublishableKey, data.stripePublishableKey), thumbImage: this.toAstProperty(PropertyConfigKey.thumbImage, data.thumbImage), scormSource: this.toAstProperty(PropertyConfigKey.scormSource, data.scormSource), posterImage: this.toAstProperty(PropertyConfigKey.posterImage, data.posterImage), focusX: this.toAstProperty(PropertyConfigKey.focusX, data.focusX), focusY: this.toAstProperty(PropertyConfigKey.focusY, data.focusY), pointerLeft: this.toAstProperty(PropertyConfigKey.pointerLeft, data.pointerLeft), pointerTop: this.toAstProperty(PropertyConfigKey.pointerTop, data.pointerTop), listItemIndent: this.toAstProperty(PropertyConfigKey.listItemIndent, data.listItemIndent), backgroundWallpaper: this.toAstProperty(PropertyConfigKey.backgroundWallpaper, data.backgroundWallpaper), hasBookNavigation: this.toAstProperty(PropertyConfigKey.hasBookNavigation, data.hasBookNavigation), duration: this.toAstProperty(PropertyConfigKey.duration, data.duration), deeplink: this.toAstProperty(PropertyConfigKey.deeplink, data.deeplink), externalLink: this.toAstProperty(PropertyConfigKey.externalLink, data.externalLink), externalLinkText: this.toAstProperty(PropertyConfigKey.externalLinkText, data.externalLinkText), videoCallLink: this.toAstProperty(PropertyConfigKey.videoCallLink, data.videoCallLink), vendorSurveyId: this.toAstProperty(PropertyConfigKey.vendorSurveyId, data.vendorSurveyId), vendorUrl: this.toAstProperty(PropertyConfigKey.vendorUrl, data.vendorUrl), search: this.toAstProperty(PropertyConfigKey.search, data.search), list: this.toAstProperty(PropertyConfigKey.list, data.list), textReference: this.toAstProperty(PropertyConfigKey.textReference, data.textReference), isTracked: this.toAstProperty(PropertyConfigKey.isTracked, data.isTracked), isInfoOnly: this.toAstProperty(PropertyConfigKey.isInfoOnly, data.isInfoOnly), imageFirst: this.toAstProperty(PropertyConfigKey.imageFirst, data.imageFirst), activityType: this.toAstProperty(PropertyConfigKey.activityType, data.activityType), labelTrue: this.toAstProperty(PropertyConfigKey.labelTrue, data.labelTrue), labelFalse: this.toAstProperty(PropertyConfigKey.labelFalse, data.labelFalse), content2Buy: this.toAstProperty(PropertyConfigKey.content2Buy, data.content2Buy), mailingList: this.toAstProperty(PropertyConfigKey.mailingList, data.mailingList), buttonCaption: this.toAstProperty(PropertyConfigKey.buttonCaption, data.buttonCaption), callToActionUrl: this.toAstProperty(PropertyConfigKey.callToActionUrl, data.callToActionUrl), caption: this.handleJsonText(context, true, data.caption), quotedPerson: this.toAstProperty(PropertyConfigKey.quotedPerson, data.quotedPerson), reasonableNumOfChars: reasonableNumOfCharsProperty, resolved: this.toAstProperty(PropertyConfigKey.resolved, data.resolved), resolvedDate: this.toAstProperty(PropertyConfigKey.resolvedDate, data.resolvedDate), resolvedBy: this.toAstProperty(PropertyConfigKey.resolvedBy, data.resolvedBy), handInAcceptFileType: this.toAstProperty(PropertyConfigKey.handInAcceptFileType, data.handInAcceptFileType), handInRequirement: this.toAstProperty(PropertyConfigKey.handInRequirement, data.handInRequirement), handInInstruction: this.toAstProperty(PropertyConfigKey.handInInstruction, data.handInInstruction), maxCreatedBits: this.toAstProperty(PropertyConfigKey.maxCreatedBits, data.maxCreatedBits), maxDisplayLevel: this.toAstProperty(PropertyConfigKey.maxDisplayLevel, data.maxDisplayLevel), maxTocChapterLevel: this.toAstProperty(PropertyConfigKey.maxTocChapterLevel, data.maxTocChapterLevel), page: this.toAstProperty(PropertyConfigKey.page, data.page), productId: this.toAstProperty(PropertyConfigKey.productId, data.productId), product: this.toAstProperty(PropertyConfigKey.product, data.product), productList: this.toAstProperty(PropertyConfigKey.productList, data.productList), productVideo: this.toAstProperty(PropertyConfigKey.productVideo, data.productVideo), productVideoList: this.toAstProperty(PropertyConfigKey.productVideoList, data.productVideoList), productFolder: this.toAstProperty(PropertyConfigKey.productFolder, data.productFolder), technicalTerm: this.buildTechnicalTerm(context, data.technicalTerm), servings: this.buildServings(context, data.servings), ratingLevelStart: this.buildRatingLevelStartEnd(context, data.ratingLevelStart), ratingLevelEnd: this.buildRatingLevelStartEnd(context, data.ratingLevelEnd), ratingLevelSelected: this.toAstProperty(PropertyConfigKey.ratingLevelSelected, data.ratingLevelSelected), markConfig: this.buildMarkConfigs(context, data.markConfig), imageSource: this.buildImageSource(context, data.imageSource), person: this.buildPerson(context, data.person), bot: this.toAstProperty(PropertyConfigKey.bot, data.bot), referenceProperty: this.toAstProperty(PropertyConfigKey.property_reference, data.referenceProperty),
|
|
66
72
|
// Book data
|
|
67
|
-
title: this.handleJsonText(data.title), subtitle: this.handleJsonText(data.subtitle), level: NumberUtils.asNumber(data.level), toc: this.toAstProperty(PropertyConfigKey.toc, data.toc), progress: this.toAstProperty(PropertyConfigKey.progress, data.progress), anchor: data.anchor, reference: data.reference, referenceEnd: data.referenceEnd, revealSolutions: this.toAstProperty(PropertyConfigKey.revealSolutions, data.revealSolutions),
|
|
73
|
+
title: this.handleJsonText(context, true, data.title), subtitle: this.handleJsonText(context, true, data.subtitle), level: NumberUtils.asNumber(data.level), toc: this.toAstProperty(PropertyConfigKey.toc, data.toc), progress: this.toAstProperty(PropertyConfigKey.progress, data.progress), anchor: data.anchor, reference: data.reference, referenceEnd: data.referenceEnd, revealSolutions: this.toAstProperty(PropertyConfigKey.revealSolutions, data.revealSolutions),
|
|
68
74
|
// Item, Lead, Hint, Instruction
|
|
69
|
-
item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), pageNumber: this.handleJsonText(data.pageNumber), marginNumber: this.handleJsonText(data.marginNumber), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction), partialAnswer: this.toAstProperty(PropertyConfigKey.partialAnswer, data.partialAnswer), sampleSolution: this.toAstProperty(PropertyConfigKey.property_sampleSolution, data.sampleSolution), additionalSolutions: this.toAstProperty(PropertyConfigKey.additionalSolutions, data.additionalSolutions) }, this.toExample(data.__isDefaultExample, data.example)), {
|
|
75
|
+
item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), pageNumber: this.handleJsonText(context, true, data.pageNumber), marginNumber: this.handleJsonText(context, true, data.marginNumber), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction), partialAnswer: this.toAstProperty(PropertyConfigKey.partialAnswer, data.partialAnswer), sampleSolution: this.toAstProperty(PropertyConfigKey.property_sampleSolution, data.sampleSolution), additionalSolutions: this.toAstProperty(PropertyConfigKey.additionalSolutions, data.additionalSolutions) }, this.toExample(data.__isDefaultExample, data.example)), {
|
|
70
76
|
// Person
|
|
71
|
-
imagePlaceholder: ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(
|
|
77
|
+
imagePlaceholder: ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag.image, (_b = data.imagePlaceholder) === null || _b === void 0 ? void 0 : _b.image)), resources: ArrayUtils.asArray(this.resourceBuilder.resourceFromResourceJson(context, data.resources)),
|
|
72
78
|
// Body, Card, Footer, must be after all other properties except the extraProperties and markup / parser
|
|
73
|
-
body: this.buildBody(
|
|
79
|
+
body: this.buildBody(context, data.body), cardNode, footer: this.buildFooter(context, data.footer),
|
|
74
80
|
// Must be after other properties/tags in the AST so key clashes are avoided correctly
|
|
75
81
|
extraProperties: this.parseExtraProperties(data.extraProperties), markup: data.markup, parser: data.parser,
|
|
76
82
|
// Private properties
|
|
77
83
|
__isDefaultExample: (_c = data.__isDefaultExample) !== null && _c !== void 0 ? _c : false });
|
|
78
84
|
// Push reasonableNumOfChars down the tree for the interview bit
|
|
79
85
|
if (Config.isOfBitType(node.bitType, BitType.interview)) {
|
|
80
|
-
this.pushDownTree(undefined, undefined, cardNode, 'questions', PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars);
|
|
86
|
+
this.pushDownTree(context, undefined, undefined, cardNode, 'questions', PropertyConfigKey.reasonableNumOfChars, data.reasonableNumOfChars);
|
|
81
87
|
}
|
|
82
88
|
// Push isCaseSensitive down the tree for the cloze, match and match-matrix bits
|
|
83
|
-
this.pushDownTree([node.body, ...((_e = (_d = cardNode === null || cardNode === void 0 ? void 0 : cardNode.cardBits) === null || _d === void 0 ? void 0 : _d.map((cardBit) => cardBit.body)) !== null && _e !== void 0 ? _e : [])], [BodyBitType.gap], undefined, undefined, //'isCaseSensitive',
|
|
89
|
+
this.pushDownTree(context, [node.body, ...((_e = (_d = cardNode === null || cardNode === void 0 ? void 0 : cardNode.cardBits) === null || _d === void 0 ? void 0 : _d.map((cardBit) => cardBit.body)) !== null && _e !== void 0 ? _e : [])], [BodyBitType.gap], undefined, undefined, //'isCaseSensitive',
|
|
84
90
|
PropertyConfigKey.isCaseSensitive, (_f = data.isCaseSensitive) !== null && _f !== void 0 ? _f : true);
|
|
85
|
-
this.pushDownTree(undefined, undefined, cardNode, 'pairs', PropertyConfigKey.isCaseSensitive, (_g = data.isCaseSensitive) !== null && _g !== void 0 ? _g : true);
|
|
86
|
-
this.pushDownTree(undefined, undefined, cardNode, ['matrix', 'cells'], PropertyConfigKey.isCaseSensitive, (_h = data.isCaseSensitive) !== null && _h !== void 0 ? _h : true);
|
|
91
|
+
this.pushDownTree(context, undefined, undefined, cardNode, 'pairs', PropertyConfigKey.isCaseSensitive, (_g = data.isCaseSensitive) !== null && _g !== void 0 ? _g : true);
|
|
92
|
+
this.pushDownTree(context, undefined, undefined, cardNode, ['matrix', 'cells'], PropertyConfigKey.isCaseSensitive, (_h = data.isCaseSensitive) !== null && _h !== void 0 ? _h : true);
|
|
87
93
|
// If __isDefaultExample is set at the bit level, push the default example down the tree to the relevant nodes
|
|
88
|
-
this.pushExampleDownTree(node.body, cardNode, node.__isDefaultExample, convertedExample.example);
|
|
94
|
+
this.pushExampleDownTree(context, node.body, cardNode, node.__isDefaultExample, convertedExample.example);
|
|
89
95
|
// Set default values
|
|
90
96
|
this.setDefaultBitValues(node);
|
|
91
97
|
// Set the 'isExample' flags
|
|
@@ -107,12 +113,12 @@ class Builder extends BaseBuilder {
|
|
|
107
113
|
* @param data - data for the node
|
|
108
114
|
* @returns
|
|
109
115
|
*/
|
|
110
|
-
buildBooks(data) {
|
|
116
|
+
buildBooks(context, data) {
|
|
111
117
|
if (StringUtils.isString(data))
|
|
112
118
|
return data;
|
|
113
119
|
if (!Array.isArray(data))
|
|
114
120
|
return undefined;
|
|
115
|
-
const nodes = data.map((d) => this.buildBook(d)).filter((d) => d != null);
|
|
121
|
+
const nodes = data.map((d) => this.buildBook(context, d)).filter((d) => d != null);
|
|
116
122
|
return nodes.length > 0 ? nodes : undefined;
|
|
117
123
|
}
|
|
118
124
|
/**
|
|
@@ -121,7 +127,7 @@ class Builder extends BaseBuilder {
|
|
|
121
127
|
* @param data - data for the node
|
|
122
128
|
* @returns
|
|
123
129
|
*/
|
|
124
|
-
buildBook(data) {
|
|
130
|
+
buildBook(_context, data) {
|
|
125
131
|
var _a, _b, _c;
|
|
126
132
|
if (!data)
|
|
127
133
|
return undefined;
|
|
@@ -144,10 +150,10 @@ class Builder extends BaseBuilder {
|
|
|
144
150
|
* @param data - data for the node
|
|
145
151
|
* @returns
|
|
146
152
|
*/
|
|
147
|
-
buildChoices(data) {
|
|
153
|
+
buildChoices(context, data) {
|
|
148
154
|
if (!Array.isArray(data))
|
|
149
155
|
return undefined;
|
|
150
|
-
const nodes = data.map((d) => this.buildChoice(d)).filter((d) => d != null);
|
|
156
|
+
const nodes = data.map((d) => this.buildChoice(context, d)).filter((d) => d != null);
|
|
151
157
|
return nodes.length > 0 ? nodes : undefined;
|
|
152
158
|
}
|
|
153
159
|
/**
|
|
@@ -156,12 +162,12 @@ class Builder extends BaseBuilder {
|
|
|
156
162
|
* @param data - data for the node
|
|
157
163
|
* @returns
|
|
158
164
|
*/
|
|
159
|
-
buildChoice(data) {
|
|
165
|
+
buildChoice(context, data) {
|
|
160
166
|
var _a;
|
|
161
167
|
if (!data)
|
|
162
168
|
return undefined;
|
|
163
169
|
// NOTE: Node order is important and is defined here
|
|
164
|
-
const node = Object.assign({ choice: (_a = data.choice) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
170
|
+
const node = Object.assign({ choice: (_a = data.choice) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
165
171
|
// Remove Unset Optionals
|
|
166
172
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
167
173
|
ignoreAllFalse: true,
|
|
@@ -176,10 +182,10 @@ class Builder extends BaseBuilder {
|
|
|
176
182
|
* @param data - data for the node
|
|
177
183
|
* @returns
|
|
178
184
|
*/
|
|
179
|
-
buildResponses(data) {
|
|
185
|
+
buildResponses(context, data) {
|
|
180
186
|
if (!Array.isArray(data))
|
|
181
187
|
return undefined;
|
|
182
|
-
const nodes = data.map((d) => this.buildResponse(d)).filter((d) => d != null);
|
|
188
|
+
const nodes = data.map((d) => this.buildResponse(context, d)).filter((d) => d != null);
|
|
183
189
|
return nodes.length > 0 ? nodes : undefined;
|
|
184
190
|
}
|
|
185
191
|
/**
|
|
@@ -188,12 +194,12 @@ class Builder extends BaseBuilder {
|
|
|
188
194
|
* @param data - data for the node
|
|
189
195
|
* @returns
|
|
190
196
|
*/
|
|
191
|
-
buildResponse(data) {
|
|
197
|
+
buildResponse(context, data) {
|
|
192
198
|
var _a;
|
|
193
199
|
if (!data)
|
|
194
200
|
return undefined;
|
|
195
201
|
// NOTE: Node order is important and is defined here
|
|
196
|
-
const node = Object.assign({ response: (_a = data.response) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
202
|
+
const node = Object.assign({ response: (_a = data.response) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
197
203
|
// Remove Unset Optionals
|
|
198
204
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
199
205
|
ignoreAllFalse: true,
|
|
@@ -208,10 +214,10 @@ class Builder extends BaseBuilder {
|
|
|
208
214
|
* @param data - data for the node
|
|
209
215
|
* @returns
|
|
210
216
|
*/
|
|
211
|
-
buildBotResponses(data) {
|
|
217
|
+
buildBotResponses(context, data) {
|
|
212
218
|
if (!Array.isArray(data))
|
|
213
219
|
return undefined;
|
|
214
|
-
const nodes = data.map((d) => this.botResponse(d)).filter((d) => d != null);
|
|
220
|
+
const nodes = data.map((d) => this.botResponse(context, d)).filter((d) => d != null);
|
|
215
221
|
return nodes.length > 0 ? nodes : undefined;
|
|
216
222
|
}
|
|
217
223
|
/**
|
|
@@ -220,7 +226,7 @@ class Builder extends BaseBuilder {
|
|
|
220
226
|
* @param data - data for the node
|
|
221
227
|
* @returns
|
|
222
228
|
*/
|
|
223
|
-
botResponse(data) {
|
|
229
|
+
botResponse(context, data) {
|
|
224
230
|
var _a, _b, _c;
|
|
225
231
|
if (!data)
|
|
226
232
|
return undefined;
|
|
@@ -229,9 +235,9 @@ class Builder extends BaseBuilder {
|
|
|
229
235
|
response: (_a = data.response) !== null && _a !== void 0 ? _a : '',
|
|
230
236
|
reaction: (_b = data.reaction) !== null && _b !== void 0 ? _b : '',
|
|
231
237
|
feedback: (_c = data.feedback) !== null && _c !== void 0 ? _c : '',
|
|
232
|
-
item: this.handleJsonText(data.item),
|
|
233
|
-
lead: this.handleJsonText(data.lead),
|
|
234
|
-
hint: this.handleJsonText(data.hint),
|
|
238
|
+
item: this.handleJsonText(context, true, data.item),
|
|
239
|
+
lead: this.handleJsonText(context, true, data.lead),
|
|
240
|
+
hint: this.handleJsonText(context, true, data.hint),
|
|
235
241
|
};
|
|
236
242
|
// Remove Unset Optionals
|
|
237
243
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
@@ -248,10 +254,10 @@ class Builder extends BaseBuilder {
|
|
|
248
254
|
* @param data - data for the node
|
|
249
255
|
* @returns
|
|
250
256
|
*/
|
|
251
|
-
buildQuizzes(data) {
|
|
257
|
+
buildQuizzes(context, data) {
|
|
252
258
|
if (!Array.isArray(data))
|
|
253
259
|
return undefined;
|
|
254
|
-
const nodes = data.map((d) => this.buildQuiz(d)).filter((d) => d != null);
|
|
260
|
+
const nodes = data.map((d) => this.buildQuiz(context, d)).filter((d) => d != null);
|
|
255
261
|
return nodes.length > 0 ? nodes : undefined;
|
|
256
262
|
}
|
|
257
263
|
/**
|
|
@@ -260,21 +266,21 @@ class Builder extends BaseBuilder {
|
|
|
260
266
|
* @param data - data for the node
|
|
261
267
|
* @returns
|
|
262
268
|
*/
|
|
263
|
-
buildQuiz(data) {
|
|
269
|
+
buildQuiz(context, data) {
|
|
264
270
|
if (!data)
|
|
265
271
|
return undefined;
|
|
266
272
|
const convertedExample = Object.assign({}, this.toExample(data.__isDefaultExample, data.__defaultExample));
|
|
267
273
|
let choices;
|
|
268
274
|
let responses;
|
|
269
275
|
if (data.choices) {
|
|
270
|
-
choices = this.buildChoices(data.choices);
|
|
276
|
+
choices = this.buildChoices(context, data.choices);
|
|
271
277
|
// Push __isDefaultExample down the tree
|
|
272
|
-
this.pushExampleDownTreeBoolean(data.__isDefaultExample, convertedExample.example, true, choices);
|
|
278
|
+
this.pushExampleDownTreeBoolean(context, data.__isDefaultExample, convertedExample.example, true, choices);
|
|
273
279
|
}
|
|
274
280
|
else if (data.responses) {
|
|
275
|
-
responses = this.buildResponses(data.responses);
|
|
281
|
+
responses = this.buildResponses(context, data.responses);
|
|
276
282
|
// Push __isDefaultExample down the tree
|
|
277
|
-
this.pushExampleDownTreeBoolean(data.__isDefaultExample, convertedExample.example, false, responses);
|
|
283
|
+
this.pushExampleDownTreeBoolean(context, data.__isDefaultExample, convertedExample.example, false, responses);
|
|
278
284
|
}
|
|
279
285
|
else {
|
|
280
286
|
// No choices or responses, not a valid quiz
|
|
@@ -282,10 +288,10 @@ class Builder extends BaseBuilder {
|
|
|
282
288
|
}
|
|
283
289
|
// NOTE: Node order is important and is defined here
|
|
284
290
|
const node = {
|
|
285
|
-
item: this.handleJsonText(data.item),
|
|
286
|
-
lead: this.handleJsonText(data.lead),
|
|
287
|
-
hint: this.handleJsonText(data.hint),
|
|
288
|
-
instruction: this.handleJsonText(data.instruction),
|
|
291
|
+
item: this.handleJsonText(context, true, data.item),
|
|
292
|
+
lead: this.handleJsonText(context, true, data.lead),
|
|
293
|
+
hint: this.handleJsonText(context, true, data.hint),
|
|
294
|
+
instruction: this.handleJsonText(context, true, data.instruction),
|
|
289
295
|
isExample: !!data.__defaultExample,
|
|
290
296
|
choices: choices,
|
|
291
297
|
responses: responses,
|
|
@@ -303,7 +309,7 @@ class Builder extends BaseBuilder {
|
|
|
303
309
|
* @param data - data for the node
|
|
304
310
|
* @returns
|
|
305
311
|
*/
|
|
306
|
-
buildHeading(data) {
|
|
312
|
+
buildHeading(_context, data) {
|
|
307
313
|
var _a, _b, _c;
|
|
308
314
|
if (!data)
|
|
309
315
|
return undefined;
|
|
@@ -328,10 +334,10 @@ class Builder extends BaseBuilder {
|
|
|
328
334
|
* @param data - data for the node
|
|
329
335
|
* @returns
|
|
330
336
|
*/
|
|
331
|
-
buildPairs(
|
|
337
|
+
buildPairs(context, data) {
|
|
332
338
|
if (!Array.isArray(data))
|
|
333
339
|
return undefined;
|
|
334
|
-
const nodes = data.map((d) => this.buildPair(
|
|
340
|
+
const nodes = data.map((d) => this.buildPair(context, d)).filter((d) => d != null);
|
|
335
341
|
return nodes.length > 0 ? nodes : undefined;
|
|
336
342
|
}
|
|
337
343
|
/**
|
|
@@ -340,18 +346,18 @@ class Builder extends BaseBuilder {
|
|
|
340
346
|
* @param data - data for the node
|
|
341
347
|
* @returns
|
|
342
348
|
*/
|
|
343
|
-
buildPair(
|
|
349
|
+
buildPair(context, data) {
|
|
344
350
|
var _a, _b, _c, _d;
|
|
345
351
|
if (!data)
|
|
346
352
|
return undefined;
|
|
347
353
|
// Set default example
|
|
348
354
|
const defaultExample = Array.isArray(data.__valuesAst) && data.__valuesAst.length > 0 ? data.__valuesAst[0] : null;
|
|
349
355
|
// Process the keyAudio and keyImage resources
|
|
350
|
-
const keyAudio = (_a = ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(
|
|
351
|
-
const keyImage = (_b = ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(
|
|
356
|
+
const keyAudio = (_a = ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag.audio, data.keyAudio))) === null || _a === void 0 ? void 0 : _a.audio;
|
|
357
|
+
const keyImage = (_b = ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag.image, data.keyImage))) === null || _b === void 0 ? void 0 : _b.image;
|
|
352
358
|
// NOTE: Node order is important and is defined here
|
|
353
359
|
const node = Object.assign(Object.assign({ key: (_c = data.key) !== null && _c !== void 0 ? _c : '', keyAudio,
|
|
354
|
-
keyImage, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { values: (_d = data.values) !== null && _d !== void 0 ? _d : [], __valuesAst: data.__valuesAst });
|
|
360
|
+
keyImage, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { values: (_d = data.values) !== null && _d !== void 0 ? _d : [], __valuesAst: data.__valuesAst });
|
|
355
361
|
// Remove Unset Optionals
|
|
356
362
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
357
363
|
ignoreAllFalse: true,
|
|
@@ -378,10 +384,10 @@ class Builder extends BaseBuilder {
|
|
|
378
384
|
* @param data - data for the node
|
|
379
385
|
* @returns
|
|
380
386
|
*/
|
|
381
|
-
buildMatricies(data) {
|
|
387
|
+
buildMatricies(context, data) {
|
|
382
388
|
if (!Array.isArray(data))
|
|
383
389
|
return undefined;
|
|
384
|
-
const nodes = data.map((d) => this.buildMatrix(d)).filter((d) => d != null);
|
|
390
|
+
const nodes = data.map((d) => this.buildMatrix(context, d)).filter((d) => d != null);
|
|
385
391
|
return nodes.length > 0 ? nodes : undefined;
|
|
386
392
|
}
|
|
387
393
|
/**
|
|
@@ -390,7 +396,7 @@ class Builder extends BaseBuilder {
|
|
|
390
396
|
* @param data - data for the node
|
|
391
397
|
* @returns
|
|
392
398
|
*/
|
|
393
|
-
buildMatrix(data) {
|
|
399
|
+
buildMatrix(context, data) {
|
|
394
400
|
var _a, _b, _c;
|
|
395
401
|
if (!data)
|
|
396
402
|
return undefined;
|
|
@@ -411,12 +417,12 @@ class Builder extends BaseBuilder {
|
|
|
411
417
|
// NOTE: Node order is important and is defined here
|
|
412
418
|
const node = {
|
|
413
419
|
key: (_b = data.key) !== null && _b !== void 0 ? _b : '',
|
|
414
|
-
item: this.handleJsonText(data.item),
|
|
415
|
-
lead: this.handleJsonText(data.lead),
|
|
416
|
-
hint: this.handleJsonText(data.hint),
|
|
417
|
-
instruction: this.handleJsonText(data.instruction),
|
|
420
|
+
item: this.handleJsonText(context, true, data.item),
|
|
421
|
+
lead: this.handleJsonText(context, true, data.lead),
|
|
422
|
+
hint: this.handleJsonText(context, true, data.hint),
|
|
423
|
+
instruction: this.handleJsonText(context, true, data.instruction),
|
|
418
424
|
isExample,
|
|
419
|
-
cells: ((_c = data.cells) !== null && _c !== void 0 ? _c : []).map((c) => this.buildMatrixCell(c)).filter((c) => c != null),
|
|
425
|
+
cells: ((_c = data.cells) !== null && _c !== void 0 ? _c : []).map((c) => this.buildMatrixCell(context, c)).filter((c) => c != null),
|
|
420
426
|
};
|
|
421
427
|
// Remove Unset Optionals
|
|
422
428
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
@@ -432,14 +438,14 @@ class Builder extends BaseBuilder {
|
|
|
432
438
|
* @param data - data for the node
|
|
433
439
|
* @returns
|
|
434
440
|
*/
|
|
435
|
-
buildMatrixCell(data) {
|
|
441
|
+
buildMatrixCell(context, data) {
|
|
436
442
|
var _a;
|
|
437
443
|
if (!data)
|
|
438
444
|
return undefined;
|
|
439
445
|
// Set default example
|
|
440
446
|
const defaultExample = Array.isArray(data.__valuesAst) && data.__valuesAst.length > 0 ? data.__valuesAst[0] : null;
|
|
441
447
|
// NOTE: Node order is important and is defined here
|
|
442
|
-
const node = Object.assign(Object.assign({ values: (_a = data.values) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __valuesAst: data.__valuesAst });
|
|
448
|
+
const node = Object.assign(Object.assign({ values: (_a = data.values) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __valuesAst: data.__valuesAst });
|
|
443
449
|
// Remove Unset Optionals
|
|
444
450
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
445
451
|
ignoreAllFalse: true,
|
|
@@ -454,7 +460,7 @@ class Builder extends BaseBuilder {
|
|
|
454
460
|
* @param data - data for the node
|
|
455
461
|
* @returns
|
|
456
462
|
*/
|
|
457
|
-
buildPronunciationTable(
|
|
463
|
+
buildPronunciationTable(context, dataIn) {
|
|
458
464
|
var _a;
|
|
459
465
|
if (!dataIn)
|
|
460
466
|
return undefined;
|
|
@@ -463,10 +469,10 @@ class Builder extends BaseBuilder {
|
|
|
463
469
|
data: ((_a = dataIn.data) !== null && _a !== void 0 ? _a : []).map((row) => (row !== null && row !== void 0 ? row : []).map((cell) => {
|
|
464
470
|
var _a;
|
|
465
471
|
// Process the audio resource
|
|
466
|
-
const audio = (_a = ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(
|
|
472
|
+
const audio = (_a = ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag.audio, cell.audio))) === null || _a === void 0 ? void 0 : _a.audio;
|
|
467
473
|
return {
|
|
468
|
-
title: this.handleJsonText(cell.title),
|
|
469
|
-
body: this.handleJsonText(cell.body
|
|
474
|
+
title: this.handleJsonText(context, true, cell.title),
|
|
475
|
+
body: this.handleJsonText(context, true, cell.body),
|
|
470
476
|
audio,
|
|
471
477
|
};
|
|
472
478
|
})),
|
|
@@ -483,14 +489,14 @@ class Builder extends BaseBuilder {
|
|
|
483
489
|
* @param data - data for the node
|
|
484
490
|
* @returns
|
|
485
491
|
*/
|
|
486
|
-
buildTable(
|
|
492
|
+
buildTable(context, dataIn) {
|
|
487
493
|
var _a, _b;
|
|
488
494
|
if (!dataIn)
|
|
489
495
|
return undefined;
|
|
490
496
|
// NOTE: Node order is important and is defined here
|
|
491
497
|
const node = {
|
|
492
|
-
columns: ((_a = dataIn.columns) !== null && _a !== void 0 ? _a : []).map((col) => this.handleJsonText(
|
|
493
|
-
data: ((_b = dataIn.data) !== null && _b !== void 0 ? _b : []).map((row) => (row !== null && row !== void 0 ? row : []).map((cell) => this.handleJsonText(
|
|
498
|
+
columns: ((_a = dataIn.columns) !== null && _a !== void 0 ? _a : []).map((col) => this.handleJsonText(context, true, col)),
|
|
499
|
+
data: ((_b = dataIn.data) !== null && _b !== void 0 ? _b : []).map((row) => (row !== null && row !== void 0 ? row : []).map((cell) => this.handleJsonText(context, true, cell))),
|
|
494
500
|
};
|
|
495
501
|
// Remove Unset Optionals
|
|
496
502
|
// ObjectUtils.removeUnwantedProperties(node, {
|
|
@@ -504,10 +510,10 @@ class Builder extends BaseBuilder {
|
|
|
504
510
|
* @param data - data for the node
|
|
505
511
|
* @returns
|
|
506
512
|
*/
|
|
507
|
-
buildQuestions(
|
|
513
|
+
buildQuestions(context, data) {
|
|
508
514
|
if (!Array.isArray(data))
|
|
509
515
|
return undefined;
|
|
510
|
-
const nodes = data.map((d) => this.buildQuestion(
|
|
516
|
+
const nodes = data.map((d) => this.buildQuestion(context, d)).filter((d) => d != null);
|
|
511
517
|
return nodes.length > 0 ? nodes : undefined;
|
|
512
518
|
}
|
|
513
519
|
/**
|
|
@@ -516,16 +522,14 @@ class Builder extends BaseBuilder {
|
|
|
516
522
|
* @param data - data for the node
|
|
517
523
|
* @returns
|
|
518
524
|
*/
|
|
519
|
-
buildQuestion(
|
|
525
|
+
buildQuestion(context, data) {
|
|
520
526
|
var _a, _b, _c, _d, _e;
|
|
521
527
|
if (!data)
|
|
522
528
|
return undefined;
|
|
523
529
|
// Set default example
|
|
524
530
|
const defaultExample = data.__sampleSolutionAst;
|
|
525
|
-
// Unused
|
|
526
|
-
textFormat;
|
|
527
531
|
// NOTE: Node order is important and is defined here
|
|
528
|
-
const node = Object.assign(Object.assign({ question: (_a = data.question) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = data.partialAnswer) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = data.sampleSolution) !== null && _c !== void 0 ? _c : '', additionalSolutions: ((_d = data.additionalSolutions) !== null && _d !== void 0 ? _d : undefined), reasonableNumOfChars: ((_e = data.reasonableNumOfChars) !== null && _e !== void 0 ? _e : undefined), item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __sampleSolutionAst: data.__sampleSolutionAst });
|
|
532
|
+
const node = Object.assign(Object.assign({ question: (_a = data.question) !== null && _a !== void 0 ? _a : '', partialAnswer: (_b = data.partialAnswer) !== null && _b !== void 0 ? _b : '', sampleSolution: (_c = data.sampleSolution) !== null && _c !== void 0 ? _c : '', additionalSolutions: ((_d = data.additionalSolutions) !== null && _d !== void 0 ? _d : undefined), reasonableNumOfChars: ((_e = data.reasonableNumOfChars) !== null && _e !== void 0 ? _e : undefined), item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __sampleSolutionAst: data.__sampleSolutionAst });
|
|
529
533
|
// Remove Unset Optionals
|
|
530
534
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
531
535
|
ignoreAllFalse: true,
|
|
@@ -541,10 +545,10 @@ class Builder extends BaseBuilder {
|
|
|
541
545
|
* @param data - data for the node
|
|
542
546
|
* @returns
|
|
543
547
|
*/
|
|
544
|
-
buildIngredients(data) {
|
|
548
|
+
buildIngredients(context, data) {
|
|
545
549
|
if (!Array.isArray(data))
|
|
546
550
|
return undefined;
|
|
547
|
-
const nodes = data.map((d) => this.buildIngredient(d)).filter((d) => d != null);
|
|
551
|
+
const nodes = data.map((d) => this.buildIngredient(context, d)).filter((d) => d != null);
|
|
548
552
|
return nodes.length > 0 ? nodes : undefined;
|
|
549
553
|
}
|
|
550
554
|
/**
|
|
@@ -553,7 +557,7 @@ class Builder extends BaseBuilder {
|
|
|
553
557
|
* @param data - data for the node
|
|
554
558
|
* @returns
|
|
555
559
|
*/
|
|
556
|
-
buildIngredient(data) {
|
|
560
|
+
buildIngredient(_context, data) {
|
|
557
561
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
558
562
|
if (!data)
|
|
559
563
|
return undefined;
|
|
@@ -588,13 +592,14 @@ class Builder extends BaseBuilder {
|
|
|
588
592
|
* @param data - data for the node
|
|
589
593
|
* @returns
|
|
590
594
|
*/
|
|
591
|
-
buildBody(
|
|
595
|
+
buildBody(context, data) {
|
|
592
596
|
if (!data)
|
|
593
597
|
return undefined;
|
|
594
598
|
let body;
|
|
595
599
|
const bodyBits = [];
|
|
596
600
|
const placeholders = data.placeholders;
|
|
597
601
|
const bodyString = data.bodyString;
|
|
602
|
+
const { textFormat } = context;
|
|
598
603
|
// Handle JSON type body
|
|
599
604
|
const handleJsonBody = () => {
|
|
600
605
|
// Attempt to parse a string body as JSON to support the legacy format
|
|
@@ -660,6 +665,7 @@ class Builder extends BaseBuilder {
|
|
|
660
665
|
// Convert the body string to AST
|
|
661
666
|
rawBody = this.textParser.toAst(bodyStr, {
|
|
662
667
|
textFormat,
|
|
668
|
+
isProperty: false,
|
|
663
669
|
});
|
|
664
670
|
const replaceBitsRecursive = (bodyText) => {
|
|
665
671
|
for (let i = 0, len = bodyText.length; i < len; i++) {
|
|
@@ -688,16 +694,16 @@ class Builder extends BaseBuilder {
|
|
|
688
694
|
let parsedBit;
|
|
689
695
|
switch (bodyBit.type) {
|
|
690
696
|
case BodyBitType.gap:
|
|
691
|
-
parsedBit = this.buildGap(bodyBit);
|
|
697
|
+
parsedBit = this.buildGap(context, bodyBit);
|
|
692
698
|
break;
|
|
693
699
|
case BodyBitType.mark:
|
|
694
|
-
parsedBit = this.buildMark(bodyBit);
|
|
700
|
+
parsedBit = this.buildMark(context, bodyBit);
|
|
695
701
|
break;
|
|
696
702
|
case BodyBitType.select:
|
|
697
|
-
parsedBit = this.buildSelect(bodyBit);
|
|
703
|
+
parsedBit = this.buildSelect(context, bodyBit);
|
|
698
704
|
break;
|
|
699
705
|
case BodyBitType.highlight:
|
|
700
|
-
parsedBit = this.buildHighlight(bodyBit);
|
|
706
|
+
parsedBit = this.buildHighlight(context, bodyBit);
|
|
701
707
|
break;
|
|
702
708
|
default:
|
|
703
709
|
// TODO?? Ensure other parts are valid
|
|
@@ -743,11 +749,11 @@ class Builder extends BaseBuilder {
|
|
|
743
749
|
* @param data - data for the node
|
|
744
750
|
* @returns
|
|
745
751
|
*/
|
|
746
|
-
buildFooter(data) {
|
|
752
|
+
buildFooter(context, data) {
|
|
747
753
|
if (!data)
|
|
748
754
|
return undefined;
|
|
749
755
|
const node = {
|
|
750
|
-
footer: this.handleJsonText(data.footer),
|
|
756
|
+
footer: this.handleJsonText(context, false, data.footer),
|
|
751
757
|
};
|
|
752
758
|
return node;
|
|
753
759
|
}
|
|
@@ -757,7 +763,7 @@ class Builder extends BaseBuilder {
|
|
|
757
763
|
* @param data - data for the node
|
|
758
764
|
* @returns
|
|
759
765
|
*/
|
|
760
|
-
buildGap(data) {
|
|
766
|
+
buildGap(context, data) {
|
|
761
767
|
var _a;
|
|
762
768
|
if (!data)
|
|
763
769
|
return undefined;
|
|
@@ -766,7 +772,7 @@ class Builder extends BaseBuilder {
|
|
|
766
772
|
// Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
|
|
767
773
|
data = this.bodyBitCopyFromAttrs(data);
|
|
768
774
|
// NOTE: Node order is important and is defined here
|
|
769
|
-
const node = Object.assign(Object.assign({ type: BodyBitType.gap, solutions: (_a = data.solutions) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __solutionsAst: data.__solutionsAst, attrs: {} });
|
|
775
|
+
const node = Object.assign(Object.assign({ type: BodyBitType.gap, solutions: (_a = data.solutions) !== null && _a !== void 0 ? _a : [], item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction), isCaseSensitive: data.isCaseSensitive }, this.toExample(data.__isDefaultExample, data.example, defaultExample)), { __solutionsAst: data.__solutionsAst, attrs: {} });
|
|
770
776
|
// Remove Unset Optionals
|
|
771
777
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
772
778
|
ignoreAllFalse: true,
|
|
@@ -781,10 +787,10 @@ class Builder extends BaseBuilder {
|
|
|
781
787
|
* @param data - data for the node
|
|
782
788
|
* @returns
|
|
783
789
|
*/
|
|
784
|
-
buildMarkConfigs(data) {
|
|
790
|
+
buildMarkConfigs(context, data) {
|
|
785
791
|
if (!Array.isArray(data))
|
|
786
792
|
return undefined;
|
|
787
|
-
const nodes = data.map((d) => this.buildMarkConfig(d)).filter((d) => d != null);
|
|
793
|
+
const nodes = data.map((d) => this.buildMarkConfig(context, d)).filter((d) => d != null);
|
|
788
794
|
return nodes.length > 0 ? nodes : undefined;
|
|
789
795
|
}
|
|
790
796
|
/**
|
|
@@ -793,7 +799,7 @@ class Builder extends BaseBuilder {
|
|
|
793
799
|
* @param data - data for the node
|
|
794
800
|
* @returns
|
|
795
801
|
*/
|
|
796
|
-
buildMarkConfig(data) {
|
|
802
|
+
buildMarkConfig(_context, data) {
|
|
797
803
|
var _a, _b, _c;
|
|
798
804
|
if (!data)
|
|
799
805
|
return undefined;
|
|
@@ -815,14 +821,14 @@ class Builder extends BaseBuilder {
|
|
|
815
821
|
* @param data - data for the node
|
|
816
822
|
* @returns
|
|
817
823
|
*/
|
|
818
|
-
buildMark(data) {
|
|
824
|
+
buildMark(context, data) {
|
|
819
825
|
var _a, _b;
|
|
820
826
|
if (!data)
|
|
821
827
|
return undefined;
|
|
822
828
|
// Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
|
|
823
829
|
data = this.bodyBitCopyFromAttrs(data);
|
|
824
830
|
// NOTE: Node order is important and is defined here
|
|
825
|
-
const node = Object.assign(Object.assign({ type: BodyBitType.mark, solution: (_a = data.solution) !== null && _a !== void 0 ? _a : '', mark: (_b = data.mark) !== null && _b !== void 0 ? _b : '', item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true)), { attrs: {} });
|
|
831
|
+
const node = Object.assign(Object.assign({ type: BodyBitType.mark, solution: (_a = data.solution) !== null && _a !== void 0 ? _a : '', mark: (_b = data.mark) !== null && _b !== void 0 ? _b : '', item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true)), { attrs: {} });
|
|
826
832
|
// Remove Unset Optionals
|
|
827
833
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
828
834
|
ignoreAllFalse: true,
|
|
@@ -838,14 +844,14 @@ class Builder extends BaseBuilder {
|
|
|
838
844
|
* @param data - data for the node
|
|
839
845
|
* @returns
|
|
840
846
|
*/
|
|
841
|
-
buildSelect(data) {
|
|
847
|
+
buildSelect(context, data) {
|
|
842
848
|
var _a, _b, _c;
|
|
843
849
|
if (!data)
|
|
844
850
|
return undefined;
|
|
845
851
|
// Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
|
|
846
852
|
data = this.bodyBitCopyFromAttrs(data);
|
|
847
853
|
// NOTE: Node order is important and is defined here
|
|
848
|
-
const node = Object.assign(Object.assign({ type: BodyBitType.select, options: (_a = this.buildSelectOptions(data.options)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(false, undefined, undefined)), { __hintString: data.__hintString, __instructionString: data.__instructionString, attrs: {} });
|
|
854
|
+
const node = Object.assign(Object.assign({ type: BodyBitType.select, options: (_a = this.buildSelectOptions(context, data.options)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(false, undefined, undefined)), { __hintString: data.__hintString, __instructionString: data.__instructionString, attrs: {} });
|
|
849
855
|
// Remove Unset Optionals
|
|
850
856
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
851
857
|
ignoreAllFalse: true,
|
|
@@ -860,10 +866,10 @@ class Builder extends BaseBuilder {
|
|
|
860
866
|
* @param data - data for the node
|
|
861
867
|
* @returns
|
|
862
868
|
*/
|
|
863
|
-
buildSelectOptions(data) {
|
|
869
|
+
buildSelectOptions(context, data) {
|
|
864
870
|
if (!Array.isArray(data))
|
|
865
871
|
return undefined;
|
|
866
|
-
const nodes = data.map((d) => this.buildSelectOption(d)).filter((d) => d != null);
|
|
872
|
+
const nodes = data.map((d) => this.buildSelectOption(context, d)).filter((d) => d != null);
|
|
867
873
|
return nodes.length > 0 ? nodes : undefined;
|
|
868
874
|
}
|
|
869
875
|
/**
|
|
@@ -872,12 +878,12 @@ class Builder extends BaseBuilder {
|
|
|
872
878
|
* @param data - data for the node
|
|
873
879
|
* @returns
|
|
874
880
|
*/
|
|
875
|
-
buildSelectOption(data) {
|
|
881
|
+
buildSelectOption(context, data) {
|
|
876
882
|
var _a;
|
|
877
883
|
if (!data)
|
|
878
884
|
return undefined;
|
|
879
885
|
// NOTE: Node order is important and is defined here
|
|
880
|
-
const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
886
|
+
const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
881
887
|
// Remove Unset Optionals
|
|
882
888
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
883
889
|
ignoreAllFalse: true,
|
|
@@ -892,14 +898,14 @@ class Builder extends BaseBuilder {
|
|
|
892
898
|
* @param data - data for the node
|
|
893
899
|
* @returns
|
|
894
900
|
*/
|
|
895
|
-
buildHighlight(data) {
|
|
901
|
+
buildHighlight(context, data) {
|
|
896
902
|
var _a, _b, _c;
|
|
897
903
|
if (!data)
|
|
898
904
|
return undefined;
|
|
899
905
|
// Copy any attributes from 'attrs' to the body bit (data is in 'attrs' when coming from JSON)
|
|
900
906
|
data = this.bodyBitCopyFromAttrs(data);
|
|
901
907
|
// NOTE: Node order is important and is defined here
|
|
902
|
-
const node = Object.assign(Object.assign({ type: BodyBitType.highlight, texts: (_a = this.buildHighlightTexts(data.texts)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(false, undefined, undefined)), { attrs: {} });
|
|
908
|
+
const node = Object.assign(Object.assign({ type: BodyBitType.highlight, texts: (_a = this.buildHighlightTexts(context, data.texts)) !== null && _a !== void 0 ? _a : [], prefix: (_b = data.prefix) !== null && _b !== void 0 ? _b : '', postfix: (_c = data.postfix) !== null && _c !== void 0 ? _c : '', item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(false, undefined, undefined)), { attrs: {} });
|
|
903
909
|
// Remove Unset Optionals
|
|
904
910
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
905
911
|
ignoreAllFalse: true,
|
|
@@ -914,10 +920,10 @@ class Builder extends BaseBuilder {
|
|
|
914
920
|
* @param data - data for the node
|
|
915
921
|
* @returns
|
|
916
922
|
*/
|
|
917
|
-
buildHighlightTexts(data) {
|
|
923
|
+
buildHighlightTexts(context, data) {
|
|
918
924
|
if (!Array.isArray(data))
|
|
919
925
|
return undefined;
|
|
920
|
-
const nodes = data.map((d) => this.buildHighlightText(d)).filter((d) => d != null);
|
|
926
|
+
const nodes = data.map((d) => this.buildHighlightText(context, d)).filter((d) => d != null);
|
|
921
927
|
return nodes.length > 0 ? nodes : undefined;
|
|
922
928
|
}
|
|
923
929
|
/**
|
|
@@ -926,12 +932,12 @@ class Builder extends BaseBuilder {
|
|
|
926
932
|
* @param data - data for the node
|
|
927
933
|
* @returns
|
|
928
934
|
*/
|
|
929
|
-
buildHighlightText(data) {
|
|
935
|
+
buildHighlightText(context, data) {
|
|
930
936
|
var _a;
|
|
931
937
|
if (!data)
|
|
932
938
|
return undefined;
|
|
933
939
|
// NOTE: Node order is important and is defined here
|
|
934
|
-
const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, isHighlighted: !!data.isHighlighted, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
940
|
+
const node = Object.assign({ text: (_a = data.text) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, isHighlighted: !!data.isHighlighted, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
935
941
|
// Remove Unset Optionals
|
|
936
942
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
937
943
|
ignoreAllFalse: true,
|
|
@@ -946,10 +952,10 @@ class Builder extends BaseBuilder {
|
|
|
946
952
|
* @param data - data for the node
|
|
947
953
|
* @returns
|
|
948
954
|
*/
|
|
949
|
-
buildFlashcards(
|
|
955
|
+
buildFlashcards(context, data) {
|
|
950
956
|
if (!Array.isArray(data))
|
|
951
957
|
return undefined;
|
|
952
|
-
const nodes = data.map((d) => this.buildFlashcard(
|
|
958
|
+
const nodes = data.map((d) => this.buildFlashcard(context, d)).filter((d) => d != null);
|
|
953
959
|
return nodes.length > 0 ? nodes : undefined;
|
|
954
960
|
}
|
|
955
961
|
/**
|
|
@@ -958,11 +964,11 @@ class Builder extends BaseBuilder {
|
|
|
958
964
|
* @param data - data for the node
|
|
959
965
|
* @returns
|
|
960
966
|
*/
|
|
961
|
-
buildFlashcard(
|
|
967
|
+
buildFlashcard(context, data) {
|
|
962
968
|
if (!data)
|
|
963
969
|
return undefined;
|
|
964
970
|
// NOTE: Node order is important and is defined here
|
|
965
|
-
const node = Object.assign({ question: this.handleJsonText(data.question
|
|
971
|
+
const node = Object.assign({ question: this.handleJsonText(context, true, data.question), answer: this.handleJsonText(context, true, data.answer), alternativeAnswers: this.handleJsonText(context, true, data.alternativeAnswers), item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
|
|
966
972
|
// Remove Unset Optionals
|
|
967
973
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
968
974
|
ignoreAllFalse: true,
|
|
@@ -977,10 +983,10 @@ class Builder extends BaseBuilder {
|
|
|
977
983
|
* @param data - data for the node
|
|
978
984
|
* @returns
|
|
979
985
|
*/
|
|
980
|
-
buildDefinitionList(
|
|
986
|
+
buildDefinitionList(context, data) {
|
|
981
987
|
if (!Array.isArray(data))
|
|
982
988
|
return undefined;
|
|
983
|
-
const nodes = data.map((d) => this.buildDefinitionListItem(
|
|
989
|
+
const nodes = data.map((d) => this.buildDefinitionListItem(context, d)).filter((d) => d != null);
|
|
984
990
|
return nodes.length > 0 ? nodes : undefined;
|
|
985
991
|
}
|
|
986
992
|
/**
|
|
@@ -989,11 +995,11 @@ class Builder extends BaseBuilder {
|
|
|
989
995
|
* @param data - data for the node
|
|
990
996
|
* @returns
|
|
991
997
|
*/
|
|
992
|
-
buildDefinitionListItem(
|
|
998
|
+
buildDefinitionListItem(context, data) {
|
|
993
999
|
if (!data)
|
|
994
1000
|
return undefined;
|
|
995
1001
|
// NOTE: Node order is important and is defined here
|
|
996
|
-
const node = Object.assign({ term: this.handleJsonText(data.term
|
|
1002
|
+
const node = Object.assign({ term: this.handleJsonText(context, true, data.term), definition: this.handleJsonText(context, true, data.definition), alternativeDefinitions: this.handleJsonText(context, true, data.alternativeDefinitions), item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, true));
|
|
997
1003
|
// Remove Unset Optionals
|
|
998
1004
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
999
1005
|
ignoreAllFalse: true,
|
|
@@ -1008,10 +1014,10 @@ class Builder extends BaseBuilder {
|
|
|
1008
1014
|
* @param data - data for the node
|
|
1009
1015
|
* @returns
|
|
1010
1016
|
*/
|
|
1011
|
-
buildStatements(data) {
|
|
1017
|
+
buildStatements(context, data) {
|
|
1012
1018
|
if (!Array.isArray(data))
|
|
1013
1019
|
return undefined;
|
|
1014
|
-
const nodes = data.map((d) => this.buildStatement(d)).filter((d) => d != null);
|
|
1020
|
+
const nodes = data.map((d) => this.buildStatement(context, d)).filter((d) => d != null);
|
|
1015
1021
|
return nodes.length > 0 ? nodes : undefined;
|
|
1016
1022
|
}
|
|
1017
1023
|
/**
|
|
@@ -1020,12 +1026,12 @@ class Builder extends BaseBuilder {
|
|
|
1020
1026
|
* @param data - data for the node
|
|
1021
1027
|
* @returns
|
|
1022
1028
|
*/
|
|
1023
|
-
buildStatement(data) {
|
|
1029
|
+
buildStatement(context, data) {
|
|
1024
1030
|
var _a;
|
|
1025
1031
|
if (!data)
|
|
1026
1032
|
return undefined;
|
|
1027
1033
|
// NOTE: Node order is important and is defined here
|
|
1028
|
-
const node = Object.assign({ statement: (_a = data.statement) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(data.item), lead: this.handleJsonText(data.lead), hint: this.handleJsonText(data.hint), instruction: this.handleJsonText(data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
1034
|
+
const node = Object.assign({ statement: (_a = data.statement) !== null && _a !== void 0 ? _a : '', isCorrect: !!data.isCorrect, item: this.handleJsonText(context, true, data.item), lead: this.handleJsonText(context, true, data.lead), hint: this.handleJsonText(context, true, data.hint), instruction: this.handleJsonText(context, true, data.instruction) }, this.toExample(data.__isDefaultExample, data.example, !!data.isCorrect));
|
|
1029
1035
|
// Remove Unset Optionals
|
|
1030
1036
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
1031
1037
|
ignoreAllFalse: true,
|
|
@@ -1040,7 +1046,7 @@ class Builder extends BaseBuilder {
|
|
|
1040
1046
|
* @param data - data for the node
|
|
1041
1047
|
* @returns
|
|
1042
1048
|
*/
|
|
1043
|
-
buildImageSource(data) {
|
|
1049
|
+
buildImageSource(_context, data) {
|
|
1044
1050
|
if (!data)
|
|
1045
1051
|
return undefined;
|
|
1046
1052
|
const { url, mockupId, size, format, trim } = data;
|
|
@@ -1066,7 +1072,7 @@ class Builder extends BaseBuilder {
|
|
|
1066
1072
|
* @param data - data for the node
|
|
1067
1073
|
* @returns
|
|
1068
1074
|
*/
|
|
1069
|
-
buildPerson(
|
|
1075
|
+
buildPerson(context, data) {
|
|
1070
1076
|
var _a;
|
|
1071
1077
|
if (!data)
|
|
1072
1078
|
return undefined;
|
|
@@ -1076,7 +1082,7 @@ class Builder extends BaseBuilder {
|
|
|
1076
1082
|
const node = {
|
|
1077
1083
|
name: name !== null && name !== void 0 ? name : '',
|
|
1078
1084
|
title: (title !== null && title !== void 0 ? title : undefined),
|
|
1079
|
-
avatarImage: (_a = ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(
|
|
1085
|
+
avatarImage: (_a = ArrayUtils.asSingle(this.resourceBuilder.resourceFromResourceDataJson(context, ResourceTag.image, avatarImage))) === null || _a === void 0 ? void 0 : _a.image,
|
|
1080
1086
|
};
|
|
1081
1087
|
// Remove Unset Optionals
|
|
1082
1088
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
@@ -1091,7 +1097,7 @@ class Builder extends BaseBuilder {
|
|
|
1091
1097
|
* @param data - data for the node
|
|
1092
1098
|
* @returns
|
|
1093
1099
|
*/
|
|
1094
|
-
buildTechnicalTerm(data) {
|
|
1100
|
+
buildTechnicalTerm(_context, data) {
|
|
1095
1101
|
if (!data)
|
|
1096
1102
|
return undefined;
|
|
1097
1103
|
const { technicalTerm, lang } = data;
|
|
@@ -1113,7 +1119,7 @@ class Builder extends BaseBuilder {
|
|
|
1113
1119
|
* @param data - data for the node
|
|
1114
1120
|
* @returns
|
|
1115
1121
|
*/
|
|
1116
|
-
buildServings(data) {
|
|
1122
|
+
buildServings(_context, data) {
|
|
1117
1123
|
if (!data)
|
|
1118
1124
|
return undefined;
|
|
1119
1125
|
const { servings, unit, unitAbbr, decimalPlaces, disableCalculation, hint } = data;
|
|
@@ -1139,14 +1145,14 @@ class Builder extends BaseBuilder {
|
|
|
1139
1145
|
* @param data - data for the node
|
|
1140
1146
|
* @returns
|
|
1141
1147
|
*/
|
|
1142
|
-
buildRatingLevelStartEnd(data) {
|
|
1148
|
+
buildRatingLevelStartEnd(context, data) {
|
|
1143
1149
|
if (!data)
|
|
1144
1150
|
return undefined;
|
|
1145
1151
|
const { level, label } = data;
|
|
1146
1152
|
// NOTE: Node order is important and is defined here
|
|
1147
1153
|
const node = {
|
|
1148
1154
|
level: level !== null && level !== void 0 ? level : 0,
|
|
1149
|
-
label: this.handleJsonText(label),
|
|
1155
|
+
label: this.handleJsonText(context, true, label),
|
|
1150
1156
|
};
|
|
1151
1157
|
// Remove Unset Optionals
|
|
1152
1158
|
ObjectUtils.removeUnwantedProperties(node, {
|
|
@@ -1161,12 +1167,10 @@ class Builder extends BaseBuilder {
|
|
|
1161
1167
|
* @param data - data for the node
|
|
1162
1168
|
* @returns
|
|
1163
1169
|
*/
|
|
1164
|
-
buildCaptionDefinition(
|
|
1170
|
+
buildCaptionDefinition(_context, data) {
|
|
1165
1171
|
var _a, _b;
|
|
1166
1172
|
if (!data)
|
|
1167
1173
|
return undefined;
|
|
1168
|
-
// Unused
|
|
1169
|
-
textFormat;
|
|
1170
1174
|
// NOTE: Node order is important and is defined here
|
|
1171
1175
|
const node = {
|
|
1172
1176
|
// term: this.convertJsonTextToAstText(data.term),
|
|
@@ -1187,7 +1191,7 @@ class Builder extends BaseBuilder {
|
|
|
1187
1191
|
* @param data - data for the node
|
|
1188
1192
|
* @returns
|
|
1189
1193
|
*/
|
|
1190
|
-
buildCaptionDefinitionList(
|
|
1194
|
+
buildCaptionDefinitionList(context, data) {
|
|
1191
1195
|
var _a, _b;
|
|
1192
1196
|
if (!data)
|
|
1193
1197
|
return undefined;
|
|
@@ -1196,7 +1200,7 @@ class Builder extends BaseBuilder {
|
|
|
1196
1200
|
columns: (_a = data.columns) !== null && _a !== void 0 ? _a : [],
|
|
1197
1201
|
definitions: ((_b = data.definitions) !== null && _b !== void 0 ? _b : [])
|
|
1198
1202
|
.map((d) => {
|
|
1199
|
-
return this.buildCaptionDefinition(
|
|
1203
|
+
return this.buildCaptionDefinition(context, {
|
|
1200
1204
|
term: d.term,
|
|
1201
1205
|
definition: d.definition,
|
|
1202
1206
|
});
|
|
@@ -1215,10 +1219,10 @@ class Builder extends BaseBuilder {
|
|
|
1215
1219
|
* @param data - data for the node
|
|
1216
1220
|
* @returns
|
|
1217
1221
|
*/
|
|
1218
|
-
buildCardBits(
|
|
1222
|
+
buildCardBits(context, data) {
|
|
1219
1223
|
if (!Array.isArray(data))
|
|
1220
1224
|
return undefined;
|
|
1221
|
-
const nodes = data.map((d) => this.buildCardBit(
|
|
1225
|
+
const nodes = data.map((d) => this.buildCardBit(context, d)).filter((d) => d != null);
|
|
1222
1226
|
return nodes.length > 0 ? nodes : undefined;
|
|
1223
1227
|
}
|
|
1224
1228
|
/**
|
|
@@ -1227,9 +1231,10 @@ class Builder extends BaseBuilder {
|
|
|
1227
1231
|
* @param data - data for the node
|
|
1228
1232
|
* @returns
|
|
1229
1233
|
*/
|
|
1230
|
-
buildCardBit(
|
|
1234
|
+
buildCardBit(context, data) {
|
|
1231
1235
|
if (!data)
|
|
1232
1236
|
return undefined;
|
|
1237
|
+
const { bitType, textFormat } = context;
|
|
1233
1238
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1234
1239
|
const node = this.buildBit(Object.assign(Object.assign({}, data), { bitType, textFormat }));
|
|
1235
1240
|
// // NOTE: Node order is important and is defined here
|
|
@@ -1256,26 +1261,26 @@ class Builder extends BaseBuilder {
|
|
|
1256
1261
|
//
|
|
1257
1262
|
// Private
|
|
1258
1263
|
//
|
|
1259
|
-
buildCardNode(
|
|
1264
|
+
buildCardNode(context, data) {
|
|
1260
1265
|
const node = {
|
|
1261
|
-
questions: this.buildQuestions(
|
|
1266
|
+
questions: this.buildQuestions(context, data.questions),
|
|
1262
1267
|
elements: data.elements,
|
|
1263
|
-
flashcards: this.buildFlashcards(
|
|
1264
|
-
definitions: this.buildDefinitionList(
|
|
1265
|
-
statement: this.buildStatement(data.statement),
|
|
1266
|
-
statements: this.buildStatements(data.statements),
|
|
1267
|
-
choices: this.buildChoices(data.choices),
|
|
1268
|
-
responses: this.buildResponses(data.responses),
|
|
1269
|
-
quizzes: this.buildQuizzes(data.quizzes),
|
|
1270
|
-
heading: this.buildHeading(data.heading),
|
|
1271
|
-
pairs: this.buildPairs(
|
|
1272
|
-
matrix: this.buildMatricies(data.matrix),
|
|
1273
|
-
pronunciationTable: this.buildPronunciationTable(
|
|
1274
|
-
table: this.buildTable(
|
|
1275
|
-
botResponses: this.buildBotResponses(data.botResponses),
|
|
1276
|
-
ingredients: this.buildIngredients(data.ingredients),
|
|
1277
|
-
captionDefinitionList: this.buildCaptionDefinitionList(
|
|
1278
|
-
cardBits: this.buildCardBits(
|
|
1268
|
+
flashcards: this.buildFlashcards(context, data.flashcards),
|
|
1269
|
+
definitions: this.buildDefinitionList(context, data.definitions),
|
|
1270
|
+
statement: this.buildStatement(context, data.statement),
|
|
1271
|
+
statements: this.buildStatements(context, data.statements),
|
|
1272
|
+
choices: this.buildChoices(context, data.choices),
|
|
1273
|
+
responses: this.buildResponses(context, data.responses),
|
|
1274
|
+
quizzes: this.buildQuizzes(context, data.quizzes),
|
|
1275
|
+
heading: this.buildHeading(context, data.heading),
|
|
1276
|
+
pairs: this.buildPairs(context, data.pairs),
|
|
1277
|
+
matrix: this.buildMatricies(context, data.matrix),
|
|
1278
|
+
pronunciationTable: this.buildPronunciationTable(context, data.pronunciationTable),
|
|
1279
|
+
table: this.buildTable(context, data.table),
|
|
1280
|
+
botResponses: this.buildBotResponses(context, data.botResponses),
|
|
1281
|
+
ingredients: this.buildIngredients(context, data.ingredients),
|
|
1282
|
+
captionDefinitionList: this.buildCaptionDefinitionList(context, data.captionDefinitionList),
|
|
1283
|
+
cardBits: this.buildCardBits(context, data.cardBits),
|
|
1279
1284
|
};
|
|
1280
1285
|
// Remove Unset Optionals
|
|
1281
1286
|
ObjectUtils.removeUnwantedProperties(node);
|
|
@@ -1309,28 +1314,28 @@ class Builder extends BaseBuilder {
|
|
|
1309
1314
|
* @param example
|
|
1310
1315
|
* @returns true if any of the answers has an example, otherwise undefined
|
|
1311
1316
|
*/
|
|
1312
|
-
pushExampleDownTree(body, cardNode, __isDefaultExample, example) {
|
|
1317
|
+
pushExampleDownTree(context, body, cardNode, __isDefaultExample, example) {
|
|
1313
1318
|
if (__isDefaultExample || example != null) {
|
|
1314
1319
|
if (cardNode) {
|
|
1315
|
-
this.pushExampleDownTreeString(__isDefaultExample, example, cardNode.pairs);
|
|
1316
|
-
this.pushExampleDownTreeBoolean(__isDefaultExample, example, false, cardNode.flashcards);
|
|
1317
|
-
this.pushExampleDownTreeBoolean(__isDefaultExample, example, false, cardNode.definitions);
|
|
1318
|
-
this.pushExampleDownTreeBoolean(__isDefaultExample, example, true, cardNode.choices);
|
|
1319
|
-
this.pushExampleDownTreeBoolean(__isDefaultExample, example, false, cardNode.responses, cardNode.statements, cardNode.statement);
|
|
1320
|
+
this.pushExampleDownTreeString(context, __isDefaultExample, example, cardNode.pairs);
|
|
1321
|
+
this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.flashcards);
|
|
1322
|
+
this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.definitions);
|
|
1323
|
+
this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, true, cardNode.choices);
|
|
1324
|
+
this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, cardNode.responses, cardNode.statements, cardNode.statement);
|
|
1320
1325
|
if (cardNode.quizzes) {
|
|
1321
1326
|
for (const quiz of cardNode.quizzes) {
|
|
1322
|
-
this.pushExampleDownTreeBoolean(__isDefaultExample, example, true, quiz.choices);
|
|
1323
|
-
this.pushExampleDownTreeBoolean(__isDefaultExample, example, false, quiz.responses);
|
|
1327
|
+
this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, true, quiz.choices);
|
|
1328
|
+
this.pushExampleDownTreeBoolean(context, __isDefaultExample, example, false, quiz.responses);
|
|
1324
1329
|
}
|
|
1325
1330
|
}
|
|
1326
1331
|
if (cardNode.matrix) {
|
|
1327
1332
|
for (const m of cardNode.matrix) {
|
|
1328
|
-
this.pushExampleDownTreeString(__isDefaultExample, example, m.cells);
|
|
1333
|
+
this.pushExampleDownTreeString(context, __isDefaultExample, example, m.cells);
|
|
1329
1334
|
}
|
|
1330
1335
|
}
|
|
1331
1336
|
}
|
|
1332
1337
|
if (body) {
|
|
1333
|
-
this.pushExampleDownTreeBodyBits(__isDefaultExample, example, body);
|
|
1338
|
+
this.pushExampleDownTreeBodyBits(context, __isDefaultExample, example, body);
|
|
1334
1339
|
}
|
|
1335
1340
|
}
|
|
1336
1341
|
}
|
|
@@ -1343,7 +1348,7 @@ class Builder extends BaseBuilder {
|
|
|
1343
1348
|
* @param nodes
|
|
1344
1349
|
* @returns true if any of the answers has an example, otherwise undefined
|
|
1345
1350
|
*/
|
|
1346
|
-
pushExampleDownTreeBoolean(__isDefaultExample, example, onlyCorrect, ...nodes) {
|
|
1351
|
+
pushExampleDownTreeBoolean(_context, __isDefaultExample, example, onlyCorrect, ...nodes) {
|
|
1347
1352
|
if (!__isDefaultExample && example == null)
|
|
1348
1353
|
return;
|
|
1349
1354
|
if (Array.isArray(nodes)) {
|
|
@@ -1363,19 +1368,19 @@ class Builder extends BaseBuilder {
|
|
|
1363
1368
|
* @param nodes
|
|
1364
1369
|
* @returns true if any of the answers has an example, otherwise undefined
|
|
1365
1370
|
*/
|
|
1366
|
-
pushExampleDownTreeString(__isDefaultExample, example, ...nodes) {
|
|
1371
|
+
pushExampleDownTreeString(context, __isDefaultExample, example, ...nodes) {
|
|
1367
1372
|
if (!__isDefaultExample && !example)
|
|
1368
1373
|
return;
|
|
1369
1374
|
if (Array.isArray(nodes)) {
|
|
1370
1375
|
for (const ds of nodes) {
|
|
1371
1376
|
if (ds) {
|
|
1372
1377
|
const exampleNodes = Array.isArray(ds) ? ds : [ds];
|
|
1373
|
-
BitUtils.fillStringExample(exampleNodes, __isDefaultExample, example, false);
|
|
1378
|
+
BitUtils.fillStringExample(context.textFormat, exampleNodes, __isDefaultExample, example, false);
|
|
1374
1379
|
}
|
|
1375
1380
|
}
|
|
1376
1381
|
}
|
|
1377
1382
|
}
|
|
1378
|
-
pushExampleDownTreeBodyBits(__isDefaultExample, example, body) {
|
|
1383
|
+
pushExampleDownTreeBodyBits(context, __isDefaultExample, example, body) {
|
|
1379
1384
|
if (!__isDefaultExample && !example)
|
|
1380
1385
|
return;
|
|
1381
1386
|
const bodyBitsJson = this.textParser.extractBodyBits(body === null || body === void 0 ? void 0 : body.body);
|
|
@@ -1384,7 +1389,7 @@ class Builder extends BaseBuilder {
|
|
|
1384
1389
|
switch (part.type) {
|
|
1385
1390
|
case BodyBitType.gap: {
|
|
1386
1391
|
const gap = part;
|
|
1387
|
-
BitUtils.fillStringExample([gap], __isDefaultExample, example, false);
|
|
1392
|
+
BitUtils.fillStringExample(context.textFormat, [gap], __isDefaultExample, example, false);
|
|
1388
1393
|
break;
|
|
1389
1394
|
}
|
|
1390
1395
|
case BodyBitType.mark: {
|
|
@@ -1417,7 +1422,7 @@ class Builder extends BaseBuilder {
|
|
|
1417
1422
|
* @param path path for the value
|
|
1418
1423
|
* @param value the value to push down
|
|
1419
1424
|
*/
|
|
1420
|
-
pushDownTree(body, bodyBitTypes, cardNode, cardNodePath, path, value) {
|
|
1425
|
+
pushDownTree(_context, body, bodyBitTypes, cardNode, cardNodePath, path, value) {
|
|
1421
1426
|
if (value === undefined)
|
|
1422
1427
|
return;
|
|
1423
1428
|
// Add value to card nodes if required (TODO - nested paths)
|