@gmb/bitmark-parser-generator 1.35.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/cjs/BitmarkParserGenerator.js +8 -3
- package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
- package/dist/cjs/ast/Ast.js +1 -0
- package/dist/cjs/ast/Ast.js.map +1 -1
- package/dist/cjs/ast/BaseBuilder.js +91 -54
- package/dist/cjs/ast/BaseBuilder.js.map +1 -1
- package/dist/cjs/ast/Builder.js +776 -389
- package/dist/cjs/ast/Builder.js.map +1 -1
- package/dist/cjs/ast/ResourceBuilder.js +516 -252
- package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
- package/dist/cjs/ast/rules/NodeValidator.js +61 -22
- package/dist/cjs/ast/rules/NodeValidator.js.map +1 -1
- package/dist/cjs/breakscaping/Breakscape.js +96 -71
- package/dist/cjs/breakscaping/Breakscape.js.map +1 -1
- package/dist/cjs/config/raw/bits.js +14 -5
- package/dist/cjs/config/raw/bits.js.map +1 -1
- package/dist/cjs/config/raw/properties.js +7 -2
- package/dist/cjs/config/raw/properties.js.map +1 -1
- package/dist/cjs/generated/build-info.js +1 -1
- package/dist/cjs/generated/build-info.js.map +1 -1
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +1 -0
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
- package/dist/cjs/generator/AstWalkerGenerator.js +4 -1
- package/dist/cjs/generator/AstWalkerGenerator.js.map +1 -1
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js +959 -338
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +308 -1982
- package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
- package/dist/cjs/generator/text/TextGenerator.js +26 -8
- package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/ast/NodeType.js +27 -8
- package/dist/cjs/model/ast/NodeType.js.map +1 -1
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +1 -0
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/cjs/model/enum/BitType.js +1 -2
- package/dist/cjs/model/enum/BitType.js.map +1 -1
- package/dist/cjs/model/enum/PropertyFormat.js +3 -1
- package/dist/cjs/model/enum/PropertyFormat.js.map +1 -1
- package/dist/cjs/model/enum/TextFormat.js +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js +9 -3
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +49 -131
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +7 -31
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +255 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +175 -129
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +8 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +61 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +11 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +21 -17
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +50 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +2 -15
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +4 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +5 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +23 -7
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +3 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +19 -8
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +4 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +4 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +14 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +37 -21
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +3 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/json/JsonParser.js +73 -765
- package/dist/cjs/parser/json/JsonParser.js.map +1 -1
- package/dist/cjs/parser/text/TextParser.js +61 -2
- package/dist/cjs/parser/text/TextParser.js.map +1 -1
- package/dist/cjs/utils/BitUtils.js +15 -13
- package/dist/cjs/utils/BitUtils.js.map +1 -1
- package/dist/esm/BitmarkParserGenerator.js +8 -3
- package/dist/esm/BitmarkParserGenerator.js.map +1 -1
- package/dist/esm/ast/Ast.js +1 -0
- package/dist/esm/ast/Ast.js.map +1 -1
- package/dist/esm/ast/BaseBuilder.js +91 -54
- package/dist/esm/ast/BaseBuilder.js.map +1 -1
- package/dist/esm/ast/Builder.js +776 -389
- package/dist/esm/ast/Builder.js.map +1 -1
- package/dist/esm/ast/ResourceBuilder.js +516 -252
- package/dist/esm/ast/ResourceBuilder.js.map +1 -1
- package/dist/esm/ast/rules/NodeValidator.js +61 -22
- package/dist/esm/ast/rules/NodeValidator.js.map +1 -1
- package/dist/esm/breakscaping/Breakscape.js +96 -71
- package/dist/esm/breakscaping/Breakscape.js.map +1 -1
- package/dist/esm/config/raw/bits.js +14 -5
- package/dist/esm/config/raw/bits.js.map +1 -1
- package/dist/esm/config/raw/properties.js +7 -2
- package/dist/esm/config/raw/properties.js.map +1 -1
- package/dist/esm/generated/build-info.js +1 -1
- package/dist/esm/generated/build-info.js.map +1 -1
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +1 -0
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
- package/dist/esm/generator/AstWalkerGenerator.js +4 -1
- package/dist/esm/generator/AstWalkerGenerator.js.map +1 -1
- package/dist/esm/generator/bitmark/BitmarkGenerator.js +959 -338
- package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +308 -1982
- package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
- package/dist/esm/generator/text/TextGenerator.js +26 -8
- package/dist/esm/generator/text/TextGenerator.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/ast/NodeType.js +27 -8
- package/dist/esm/model/ast/NodeType.js.map +1 -1
- package/dist/esm/model/config/enum/PropertyConfigKey.js +1 -0
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/esm/model/enum/BitType.js +1 -2
- package/dist/esm/model/enum/BitType.js.map +1 -1
- package/dist/esm/model/enum/PropertyFormat.js +3 -1
- package/dist/esm/model/enum/PropertyFormat.js.map +1 -1
- package/dist/esm/model/enum/TextFormat.js +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js +9 -3
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +49 -131
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +7 -31
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +252 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +175 -129
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +8 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +58 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +11 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +21 -17
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +47 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +2 -15
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +4 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +5 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +23 -7
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +3 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +19 -8
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +4 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +4 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +14 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +37 -21
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +3 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/json/JsonParser.js +73 -765
- package/dist/esm/parser/json/JsonParser.js.map +1 -1
- package/dist/esm/parser/text/TextParser.js +61 -2
- package/dist/esm/parser/text/TextParser.js.map +1 -1
- package/dist/esm/utils/BitUtils.js +15 -13
- package/dist/esm/utils/BitUtils.js.map +1 -1
- package/dist/types/BitmarkParserGenerator.d.ts +8 -0
- package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
- package/dist/types/ast/Ast.d.ts.map +1 -1
- package/dist/types/ast/BaseBuilder.d.ts +31 -21
- package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
- package/dist/types/ast/Builder.d.ts +279 -441
- package/dist/types/ast/Builder.d.ts.map +1 -1
- package/dist/types/ast/ResourceBuilder.d.ts +177 -164
- package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
- package/dist/types/ast/rules/NodeValidator.d.ts +3 -2
- package/dist/types/ast/rules/NodeValidator.d.ts.map +1 -1
- package/dist/types/breakscaping/Breakscape.d.ts +6 -5
- package/dist/types/breakscaping/Breakscape.d.ts.map +1 -1
- package/dist/types/config/raw/bits.d.ts.map +1 -1
- package/dist/types/config/raw/properties.d.ts.map +1 -1
- package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +1 -1
- package/dist/types/generator/AstWalkerGenerator.d.ts.map +1 -1
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +89 -55
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
- package/dist/types/generator/json/JsonGenerator.d.ts +88 -108
- package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
- package/dist/types/generator/text/TextGenerator.d.ts +14 -2
- package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/model/ast/NodeType.d.ts +48 -16
- package/dist/types/model/ast/NodeType.d.ts.map +1 -1
- package/dist/types/model/ast/Nodes.d.ts +64 -440
- package/dist/types/model/ast/Nodes.d.ts.map +1 -1
- package/dist/types/model/config/enum/ConfigKey.d.ts +2 -0
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +3 -0
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
- package/dist/types/model/enum/BitType.d.ts +2 -4
- package/dist/types/model/enum/BitType.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyFormat.d.ts +4 -2
- package/dist/types/model/enum/PropertyFormat.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyTag.d.ts +2 -0
- package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
- package/dist/types/model/json/BitJson.d.ts +32 -20
- package/dist/types/model/json/BitJson.d.ts.map +1 -1
- package/dist/types/model/json/BodyBitJson.d.ts +16 -12
- package/dist/types/model/json/BodyBitJson.d.ts.map +1 -1
- package/dist/types/model/json/ResourceJson.d.ts +2 -22
- package/dist/types/model/json/ResourceJson.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts +3 -2
- package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +2 -15
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +83 -71
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts +37 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts +15 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +16 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +5 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/json/JsonParser.d.ts +9 -72
- package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
- package/dist/types/parser/text/TextParser.d.ts +16 -1
- package/dist/types/parser/text/TextParser.d.ts.map +1 -1
- package/dist/types/utils/BitUtils.d.ts +8 -8
- package/dist/types/utils/BitUtils.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -11,19 +11,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BitmarkGenerator = void 0;
|
|
13
13
|
const Ast_1 = require("../../ast/Ast");
|
|
14
|
+
const Breakscape_1 = require("../../breakscaping/Breakscape");
|
|
14
15
|
const Config_1 = require("../../config/Config");
|
|
15
16
|
const NodeType_1 = require("../../model/ast/NodeType");
|
|
16
17
|
const BitType_1 = require("../../model/enum/BitType");
|
|
17
18
|
const BitmarkVersion_1 = require("../../model/enum/BitmarkVersion");
|
|
18
19
|
const BodyBitType_1 = require("../../model/enum/BodyBitType");
|
|
19
20
|
const CardSetVersion_1 = require("../../model/enum/CardSetVersion");
|
|
20
|
-
const
|
|
21
|
+
const PropertyFormat_1 = require("../../model/enum/PropertyFormat");
|
|
21
22
|
const PropertyTag_1 = require("../../model/enum/PropertyTag");
|
|
22
23
|
const ResourceTag_1 = require("../../model/enum/ResourceTag");
|
|
23
24
|
const TextFormat_1 = require("../../model/enum/TextFormat");
|
|
24
25
|
const BooleanUtils_1 = require("../../utils/BooleanUtils");
|
|
25
26
|
const ObjectUtils_1 = require("../../utils/ObjectUtils");
|
|
27
|
+
const StringUtils_1 = require("../../utils/StringUtils");
|
|
26
28
|
const AstWalkerGenerator_1 = require("../AstWalkerGenerator");
|
|
29
|
+
const TextGenerator_1 = require("../text/TextGenerator");
|
|
27
30
|
const DEFAULT_OPTIONS = {
|
|
28
31
|
debugGenerationInline: false,
|
|
29
32
|
};
|
|
@@ -53,6 +56,17 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
53
56
|
// State
|
|
54
57
|
this.skipNLBetweenBitsValue = false;
|
|
55
58
|
this.wroteSomething = false;
|
|
59
|
+
this.inTag = true;
|
|
60
|
+
// Keep TS happy
|
|
61
|
+
this.inTag;
|
|
62
|
+
// Bind callbacks
|
|
63
|
+
this.enter = this.enter.bind(this);
|
|
64
|
+
this.between = this.between.bind(this);
|
|
65
|
+
this.exit = this.exit.bind(this);
|
|
66
|
+
this.leaf = this.leaf.bind(this);
|
|
67
|
+
this.write = this.write.bind(this);
|
|
68
|
+
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
69
|
+
// Set options
|
|
56
70
|
this.bitmarkVersion = (_a = BitmarkVersion_1.BitmarkVersion.fromValue(options === null || options === void 0 ? void 0 : options.bitmarkVersion)) !== null && _a !== void 0 ? _a : BitmarkVersion_1.DEFAULT_BITMARK_VERSION;
|
|
57
71
|
this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options === null || options === void 0 ? void 0 : options.bitmarkOptions);
|
|
58
72
|
this.debugGenerationInline = (_b = this.options.debugGenerationInline) !== null && _b !== void 0 ? _b : false;
|
|
@@ -69,11 +83,14 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
69
83
|
}
|
|
70
84
|
// Calculate the prettify space
|
|
71
85
|
this.prettifySpace = this.options.prettifyJson === true ? 2 : this.options.prettifyJson || undefined;
|
|
86
|
+
// Create the text generator
|
|
87
|
+
this.textGenerator = new TextGenerator_1.TextGenerator(this.bitmarkVersion, {
|
|
88
|
+
writeCallback: this.write,
|
|
89
|
+
bodyBitCallback: this.bodyBitCallback,
|
|
90
|
+
debugGenerationInline: this.debugGenerationInline,
|
|
91
|
+
});
|
|
72
92
|
this.writer = writer;
|
|
73
|
-
this.
|
|
74
|
-
this.between = this.between.bind(this);
|
|
75
|
-
this.exit = this.exit.bind(this);
|
|
76
|
-
this.leaf = this.leaf.bind(this);
|
|
93
|
+
this.generateResourceHandlers();
|
|
77
94
|
this.generatePropertyHandlers();
|
|
78
95
|
}
|
|
79
96
|
/**
|
|
@@ -113,6 +130,7 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
113
130
|
resetState() {
|
|
114
131
|
this.skipNLBetweenBitsValue = false;
|
|
115
132
|
this.wroteSomething = false;
|
|
133
|
+
this.inTag = true;
|
|
116
134
|
this.printed = false;
|
|
117
135
|
}
|
|
118
136
|
walkAndWrite(ast) {
|
|
@@ -143,12 +161,12 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
143
161
|
this.writeOPD(bit.bitLevel);
|
|
144
162
|
if (bit.isCommented)
|
|
145
163
|
this.writeString('|');
|
|
146
|
-
this.
|
|
164
|
+
this.writeBreakscapedTagString(bit.bitType);
|
|
147
165
|
if (bit.textFormat) {
|
|
148
166
|
const write = this.isWriteTextFormat(bit.textFormat, bitConfig.textFormatDefault);
|
|
149
167
|
if (write) {
|
|
150
168
|
this.writeColon();
|
|
151
|
-
this.
|
|
169
|
+
this.writeBreakscapedTagString(bit.textFormat);
|
|
152
170
|
}
|
|
153
171
|
}
|
|
154
172
|
// Use the bitConfig to see if we need to write the resourceType attachment
|
|
@@ -171,10 +189,12 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
171
189
|
}
|
|
172
190
|
if (resourceType) {
|
|
173
191
|
this.writeAmpersand();
|
|
174
|
-
this.
|
|
192
|
+
this.writeBreakscapedTagString(resourceType);
|
|
175
193
|
}
|
|
176
194
|
this.writeCL();
|
|
177
195
|
this.writeNL();
|
|
196
|
+
// Continue traversal
|
|
197
|
+
return true;
|
|
178
198
|
}
|
|
179
199
|
between_bitsValue(node, left, right, route) {
|
|
180
200
|
// The following keys are combined with other keys so don't need newlines
|
|
@@ -195,14 +215,20 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
195
215
|
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
196
216
|
const parent = this.getParentNode(route);
|
|
197
217
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
198
|
-
return;
|
|
218
|
+
return true;
|
|
199
219
|
for (let i = 0; i < internalComment.length; i++) {
|
|
200
220
|
const comment = internalComment[i];
|
|
201
221
|
const last = i === internalComment.length - 1;
|
|
202
|
-
this.writeProperty('internalComment', comment
|
|
222
|
+
this.writeProperty('internalComment', comment, {
|
|
223
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
224
|
+
single: false,
|
|
225
|
+
ignoreEmpty: true,
|
|
226
|
+
});
|
|
203
227
|
if (!last)
|
|
204
228
|
this.writeNL();
|
|
205
229
|
}
|
|
230
|
+
// Stop traversal of this branch
|
|
231
|
+
return false;
|
|
206
232
|
}
|
|
207
233
|
// bitmarkAst -> bits -> bitsValue -> labelTrue / labelFalse
|
|
208
234
|
enter_labelTrue(node, route) {
|
|
@@ -210,14 +236,24 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
210
236
|
// Ignore example that is not at the bit level as it are handled elsewhere
|
|
211
237
|
const parent = this.getParentNode(route);
|
|
212
238
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
213
|
-
return;
|
|
239
|
+
return true;
|
|
214
240
|
const bit = parent === null || parent === void 0 ? void 0 : parent.value;
|
|
215
241
|
if (bit) {
|
|
216
242
|
if (value != '')
|
|
217
|
-
this.writeProperty(PropertyTag_1.PropertyTag.labelTrue, value,
|
|
243
|
+
this.writeProperty(PropertyTag_1.PropertyTag.labelTrue, value, {
|
|
244
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
245
|
+
single: true,
|
|
246
|
+
ignoreEmpty: true,
|
|
247
|
+
});
|
|
218
248
|
if (bit.labelFalse && bit.labelFalse[0] != '')
|
|
219
|
-
this.writeProperty(PropertyTag_1.PropertyTag.labelFalse, bit.labelFalse,
|
|
249
|
+
this.writeProperty(PropertyTag_1.PropertyTag.labelFalse, bit.labelFalse, {
|
|
250
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
251
|
+
single: true,
|
|
252
|
+
ignoreEmpty: true,
|
|
253
|
+
});
|
|
220
254
|
}
|
|
255
|
+
// Stop traversal of this branch
|
|
256
|
+
return false;
|
|
221
257
|
}
|
|
222
258
|
// bitmarkAst -> bits -> bitsValue -> imageSource
|
|
223
259
|
enter_imageSource(node, route) {
|
|
@@ -225,19 +261,41 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
225
261
|
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
226
262
|
const parent = this.getParentNode(route);
|
|
227
263
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
228
|
-
return;
|
|
264
|
+
return true;
|
|
229
265
|
const { url, mockupId, size, format, trim } = imageSource;
|
|
230
|
-
this.writeProperty('imageSource', url,
|
|
266
|
+
this.writeProperty('imageSource', url, {
|
|
267
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
268
|
+
single: true,
|
|
269
|
+
ignoreEmpty: true,
|
|
270
|
+
});
|
|
231
271
|
if (url) {
|
|
232
272
|
if (mockupId)
|
|
233
|
-
this.writeProperty('mockupId', mockupId,
|
|
273
|
+
this.writeProperty('mockupId', mockupId, {
|
|
274
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
275
|
+
single: true,
|
|
276
|
+
ignoreEmpty: true,
|
|
277
|
+
});
|
|
234
278
|
if (size)
|
|
235
|
-
this.writeProperty('size', size,
|
|
279
|
+
this.writeProperty('size', size, {
|
|
280
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
281
|
+
single: true,
|
|
282
|
+
ignoreEmpty: true,
|
|
283
|
+
});
|
|
236
284
|
if (format)
|
|
237
|
-
this.writeProperty('format', format,
|
|
285
|
+
this.writeProperty('format', format, {
|
|
286
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
287
|
+
single: true,
|
|
288
|
+
ignoreEmpty: true,
|
|
289
|
+
});
|
|
238
290
|
if (BooleanUtils_1.BooleanUtils.isBoolean(trim))
|
|
239
|
-
this.writeProperty('trim', trim,
|
|
291
|
+
this.writeProperty('trim', trim, {
|
|
292
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
293
|
+
single: true,
|
|
294
|
+
ignoreEmpty: true,
|
|
295
|
+
});
|
|
240
296
|
}
|
|
297
|
+
// Stop traversal of this branch
|
|
298
|
+
return false;
|
|
241
299
|
}
|
|
242
300
|
// bitmarkAst -> bits -> bitsValue -> technicalTerm
|
|
243
301
|
enter_technicalTerm(node, route) {
|
|
@@ -245,11 +303,22 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
245
303
|
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
246
304
|
const parent = this.getParentNode(route);
|
|
247
305
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
248
|
-
return;
|
|
306
|
+
return true;
|
|
249
307
|
const { technicalTerm, lang } = nodeValue;
|
|
250
|
-
this.writeProperty('technicalTerm', technicalTerm,
|
|
251
|
-
|
|
252
|
-
|
|
308
|
+
this.writeProperty('technicalTerm', technicalTerm, {
|
|
309
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
310
|
+
single: true,
|
|
311
|
+
ignoreEmpty: true,
|
|
312
|
+
});
|
|
313
|
+
if (lang != null) {
|
|
314
|
+
this.writeProperty('lang', lang, {
|
|
315
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
316
|
+
single: true,
|
|
317
|
+
ignoreEmpty: true,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
// Stop traversal of this branch
|
|
321
|
+
return false;
|
|
253
322
|
}
|
|
254
323
|
// bitmarkAst -> bits -> bitsValue -> servings
|
|
255
324
|
enter_servings(node, route) {
|
|
@@ -257,17 +326,52 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
257
326
|
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
258
327
|
const parent = this.getParentNode(route);
|
|
259
328
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
260
|
-
return;
|
|
261
|
-
const { servings, unit, unitAbbr, decimalPlaces, disableCalculation } = nodeValue;
|
|
262
|
-
this.writeProperty('servings', servings,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
if (
|
|
268
|
-
this.writeProperty('
|
|
269
|
-
|
|
270
|
-
|
|
329
|
+
return true;
|
|
330
|
+
const { servings, unit, unitAbbr, decimalPlaces, disableCalculation, hint } = nodeValue;
|
|
331
|
+
this.writeProperty('servings', servings, {
|
|
332
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
333
|
+
single: true,
|
|
334
|
+
ignoreEmpty: true,
|
|
335
|
+
});
|
|
336
|
+
if (unit != null) {
|
|
337
|
+
this.writeProperty('unit', unit, {
|
|
338
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
339
|
+
single: true,
|
|
340
|
+
ignoreEmpty: true,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
if (unitAbbr != null) {
|
|
344
|
+
this.writeProperty('unitAbbr', unitAbbr, {
|
|
345
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
346
|
+
single: true,
|
|
347
|
+
ignoreEmpty: true,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
if (decimalPlaces != null) {
|
|
351
|
+
this.writeProperty('decimalPlaces', decimalPlaces, {
|
|
352
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
353
|
+
single: true,
|
|
354
|
+
ignoreEmpty: true,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
if (disableCalculation != null) {
|
|
358
|
+
this.writeProperty('disableCalculation', disableCalculation, {
|
|
359
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
360
|
+
single: true,
|
|
361
|
+
ignoreEmpty: true,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
if (hint != null) {
|
|
365
|
+
this.writeOPQ();
|
|
366
|
+
this.writeBreakscapedTagString(hint);
|
|
367
|
+
this.writeCL();
|
|
368
|
+
// this.writeProperty('hint', hint, {
|
|
369
|
+
// format: PropertyFormat.trimmedString,
|
|
370
|
+
// single: true,
|
|
371
|
+
// ignoreEmpty: true,
|
|
372
|
+
// });
|
|
373
|
+
}
|
|
374
|
+
return false;
|
|
271
375
|
}
|
|
272
376
|
// bitmarkAst -> bits -> bitsValue -> person
|
|
273
377
|
enter_person(node, route) {
|
|
@@ -275,15 +379,25 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
275
379
|
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
276
380
|
const parent = this.getParentNode(route);
|
|
277
381
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
278
|
-
return;
|
|
382
|
+
return true;
|
|
279
383
|
const { name, title, avatarImage } = person;
|
|
280
|
-
this.writeProperty('person', name,
|
|
384
|
+
this.writeProperty('person', name, {
|
|
385
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
386
|
+
single: true,
|
|
387
|
+
ignoreEmpty: true,
|
|
388
|
+
});
|
|
281
389
|
if (title) {
|
|
282
|
-
this.writeProperty('title', title,
|
|
390
|
+
this.writeProperty('title', title, {
|
|
391
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
392
|
+
single: true,
|
|
393
|
+
ignoreEmpty: true,
|
|
394
|
+
});
|
|
283
395
|
}
|
|
284
396
|
if (avatarImage) {
|
|
285
|
-
this.writeResource(avatarImage);
|
|
397
|
+
this.writeResource(ResourceTag_1.ResourceTag.image, avatarImage.src);
|
|
286
398
|
}
|
|
399
|
+
// Stop traversal of this branch
|
|
400
|
+
return false;
|
|
287
401
|
}
|
|
288
402
|
// bitmarkAst -> bits -> bitsValue -> ratingLevelStart
|
|
289
403
|
enter_ratingLevelStart(node, route) {
|
|
@@ -303,45 +417,110 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
303
417
|
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
304
418
|
const parent = this.getParentNode(route);
|
|
305
419
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
306
|
-
return;
|
|
420
|
+
return true;
|
|
307
421
|
const { level, label } = n;
|
|
308
422
|
const levelKey = node.key === NodeType_1.NodeType.ratingLevelStart ? PropertyTag_1.PropertyTag.ratingLevelStart : PropertyTag_1.PropertyTag.ratingLevelEnd;
|
|
309
|
-
this.writeProperty(levelKey, level,
|
|
423
|
+
this.writeProperty(levelKey, level, {
|
|
424
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
425
|
+
single: true,
|
|
426
|
+
ignoreEmpty: true,
|
|
427
|
+
});
|
|
310
428
|
if (label) {
|
|
311
|
-
this.writeProperty('label', label,
|
|
429
|
+
this.writeProperty('label', label, {
|
|
430
|
+
format: PropertyFormat_1.PropertyFormat.bitmarkMinusMinus,
|
|
431
|
+
single: true,
|
|
432
|
+
ignoreEmpty: true,
|
|
433
|
+
});
|
|
312
434
|
}
|
|
435
|
+
return false;
|
|
313
436
|
}
|
|
314
|
-
// bitmarkAst -> bits -> bitsValue ->
|
|
437
|
+
// bitmarkAst -> bits -> bitsValue -> markConfig
|
|
438
|
+
enter_markConfig(_node, _route) {
|
|
439
|
+
// Handler so markConfig is not processed by the default property handler
|
|
440
|
+
// Continue traversal
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
// bitmarkAst -> bits -> bitsValue -> markConfig -> markConfigValue
|
|
315
444
|
enter_markConfigValue(node, route) {
|
|
316
445
|
const markConfig = node.value;
|
|
317
446
|
// Ignore values that are not at the correct level as they might be handled elsewhere
|
|
318
447
|
const parent = this.getParentNode(route);
|
|
319
448
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.markConfig)
|
|
320
|
-
return;
|
|
449
|
+
return true;
|
|
321
450
|
const { mark, color, emphasis } = markConfig;
|
|
322
451
|
if (mark) {
|
|
323
|
-
this.writeProperty('mark', mark,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
452
|
+
this.writeProperty('mark', mark, {
|
|
453
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
454
|
+
single: true,
|
|
455
|
+
ignoreEmpty: true,
|
|
456
|
+
});
|
|
457
|
+
if (color) {
|
|
458
|
+
this.writeProperty('color', color, {
|
|
459
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
460
|
+
single: true,
|
|
461
|
+
ignoreEmpty: true,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
if (emphasis) {
|
|
465
|
+
this.writeProperty('emphasis', emphasis, {
|
|
466
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
467
|
+
single: true,
|
|
468
|
+
ignoreEmpty: true,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
328
471
|
this.writeNL();
|
|
329
472
|
}
|
|
473
|
+
// Stop traversal of this branch
|
|
474
|
+
return false;
|
|
330
475
|
}
|
|
331
476
|
// bitmarkAst -> bits -> bitsValue -> partialAnswer
|
|
477
|
+
enter_partialAnswer(node, _route) {
|
|
478
|
+
this.writeProperty('partialAnswer', node.value, {
|
|
479
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
480
|
+
single: true,
|
|
481
|
+
ignoreEmpty: true,
|
|
482
|
+
});
|
|
483
|
+
// Stop traversal of this branch
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
332
486
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> partialAnswer
|
|
333
487
|
leaf_partialAnswer(node, _route) {
|
|
334
|
-
this.writeProperty('partialAnswer', node.value
|
|
488
|
+
this.writeProperty('partialAnswer', node.value, {
|
|
489
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
490
|
+
single: true,
|
|
491
|
+
ignoreEmpty: true,
|
|
492
|
+
});
|
|
493
|
+
// Stop traversal of this branch
|
|
494
|
+
return false;
|
|
335
495
|
}
|
|
336
496
|
// bitmarkAst -> bits -> bitsValue -> sampleSolution
|
|
337
497
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> sampleSolution
|
|
498
|
+
enter_sampleSolution(node, _route) {
|
|
499
|
+
this.writeProperty('sampleSolution', node.value, {
|
|
500
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
501
|
+
single: true,
|
|
502
|
+
ignoreEmpty: true,
|
|
503
|
+
});
|
|
504
|
+
// Stop traversal of this branch
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
338
507
|
leaf_sampleSolution(node, _route) {
|
|
339
|
-
this.writeProperty('sampleSolution', node.value
|
|
508
|
+
this.writeProperty('sampleSolution', node.value, {
|
|
509
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
510
|
+
single: true,
|
|
511
|
+
ignoreEmpty: true,
|
|
512
|
+
});
|
|
513
|
+
// Stop traversal of this branch
|
|
514
|
+
return false;
|
|
340
515
|
}
|
|
341
516
|
// bitmarkAst -> bits -> bitsValue -> reasonableNumOfChars
|
|
342
517
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> reasonableNumOfChars
|
|
343
518
|
leaf_reasonableNumOfChars(node, _route) {
|
|
344
|
-
this.writeProperty('reasonableNumOfChars', node.value
|
|
519
|
+
this.writeProperty('reasonableNumOfChars', node.value, {
|
|
520
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
521
|
+
single: true,
|
|
522
|
+
ignoreEmpty: true,
|
|
523
|
+
});
|
|
345
524
|
}
|
|
346
525
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> additionalSolutions
|
|
347
526
|
between_additionalSolutions(_node, _left, _right, route) {
|
|
@@ -357,60 +536,244 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
357
536
|
const parent = this.getParentNode(route, 2);
|
|
358
537
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.questionsValue)
|
|
359
538
|
return;
|
|
360
|
-
this.writeProperty('additionalSolutions', node.value
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
539
|
+
this.writeProperty('additionalSolutions', node.value, {
|
|
540
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
541
|
+
single: false,
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
// bitmarkAst -> bits -> bitsValue -> item
|
|
545
|
+
enter_item(node, route) {
|
|
546
|
+
var _a, _b, _c;
|
|
547
|
+
const item = node.value;
|
|
548
|
+
const parent = this.getParentNode(route);
|
|
549
|
+
if (this.isEmptyText(item))
|
|
550
|
+
return false; // Ignore empty
|
|
551
|
+
if (!this.isEmptyText((_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.lead))
|
|
552
|
+
return true; // Will be handled by lead
|
|
553
|
+
if (!this.isEmptyText((_b = parent === null || parent === void 0 ? void 0 : parent.value) === null || _b === void 0 ? void 0 : _b.pageNumber))
|
|
554
|
+
return true; // Will be handled by pageNumber
|
|
555
|
+
if (!this.isEmptyText((_c = parent === null || parent === void 0 ? void 0 : parent.value) === null || _c === void 0 ? void 0 : _c.marginNumber))
|
|
556
|
+
return true; // Will be handled by marginNumber
|
|
557
|
+
this.writeOPC();
|
|
558
|
+
this.textGenerator.generateSync(item, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
559
|
+
this.writeCL();
|
|
560
|
+
return true;
|
|
561
|
+
}
|
|
562
|
+
// bitmarkAst -> bits -> bitsValue -> lead
|
|
563
|
+
enter_lead(node, route) {
|
|
564
|
+
var _a, _b, _c, _d;
|
|
565
|
+
const lead = node.value;
|
|
566
|
+
const parent = this.getParentNode(route);
|
|
567
|
+
if (this.isEmptyText(lead))
|
|
568
|
+
return false; // Ignore empty
|
|
569
|
+
if (!this.isEmptyText((_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.pageNumber))
|
|
570
|
+
return true; // Will be handled by pageNumber
|
|
571
|
+
if (!this.isEmptyText((_b = parent === null || parent === void 0 ? void 0 : parent.value) === null || _b === void 0 ? void 0 : _b.marginNumber))
|
|
572
|
+
return true; // Will be handled by marginNumber
|
|
573
|
+
this.writeOPC();
|
|
574
|
+
this.textGenerator.generateSync((_d = (_c = parent === null || parent === void 0 ? void 0 : parent.value) === null || _c === void 0 ? void 0 : _c.item) !== null && _d !== void 0 ? _d : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
575
|
+
this.writeCL();
|
|
576
|
+
this.writeOPC();
|
|
577
|
+
this.textGenerator.generateSync(lead, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
578
|
+
this.writeCL();
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
// bitmarkAst -> bits -> bitsValue -> pageNumber
|
|
582
|
+
enter_pageNumber(node, route) {
|
|
583
|
+
var _a, _b, _c, _d, _e;
|
|
584
|
+
const pageNumber = node.value;
|
|
585
|
+
const parent = this.getParentNode(route);
|
|
586
|
+
if (this.isEmptyText(pageNumber))
|
|
587
|
+
return false; // Ignore empty
|
|
588
|
+
if (!this.isEmptyText((_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.marginNumber))
|
|
589
|
+
return true; // Will be handled by marginNumber
|
|
590
|
+
this.writeOPC();
|
|
591
|
+
this.textGenerator.generateSync((_c = (_b = parent === null || parent === void 0 ? void 0 : parent.value) === null || _b === void 0 ? void 0 : _b.item) !== null && _c !== void 0 ? _c : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
592
|
+
this.writeCL();
|
|
593
|
+
this.writeOPC();
|
|
594
|
+
this.textGenerator.generateSync((_e = (_d = parent === null || parent === void 0 ? void 0 : parent.value) === null || _d === void 0 ? void 0 : _d.lead) !== null && _e !== void 0 ? _e : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
595
|
+
this.writeCL();
|
|
596
|
+
this.writeOPC();
|
|
597
|
+
this.textGenerator.generateSync(pageNumber !== null && pageNumber !== void 0 ? pageNumber : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
598
|
+
this.writeCL();
|
|
599
|
+
return true;
|
|
600
|
+
}
|
|
601
|
+
// bitmarkAst -> bits -> bitsValue -> marginNumber
|
|
602
|
+
enter_marginNumber(node, route) {
|
|
603
|
+
var _a, _b, _c, _d, _e, _f;
|
|
604
|
+
const marginNumber = node.value;
|
|
605
|
+
const parent = this.getParentNode(route);
|
|
606
|
+
if (this.isEmptyText(marginNumber))
|
|
607
|
+
return false; // Ignore empty
|
|
608
|
+
this.writeOPC();
|
|
609
|
+
this.textGenerator.generateSync((_b = (_a = parent === null || parent === void 0 ? void 0 : parent.value) === null || _a === void 0 ? void 0 : _a.item) !== null && _b !== void 0 ? _b : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
610
|
+
this.writeCL();
|
|
611
|
+
this.writeOPC();
|
|
612
|
+
this.textGenerator.generateSync((_d = (_c = parent === null || parent === void 0 ? void 0 : parent.value) === null || _c === void 0 ? void 0 : _c.lead) !== null && _d !== void 0 ? _d : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
613
|
+
this.writeCL();
|
|
614
|
+
this.writeOPC();
|
|
615
|
+
this.textGenerator.generateSync((_f = (_e = parent === null || parent === void 0 ? void 0 : parent.value) === null || _e === void 0 ? void 0 : _e.pageNumber) !== null && _f !== void 0 ? _f : '', TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
616
|
+
this.writeCL();
|
|
617
|
+
this.writeOPC();
|
|
618
|
+
this.textGenerator.generateSync(marginNumber, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
619
|
+
this.writeCL();
|
|
620
|
+
return true;
|
|
386
621
|
}
|
|
387
622
|
// bitmarkAst -> bits -> bitsValue -> body
|
|
388
623
|
enter_body(node, route) {
|
|
624
|
+
var _a;
|
|
625
|
+
// Ignore values that are not at the bit level as they might be handled elsewhere
|
|
626
|
+
const parent = this.getParentNode(route);
|
|
627
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.cardBitsValue)
|
|
628
|
+
return true;
|
|
629
|
+
this.inTag = false;
|
|
389
630
|
// always write a NL before the body content if there is any?
|
|
390
631
|
const body = node.value;
|
|
391
|
-
|
|
632
|
+
const textFormat = this.getTextFormat(route);
|
|
633
|
+
const isBitmarkText = textFormat === TextFormat_1.TextFormat.bitmarkPlusPlus || textFormat === TextFormat_1.TextFormat.bitmarkMinusMinus;
|
|
634
|
+
// Handle body
|
|
635
|
+
if (textFormat === TextFormat_1.TextFormat.json) {
|
|
636
|
+
const json = (_a = body.body) !== null && _a !== void 0 ? _a : null;
|
|
637
|
+
if (Array.isArray(json) || ObjectUtils_1.ObjectUtils.isObject(json)) {
|
|
638
|
+
const text = JSON.stringify(json, null, this.prettifySpace);
|
|
639
|
+
if (text) {
|
|
640
|
+
this.writeNL();
|
|
641
|
+
this.writePlainTextDivider();
|
|
642
|
+
this.writeNL();
|
|
643
|
+
this.write(Breakscape_1.Breakscape.breakscape(text, {
|
|
644
|
+
textFormat: TextFormat_1.TextFormat.text,
|
|
645
|
+
}));
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
else if (isBitmarkText) {
|
|
650
|
+
// handle bitmark text
|
|
651
|
+
this.writeNL();
|
|
652
|
+
// The text generator will write to the writer
|
|
653
|
+
const b = (Array.isArray(body.body) ? body.body : []);
|
|
654
|
+
this.textGenerator.generateSync(b, textFormat);
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
// handle plain text
|
|
658
|
+
this.writeNL();
|
|
659
|
+
this.writePlainTextDivider();
|
|
392
660
|
this.writeNL();
|
|
393
|
-
|
|
394
|
-
|
|
661
|
+
const s = (StringUtils_1.StringUtils.isString(body.body) ? body.body : '');
|
|
662
|
+
this.write(Breakscape_1.Breakscape.breakscape(`${s}`, {
|
|
663
|
+
textFormat: TextFormat_1.TextFormat.text,
|
|
664
|
+
}));
|
|
665
|
+
this.writeNL();
|
|
666
|
+
}
|
|
667
|
+
// Stop traversal of this branch
|
|
668
|
+
return false;
|
|
669
|
+
// if ((body.body && body.body.length > 0) || body.bodyJson) {
|
|
670
|
+
// this.writeNL();
|
|
671
|
+
// // Write the plain text divider if not bitmark++/-- format
|
|
672
|
+
// const textFormat = this.getTextFormat(route);
|
|
673
|
+
// const isBitmarkText = textFormat === TextFormat.bitmarkPlusPlus || textFormat === TextFormat.bitmarkMinusMinus;
|
|
674
|
+
// if (!isBitmarkText) {
|
|
675
|
+
// this.writePlainTextDivider();
|
|
676
|
+
// this.writeNL();
|
|
677
|
+
// }
|
|
678
|
+
// }
|
|
679
|
+
}
|
|
680
|
+
exit_body(_node, _route) {
|
|
681
|
+
this.inTag = true;
|
|
682
|
+
}
|
|
683
|
+
bodyBitCallback(bodyBit, _index, _route) {
|
|
684
|
+
// console.log('bodyBitCallback', bodyBit, index, route);
|
|
685
|
+
var _a;
|
|
686
|
+
// Walk the body bit AST
|
|
687
|
+
const nodeType = (_a = NodeType_1.NodeType.fromValue(bodyBit.type)) !== null && _a !== void 0 ? _a : NodeType_1.NodeType.bodyBit;
|
|
688
|
+
this.ast.walk(bodyBit, nodeType, this, undefined);
|
|
689
|
+
return ''; // Return empty string as we are writing to the writer
|
|
690
|
+
}
|
|
691
|
+
// bodyBit -> gap
|
|
692
|
+
enter_gap(node, _route) {
|
|
693
|
+
const gap = node.value;
|
|
694
|
+
if (gap.solutions && gap.solutions.length === 0) {
|
|
695
|
+
// If there are no solutions, we need to write the special cloze gap [_] to indicate this
|
|
696
|
+
this.writeOPU();
|
|
697
|
+
this.writeCL();
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
for (const solution of gap.solutions) {
|
|
701
|
+
this.writeOPU();
|
|
702
|
+
this.writeBreakscapedTagString(solution);
|
|
703
|
+
this.writeCL();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
// Continue traversal
|
|
707
|
+
return true;
|
|
708
|
+
}
|
|
709
|
+
// bodyBit -> mark
|
|
710
|
+
enter_mark(node, _route) {
|
|
711
|
+
const mark = node.value;
|
|
712
|
+
this.writeOPE();
|
|
713
|
+
this.writeBreakscapedTagString(mark.solution);
|
|
714
|
+
this.writeCL();
|
|
715
|
+
// Continue traversal
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
// bodyBit -> select
|
|
719
|
+
enter_select(_node, _route) {
|
|
720
|
+
// Continue traversal
|
|
721
|
+
return true;
|
|
722
|
+
}
|
|
723
|
+
// bodyBit -> highlight
|
|
724
|
+
enter_highlight(_node, _route) {
|
|
725
|
+
// Continue traversal
|
|
726
|
+
return true;
|
|
727
|
+
}
|
|
728
|
+
// bitmarkAst -> bits -> footer
|
|
729
|
+
enter_footer(node, route) {
|
|
730
|
+
const parent = this.getParentNode(route);
|
|
731
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
732
|
+
return true;
|
|
733
|
+
const footer = node.value;
|
|
734
|
+
const textFormat = this.getTextFormat(route);
|
|
735
|
+
// Handle footer
|
|
736
|
+
if (textFormat === TextFormat_1.TextFormat.json) {
|
|
737
|
+
// Json footer?!
|
|
738
|
+
// Not valid, ignore
|
|
739
|
+
}
|
|
740
|
+
else if (footer.footer && footer.footer.length > 0) {
|
|
395
741
|
const isBitmarkText = textFormat === TextFormat_1.TextFormat.bitmarkPlusPlus || textFormat === TextFormat_1.TextFormat.bitmarkMinusMinus;
|
|
396
|
-
if (
|
|
397
|
-
|
|
742
|
+
if (isBitmarkText) {
|
|
743
|
+
// handle bitmark text
|
|
744
|
+
this.write('~~~~');
|
|
398
745
|
this.writeNL();
|
|
746
|
+
// The text generator will write to the writer
|
|
747
|
+
this.textGenerator.generateSync(footer.footer, TextFormat_1.TextFormat.text);
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
// Plain text footer?!
|
|
751
|
+
// Not valid, ignore (plain text cannot have a card set / footer marker, so cannot have a footer!
|
|
399
752
|
}
|
|
400
753
|
}
|
|
754
|
+
// Stop traversal of this branch
|
|
755
|
+
return false;
|
|
401
756
|
}
|
|
402
757
|
// bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> solutions
|
|
403
|
-
enter_solutions(node,
|
|
758
|
+
enter_solutions(node, route) {
|
|
759
|
+
const parent = this.getParentNode(route);
|
|
760
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
761
|
+
return true;
|
|
404
762
|
const solutions = node.value;
|
|
405
763
|
if (solutions && solutions.length === 0) {
|
|
406
764
|
// If there are no solutions, we need to write the special cloze gap [_] to indicate this
|
|
407
765
|
this.writeOPU();
|
|
408
766
|
this.writeCL();
|
|
409
767
|
}
|
|
768
|
+
// Continue traversal
|
|
769
|
+
return true;
|
|
410
770
|
}
|
|
411
771
|
// bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> solution
|
|
412
772
|
leaf_solution(node, route) {
|
|
413
773
|
var _a;
|
|
774
|
+
const parent = this.getParentNode(route);
|
|
775
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
776
|
+
return;
|
|
414
777
|
const solution = node.value;
|
|
415
778
|
// Ignore values that are not at the correct level as they might be handled elsewhere
|
|
416
779
|
const bodyPartsValue = (_a = this.getParentNode(route, 2)) === null || _a === void 0 ? void 0 : _a.value;
|
|
@@ -418,20 +781,22 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
418
781
|
return;
|
|
419
782
|
if (solution) {
|
|
420
783
|
this.writeOPE();
|
|
421
|
-
this.
|
|
784
|
+
this.writeBreakscapedTagString(solution);
|
|
422
785
|
this.writeCL();
|
|
423
786
|
}
|
|
424
787
|
}
|
|
425
|
-
// bitmarkAst -> bits -> bitsValue -> body ->
|
|
788
|
+
// bitmarkAst -> bits -> bitsValue -> body -> bodyBit -> mark -> mark
|
|
426
789
|
leaf_mark(node, route) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
// Ignore values that are not at the correct level as they might be handled elsewhere
|
|
430
|
-
const bodyPartsValue = (_a = this.getParentNode(route, 2)) === null || _a === void 0 ? void 0 : _a.value;
|
|
431
|
-
if ((bodyPartsValue === null || bodyPartsValue === void 0 ? void 0 : bodyPartsValue.type) !== BodyBitType_1.BodyBitType.mark)
|
|
790
|
+
const root = route[0];
|
|
791
|
+
if ((root === null || root === void 0 ? void 0 : root.key) !== NodeType_1.NodeType.mark)
|
|
432
792
|
return;
|
|
793
|
+
const mark = node.value;
|
|
433
794
|
if (mark) {
|
|
434
|
-
this.writeProperty('mark', mark,
|
|
795
|
+
this.writeProperty('mark', mark, {
|
|
796
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
797
|
+
single: true,
|
|
798
|
+
ignoreEmpty: true,
|
|
799
|
+
});
|
|
435
800
|
}
|
|
436
801
|
}
|
|
437
802
|
// bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> options -> optionsValue
|
|
@@ -445,6 +810,8 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
445
810
|
}
|
|
446
811
|
this.write(selectOption.text);
|
|
447
812
|
this.writeCL();
|
|
813
|
+
// Continue traversal
|
|
814
|
+
return true;
|
|
448
815
|
}
|
|
449
816
|
// bitmarkAst -> bits -> bitsValue -> body -> bodyParts -> bodyPartsValue -> data -> texts -> textsValue
|
|
450
817
|
enter_textsValue(node, _route) {
|
|
@@ -457,15 +824,19 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
457
824
|
}
|
|
458
825
|
this.write(highlightText.text);
|
|
459
826
|
this.writeCL();
|
|
827
|
+
// Continue traversal
|
|
828
|
+
return true;
|
|
460
829
|
}
|
|
461
830
|
// bitmarkAst -> bits -> bitsValue -> cardNode
|
|
462
831
|
enter_cardNode(_node, route) {
|
|
463
832
|
// Ignore cards for xxx-1
|
|
464
833
|
const isBitType1 = this.isOfBitType1(route);
|
|
465
834
|
if (isBitType1)
|
|
466
|
-
return;
|
|
835
|
+
return true;
|
|
467
836
|
this.writeCardSetStart();
|
|
468
837
|
this.writeNL();
|
|
838
|
+
// Continue traversal
|
|
839
|
+
return true;
|
|
469
840
|
}
|
|
470
841
|
between_cardNode(_node, _left, _right, route) {
|
|
471
842
|
// Ignore cards for xxx-1
|
|
@@ -507,26 +878,29 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
507
878
|
}
|
|
508
879
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue
|
|
509
880
|
between_flashcardsValue(_node, _left, right, _route) {
|
|
881
|
+
var _a;
|
|
510
882
|
if (right.key === NodeType_1.NodeType.answer) {
|
|
511
883
|
this.writeNL();
|
|
512
884
|
this.writeCardSetSideDivider();
|
|
513
885
|
this.writeNL();
|
|
514
886
|
}
|
|
515
|
-
else if (right.key === NodeType_1.NodeType.alternativeAnswers) {
|
|
887
|
+
else if (right.key === NodeType_1.NodeType.alternativeAnswers && ((_a = right.value) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
|
|
516
888
|
this.writeNL();
|
|
517
889
|
this.writeCardSetVariantDivider();
|
|
518
890
|
this.writeNL();
|
|
519
891
|
}
|
|
520
892
|
}
|
|
521
893
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> answer
|
|
522
|
-
|
|
894
|
+
enter_answer(node, route) {
|
|
523
895
|
// Ignore responses that are not at the flashcardsValue level as they are handled elsewhere
|
|
524
896
|
const parent = this.getParentNode(route);
|
|
525
897
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.flashcardsValue)
|
|
526
|
-
return;
|
|
898
|
+
return true;
|
|
527
899
|
if (node.value) {
|
|
528
|
-
this.
|
|
900
|
+
this.textGenerator.generateSync(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
529
901
|
}
|
|
902
|
+
// Stop traversal of this branch
|
|
903
|
+
return false;
|
|
530
904
|
}
|
|
531
905
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers
|
|
532
906
|
between_alternativeAnswers(_node, _route) {
|
|
@@ -535,30 +909,38 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
535
909
|
this.writeNL();
|
|
536
910
|
}
|
|
537
911
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> flashcards -> flashcardsValue -> alternativeAnswers -> alternativeAnswersValue
|
|
538
|
-
|
|
912
|
+
enter_alternativeAnswersValue(node, route) {
|
|
539
913
|
// Ignore responses that are not at the alternativeAnswers level as they are handled elsewhere
|
|
540
914
|
const parent = this.getParentNode(route);
|
|
541
915
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.alternativeAnswers)
|
|
542
|
-
return;
|
|
916
|
+
return true;
|
|
543
917
|
if (node.value) {
|
|
544
|
-
this.
|
|
918
|
+
// this.writeBreakscapedTagString(node.value);
|
|
919
|
+
this.textGenerator.generateSync(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
545
920
|
}
|
|
921
|
+
// Stop traversal of this branch
|
|
922
|
+
return false;
|
|
546
923
|
}
|
|
547
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue ->
|
|
924
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> alternativeDefintions
|
|
548
925
|
between_alternativeDefinitions(_node, _route) {
|
|
549
926
|
this.writeNL();
|
|
550
927
|
this.writeCardSetVariantDivider();
|
|
551
928
|
this.writeNL();
|
|
552
929
|
}
|
|
553
930
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> alternativeDefinitions -> alternativeDefinitionsValue
|
|
554
|
-
|
|
555
|
-
// Ignore responses that are not at the
|
|
931
|
+
enter_alternativeDefinitionsValue(node, route) {
|
|
932
|
+
// Ignore responses that are not at the alternativeAnswers level as they are handled elsewhere
|
|
556
933
|
const parent = this.getParentNode(route);
|
|
557
934
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.alternativeDefinitions)
|
|
558
|
-
return;
|
|
935
|
+
return true;
|
|
559
936
|
if (node.value) {
|
|
560
|
-
this.
|
|
937
|
+
// this.writeNL();
|
|
938
|
+
// this.writeCardSetVariantDivider();
|
|
939
|
+
// this.writeNL();
|
|
940
|
+
this.textGenerator.generateSync(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
561
941
|
}
|
|
942
|
+
// Stop traversal of this branch
|
|
943
|
+
return false;
|
|
562
944
|
}
|
|
563
945
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> statements
|
|
564
946
|
enter_statements(_node, _route) {
|
|
@@ -584,8 +966,10 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
584
966
|
else {
|
|
585
967
|
this.writeOPM();
|
|
586
968
|
}
|
|
587
|
-
this.write(statement.
|
|
969
|
+
this.write(statement.statement);
|
|
588
970
|
this.writeCL();
|
|
971
|
+
// Continue traversal
|
|
972
|
+
return true;
|
|
589
973
|
}
|
|
590
974
|
// bitmarkAst -> bits -> bitsValue -> choices
|
|
591
975
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> choices
|
|
@@ -605,8 +989,10 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
605
989
|
else {
|
|
606
990
|
this.writeOPM();
|
|
607
991
|
}
|
|
608
|
-
this.write(choice.
|
|
992
|
+
this.write(choice.choice);
|
|
609
993
|
this.writeCL();
|
|
994
|
+
// Continue traversal
|
|
995
|
+
return true;
|
|
610
996
|
}
|
|
611
997
|
// bitmarkAst -> bits -> bitsValue -> responses
|
|
612
998
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes -> quizzesValue -> responses
|
|
@@ -626,8 +1012,10 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
626
1012
|
else {
|
|
627
1013
|
this.writeOPM();
|
|
628
1014
|
}
|
|
629
|
-
this.write(response.
|
|
1015
|
+
this.write(response.response);
|
|
630
1016
|
this.writeCL();
|
|
1017
|
+
// Continue traversal
|
|
1018
|
+
return true;
|
|
631
1019
|
}
|
|
632
1020
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> quizzes
|
|
633
1021
|
enter_quizzes(_node, _route) {
|
|
@@ -691,13 +1079,17 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
691
1079
|
enter_keyAudio(node, _route) {
|
|
692
1080
|
const resource = node.value;
|
|
693
1081
|
// This is a resource, so handle it with the common code
|
|
694
|
-
this.writeResource(resource);
|
|
1082
|
+
this.writeResource(ResourceTag_1.ResourceTag.audio, resource.src);
|
|
1083
|
+
// Stop traversal of this branch
|
|
1084
|
+
return false;
|
|
695
1085
|
}
|
|
696
1086
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> pairs -> pairsValue -> keyImage
|
|
697
1087
|
enter_keyImage(node, _route) {
|
|
698
1088
|
const resource = node.value;
|
|
699
1089
|
// This is a resource, so handle it with the common code
|
|
700
|
-
this.writeResource(resource);
|
|
1090
|
+
this.writeResource(ResourceTag_1.ResourceTag.image, resource.src);
|
|
1091
|
+
// Stop traversal of this branch
|
|
1092
|
+
return false;
|
|
701
1093
|
}
|
|
702
1094
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> matrix
|
|
703
1095
|
enter_matrix(_node, _route) {
|
|
@@ -736,8 +1128,8 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
736
1128
|
this.writeCardSetCardDivider();
|
|
737
1129
|
this.writeNL();
|
|
738
1130
|
}
|
|
739
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> table ->
|
|
740
|
-
|
|
1131
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data
|
|
1132
|
+
between_data(_node, _left, _right, route) {
|
|
741
1133
|
const parent = this.getParentNode(route);
|
|
742
1134
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.table)
|
|
743
1135
|
return;
|
|
@@ -761,20 +1153,23 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
761
1153
|
leaf_columnsValue(node, _route) {
|
|
762
1154
|
this.writeOPHASH();
|
|
763
1155
|
if (node.value)
|
|
764
|
-
this.
|
|
1156
|
+
this.writeBreakscapedTagString(node.value);
|
|
765
1157
|
this.writeCL();
|
|
766
1158
|
}
|
|
767
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> table ->
|
|
768
|
-
|
|
769
|
-
const parent = this.getParentNode(route);
|
|
770
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.
|
|
1159
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data -> dataValue
|
|
1160
|
+
between_dataValue(_node, _left, _right, route) {
|
|
1161
|
+
const parent = this.getParentNode(route, 2);
|
|
1162
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.table)
|
|
771
1163
|
return;
|
|
772
1164
|
this.writeNL();
|
|
773
1165
|
this.writeCardSetSideDivider();
|
|
774
1166
|
this.writeNL();
|
|
775
1167
|
}
|
|
776
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> table ->
|
|
777
|
-
|
|
1168
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> table -> data -> dataValue -> dataValueValue
|
|
1169
|
+
leaf_dataValueValue(node, route) {
|
|
1170
|
+
const parent = this.getParentNode(route, 3);
|
|
1171
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.table)
|
|
1172
|
+
return;
|
|
778
1173
|
if (node.value)
|
|
779
1174
|
this.write(node.value);
|
|
780
1175
|
}
|
|
@@ -803,23 +1198,49 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
803
1198
|
// this.writeCardSetSideDivider();
|
|
804
1199
|
// this.writeNL();
|
|
805
1200
|
// }
|
|
806
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue -> term
|
|
807
1201
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> term
|
|
1202
|
+
enter_term(node, route) {
|
|
1203
|
+
const parent = this.getParentNode(route);
|
|
1204
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.definitionsValue)
|
|
1205
|
+
return true;
|
|
1206
|
+
if (node.value) {
|
|
1207
|
+
this.textGenerator.generateSync(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1208
|
+
}
|
|
1209
|
+
// Stop traversal of this branch
|
|
1210
|
+
return false;
|
|
1211
|
+
}
|
|
1212
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue -> term
|
|
808
1213
|
leaf_term(node, route) {
|
|
809
1214
|
const parent = this.getParentNode(route);
|
|
810
1215
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.definitionsValue)
|
|
811
|
-
return;
|
|
812
|
-
if (node.value)
|
|
1216
|
+
return true;
|
|
1217
|
+
if (node.value) {
|
|
813
1218
|
this.write(node.value);
|
|
1219
|
+
}
|
|
1220
|
+
// Stop traversal of this branch
|
|
1221
|
+
return false;
|
|
814
1222
|
}
|
|
815
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode ->
|
|
816
|
-
|
|
817
|
-
leaf_description(node, route) {
|
|
1223
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue -> definition
|
|
1224
|
+
enter_definition(node, route) {
|
|
818
1225
|
const parent = this.getParentNode(route);
|
|
819
1226
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.definitionsValue)
|
|
820
|
-
return;
|
|
821
|
-
if (node.value)
|
|
1227
|
+
return true;
|
|
1228
|
+
if (node.value) {
|
|
1229
|
+
this.textGenerator.generateSync(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1230
|
+
}
|
|
1231
|
+
// Stop traversal of this branch
|
|
1232
|
+
return false;
|
|
1233
|
+
}
|
|
1234
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue -> definition
|
|
1235
|
+
leaf_definition(node, route) {
|
|
1236
|
+
const parent = this.getParentNode(route);
|
|
1237
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.definitionsValue)
|
|
1238
|
+
return true;
|
|
1239
|
+
if (node.value) {
|
|
822
1240
|
this.write(node.value);
|
|
1241
|
+
}
|
|
1242
|
+
// Stop traversal of this branch
|
|
1243
|
+
return false;
|
|
823
1244
|
}
|
|
824
1245
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions
|
|
825
1246
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions
|
|
@@ -831,23 +1252,37 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
831
1252
|
this.writeCardSetCardDivider();
|
|
832
1253
|
this.writeNL();
|
|
833
1254
|
}
|
|
834
|
-
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue
|
|
835
1255
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> definitions -> definitionsValue
|
|
836
1256
|
between_definitionsValue(_node, _left, right, route) {
|
|
1257
|
+
var _a;
|
|
837
1258
|
const parent = this.getParentNode(route);
|
|
838
1259
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.definitions)
|
|
839
1260
|
return;
|
|
840
|
-
if (right.key === NodeType_1.NodeType.
|
|
1261
|
+
if (right.key === NodeType_1.NodeType.definition) {
|
|
841
1262
|
this.writeNL();
|
|
842
1263
|
this.writeCardSetSideDivider();
|
|
843
1264
|
this.writeNL();
|
|
844
1265
|
}
|
|
845
|
-
else if (right.key === NodeType_1.NodeType.alternativeDefinitions) {
|
|
1266
|
+
else if (right.key === NodeType_1.NodeType.alternativeDefinitions && ((_a = right.value) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
846
1267
|
this.writeNL();
|
|
847
1268
|
this.writeCardSetVariantDivider();
|
|
848
1269
|
this.writeNL();
|
|
849
1270
|
}
|
|
850
1271
|
}
|
|
1272
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> captionDefinitionList -> definitions -> definitionsValue
|
|
1273
|
+
// protected between_definitionsValue(_node: NodeInfo, _left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void {
|
|
1274
|
+
// const parent = this.getParentNode(route);
|
|
1275
|
+
// if (parent?.key !== NodeType.definitions) return;
|
|
1276
|
+
// if (right.key === NodeType.definition) {
|
|
1277
|
+
// this.writeNL();
|
|
1278
|
+
// this.writeCardSetSideDivider();
|
|
1279
|
+
// this.writeNL();
|
|
1280
|
+
// } else if (right.key === NodeType.alternativeDefinitions && right.value?.length > 0) {
|
|
1281
|
+
// this.writeNL();
|
|
1282
|
+
// this.writeCardSetVariantDivider();
|
|
1283
|
+
// this.writeNL();
|
|
1284
|
+
// }
|
|
1285
|
+
// }
|
|
851
1286
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> questions
|
|
852
1287
|
enter_questions(_node, _route) {
|
|
853
1288
|
//
|
|
@@ -887,7 +1322,7 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
887
1322
|
const ingredient = node.value;
|
|
888
1323
|
if (ingredient.title != null) {
|
|
889
1324
|
this.writeOPHASH();
|
|
890
|
-
this.
|
|
1325
|
+
this.writeBreakscapedTagString(ingredient.title);
|
|
891
1326
|
this.writeCL();
|
|
892
1327
|
this.writeNL();
|
|
893
1328
|
}
|
|
@@ -902,24 +1337,42 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
902
1337
|
// [!43]
|
|
903
1338
|
if (ingredient.quantity != null) {
|
|
904
1339
|
this.writeOPB();
|
|
905
|
-
this.
|
|
1340
|
+
this.writeBreakscapedTagString(`${ingredient.quantity}`);
|
|
906
1341
|
this.writeCL();
|
|
907
1342
|
}
|
|
908
1343
|
// [@unit:kilograms]
|
|
909
1344
|
if (ingredient.unit != null)
|
|
910
|
-
this.writeProperty('unit', ingredient.unit,
|
|
1345
|
+
this.writeProperty('unit', ingredient.unit, {
|
|
1346
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1347
|
+
single: true,
|
|
1348
|
+
ignoreEmpty: true,
|
|
1349
|
+
});
|
|
911
1350
|
// [@unitAbbr:kg]
|
|
912
1351
|
if (ingredient.unitAbbr != null)
|
|
913
|
-
this.writeProperty('unitAbbr', ingredient.unitAbbr,
|
|
1352
|
+
this.writeProperty('unitAbbr', ingredient.unitAbbr, {
|
|
1353
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1354
|
+
single: true,
|
|
1355
|
+
ignoreEmpty: true,
|
|
1356
|
+
});
|
|
914
1357
|
// [@decimalPlaces:1]
|
|
915
1358
|
if (ingredient.decimalPlaces != null)
|
|
916
|
-
this.writeProperty('decimalPlaces', ingredient.decimalPlaces,
|
|
1359
|
+
this.writeProperty('decimalPlaces', ingredient.decimalPlaces, {
|
|
1360
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1361
|
+
single: true,
|
|
1362
|
+
ignoreEmpty: true,
|
|
1363
|
+
});
|
|
917
1364
|
// [@disableCalculation]
|
|
918
1365
|
if (ingredient.disableCalculation)
|
|
919
|
-
this.writeProperty('disableCalculation', true,
|
|
1366
|
+
this.writeProperty('disableCalculation', true, {
|
|
1367
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1368
|
+
single: true,
|
|
1369
|
+
ignoreEmpty: true,
|
|
1370
|
+
});
|
|
920
1371
|
// item
|
|
921
1372
|
if (ingredient.item != null)
|
|
922
1373
|
this.write(ingredient.item);
|
|
1374
|
+
// Stop traversal of this branch
|
|
1375
|
+
return false;
|
|
923
1376
|
}
|
|
924
1377
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses
|
|
925
1378
|
enter_botResponses(_node, _route) {
|
|
@@ -952,37 +1405,42 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
952
1405
|
//
|
|
953
1406
|
}
|
|
954
1407
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
|
|
955
|
-
leaf_response(node,
|
|
1408
|
+
leaf_response(node, route) {
|
|
1409
|
+
const parent = this.getParentNode(route);
|
|
1410
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.botResponsesValue)
|
|
1411
|
+
return;
|
|
956
1412
|
this.writeOPB();
|
|
957
|
-
this.
|
|
1413
|
+
this.writeBreakscapedTagString(node.value);
|
|
958
1414
|
this.writeCL();
|
|
959
1415
|
}
|
|
960
1416
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> reaction
|
|
961
|
-
leaf_reaction(node,
|
|
962
|
-
this.
|
|
1417
|
+
leaf_reaction(node, route) {
|
|
1418
|
+
const parent = this.getParentNode(route);
|
|
1419
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.botResponsesValue)
|
|
1420
|
+
return;
|
|
1421
|
+
this.writeProperty('reaction', node.value, {
|
|
1422
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1423
|
+
single: true,
|
|
1424
|
+
ignoreEmpty: true,
|
|
1425
|
+
});
|
|
963
1426
|
}
|
|
964
1427
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> feedback
|
|
965
|
-
leaf_feedback(node,
|
|
1428
|
+
leaf_feedback(node, route) {
|
|
1429
|
+
const parent = this.getParentNode(route);
|
|
1430
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.botResponsesValue)
|
|
1431
|
+
return;
|
|
966
1432
|
const feeback = node.value;
|
|
967
1433
|
if (feeback) {
|
|
968
1434
|
this.write(feeback);
|
|
969
1435
|
}
|
|
970
1436
|
}
|
|
971
|
-
// bitmarkAst -> bits -> bitsValue -> resources
|
|
972
|
-
between_resources(_node, _left, _right, _route) {
|
|
973
|
-
this.writeNL();
|
|
974
|
-
}
|
|
975
|
-
// bitmarkAst -> bits -> bitsValue -> resourcesValue
|
|
976
|
-
enter_resourcesValue(node, _route) {
|
|
977
|
-
const resource = node.value;
|
|
978
|
-
// This is a resource, so handle it with the common code
|
|
979
|
-
this.writeResource(resource);
|
|
980
|
-
}
|
|
981
1437
|
// bitmarkAst -> bits -> bitsValue -> imagePlaceholder
|
|
982
1438
|
enter_imagePlaceholder(node, _route) {
|
|
983
1439
|
const resource = node.value;
|
|
984
1440
|
// This is a resource, so handle it with the common code
|
|
985
1441
|
this.writePropertyStyleResource(node.key, resource);
|
|
1442
|
+
// Continue traversal
|
|
1443
|
+
return true;
|
|
986
1444
|
}
|
|
987
1445
|
exit_imagePlaceholder(_node, _route) {
|
|
988
1446
|
this.writeNL();
|
|
@@ -995,16 +1453,26 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
995
1453
|
// Bit poster image
|
|
996
1454
|
const posterImage = node.value;
|
|
997
1455
|
if (posterImage) {
|
|
998
|
-
this.writeProperty('posterImage', posterImage
|
|
1456
|
+
this.writeProperty('posterImage', posterImage, {
|
|
1457
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1458
|
+
single: true,
|
|
1459
|
+
ignoreEmpty: true,
|
|
1460
|
+
});
|
|
999
1461
|
}
|
|
1000
1462
|
}
|
|
1001
1463
|
else {
|
|
1002
1464
|
// Resource poster image
|
|
1003
1465
|
const posterImage = node.value;
|
|
1004
|
-
if (posterImage && posterImage.
|
|
1005
|
-
this.writeProperty('posterImage', posterImage.
|
|
1466
|
+
if (posterImage && posterImage.src) {
|
|
1467
|
+
this.writeProperty('posterImage', posterImage.src, {
|
|
1468
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1469
|
+
single: true,
|
|
1470
|
+
ignoreEmpty: true,
|
|
1471
|
+
});
|
|
1006
1472
|
}
|
|
1007
1473
|
}
|
|
1474
|
+
// Continue traversal
|
|
1475
|
+
return true;
|
|
1008
1476
|
}
|
|
1009
1477
|
// bitmarkAst -> bits -> bitsValue -> resource -> thumbnails
|
|
1010
1478
|
// [src1x,src2x,src3x,src4x,width,height,alt,zoomDisabled,caption]
|
|
@@ -1018,21 +1486,24 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1018
1486
|
break;
|
|
1019
1487
|
const thumbnail = thumbnails[i];
|
|
1020
1488
|
const key = thumbnailKeys[i];
|
|
1021
|
-
this.writeProperty(key, thumbnail.
|
|
1489
|
+
this.writeProperty(key, thumbnail.src, {
|
|
1490
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1491
|
+
single: true,
|
|
1492
|
+
ignoreEmpty: true,
|
|
1493
|
+
});
|
|
1022
1494
|
}
|
|
1023
1495
|
}
|
|
1496
|
+
// Stop traversal of this branch
|
|
1497
|
+
return false;
|
|
1024
1498
|
}
|
|
1025
|
-
//
|
|
1026
|
-
// Terminal nodes (leaves)
|
|
1027
|
-
//
|
|
1028
1499
|
// bitmarkAst -> bits -> bitsValue -> bitType
|
|
1029
1500
|
// bitmarkAst -> bits -> bitsValue -> textFormat
|
|
1030
1501
|
// bitmarkAst -> bits -> title
|
|
1031
|
-
|
|
1032
|
-
const parent = this.getParentNode(route);
|
|
1502
|
+
enter_title(node, route) {
|
|
1033
1503
|
// Ensure this is at the bit level
|
|
1504
|
+
const parent = this.getParentNode(route);
|
|
1034
1505
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
1035
|
-
return;
|
|
1506
|
+
return true;
|
|
1036
1507
|
const value = node.value;
|
|
1037
1508
|
const title = value;
|
|
1038
1509
|
const bit = parent === null || parent === void 0 ? void 0 : parent.value;
|
|
@@ -1041,12 +1512,18 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1041
1512
|
this.writeOP();
|
|
1042
1513
|
for (let i = 0; i < +level; i++)
|
|
1043
1514
|
this.writeHash();
|
|
1044
|
-
this.
|
|
1515
|
+
this.textGenerator.generateSync(title, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1045
1516
|
this.writeCL();
|
|
1046
1517
|
}
|
|
1518
|
+
// Stop traversal of this branch
|
|
1519
|
+
return false;
|
|
1047
1520
|
}
|
|
1048
1521
|
// bitmarkAst -> bits -> subtitle
|
|
1049
|
-
|
|
1522
|
+
enter_subtitle(node, route) {
|
|
1523
|
+
// Ensure this is at the bit level
|
|
1524
|
+
const parent = this.getParentNode(route);
|
|
1525
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
1526
|
+
return true;
|
|
1050
1527
|
const value = node.value;
|
|
1051
1528
|
const subtitle = value;
|
|
1052
1529
|
const level = 2;
|
|
@@ -1054,23 +1531,29 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1054
1531
|
this.writeOP();
|
|
1055
1532
|
for (let i = 0; i < level; i++)
|
|
1056
1533
|
this.writeHash();
|
|
1057
|
-
this.
|
|
1534
|
+
this.textGenerator.generateSync(subtitle, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1058
1535
|
this.writeCL();
|
|
1059
1536
|
}
|
|
1537
|
+
// Stop traversal of this branch
|
|
1538
|
+
return false;
|
|
1060
1539
|
}
|
|
1061
1540
|
// bitmarkAst -> bits -> bitsValue -> book
|
|
1062
1541
|
leaf_book(node, route) {
|
|
1063
1542
|
const parent = this.getParentNode(route);
|
|
1064
1543
|
const bit = parent === null || parent === void 0 ? void 0 : parent.value;
|
|
1065
1544
|
if (bit && node.value) {
|
|
1066
|
-
this.writeProperty('book', node.value
|
|
1545
|
+
this.writeProperty('book', node.value, {
|
|
1546
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1547
|
+
single: true,
|
|
1548
|
+
ignoreEmpty: false,
|
|
1549
|
+
});
|
|
1067
1550
|
if (bit.reference) {
|
|
1068
1551
|
this.writeOPRANGLE();
|
|
1069
|
-
this.
|
|
1552
|
+
this.writeBreakscapedTagString(bit.reference);
|
|
1070
1553
|
this.writeCL();
|
|
1071
1554
|
if (bit.referenceEnd) {
|
|
1072
1555
|
this.writeOPRANGLE();
|
|
1073
|
-
this.
|
|
1556
|
+
this.writeBreakscapedTagString(bit.referenceEnd);
|
|
1074
1557
|
this.writeCL();
|
|
1075
1558
|
}
|
|
1076
1559
|
}
|
|
@@ -1080,7 +1563,7 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1080
1563
|
leaf_anchor(node, _route) {
|
|
1081
1564
|
if (node.value) {
|
|
1082
1565
|
this.writeOPDANGLE();
|
|
1083
|
-
this.
|
|
1566
|
+
this.writeBreakscapedTagString(node.value);
|
|
1084
1567
|
this.writeCL();
|
|
1085
1568
|
}
|
|
1086
1569
|
}
|
|
@@ -1092,7 +1575,7 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1092
1575
|
// Only write reference if it is not chained to 'book'
|
|
1093
1576
|
if (!bit.book) {
|
|
1094
1577
|
this.writeOPRANGLE();
|
|
1095
|
-
this.
|
|
1578
|
+
this.writeBreakscapedTagString(node.value);
|
|
1096
1579
|
this.writeCL();
|
|
1097
1580
|
}
|
|
1098
1581
|
}
|
|
@@ -1100,101 +1583,80 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1100
1583
|
// * -> itemLead --> item
|
|
1101
1584
|
// * -> itemLead --> lead
|
|
1102
1585
|
// * -> hint
|
|
1103
|
-
|
|
1586
|
+
enter_hint(node, _route) {
|
|
1104
1587
|
const value = node.value;
|
|
1105
1588
|
const text = value;
|
|
1106
|
-
if (text) {
|
|
1589
|
+
if (!this.isEmptyText(text)) {
|
|
1107
1590
|
this.writeOPQ();
|
|
1108
|
-
this.
|
|
1591
|
+
this.textGenerator.generateSync(text, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1109
1592
|
this.writeCL();
|
|
1110
1593
|
}
|
|
1594
|
+
// Stop traversal of this branch
|
|
1595
|
+
return false;
|
|
1111
1596
|
}
|
|
1112
1597
|
// bitmarkAst -> bits -> bitsValue -> * -> instruction
|
|
1113
|
-
|
|
1598
|
+
enter_instruction(node, _route) {
|
|
1114
1599
|
const value = node.value;
|
|
1115
1600
|
const text = value;
|
|
1116
|
-
if (text) {
|
|
1601
|
+
if (!this.isEmptyText(text)) {
|
|
1117
1602
|
this.writeOPB();
|
|
1118
|
-
this.
|
|
1603
|
+
this.textGenerator.generateSync(text, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1119
1604
|
this.writeCL();
|
|
1120
1605
|
}
|
|
1606
|
+
// Stop traversal of this branch
|
|
1607
|
+
return false;
|
|
1121
1608
|
}
|
|
1122
|
-
// bitmarkAst -> bits -> bitsValue -> * -> example
|
|
1123
|
-
|
|
1124
|
-
var _a
|
|
1125
|
-
const
|
|
1126
|
-
const parent = this.getParentNode(route);
|
|
1127
|
-
const isExample = (_a = parent === null || parent === void 0 ? void 0 : parent.value.isExample) !== null && _a !== void 0 ? _a : false;
|
|
1128
|
-
const isDefaultExample = (_b = parent === null || parent === void 0 ? void 0 : parent.value.isDefaultExample) !== null && _b !== void 0 ? _b : false;
|
|
1609
|
+
// bitmarkAst -> bits -> bitsValue -> * -> isExample / example
|
|
1610
|
+
leaf_isExample(node, route) {
|
|
1611
|
+
var _a;
|
|
1612
|
+
const isExample = node.value;
|
|
1129
1613
|
if (!isExample)
|
|
1130
1614
|
return;
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
}
|
|
1136
|
-
else if (value != null) {
|
|
1615
|
+
const parent = this.getParentNode(route);
|
|
1616
|
+
const example = (_a = parent === null || parent === void 0 ? void 0 : parent.value.example) !== null && _a !== void 0 ? _a : null;
|
|
1617
|
+
// const __isDefaultExample = parent?.value.__isDefaultExample ?? false;
|
|
1618
|
+
if (example != null && example !== '') {
|
|
1137
1619
|
this.writeOPA();
|
|
1138
1620
|
this.writeString('example');
|
|
1139
1621
|
this.writeColon();
|
|
1140
|
-
if (
|
|
1622
|
+
if (example === true) {
|
|
1141
1623
|
this.writeString('true');
|
|
1142
1624
|
}
|
|
1143
|
-
else if (
|
|
1625
|
+
else if (example === false) {
|
|
1144
1626
|
this.writeString('false');
|
|
1145
1627
|
}
|
|
1628
|
+
else if (Array.isArray(example)) {
|
|
1629
|
+
// TextAst
|
|
1630
|
+
this.textGenerator.generateSync(example, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1631
|
+
}
|
|
1146
1632
|
else {
|
|
1147
1633
|
// String
|
|
1148
|
-
this.
|
|
1634
|
+
this.writeBreakscapedTagString(example);
|
|
1149
1635
|
}
|
|
1150
1636
|
this.writeCL();
|
|
1151
1637
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
if (text) {
|
|
1158
|
-
this.writeString(text);
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
// bitmarkAst -> bits -> body -> bodyValue -> bodyJson
|
|
1162
|
-
enter_bodyJson(node, _route) {
|
|
1163
|
-
const value = node.value;
|
|
1164
|
-
if (Array.isArray(value) || ObjectUtils_1.ObjectUtils.isObject(value)) {
|
|
1165
|
-
const text = JSON.stringify(value, null, this.prettifySpace);
|
|
1166
|
-
if (text) {
|
|
1167
|
-
this.writeString(text);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
// Stop traversal of this branch to avoid processing the bodyJson
|
|
1171
|
-
return false;
|
|
1172
|
-
}
|
|
1173
|
-
// bitmarkAst -> bits -> footer
|
|
1174
|
-
enter_footer(_node, _route) {
|
|
1175
|
-
this.write('~~~~');
|
|
1176
|
-
this.writeNL();
|
|
1177
|
-
}
|
|
1178
|
-
// bitmarkAst -> bits -> footer -> footerText
|
|
1179
|
-
leaf_footerText(node, _route) {
|
|
1180
|
-
const value = node.value;
|
|
1181
|
-
const text = value;
|
|
1182
|
-
if (text) {
|
|
1183
|
-
this.writeString(text);
|
|
1638
|
+
else {
|
|
1639
|
+
// Don't write example if it is null.
|
|
1640
|
+
// this.writeOPA();
|
|
1641
|
+
// this.writeString('example');
|
|
1642
|
+
// this.writeCL();
|
|
1184
1643
|
}
|
|
1185
1644
|
}
|
|
1186
1645
|
// bitmarkAst -> bits -> bitsValue -> elements -> elementsValue
|
|
1187
1646
|
leaf_elementsValue(node, _route) {
|
|
1188
1647
|
if (node.value) {
|
|
1189
|
-
this.
|
|
1648
|
+
this.writeBreakscapedTagString(node.value);
|
|
1190
1649
|
}
|
|
1191
1650
|
}
|
|
1192
1651
|
// bitmarkAst -> bits -> bitsValue -> body -> bodyValue -> gap -> solutions -> solution
|
|
1193
1652
|
// ? -> solutions -> solution
|
|
1194
|
-
leaf_solutionsValue(node,
|
|
1653
|
+
leaf_solutionsValue(node, route) {
|
|
1654
|
+
const parent = this.getParentNode(route, 2);
|
|
1655
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
1656
|
+
return;
|
|
1195
1657
|
if (node.value != null) {
|
|
1196
1658
|
this.writeOPU();
|
|
1197
|
-
this.
|
|
1659
|
+
this.writeBreakscapedTagString(node.value);
|
|
1198
1660
|
this.writeCL();
|
|
1199
1661
|
}
|
|
1200
1662
|
}
|
|
@@ -1203,7 +1665,7 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1203
1665
|
leaf_prefix(node, _route) {
|
|
1204
1666
|
if (node.value) {
|
|
1205
1667
|
this.writeOPPRE();
|
|
1206
|
-
this.
|
|
1668
|
+
this.writeBreakscapedTagString(node.value);
|
|
1207
1669
|
this.writeCL();
|
|
1208
1670
|
}
|
|
1209
1671
|
}
|
|
@@ -1212,39 +1674,50 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1212
1674
|
leaf_postfix(node, _route) {
|
|
1213
1675
|
if (node.value) {
|
|
1214
1676
|
this.writeOPPOST();
|
|
1215
|
-
this.
|
|
1677
|
+
this.writeBreakscapedTagString(node.value);
|
|
1216
1678
|
this.writeCL();
|
|
1217
1679
|
}
|
|
1218
1680
|
}
|
|
1219
1681
|
// bitmarkAst -> bits -> bitsValue -> * -> isCaseSensitive
|
|
1220
1682
|
leaf_isCaseSensitive(node, _route) {
|
|
1221
|
-
this.writeProperty('isCaseSensitive', node.value,
|
|
1683
|
+
this.writeProperty('isCaseSensitive', node.value, {
|
|
1684
|
+
format: PropertyFormat_1.PropertyFormat.boolean,
|
|
1685
|
+
single: true,
|
|
1686
|
+
ignoreFalse: false,
|
|
1687
|
+
ignoreTrue: true,
|
|
1688
|
+
});
|
|
1222
1689
|
}
|
|
1223
1690
|
// bitmarkAst -> bits -> bitsValue -> * -> isCorrect
|
|
1224
1691
|
// bitmarkAst -> bits -> bitsValue -> heading -> forKeys
|
|
1225
1692
|
leaf_forKeys(node, _route) {
|
|
1226
1693
|
this.writeOPHASH();
|
|
1227
|
-
this.
|
|
1694
|
+
this.writeBreakscapedTagString(node.value);
|
|
1695
|
+
this.writeCL();
|
|
1696
|
+
}
|
|
1697
|
+
// bitmarkAst -> bits -> bitsValue -> heading -> forValues
|
|
1698
|
+
leaf_forValues(node, _route) {
|
|
1699
|
+
this.writeOPHASH();
|
|
1700
|
+
this.writeBreakscapedTagString(node.value);
|
|
1228
1701
|
this.writeCL();
|
|
1229
1702
|
}
|
|
1230
1703
|
// bitmarkAst -> bits -> bitsValue -> heading -> forValuesValue
|
|
1231
1704
|
leaf_forValuesValue(node, _route) {
|
|
1232
1705
|
this.writeOPHASH();
|
|
1233
|
-
this.
|
|
1706
|
+
this.writeBreakscapedTagString(node.value);
|
|
1234
1707
|
this.writeCL();
|
|
1235
1708
|
}
|
|
1236
1709
|
// bitmarkAst -> bits -> bitsValue -> pairs -> pairsValue -> key
|
|
1237
1710
|
// bitmarkAst -> bits -> bitsValue -> matrix -> matrixValue -> key
|
|
1238
1711
|
leaf_key(node, _route) {
|
|
1239
1712
|
if (node.value) {
|
|
1240
|
-
this.
|
|
1713
|
+
this.writeBreakscapedTagString(node.value);
|
|
1241
1714
|
}
|
|
1242
1715
|
}
|
|
1243
1716
|
// bitmarkAst -> bits -> bitsValue -> pairs -> pairsValue -> values -> valuesValue
|
|
1244
1717
|
// bitmarkAst -> bits -> bitsValue -> matrix -> matrixValue -> cells -> cellsValue -> values -> valuesValue
|
|
1245
1718
|
leaf_valuesValue(node, _route) {
|
|
1246
1719
|
if (node.value) {
|
|
1247
|
-
this.
|
|
1720
|
+
this.writeBreakscapedTagString(node.value);
|
|
1248
1721
|
}
|
|
1249
1722
|
}
|
|
1250
1723
|
// bitmarkAst -> bits -> bitsValue -> questions -> questionsValue -> question
|
|
@@ -1255,9 +1728,22 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1255
1728
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.questionsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.flashcardsValue)
|
|
1256
1729
|
return;
|
|
1257
1730
|
if (node.value) {
|
|
1258
|
-
this.
|
|
1731
|
+
this.writeBreakscapedTagString(node.value);
|
|
1732
|
+
// this.writeNL();
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
enter_question(node, route) {
|
|
1736
|
+
// Ignore responses that are not at the questionsValue level as they are handled elsewhere
|
|
1737
|
+
const parent = this.getParentNode(route);
|
|
1738
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.questionsValue && (parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.flashcardsValue)
|
|
1739
|
+
return true;
|
|
1740
|
+
if (node.value) {
|
|
1741
|
+
this.textGenerator.generateSync(node.value, TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
1742
|
+
// this.writeString(node.value);
|
|
1259
1743
|
// this.writeNL();
|
|
1260
1744
|
}
|
|
1745
|
+
// Stop traversal of this branch
|
|
1746
|
+
return false;
|
|
1261
1747
|
}
|
|
1262
1748
|
// bitmarkAst -> bits -> bitsValue -> statements -> text
|
|
1263
1749
|
// bitmarkAst -> bits -> bitsValue -> resource -> ...
|
|
@@ -1265,25 +1751,53 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1265
1751
|
// bitmarkAst -> bits -> bitsValue -> resource -> thumbnails -> thumbnailsValue -> ...
|
|
1266
1752
|
// [src1x,src2x,src3x,src4x,width,height,alt,zoomDisabled,caption]
|
|
1267
1753
|
leaf_src1x(node, _route) {
|
|
1268
|
-
this.writeProperty('src1x', node.value
|
|
1754
|
+
this.writeProperty('src1x', node.value, {
|
|
1755
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1756
|
+
single: true,
|
|
1757
|
+
ignoreEmpty: true,
|
|
1758
|
+
});
|
|
1269
1759
|
}
|
|
1270
1760
|
leaf_src2x(node, _route) {
|
|
1271
|
-
this.writeProperty('src2x', node.value
|
|
1761
|
+
this.writeProperty('src2x', node.value, {
|
|
1762
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1763
|
+
single: true,
|
|
1764
|
+
ignoreEmpty: true,
|
|
1765
|
+
});
|
|
1272
1766
|
}
|
|
1273
1767
|
leaf_src3x(node, _route) {
|
|
1274
|
-
this.writeProperty('src3x', node.value
|
|
1768
|
+
this.writeProperty('src3x', node.value, {
|
|
1769
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1770
|
+
single: true,
|
|
1771
|
+
ignoreEmpty: true,
|
|
1772
|
+
});
|
|
1275
1773
|
}
|
|
1276
1774
|
leaf_src4x(node, _route) {
|
|
1277
|
-
this.writeProperty('src4x', node.value
|
|
1775
|
+
this.writeProperty('src4x', node.value, {
|
|
1776
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1777
|
+
single: true,
|
|
1778
|
+
ignoreEmpty: true,
|
|
1779
|
+
});
|
|
1278
1780
|
}
|
|
1279
1781
|
leaf_width(node, _route) {
|
|
1280
|
-
this.writeProperty('width', node.value
|
|
1782
|
+
this.writeProperty('width', node.value, {
|
|
1783
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1784
|
+
single: true,
|
|
1785
|
+
ignoreEmpty: true,
|
|
1786
|
+
});
|
|
1281
1787
|
}
|
|
1282
1788
|
leaf_height(node, _route) {
|
|
1283
|
-
this.writeProperty('height', node.value
|
|
1789
|
+
this.writeProperty('height', node.value, {
|
|
1790
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1791
|
+
single: true,
|
|
1792
|
+
ignoreEmpty: true,
|
|
1793
|
+
});
|
|
1284
1794
|
}
|
|
1285
1795
|
leaf_alt(node, _route) {
|
|
1286
|
-
this.writeProperty('alt', node.value
|
|
1796
|
+
this.writeProperty('alt', node.value, {
|
|
1797
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1798
|
+
single: true,
|
|
1799
|
+
ignoreEmpty: true,
|
|
1800
|
+
});
|
|
1287
1801
|
}
|
|
1288
1802
|
leaf_zoomDisabled(node, route) {
|
|
1289
1803
|
const bitType = this.getBitType(route);
|
|
@@ -1293,32 +1807,65 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1293
1807
|
BitType_1.BitType.imagesLogoGrave,
|
|
1294
1808
|
BitType_1.BitType.prototypeImages,
|
|
1295
1809
|
])) {
|
|
1296
|
-
this.writeProperty('zoomDisabled', node.value,
|
|
1810
|
+
this.writeProperty('zoomDisabled', node.value, {
|
|
1811
|
+
format: PropertyFormat_1.PropertyFormat.boolean,
|
|
1812
|
+
single: true,
|
|
1813
|
+
ignoreFalse: false,
|
|
1814
|
+
ignoreTrue: true,
|
|
1815
|
+
});
|
|
1297
1816
|
}
|
|
1298
1817
|
else {
|
|
1299
|
-
this.writeProperty('zoomDisabled', node.value,
|
|
1818
|
+
this.writeProperty('zoomDisabled', node.value, {
|
|
1819
|
+
format: PropertyFormat_1.PropertyFormat.boolean,
|
|
1820
|
+
single: true,
|
|
1821
|
+
ignoreFalse: true,
|
|
1822
|
+
ignoreTrue: false,
|
|
1823
|
+
});
|
|
1300
1824
|
}
|
|
1301
1825
|
}
|
|
1302
1826
|
leaf_license(node, _route) {
|
|
1303
|
-
this.writeProperty('license', node.value
|
|
1827
|
+
this.writeProperty('license', node.value, {
|
|
1828
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1829
|
+
single: true,
|
|
1830
|
+
ignoreEmpty: true,
|
|
1831
|
+
});
|
|
1304
1832
|
}
|
|
1305
1833
|
leaf_copyright(node, _route) {
|
|
1306
|
-
this.writeProperty('copyright', node.value
|
|
1834
|
+
this.writeProperty('copyright', node.value, {
|
|
1835
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1836
|
+
single: true,
|
|
1837
|
+
ignoreEmpty: true,
|
|
1838
|
+
});
|
|
1307
1839
|
}
|
|
1308
1840
|
leaf_provider(_node, _route) {
|
|
1309
1841
|
// provider is included in the url (it is the domain) and should not be written as a property
|
|
1310
1842
|
// this.writeProperty('provider', node.value);
|
|
1311
1843
|
}
|
|
1312
1844
|
leaf_showInIndex(node, _route) {
|
|
1313
|
-
this.writeProperty('showInIndex', node.value
|
|
1845
|
+
this.writeProperty('showInIndex', node.value, {
|
|
1846
|
+
format: PropertyFormat_1.PropertyFormat.boolean,
|
|
1847
|
+
single: true,
|
|
1848
|
+
ignoreEmpty: true,
|
|
1849
|
+
ignoreFalse: true,
|
|
1850
|
+
});
|
|
1314
1851
|
}
|
|
1315
|
-
|
|
1852
|
+
enter_caption(node, _route) {
|
|
1316
1853
|
const value = node.value;
|
|
1317
|
-
this.writeProperty('caption', value
|
|
1854
|
+
this.writeProperty('caption', value, {
|
|
1855
|
+
format: PropertyFormat_1.PropertyFormat.bitmarkMinusMinus,
|
|
1856
|
+
single: true, // ??
|
|
1857
|
+
ignoreEmpty: true,
|
|
1858
|
+
});
|
|
1859
|
+
// Stop traversal of this branch
|
|
1860
|
+
return false;
|
|
1318
1861
|
}
|
|
1319
1862
|
leaf_search(node, _route) {
|
|
1320
1863
|
const value = node.value;
|
|
1321
|
-
this.writeProperty('search', value
|
|
1864
|
+
this.writeProperty('search', value, {
|
|
1865
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1866
|
+
single: true,
|
|
1867
|
+
ignoreEmpty: true,
|
|
1868
|
+
});
|
|
1322
1869
|
}
|
|
1323
1870
|
// bitmarkAst -> bits -> bitsValue -> resource -> ...
|
|
1324
1871
|
// bitmarkAst -> bits -> bitsValue -> resource -> posterImage -> ...
|
|
@@ -1329,23 +1876,97 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1329
1876
|
const parent = this.getParentNode(route);
|
|
1330
1877
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.bitsValue)
|
|
1331
1878
|
return;
|
|
1332
|
-
this.writeProperty('duration', node.value
|
|
1879
|
+
this.writeProperty('duration', node.value, {
|
|
1880
|
+
format: PropertyFormat_1.PropertyFormat.trimmedString,
|
|
1881
|
+
single: true,
|
|
1882
|
+
ignoreEmpty: true,
|
|
1883
|
+
});
|
|
1333
1884
|
}
|
|
1334
1885
|
leaf_mute(node, _route) {
|
|
1335
|
-
this.writeProperty('mute', node.value
|
|
1886
|
+
this.writeProperty('mute', node.value, {
|
|
1887
|
+
format: PropertyFormat_1.PropertyFormat.boolean,
|
|
1888
|
+
single: true,
|
|
1889
|
+
ignoreEmpty: true,
|
|
1890
|
+
});
|
|
1336
1891
|
}
|
|
1337
1892
|
leaf_autoplay(node, _route) {
|
|
1338
|
-
this.writeProperty('autoplay', node.value
|
|
1893
|
+
this.writeProperty('autoplay', node.value, {
|
|
1894
|
+
format: PropertyFormat_1.PropertyFormat.boolean,
|
|
1895
|
+
single: true,
|
|
1896
|
+
ignoreEmpty: true,
|
|
1897
|
+
});
|
|
1339
1898
|
}
|
|
1340
1899
|
leaf_allowSubtitles(node, _route) {
|
|
1341
|
-
this.writeProperty('allowSubtitles', node.value
|
|
1900
|
+
this.writeProperty('allowSubtitles', node.value, {
|
|
1901
|
+
format: PropertyFormat_1.PropertyFormat.boolean,
|
|
1902
|
+
single: true,
|
|
1903
|
+
ignoreEmpty: true,
|
|
1904
|
+
});
|
|
1342
1905
|
}
|
|
1343
1906
|
leaf_showSubtitles(node, _route) {
|
|
1344
|
-
this.writeProperty('showSubtitles', node.value
|
|
1907
|
+
this.writeProperty('showSubtitles', node.value, {
|
|
1908
|
+
format: PropertyFormat_1.PropertyFormat.boolean,
|
|
1909
|
+
single: true,
|
|
1910
|
+
ignoreEmpty: true,
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
//
|
|
1914
|
+
// Resources
|
|
1915
|
+
//
|
|
1916
|
+
// bitmarkAst -> bits -> bitsValue -> resources
|
|
1917
|
+
between_resources(_node, _left, _right, _route) {
|
|
1918
|
+
this.writeNL();
|
|
1919
|
+
}
|
|
1920
|
+
exit_resources(_node, _left, _right, _route) {
|
|
1921
|
+
this.writeNL();
|
|
1922
|
+
}
|
|
1923
|
+
// bitmarkAst -> bits -> bitsValue -> resourcesValue
|
|
1924
|
+
between_resourcesValue(_node, _left, _right, _route) {
|
|
1925
|
+
this.writeNL();
|
|
1345
1926
|
}
|
|
1346
1927
|
//
|
|
1347
1928
|
// Generated Node Handlers
|
|
1348
1929
|
//
|
|
1930
|
+
/**
|
|
1931
|
+
* Generate the handlers for resources, as they are mostly the same, but not quite
|
|
1932
|
+
*/
|
|
1933
|
+
generateResourceHandlers() {
|
|
1934
|
+
for (const tag of ResourceTag_1.ResourceTag.keys()) {
|
|
1935
|
+
// skip unknown
|
|
1936
|
+
if (tag === ResourceTag_1.ResourceTag.keyFromValue(ResourceTag_1.ResourceTag.unknown))
|
|
1937
|
+
continue;
|
|
1938
|
+
const enterFuncName = `enter_${tag}`;
|
|
1939
|
+
// Skip if the function already exists, allows for custom handlers
|
|
1940
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1941
|
+
if (typeof this[enterFuncName] === 'function') {
|
|
1942
|
+
continue;
|
|
1943
|
+
}
|
|
1944
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1945
|
+
this[enterFuncName] = (node, route) => {
|
|
1946
|
+
const resource = node.value;
|
|
1947
|
+
if (resource == null)
|
|
1948
|
+
return false;
|
|
1949
|
+
// Ignore any property that is not at the bit level as that will be handled by a different handler
|
|
1950
|
+
const parent = this.getParentNode(route);
|
|
1951
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.resourcesValue)
|
|
1952
|
+
return true;
|
|
1953
|
+
// Get the resource alias
|
|
1954
|
+
const alias = ResourceTag_1.ResourceTag.fromValue(parent.value.__typeAlias);
|
|
1955
|
+
const type = alias !== null && alias !== void 0 ? alias : ResourceTag_1.ResourceTag.fromValue(parent.value.type);
|
|
1956
|
+
if (!type)
|
|
1957
|
+
return false;
|
|
1958
|
+
// url / src / href / app
|
|
1959
|
+
const url = resource.url || resource.src || resource.body || '';
|
|
1960
|
+
// Write the resource
|
|
1961
|
+
this.writeResource(type, url);
|
|
1962
|
+
// Continue traversal
|
|
1963
|
+
return true;
|
|
1964
|
+
};
|
|
1965
|
+
// Bind this
|
|
1966
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1967
|
+
this[enterFuncName] = this[enterFuncName].bind(this);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1349
1970
|
/**
|
|
1350
1971
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
1351
1972
|
*/
|
|
@@ -1362,36 +1983,15 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1362
1983
|
const propertiesConfig = Config_1.Config.getRawPropertiesConfig();
|
|
1363
1984
|
for (const propertyConfig of Object.values(propertiesConfig)) {
|
|
1364
1985
|
const astKey = (_a = propertyConfig.astKey) !== null && _a !== void 0 ? _a : propertyConfig.tag;
|
|
1365
|
-
// Special cases (handled outside of the automatically generated handlers)
|
|
1366
|
-
if (astKey === PropertyTag_1.PropertyTag.internalComment)
|
|
1367
|
-
continue;
|
|
1368
|
-
if (astKey === PropertyTag_1.PropertyTag.example)
|
|
1369
|
-
continue;
|
|
1370
|
-
if (astKey === PropertyTag_1.PropertyTag.labelTrue)
|
|
1371
|
-
continue;
|
|
1372
|
-
if (astKey === PropertyTag_1.PropertyTag.labelFalse)
|
|
1373
|
-
continue;
|
|
1374
|
-
if (astKey === PropertyTag_1.PropertyTag.posterImage)
|
|
1375
|
-
continue;
|
|
1376
|
-
if (astKey === PropertyTag_1.PropertyTag.imageSource)
|
|
1377
|
-
continue;
|
|
1378
|
-
if (astKey === PropertyTag_1.PropertyTag.imagePlaceholder)
|
|
1379
|
-
continue;
|
|
1380
|
-
if (astKey === PropertyTag_1.PropertyTag.technicalTerm)
|
|
1381
|
-
continue;
|
|
1382
|
-
if (astKey === PropertyTag_1.PropertyTag.servings)
|
|
1383
|
-
continue;
|
|
1384
|
-
if (astKey === PropertyTag_1.PropertyTag.person)
|
|
1385
|
-
continue;
|
|
1386
|
-
if (astKey === PropertyAstKey_1.PropertyAstKey.ast_markConfig)
|
|
1387
|
-
continue;
|
|
1388
|
-
if (astKey === PropertyTag_1.PropertyTag.ratingLevelStart)
|
|
1389
|
-
continue;
|
|
1390
|
-
if (astKey === PropertyTag_1.PropertyTag.ratingLevelEnd)
|
|
1391
|
-
continue;
|
|
1392
1986
|
const enterFuncName = `enter_${astKey}`;
|
|
1987
|
+
// Skip if the function already exists, allows for custom handlers
|
|
1988
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1989
|
+
if (typeof this[enterFuncName] === 'function') {
|
|
1990
|
+
continue;
|
|
1991
|
+
}
|
|
1393
1992
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1394
1993
|
this[enterFuncName] = (node, route) => {
|
|
1994
|
+
var _a, _b;
|
|
1395
1995
|
const value = node.value;
|
|
1396
1996
|
if (value == null)
|
|
1397
1997
|
return;
|
|
@@ -1401,7 +2001,12 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1401
2001
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) !== NodeType_1.NodeType.bitsValue)
|
|
1402
2002
|
return;
|
|
1403
2003
|
// Write the property
|
|
1404
|
-
this.writeProperty(propertyConfig.tag, node.value,
|
|
2004
|
+
this.writeProperty(propertyConfig.tag, node.value, {
|
|
2005
|
+
format: (_a = propertyConfig.format) !== null && _a !== void 0 ? _a : PropertyFormat_1.PropertyFormat.trimmedString,
|
|
2006
|
+
single: (_b = propertyConfig.single) !== null && _b !== void 0 ? _b : false,
|
|
2007
|
+
ignoreFalse: propertyConfig.defaultValue === 'false',
|
|
2008
|
+
ignoreTrue: propertyConfig.defaultValue === 'true',
|
|
2009
|
+
});
|
|
1405
2010
|
};
|
|
1406
2011
|
// Bind this
|
|
1407
2012
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1437,6 +2042,13 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1437
2042
|
//
|
|
1438
2043
|
// WRITE FUNCTIONS
|
|
1439
2044
|
//
|
|
2045
|
+
writeBreakscapedTagString(s) {
|
|
2046
|
+
if (s != null) {
|
|
2047
|
+
this.write(Breakscape_1.Breakscape.breakscape(`${s}`, {
|
|
2048
|
+
textFormat: TextFormat_1.TextFormat.bitmarkMinusMinus,
|
|
2049
|
+
}));
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
1440
2052
|
writeString(s) {
|
|
1441
2053
|
if (s != null)
|
|
1442
2054
|
this.write(`${s}`);
|
|
@@ -1571,84 +2183,86 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1571
2183
|
this.write('\n');
|
|
1572
2184
|
}
|
|
1573
2185
|
writePropertyStyleResource(key, resource) {
|
|
1574
|
-
|
|
2186
|
+
var _a;
|
|
1575
2187
|
if (key && resource) {
|
|
2188
|
+
const resourceTag = (_a = ResourceTag_1.ResourceTag.keyFromValue(resource.type)) !== null && _a !== void 0 ? _a : '';
|
|
2189
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2190
|
+
const resourceData = resource[resourceTag];
|
|
2191
|
+
const src = resourceData ? resourceData.src || resourceData.url || resourceData.body || '' : '';
|
|
1576
2192
|
this.writeOPA();
|
|
1577
|
-
this.
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
this.writeString(resourceAsArticle.value);
|
|
2193
|
+
this.writeBreakscapedTagString(key);
|
|
2194
|
+
this.writeColon();
|
|
2195
|
+
this.writeBreakscapedTagString(src);
|
|
2196
|
+
if (resource.type === ResourceTag_1.ResourceTag.article) {
|
|
1582
2197
|
this.writeNL();
|
|
1583
2198
|
}
|
|
1584
|
-
else if (resource.value) {
|
|
1585
|
-
this.writeColon();
|
|
1586
|
-
this.writeString(resource.value);
|
|
1587
|
-
}
|
|
1588
2199
|
this.writeCL();
|
|
1589
2200
|
}
|
|
1590
2201
|
}
|
|
1591
|
-
writeResource(
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
if (resource) {
|
|
1595
|
-
// All resources should now be valid as they are validated in the AST
|
|
1596
|
-
// TODO: remove code below
|
|
1597
|
-
// // Check if a resource has a value, if not, we should not write it (or any of its chained properties)
|
|
1598
|
-
// let valid = false;
|
|
1599
|
-
// if (resource.value) {
|
|
1600
|
-
// valid = true;
|
|
1601
|
-
// }
|
|
1602
|
-
// // Resource is not valid, cancel walking it's tree.
|
|
1603
|
-
// if (!valid) return false;
|
|
2202
|
+
writeResource(type, value) {
|
|
2203
|
+
// const resourceAsArticle = resource as ArticleResource;
|
|
2204
|
+
if (type) {
|
|
1604
2205
|
// Standard case
|
|
1605
2206
|
this.writeOPAMP();
|
|
1606
|
-
this.
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
this.writeString(resourceAsArticle.value);
|
|
2207
|
+
this.writeBreakscapedTagString(type);
|
|
2208
|
+
this.writeColon();
|
|
2209
|
+
this.writeBreakscapedTagString(value);
|
|
2210
|
+
if (type === ResourceTag_1.ResourceTag.article) {
|
|
1611
2211
|
this.writeNL();
|
|
1612
2212
|
}
|
|
1613
|
-
else if (resource.value) {
|
|
1614
|
-
this.writeColon();
|
|
1615
|
-
this.writeString(resource.value);
|
|
1616
|
-
}
|
|
1617
2213
|
this.writeCL();
|
|
1618
2214
|
}
|
|
1619
2215
|
}
|
|
1620
|
-
writeProperty(name, values,
|
|
2216
|
+
writeProperty(name, values, options) {
|
|
2217
|
+
var _a;
|
|
1621
2218
|
let valuesArray;
|
|
1622
2219
|
let wroteSomething = false;
|
|
1623
2220
|
if (values !== undefined) {
|
|
1624
|
-
|
|
1625
|
-
|
|
2221
|
+
const isBitmarkText = options.format === PropertyFormat_1.PropertyFormat.bitmarkMinusMinus || options.format === PropertyFormat_1.PropertyFormat.bitmarkPlusPlus;
|
|
2222
|
+
if (isBitmarkText) {
|
|
2223
|
+
// Write bitmark text
|
|
2224
|
+
if (options.ignoreEmpty && isBitmarkText && this.isEmptyText(values))
|
|
2225
|
+
return;
|
|
2226
|
+
this.writeOPA();
|
|
2227
|
+
this.writeBreakscapedTagString(name);
|
|
2228
|
+
this.writeColon();
|
|
2229
|
+
this.textGenerator.generateSync(values, (_a = TextFormat_1.TextFormat.fromValue(options.format)) !== null && _a !== void 0 ? _a : TextFormat_1.TextFormat.bitmarkMinusMinus);
|
|
2230
|
+
this.writeCL();
|
|
2231
|
+
wroteSomething = true;
|
|
1626
2232
|
}
|
|
1627
2233
|
else {
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
if (
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
2234
|
+
// Write any other property type
|
|
2235
|
+
if (!Array.isArray(values)) {
|
|
2236
|
+
valuesArray = [values];
|
|
2237
|
+
}
|
|
2238
|
+
else {
|
|
2239
|
+
valuesArray = values;
|
|
2240
|
+
}
|
|
2241
|
+
if (valuesArray.length > 0) {
|
|
2242
|
+
if (options.single)
|
|
2243
|
+
valuesArray = valuesArray.slice(valuesArray.length - 1);
|
|
2244
|
+
let propertyIndex = 0;
|
|
2245
|
+
for (const val of valuesArray) {
|
|
2246
|
+
if (val !== undefined) {
|
|
2247
|
+
if (options.ignoreFalse && val === false)
|
|
2248
|
+
continue;
|
|
2249
|
+
if (options.ignoreTrue && val === true)
|
|
2250
|
+
continue;
|
|
2251
|
+
if (options.ignoreEmpty && val === '')
|
|
2252
|
+
continue;
|
|
2253
|
+
if (propertyIndex > 0)
|
|
2254
|
+
this.writeNL();
|
|
2255
|
+
this.writeOPA();
|
|
2256
|
+
this.writeBreakscapedTagString(name);
|
|
2257
|
+
this.writeColon();
|
|
2258
|
+
this.writeBreakscapedTagString(`${val}`);
|
|
2259
|
+
this.writeCL();
|
|
2260
|
+
wroteSomething = true;
|
|
2261
|
+
propertyIndex++;
|
|
2262
|
+
}
|
|
1649
2263
|
}
|
|
1650
2264
|
}
|
|
1651
|
-
}
|
|
2265
|
+
} // isBitmarkText
|
|
1652
2266
|
}
|
|
1653
2267
|
if (!wroteSomething) {
|
|
1654
2268
|
this.skipNLBetweenBitsValue = true;
|
|
@@ -1670,6 +2284,13 @@ class BitmarkGenerator extends AstWalkerGenerator_1.AstWalkerGenerator {
|
|
|
1670
2284
|
//
|
|
1671
2285
|
// Helper functions
|
|
1672
2286
|
//
|
|
2287
|
+
isEmptyText(text) {
|
|
2288
|
+
if (!text)
|
|
2289
|
+
return true;
|
|
2290
|
+
if (Array.isArray(text))
|
|
2291
|
+
return text.length === 0;
|
|
2292
|
+
return true; // true as not valid TextAst?
|
|
2293
|
+
}
|
|
1673
2294
|
isWriteTextFormat(bitsValue, textFormatDefault) {
|
|
1674
2295
|
const isDefault = TextFormat_1.TextFormat.fromValue(bitsValue) === textFormatDefault;
|
|
1675
2296
|
const writeFormat = !isDefault || this.options.explicitTextFormat;
|