@gmb/bitmark-parser-generator 1.4.16 → 1.4.18
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 +2 -13
- package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
- package/dist/cjs/ast/Builder.js +8 -8
- package/dist/cjs/ast/Builder.js.map +1 -1
- package/dist/cjs/ast/rules/NodeValidator.js +6 -23
- package/dist/cjs/ast/rules/NodeValidator.js.map +1 -1
- package/dist/cjs/config/Config.js +57 -86
- package/dist/cjs/config/Config.js.map +1 -1
- package/dist/cjs/config/raw/bits.js +388 -450
- package/dist/cjs/config/raw/bits.js.map +1 -1
- package/dist/cjs/config/raw/properties.js +37 -0
- package/dist/cjs/config/raw/properties.js.map +1 -1
- package/dist/cjs/generated/build-info.js +1 -1
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js +9 -11
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +236 -208
- package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
- package/dist/cjs/index.js +2 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/info/InfoBuilder.js +10 -33
- package/dist/cjs/info/InfoBuilder.js.map +1 -1
- package/dist/cjs/model/ast/NodeType.js +16 -0
- package/dist/cjs/model/ast/NodeType.js.map +1 -1
- package/dist/cjs/model/config/BitConfig.js +8 -7
- package/dist/cjs/model/config/BitConfig.js.map +1 -1
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +7 -0
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/cjs/model/enum/BitType.js +86 -84
- package/dist/cjs/model/enum/BitType.js.map +1 -1
- package/dist/cjs/model/enum/PropertyAstKey.js +2 -0
- package/dist/cjs/model/enum/PropertyAstKey.js.map +1 -1
- package/dist/cjs/model/enum/PropertyTag.js +5 -0
- package/dist/cjs/model/enum/PropertyTag.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +14 -14
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +6 -6
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +11 -10
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +52 -47
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/{CommentTagContentProcessor.js → InternalCommentTagContentProcessor.js} +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +15 -17
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +14 -11
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/json/JsonParser.js +9 -9
- package/dist/cjs/parser/json/JsonParser.js.map +1 -1
- package/dist/cjs/utils/ObjectUtils.js +62 -0
- package/dist/cjs/utils/ObjectUtils.js.map +1 -1
- package/dist/esm/BitmarkParserGenerator.js +2 -13
- package/dist/esm/BitmarkParserGenerator.js.map +1 -1
- package/dist/esm/ast/Builder.js +9 -9
- package/dist/esm/ast/Builder.js.map +1 -1
- package/dist/esm/ast/rules/NodeValidator.js +6 -23
- package/dist/esm/ast/rules/NodeValidator.js.map +1 -1
- package/dist/esm/config/Config.js +57 -86
- package/dist/esm/config/Config.js.map +1 -1
- package/dist/esm/config/raw/bits.js +389 -451
- package/dist/esm/config/raw/bits.js.map +1 -1
- package/dist/esm/config/raw/properties.js +37 -0
- package/dist/esm/config/raw/properties.js.map +1 -1
- package/dist/esm/generated/build-info.js +1 -1
- package/dist/esm/generator/bitmark/BitmarkGenerator.js +10 -12
- package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +237 -209
- package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/info/InfoBuilder.js +11 -34
- package/dist/esm/info/InfoBuilder.js.map +1 -1
- package/dist/esm/model/ast/NodeType.js +16 -0
- package/dist/esm/model/ast/NodeType.js.map +1 -1
- package/dist/esm/model/config/BitConfig.js +8 -7
- package/dist/esm/model/config/BitConfig.js.map +1 -1
- package/dist/esm/model/config/enum/PropertyConfigKey.js +7 -0
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/esm/model/enum/BitType.js +85 -82
- package/dist/esm/model/enum/BitType.js.map +1 -1
- package/dist/esm/model/enum/PropertyAstKey.js +2 -0
- package/dist/esm/model/enum/PropertyAstKey.js.map +1 -1
- package/dist/esm/model/enum/PropertyTag.js +5 -0
- package/dist/esm/model/enum/PropertyTag.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +15 -15
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +6 -6
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +12 -11
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +53 -48
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/{CommentTagContentProcessor.js → InternalCommentTagContentProcessor.js} +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +16 -18
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +15 -12
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/json/JsonParser.js +10 -10
- package/dist/esm/parser/json/JsonParser.js.map +1 -1
- package/dist/esm/utils/ObjectUtils.js +59 -0
- package/dist/esm/utils/ObjectUtils.js.map +1 -1
- package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
- package/dist/types/ast/Builder.d.ts +9 -2
- package/dist/types/ast/Builder.d.ts.map +1 -1
- package/dist/types/ast/rules/NodeValidator.d.ts +0 -1
- package/dist/types/ast/rules/NodeValidator.d.ts.map +1 -1
- package/dist/types/config/Config.d.ts +16 -28
- package/dist/types/config/Config.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/generator/bitmark/BitmarkGenerator.d.ts +4 -4
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
- package/dist/types/generator/json/JsonGenerator.d.ts +22 -22
- package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
- package/dist/types/generator/text/TextGenerator.d.ts +2 -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/info/InfoBuilder.d.ts +3 -4
- package/dist/types/info/InfoBuilder.d.ts.map +1 -1
- package/dist/types/model/ast/NodeType.d.ts +32 -0
- package/dist/types/model/ast/NodeType.d.ts.map +1 -1
- package/dist/types/model/ast/Nodes.d.ts +9 -2
- package/dist/types/model/ast/Nodes.d.ts.map +1 -1
- package/dist/types/model/config/BitConfig.d.ts +5 -4
- package/dist/types/model/config/BitConfig.d.ts.map +1 -1
- package/dist/types/model/config/_Config.d.ts +3 -5
- package/dist/types/model/config/_Config.d.ts.map +1 -1
- package/dist/types/model/config/enum/ConfigKey.d.ts +14 -0
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +21 -0
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
- package/dist/types/model/enum/BitType.d.ts +171 -178
- package/dist/types/model/enum/BitType.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyAstKey.d.ts +4 -0
- package/dist/types/model/enum/PropertyAstKey.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyTag.d.ts +10 -0
- package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
- package/dist/types/model/json/BitJson.d.ts +5 -0
- package/dist/types/model/json/BitJson.d.ts.map +1 -1
- package/dist/types/model/json/ParserJson.d.ts +1 -1
- package/dist/types/model/json/ParserJson.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +6 -6
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +6 -6
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts +2 -2
- 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 +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts +5 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/InternalCommentTagContentProcessor.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/PartnerChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +3 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +3 -3
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
- package/dist/types/utils/ObjectUtils.d.ts +9 -0
- package/dist/types/utils/ObjectUtils.d.ts.map +1 -1
- package/package.json +3 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CommentTagContentProcessor.js.map +0 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CommentTagContentProcessor.js.map +0 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/CommentTagContentProcessor.d.ts +0 -5
- package/dist/types/parser/bitmark/peg/contentProcessors/CommentTagContentProcessor.d.ts.map +0 -1
|
@@ -221,7 +221,7 @@ class JsonGenerator {
|
|
|
221
221
|
if (isBoolean) {
|
|
222
222
|
// Boolean example
|
|
223
223
|
defaultExample = true;
|
|
224
|
-
if (bit.bitType
|
|
224
|
+
if (Config_1.Config.isOfBitType(bit.bitType, BitType_1.BitType.trueFalse1)) {
|
|
225
225
|
if (((_b = (_a = bit.cardNode) === null || _a === void 0 ? void 0 : _a.statement) === null || _b === void 0 ? void 0 : _b.isCorrect) !== undefined) {
|
|
226
226
|
defaultExample = bit.cardNode.statement.isCorrect;
|
|
227
227
|
}
|
|
@@ -339,7 +339,7 @@ class JsonGenerator {
|
|
|
339
339
|
return;
|
|
340
340
|
// Create the listItems / sections if not already created
|
|
341
341
|
let listItems;
|
|
342
|
-
if (bitType
|
|
342
|
+
if (bitType === BitType_1.BitType.pageFooter) {
|
|
343
343
|
if (!this.bitJson.sections)
|
|
344
344
|
this.bitJson.sections = [];
|
|
345
345
|
listItems = this.bitJson.sections;
|
|
@@ -946,13 +946,13 @@ class JsonGenerator {
|
|
|
946
946
|
excessResources.push(rJson);
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
// Extract comments from the AST and add to the parser
|
|
950
|
-
const
|
|
949
|
+
// Extract internal comments from the AST and add to the parser
|
|
950
|
+
const internalComments = Breakscape_1.Breakscape.unbreakscape(this.getInternalComments(route));
|
|
951
951
|
if ((parent === null || parent === void 0 ? void 0 : parent.key) === NodeType_1.NodeType.bitsValue) {
|
|
952
952
|
// Bit level parser information
|
|
953
953
|
this.bitWrapperJson.parser = Object.assign(Object.assign({ version,
|
|
954
954
|
bitmarkVersion,
|
|
955
|
-
|
|
955
|
+
internalComments }, parserRest), { warnings,
|
|
956
956
|
errors,
|
|
957
957
|
excessResources });
|
|
958
958
|
if (!this.options.enableWarnings) {
|
|
@@ -1689,9 +1689,9 @@ class JsonGenerator {
|
|
|
1689
1689
|
return zoomDisabled;
|
|
1690
1690
|
// The default value in the JSON is hardcoded, because there is currently no good way to set a different
|
|
1691
1691
|
// default per bit in the BitConfig.
|
|
1692
|
-
switch (bitType
|
|
1693
|
-
case BitType_1.
|
|
1694
|
-
case BitType_1.
|
|
1692
|
+
switch (bitType) {
|
|
1693
|
+
case BitType_1.BitType.imageSeparator:
|
|
1694
|
+
case BitType_1.BitType.pageBanner:
|
|
1695
1695
|
return true;
|
|
1696
1696
|
}
|
|
1697
1697
|
return false;
|
|
@@ -1854,7 +1854,7 @@ class JsonGenerator {
|
|
|
1854
1854
|
*/
|
|
1855
1855
|
createBitJson(bit) {
|
|
1856
1856
|
const bitJson = {
|
|
1857
|
-
type: bit.bitType
|
|
1857
|
+
type: bit.bitType,
|
|
1858
1858
|
format: bit.textFormat,
|
|
1859
1859
|
// Properties
|
|
1860
1860
|
id: undefined,
|
|
@@ -1892,6 +1892,8 @@ class JsonGenerator {
|
|
|
1892
1892
|
thumbImage: undefined,
|
|
1893
1893
|
focusX: undefined,
|
|
1894
1894
|
focusY: undefined,
|
|
1895
|
+
pointerLeft: undefined,
|
|
1896
|
+
pointerTop: undefined,
|
|
1895
1897
|
deeplink: undefined,
|
|
1896
1898
|
externalLink: undefined,
|
|
1897
1899
|
externalLinkText: undefined,
|
|
@@ -1910,6 +1912,9 @@ class JsonGenerator {
|
|
|
1910
1912
|
resolvedDate: undefined,
|
|
1911
1913
|
resolvedBy: undefined,
|
|
1912
1914
|
maxCreatedBits: undefined,
|
|
1915
|
+
product: undefined,
|
|
1916
|
+
productVideo: undefined,
|
|
1917
|
+
productFolder: undefined,
|
|
1913
1918
|
// Book data
|
|
1914
1919
|
title: undefined,
|
|
1915
1920
|
subtitle: undefined,
|
|
@@ -1988,207 +1993,224 @@ class JsonGenerator {
|
|
|
1988
1993
|
// NOTE: Not all bits have the same default properties.
|
|
1989
1994
|
// The properties used are a bit random sometimes?
|
|
1990
1995
|
// It would be better if this functionality was generated from the bit config
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
// Special case for 'ai' bits
|
|
2014
|
-
if (bitType.alias === BitType_1.AliasBitType.articleAi ||
|
|
2015
|
-
bitType.alias === BitType_1.AliasBitType.noteAi ||
|
|
2016
|
-
bitType.alias === BitType_1.AliasBitType.summaryAi) {
|
|
2017
|
-
if (bitJson.AIGenerated == null)
|
|
2018
|
-
bitJson.AIGenerated = true;
|
|
2019
|
-
}
|
|
2020
|
-
// Special case for 'review-...' bits
|
|
2021
|
-
if (bitType.root === BitType_1.RootBitType.reviewNote) {
|
|
2022
|
-
if (bitJson.resolved == null)
|
|
2023
|
-
bitJson.resolved = false;
|
|
2024
|
-
if (bitJson.resolvedDate == null)
|
|
2025
|
-
bitJson.resolvedDate = '';
|
|
2026
|
-
if (bitJson.resolvedBy == null)
|
|
2027
|
-
bitJson.resolvedBy = '';
|
|
2028
|
-
}
|
|
2029
|
-
break;
|
|
1996
|
+
if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType._error, BitType_1.BitType._comment])) {
|
|
1997
|
+
//
|
|
1998
|
+
delete bitJson.format;
|
|
1999
|
+
//
|
|
2000
|
+
}
|
|
2001
|
+
else if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType.article, BitType_1.BitType.sampleSolution, BitType_1.BitType.page])) {
|
|
2002
|
+
//
|
|
2003
|
+
if (bitJson.body == null)
|
|
2004
|
+
bitJson.body = this.bodyDefault;
|
|
2005
|
+
//
|
|
2006
|
+
}
|
|
2007
|
+
else if (Config_1.Config.isOfBitType(bitType, [
|
|
2008
|
+
BitType_1.BitType.cloze,
|
|
2009
|
+
BitType_1.BitType.multipleChoice1,
|
|
2010
|
+
BitType_1.BitType.multipleResponse1,
|
|
2011
|
+
BitType_1.BitType.multipleChoiceText,
|
|
2012
|
+
BitType_1.BitType.highlightText,
|
|
2013
|
+
BitType_1.BitType.clozeAndMultipleChoiceText,
|
|
2014
|
+
BitType_1.BitType.sequence,
|
|
2015
|
+
BitType_1.BitType.mark,
|
|
2016
|
+
BitType_1.BitType.flashcard,
|
|
2017
|
+
])) {
|
|
2030
2018
|
// Default, but with no 'example' at the bit level.
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
if (bitJson.instruction == null)
|
|
2045
|
-
bitJson.instruction = this.textDefault;
|
|
2046
|
-
if (bitJson.isExample == null)
|
|
2047
|
-
bitJson.isExample = false;
|
|
2048
|
-
if (bitJson.body == null)
|
|
2049
|
-
bitJson.body = this.bodyDefault;
|
|
2050
|
-
break;
|
|
2019
|
+
if (bitJson.item == null)
|
|
2020
|
+
bitJson.item = this.textDefault;
|
|
2021
|
+
if (bitJson.hint == null)
|
|
2022
|
+
bitJson.hint = this.textDefault;
|
|
2023
|
+
if (bitJson.instruction == null)
|
|
2024
|
+
bitJson.instruction = this.textDefault;
|
|
2025
|
+
if (bitJson.isExample == null)
|
|
2026
|
+
bitJson.isExample = false;
|
|
2027
|
+
if (bitJson.body == null)
|
|
2028
|
+
bitJson.body = this.bodyDefault;
|
|
2029
|
+
//
|
|
2030
|
+
}
|
|
2031
|
+
else if (Config_1.Config.isOfBitType(bitType, [BitType_1.BitType.multipleChoice, BitType_1.BitType.multipleResponse])) {
|
|
2051
2032
|
// Default with a card (and hence a footer possibility)
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2033
|
+
if (bitJson.item == null)
|
|
2034
|
+
bitJson.item = this.textDefault;
|
|
2035
|
+
if (bitJson.hint == null)
|
|
2036
|
+
bitJson.hint = this.textDefault;
|
|
2037
|
+
if (bitJson.instruction == null)
|
|
2038
|
+
bitJson.instruction = this.textDefault;
|
|
2039
|
+
if (bitJson.isExample == null)
|
|
2040
|
+
bitJson.isExample = false;
|
|
2041
|
+
if (bitJson.body == null)
|
|
2042
|
+
bitJson.body = this.bodyDefault;
|
|
2043
|
+
if (bitJson.footer == null)
|
|
2044
|
+
bitJson.footer = this.textDefault;
|
|
2045
|
+
//
|
|
2046
|
+
}
|
|
2047
|
+
else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.essay)) {
|
|
2048
|
+
//
|
|
2049
|
+
if (bitJson.item == null)
|
|
2050
|
+
bitJson.item = this.textDefault;
|
|
2051
|
+
if (bitJson.hint == null)
|
|
2052
|
+
bitJson.hint = this.textDefault;
|
|
2053
|
+
if (bitJson.instruction == null)
|
|
2054
|
+
bitJson.instruction = this.textDefault;
|
|
2055
|
+
if (bitJson.isExample == null)
|
|
2056
|
+
bitJson.isExample = false;
|
|
2057
|
+
if (bitJson.example == null)
|
|
2058
|
+
bitJson.example = null;
|
|
2059
|
+
if (bitJson.body == null)
|
|
2060
|
+
bitJson.body = this.bodyDefault;
|
|
2061
|
+
if (bitJson.partialAnswer == null)
|
|
2062
|
+
bitJson.partialAnswer = '';
|
|
2063
|
+
// if (bitJson.sampleSolution == null) bitJson.sampleSolution = '';
|
|
2064
|
+
//
|
|
2065
|
+
}
|
|
2066
|
+
else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.trueFalse1)) {
|
|
2067
|
+
//
|
|
2068
|
+
if (bitJson.item == null)
|
|
2069
|
+
bitJson.item = this.textDefault;
|
|
2070
|
+
if (bitJson.lead == null)
|
|
2071
|
+
bitJson.lead = this.textDefault;
|
|
2072
|
+
if (bitJson.hint == null)
|
|
2073
|
+
bitJson.hint = this.textDefault;
|
|
2074
|
+
if (bitJson.instruction == null)
|
|
2075
|
+
bitJson.instruction = this.textDefault;
|
|
2076
|
+
if (bitJson.isExample == null)
|
|
2077
|
+
bitJson.isExample = false;
|
|
2078
|
+
if (bitJson.example == null)
|
|
2079
|
+
bitJson.example = null;
|
|
2080
|
+
if (bitJson.isCorrect == null)
|
|
2081
|
+
bitJson.isCorrect = false;
|
|
2082
|
+
if (bitJson.body == null)
|
|
2083
|
+
bitJson.body = this.bodyDefault;
|
|
2084
|
+
//
|
|
2085
|
+
}
|
|
2086
|
+
else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.trueFalse)) {
|
|
2087
|
+
//
|
|
2088
|
+
if (bitJson.item == null)
|
|
2089
|
+
bitJson.item = this.textDefault;
|
|
2090
|
+
if (bitJson.lead == null)
|
|
2091
|
+
bitJson.lead = this.textDefault;
|
|
2092
|
+
if (bitJson.hint == null)
|
|
2093
|
+
bitJson.hint = this.textDefault;
|
|
2094
|
+
if (bitJson.instruction == null)
|
|
2095
|
+
bitJson.instruction = this.textDefault;
|
|
2096
|
+
if (bitJson.isExample == null)
|
|
2097
|
+
bitJson.isExample = false;
|
|
2098
|
+
if (bitJson.labelFalse == null)
|
|
2099
|
+
bitJson.labelFalse = '';
|
|
2100
|
+
if (bitJson.labelTrue == null)
|
|
2101
|
+
bitJson.labelTrue = '';
|
|
2102
|
+
if (bitJson.body == null)
|
|
2103
|
+
bitJson.body = this.bodyDefault;
|
|
2104
|
+
//
|
|
2105
|
+
}
|
|
2106
|
+
else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.chapter)) {
|
|
2107
|
+
//
|
|
2108
|
+
if (bitJson.item == null)
|
|
2109
|
+
bitJson.item = this.textDefault;
|
|
2110
|
+
if (bitJson.hint == null)
|
|
2111
|
+
bitJson.hint = this.textDefault;
|
|
2112
|
+
if (bitJson.isExample == null)
|
|
2113
|
+
bitJson.isExample = false;
|
|
2114
|
+
if (bitJson.example == null)
|
|
2115
|
+
bitJson.example = null;
|
|
2116
|
+
if (bitJson.toc == null)
|
|
2117
|
+
bitJson.toc = true; // Always set on chapter bits?
|
|
2118
|
+
if (bitJson.progress == null)
|
|
2119
|
+
bitJson.progress = true; // Always set on chapter bits
|
|
2120
|
+
if (bitJson.level == null)
|
|
2121
|
+
bitJson.level = 1; // Set level 1 if none set (makes no sense, but in ANTLR parser)
|
|
2122
|
+
if (bitJson.body == null)
|
|
2123
|
+
bitJson.body = this.bodyDefault;
|
|
2124
|
+
//
|
|
2125
|
+
}
|
|
2126
|
+
else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.interview)) {
|
|
2127
|
+
//
|
|
2128
|
+
if (bitJson.item == null)
|
|
2129
|
+
bitJson.item = this.textDefault;
|
|
2130
|
+
if (bitJson.hint == null)
|
|
2131
|
+
bitJson.hint = this.textDefault;
|
|
2132
|
+
if (bitJson.instruction == null)
|
|
2133
|
+
bitJson.instruction = this.textDefault;
|
|
2134
|
+
if (bitJson.isExample == null)
|
|
2135
|
+
bitJson.isExample = false;
|
|
2136
|
+
if (bitJson.body == null)
|
|
2137
|
+
bitJson.body = this.bodyDefault;
|
|
2138
|
+
if (bitJson.footer == null)
|
|
2139
|
+
bitJson.footer = this.textDefault;
|
|
2140
|
+
if (bitJson.questions == null)
|
|
2141
|
+
bitJson.questions = [];
|
|
2142
|
+
//
|
|
2143
|
+
}
|
|
2144
|
+
else if (bitType === BitType_1.BitType.matchMatrix) {
|
|
2145
|
+
//
|
|
2146
|
+
if (bitJson.item == null)
|
|
2147
|
+
bitJson.item = this.textDefault;
|
|
2148
|
+
if (bitJson.body == null)
|
|
2149
|
+
bitJson.body = this.bodyDefault;
|
|
2150
|
+
//
|
|
2151
|
+
}
|
|
2152
|
+
else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.match)) {
|
|
2153
|
+
//
|
|
2154
|
+
if (bitJson.item == null)
|
|
2155
|
+
bitJson.item = this.textDefault;
|
|
2156
|
+
if (bitJson.heading == null)
|
|
2157
|
+
bitJson.heading = {};
|
|
2158
|
+
if (bitJson.body == null)
|
|
2159
|
+
bitJson.body = this.bodyDefault;
|
|
2160
|
+
//
|
|
2161
|
+
}
|
|
2162
|
+
else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.learningPathBook)) {
|
|
2163
|
+
//
|
|
2164
|
+
if (bitJson.item == null)
|
|
2165
|
+
bitJson.item = this.textDefault;
|
|
2166
|
+
if (bitJson.hint == null)
|
|
2167
|
+
bitJson.hint = this.textDefault;
|
|
2168
|
+
if (bitJson.isExample == null)
|
|
2169
|
+
bitJson.isExample = false;
|
|
2170
|
+
if (bitJson.example == null)
|
|
2171
|
+
bitJson.example = null;
|
|
2172
|
+
if (bitJson.isTracked == null)
|
|
2173
|
+
bitJson.isTracked = true;
|
|
2174
|
+
if (bitJson.isInfoOnly == null)
|
|
2175
|
+
bitJson.isInfoOnly = false;
|
|
2176
|
+
if (bitJson.body == null)
|
|
2177
|
+
bitJson.body = this.bodyDefault;
|
|
2178
|
+
//
|
|
2179
|
+
}
|
|
2180
|
+
else if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.pageBuyButton)) {
|
|
2181
|
+
//
|
|
2182
|
+
if (bitJson.content2Buy == null)
|
|
2183
|
+
bitJson.content2Buy = '';
|
|
2184
|
+
if (bitJson.body == null)
|
|
2185
|
+
bitJson.body = this.bodyDefault;
|
|
2186
|
+
//
|
|
2187
|
+
}
|
|
2188
|
+
else {
|
|
2189
|
+
// Most bits have these defaults, but there are special cases (not sure if that is by error or design)
|
|
2190
|
+
if (bitJson.item == null)
|
|
2191
|
+
bitJson.item = this.textDefault;
|
|
2192
|
+
if (bitJson.hint == null)
|
|
2193
|
+
bitJson.hint = this.textDefault;
|
|
2194
|
+
if (bitJson.isExample == null)
|
|
2195
|
+
bitJson.isExample = false;
|
|
2196
|
+
if (bitJson.example == null)
|
|
2197
|
+
bitJson.example = null;
|
|
2198
|
+
if (bitJson.body == null)
|
|
2199
|
+
bitJson.body = this.bodyDefault;
|
|
2200
|
+
// Special case for 'ai' bits
|
|
2201
|
+
if (bitType === BitType_1.BitType.articleAi || bitType === BitType_1.BitType.noteAi || bitType === BitType_1.BitType.summaryAi) {
|
|
2202
|
+
if (bitJson.AIGenerated == null)
|
|
2203
|
+
bitJson.AIGenerated = true;
|
|
2204
|
+
}
|
|
2205
|
+
// Special case for 'review-...' bits
|
|
2206
|
+
if (Config_1.Config.isOfBitType(bitType, BitType_1.BitType.reviewNote)) {
|
|
2207
|
+
if (bitJson.resolved == null)
|
|
2208
|
+
bitJson.resolved = false;
|
|
2209
|
+
if (bitJson.resolvedDate == null)
|
|
2210
|
+
bitJson.resolvedDate = '';
|
|
2211
|
+
if (bitJson.resolvedBy == null)
|
|
2212
|
+
bitJson.resolvedBy = '';
|
|
2213
|
+
}
|
|
2192
2214
|
}
|
|
2193
2215
|
// Remove unwanted properties
|
|
2194
2216
|
// Properties
|
|
@@ -2292,6 +2314,12 @@ class JsonGenerator {
|
|
|
2292
2314
|
delete bitJson.resolvedBy;
|
|
2293
2315
|
if (bitJson.maxCreatedBits == null)
|
|
2294
2316
|
delete bitJson.maxCreatedBits;
|
|
2317
|
+
if (bitJson.product == null)
|
|
2318
|
+
delete bitJson.product;
|
|
2319
|
+
if (bitJson.productVideo == null)
|
|
2320
|
+
delete bitJson.productVideo;
|
|
2321
|
+
if (bitJson.productFolder == null)
|
|
2322
|
+
delete bitJson.productFolder;
|
|
2295
2323
|
// Book data
|
|
2296
2324
|
if (bitJson.title == null)
|
|
2297
2325
|
delete bitJson.title;
|