@gmb/bitmark-parser-generator 5.1.0 → 5.2.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/browser/cjs/index.cjs +82 -6
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +21 -3
- package/dist/browser/esm/index.d.ts +21 -3
- package/dist/browser/esm/index.js +82 -6
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli/main.js +82 -6
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +82 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +82 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -594,6 +594,7 @@ var BitType = {
|
|
|
594
594
|
trueFalse: "true-false",
|
|
595
595
|
trueFalse1: "true-false-1",
|
|
596
596
|
vendorAmcharts5Chart: "vendor-amcharts-5-chart",
|
|
597
|
+
vendorDatadogDashboard: "vendor-datadog-dashboard",
|
|
597
598
|
vendorDatadogDashboardEmbed: "vendor-datadog-dashboard-embed",
|
|
598
599
|
vendorFormbricksEmbed: "vendor-formbricks-embed",
|
|
599
600
|
vendorFormbricksLink: "vendor-formbricks-link",
|
|
@@ -1198,6 +1199,7 @@ var propertyKeys = {
|
|
|
1198
1199
|
property_internalComment: "@internalComment",
|
|
1199
1200
|
property_internalPrintPdf: "@internalPrintPdf",
|
|
1200
1201
|
property_hasPrintRestriction: "@hasPrintRestriction",
|
|
1202
|
+
property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput",
|
|
1201
1203
|
property_isCaseSensitive: "@isCaseSensitive",
|
|
1202
1204
|
property_isInfoOnly: "@isInfoOnly",
|
|
1203
1205
|
property_isPublic: "@isPublic",
|
|
@@ -1224,6 +1226,7 @@ var propertyKeys = {
|
|
|
1224
1226
|
property_listItemIndent: "@listItemIndent",
|
|
1225
1227
|
property_location: "@location",
|
|
1226
1228
|
property_machineTranslated: "@machineTranslated",
|
|
1229
|
+
property_translationOf: "@translationOf",
|
|
1227
1230
|
property_spansPageBreak: "@spansPageBreak",
|
|
1228
1231
|
property_mailingList: "@mailingList",
|
|
1229
1232
|
property_mark: "@mark",
|
|
@@ -2702,6 +2705,11 @@ var GROUPS = {
|
|
|
2702
2705
|
description: "If true, the bit is machine-translated",
|
|
2703
2706
|
format: TagFormat.plainText
|
|
2704
2707
|
},
|
|
2708
|
+
{
|
|
2709
|
+
key: ConfigKey.property_translationOf,
|
|
2710
|
+
description: "Translation source reference",
|
|
2711
|
+
format: TagFormat.plainText
|
|
2712
|
+
},
|
|
2705
2713
|
{
|
|
2706
2714
|
key: ConfigKey.property_spansPageBreak,
|
|
2707
2715
|
description: "If true, the bit spans a page break",
|
|
@@ -3352,6 +3360,12 @@ var GROUPS = {
|
|
|
3352
3360
|
description: "If true, the book has print restrictions",
|
|
3353
3361
|
format: TagFormat.boolean,
|
|
3354
3362
|
defaultValue: "true"
|
|
3363
|
+
},
|
|
3364
|
+
{
|
|
3365
|
+
key: ConfigKey.property_enforceUpdateOverUserInput,
|
|
3366
|
+
description: "If true, prioritize new content over legacy content from the instance API",
|
|
3367
|
+
format: TagFormat.boolean,
|
|
3368
|
+
defaultValue: "false"
|
|
3355
3369
|
}
|
|
3356
3370
|
]
|
|
3357
3371
|
},
|
|
@@ -9540,6 +9554,11 @@ var BITS = {
|
|
|
9540
9554
|
description: "AmCharts 5 chart bit, used to embed AmCharts 5 charts in articles or books",
|
|
9541
9555
|
textFormatDefault: TextFormat.json
|
|
9542
9556
|
},
|
|
9557
|
+
[BitType.vendorDatadogDashboard]: {
|
|
9558
|
+
since: "5.2.0",
|
|
9559
|
+
baseBitType: BitType.nonProductionPrototypeIframe,
|
|
9560
|
+
description: "A Datadog dashboard bit, used to embed Datadog dashboards"
|
|
9561
|
+
},
|
|
9543
9562
|
[BitType.vendorDatadogDashboardEmbed]: {
|
|
9544
9563
|
since: "3.12.0",
|
|
9545
9564
|
baseBitType: BitType.code,
|
|
@@ -10169,7 +10188,7 @@ var instance2 = new Config();
|
|
|
10169
10188
|
// src/generated/package_info.ts
|
|
10170
10189
|
var PACKAGE_INFO = {
|
|
10171
10190
|
"name": "@gmb/bitmark-parser-generator",
|
|
10172
|
-
"version": "5.
|
|
10191
|
+
"version": "5.2.0",
|
|
10173
10192
|
"license": "ISC"};
|
|
10174
10193
|
var Environment = {
|
|
10175
10194
|
unknown: "",
|
|
@@ -10758,6 +10777,8 @@ var NodeType = {
|
|
|
10758
10777
|
internalPrintPdfValue: "internalPrintPdfValue",
|
|
10759
10778
|
hasPrintRestriction: "hasPrintRestriction",
|
|
10760
10779
|
hasPrintRestrictionValue: "hasPrintRestrictionValue",
|
|
10780
|
+
enforceUpdateOverUserInput: "enforceUpdateOverUserInput",
|
|
10781
|
+
enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue",
|
|
10761
10782
|
isCaseSensitive: "isCaseSensitive",
|
|
10762
10783
|
isCommented: "isCommented",
|
|
10763
10784
|
isCorrect: "isCorrect",
|
|
@@ -10824,6 +10845,8 @@ var NodeType = {
|
|
|
10824
10845
|
locationValue: "locationValue",
|
|
10825
10846
|
machineTranslated: "machineTranslated",
|
|
10826
10847
|
machineTranslatedValue: "machineTranslatedValue",
|
|
10848
|
+
translationOf: "translationOf",
|
|
10849
|
+
translationOfValue: "translationOfValue",
|
|
10827
10850
|
spansPageBreak: "spansPageBreak",
|
|
10828
10851
|
spansPageBreakValue: "spansPageBreakValue",
|
|
10829
10852
|
mailingList: "mailingList",
|
|
@@ -11919,10 +11942,11 @@ var Stage = {
|
|
|
11919
11942
|
between: "between",
|
|
11920
11943
|
exit: "exit"
|
|
11921
11944
|
};
|
|
11922
|
-
var TextGenerator = class extends AstWalkerGenerator {
|
|
11945
|
+
var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
|
|
11923
11946
|
ast = new Ast();
|
|
11924
11947
|
bitmarkVersion;
|
|
11925
11948
|
options;
|
|
11949
|
+
internalTextGenerator = null;
|
|
11926
11950
|
// State
|
|
11927
11951
|
generateOptions = {};
|
|
11928
11952
|
textFormat = TextFormat.bitmarkText;
|
|
@@ -11938,6 +11962,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
11938
11962
|
exitedCodeBlock = false;
|
|
11939
11963
|
inBulletList = false;
|
|
11940
11964
|
inInline = false;
|
|
11965
|
+
markDepth = 0;
|
|
11941
11966
|
textDepth = 0;
|
|
11942
11967
|
placeholderIndex = 0;
|
|
11943
11968
|
placeholders = {};
|
|
@@ -11968,6 +11993,13 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
11968
11993
|
this.between = this.between.bind(this);
|
|
11969
11994
|
this.exit = this.exit.bind(this);
|
|
11970
11995
|
this.leaf = this.leaf.bind(this);
|
|
11996
|
+
if (!this.options.isInternal) {
|
|
11997
|
+
this.internalTextGenerator = new _TextGenerator(bitmarkVersion, {
|
|
11998
|
+
...this.options,
|
|
11999
|
+
writeCallback: void 0,
|
|
12000
|
+
isInternal: true
|
|
12001
|
+
});
|
|
12002
|
+
}
|
|
11971
12003
|
}
|
|
11972
12004
|
/**
|
|
11973
12005
|
* Generate text from a bitmark text AST
|
|
@@ -12024,6 +12056,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12024
12056
|
this.exitedCodeBlock = false;
|
|
12025
12057
|
this.inBulletList = false;
|
|
12026
12058
|
this.inInline = false;
|
|
12059
|
+
this.markDepth = 0;
|
|
12027
12060
|
this.textDepth = 0;
|
|
12028
12061
|
this.placeholderIndex = 0;
|
|
12029
12062
|
this.placeholders = {};
|
|
@@ -12071,8 +12104,16 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12071
12104
|
exit_contentValueValue(node, route) {
|
|
12072
12105
|
return this.handleExitNode(node.value, route);
|
|
12073
12106
|
}
|
|
12107
|
+
// * -> marks
|
|
12108
|
+
enter_marks(_node, _route) {
|
|
12109
|
+
this.markDepth++;
|
|
12110
|
+
}
|
|
12111
|
+
exit_marks(_node, _route) {
|
|
12112
|
+
this.markDepth--;
|
|
12113
|
+
}
|
|
12074
12114
|
// END NODE HANDLERS
|
|
12075
12115
|
handleEnterNode(node, route) {
|
|
12116
|
+
if (this.markDepth > 0) return;
|
|
12076
12117
|
this.handleEnterNodePreTextCheck(node, route);
|
|
12077
12118
|
this.handleIndent(node);
|
|
12078
12119
|
switch (node.type) {
|
|
@@ -12083,7 +12124,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12083
12124
|
case TextNodeType.hardBreak:
|
|
12084
12125
|
this.writeHardBreak(node);
|
|
12085
12126
|
break;
|
|
12086
|
-
case TextNodeType.text:
|
|
12127
|
+
case TextNodeType.text: {
|
|
12087
12128
|
this.writeMarks(node, Stage.enter);
|
|
12088
12129
|
this.writeText(node);
|
|
12089
12130
|
this.writeMarks(node, Stage.between);
|
|
@@ -12092,6 +12133,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12092
12133
|
}
|
|
12093
12134
|
this.textDepth++;
|
|
12094
12135
|
break;
|
|
12136
|
+
}
|
|
12095
12137
|
case TextNodeType.heading:
|
|
12096
12138
|
this.writeHeading(node);
|
|
12097
12139
|
this.inHeading = true;
|
|
@@ -12140,6 +12182,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12140
12182
|
}
|
|
12141
12183
|
}
|
|
12142
12184
|
handleExitNode(node, _route) {
|
|
12185
|
+
if (this.markDepth > 0) return;
|
|
12143
12186
|
switch (node.type) {
|
|
12144
12187
|
case TextNodeType.text:
|
|
12145
12188
|
this.textDepth--;
|
|
@@ -12443,7 +12486,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12443
12486
|
*/
|
|
12444
12487
|
writeMarks(node, stage) {
|
|
12445
12488
|
if (node.marks) {
|
|
12446
|
-
const forceSingleMark = !!(this.inInline || this.inHeading);
|
|
12489
|
+
const forceSingleMark = this.generateOptions.forceInline || !!(this.inInline || this.inHeading);
|
|
12447
12490
|
this.thisNodeIsPreText = false;
|
|
12448
12491
|
const emptyMarks = node.marks.length === 0;
|
|
12449
12492
|
if (emptyMarks) {
|
|
@@ -12671,13 +12714,33 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12671
12714
|
s += `|provider:${provider}`;
|
|
12672
12715
|
this.write(s);
|
|
12673
12716
|
}
|
|
12674
|
-
writeFootnoteMark(
|
|
12717
|
+
writeFootnoteMark(mark) {
|
|
12675
12718
|
const s = `footnote:`;
|
|
12676
12719
|
this.write(s);
|
|
12720
|
+
const text = this.internalTextGenerator?.generateSync(
|
|
12721
|
+
mark.attrs?.content,
|
|
12722
|
+
this.textFormat,
|
|
12723
|
+
this.textLocation,
|
|
12724
|
+
{
|
|
12725
|
+
...this.generateOptions,
|
|
12726
|
+
forceInline: true
|
|
12727
|
+
}
|
|
12728
|
+
) ?? "";
|
|
12729
|
+
this.write(text);
|
|
12677
12730
|
}
|
|
12678
|
-
writeFootnoteStarMark(
|
|
12731
|
+
writeFootnoteStarMark(mark) {
|
|
12679
12732
|
const s = `footnote*:`;
|
|
12680
12733
|
this.write(s);
|
|
12734
|
+
const text = this.internalTextGenerator?.generateSync(
|
|
12735
|
+
mark.attrs?.content,
|
|
12736
|
+
this.textFormat,
|
|
12737
|
+
this.textLocation,
|
|
12738
|
+
{
|
|
12739
|
+
...this.generateOptions,
|
|
12740
|
+
forceInline: true
|
|
12741
|
+
}
|
|
12742
|
+
) ?? "";
|
|
12743
|
+
this.write(text);
|
|
12681
12744
|
}
|
|
12682
12745
|
writeSymbolMark(mark) {
|
|
12683
12746
|
if (mark.attrs == null) return;
|
|
@@ -23684,6 +23747,12 @@ var Builder = class extends BaseBuilder {
|
|
|
23684
23747
|
data.machineTranslated,
|
|
23685
23748
|
options
|
|
23686
23749
|
),
|
|
23750
|
+
translationOf: this.toAstProperty(
|
|
23751
|
+
bitType,
|
|
23752
|
+
ConfigKey.property_translationOf,
|
|
23753
|
+
data.translationOf,
|
|
23754
|
+
options
|
|
23755
|
+
),
|
|
23687
23756
|
spansPageBreak: this.toAstProperty(
|
|
23688
23757
|
bitType,
|
|
23689
23758
|
ConfigKey.property_spansPageBreak,
|
|
@@ -24400,6 +24469,12 @@ var Builder = class extends BaseBuilder {
|
|
|
24400
24469
|
data.hasPrintRestriction,
|
|
24401
24470
|
options
|
|
24402
24471
|
),
|
|
24472
|
+
enforceUpdateOverUserInput: this.toAstProperty(
|
|
24473
|
+
bitType,
|
|
24474
|
+
ConfigKey.property_enforceUpdateOverUserInput,
|
|
24475
|
+
data.enforceUpdateOverUserInput,
|
|
24476
|
+
options
|
|
24477
|
+
),
|
|
24403
24478
|
tocResource: this.toAstProperty(
|
|
24404
24479
|
bitType,
|
|
24405
24480
|
ConfigKey.property_tocResource,
|
|
@@ -30075,6 +30150,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
30075
30150
|
if (instance2.isOfBitType(bitType, BitType.book)) {
|
|
30076
30151
|
if (bitJson.maxTocChapterLevel == null) bitJson.maxTocChapterLevel = -1;
|
|
30077
30152
|
if (bitJson.hasPrintRestriction == null) bitJson.hasPrintRestriction = true;
|
|
30153
|
+
if (bitJson.enforceUpdateOverUserInput == null) bitJson.enforceUpdateOverUserInput = false;
|
|
30078
30154
|
if (bitJson.hasMarkAsDone == null) bitJson.hasMarkAsDone = false;
|
|
30079
30155
|
if (bitJson.processHandIn == null) bitJson.processHandIn = false;
|
|
30080
30156
|
if (bitJson.isPublic == null) bitJson.isPublic = false;
|