@gmb/bitmark-parser-generator 5.27.0 → 5.29.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 +178 -9
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +37 -1
- package/dist/browser/esm/index.d.ts +37 -1
- package/dist/browser/esm/index.js +178 -9
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli/main.js +183 -11
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +178 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -1
- package/dist/index.d.ts +37 -1
- package/dist/index.js +178 -9
- package/dist/index.js.map +1 -1
- package/package.json +19 -19
|
@@ -789,6 +789,7 @@ declare const ConfigKey: {
|
|
|
789
789
|
readonly property_bubbleTag: "@bubbleTag";
|
|
790
790
|
readonly property_extractorTag: "@extractorTag";
|
|
791
791
|
readonly property_extractorInternal: "@extractorInternal";
|
|
792
|
+
readonly property_bitFingerprint: "@bitFingerprint";
|
|
792
793
|
readonly property_buttonCaption: "@buttonCaption";
|
|
793
794
|
readonly property_callToActionUrl: "@callToActionUrl";
|
|
794
795
|
readonly property_caption: "@caption";
|
|
@@ -850,6 +851,8 @@ declare const ConfigKey: {
|
|
|
850
851
|
readonly property_externalLinkText: "@externalLinkText";
|
|
851
852
|
readonly property_feedbackEngine: "@feedbackEngine";
|
|
852
853
|
readonly property_feedbackType: "@feedbackType";
|
|
854
|
+
readonly property_userFeedbackTranslationUrl: "@userFeedbackTranslationUrl";
|
|
855
|
+
readonly property_userFeedbackContentUrl: "@userFeedbackContentUrl";
|
|
853
856
|
readonly property_flashcardSet: "@flashcardSet";
|
|
854
857
|
readonly property_focusX: "@focusX";
|
|
855
858
|
readonly property_focusY: "@focusY";
|
|
@@ -1742,6 +1745,7 @@ interface BitJson {
|
|
|
1742
1745
|
extractorTag: string | string[];
|
|
1743
1746
|
extractorInternal: string | string[];
|
|
1744
1747
|
sourceBB?: number[] | number[][];
|
|
1748
|
+
bitFingerprint: string | string[];
|
|
1745
1749
|
levelCEFRp: string;
|
|
1746
1750
|
levelCEFR: string;
|
|
1747
1751
|
levelILR: string;
|
|
@@ -1760,6 +1764,8 @@ interface BitJson {
|
|
|
1760
1764
|
publisherName: string;
|
|
1761
1765
|
publications: string | string[];
|
|
1762
1766
|
relatedBook: string | string[];
|
|
1767
|
+
userFeedbackTranslationUrl: string;
|
|
1768
|
+
userFeedbackContentUrl: string;
|
|
1763
1769
|
author: string | string[];
|
|
1764
1770
|
subject: string | string[];
|
|
1765
1771
|
date: string;
|
|
@@ -2364,6 +2370,7 @@ interface Bit {
|
|
|
2364
2370
|
extractorTag?: Property;
|
|
2365
2371
|
extractorInternal?: Property;
|
|
2366
2372
|
sourceBB?: number[][];
|
|
2373
|
+
bitFingerprint?: Property;
|
|
2367
2374
|
levelCEFRp?: Property;
|
|
2368
2375
|
levelCEFR?: Property;
|
|
2369
2376
|
levelILR?: Property;
|
|
@@ -2381,6 +2388,8 @@ interface Bit {
|
|
|
2381
2388
|
publications?: Property;
|
|
2382
2389
|
relatedBook?: Property;
|
|
2383
2390
|
translationOfBook?: Property;
|
|
2391
|
+
userFeedbackTranslationUrl?: Property;
|
|
2392
|
+
userFeedbackContentUrl?: Property;
|
|
2384
2393
|
author?: Property;
|
|
2385
2394
|
subject?: Property;
|
|
2386
2395
|
date?: Property;
|
|
@@ -2710,6 +2719,8 @@ declare const NodeType: {
|
|
|
2710
2719
|
readonly bits: "bits";
|
|
2711
2720
|
readonly bitsValue: "bitsValue";
|
|
2712
2721
|
readonly bitType: "bitType";
|
|
2722
|
+
readonly bitFingerprint: "bitFingerprint";
|
|
2723
|
+
readonly bitFingerprintValue: "bitFingerprintValue";
|
|
2713
2724
|
readonly blockId: "blockId";
|
|
2714
2725
|
readonly blockIdValue: "blockIdValue";
|
|
2715
2726
|
readonly body: "body";
|
|
@@ -3186,6 +3197,10 @@ declare const NodeType: {
|
|
|
3186
3197
|
readonly relatedBookValue: "relatedBookValue";
|
|
3187
3198
|
readonly translationOfBook: "translationOfBook";
|
|
3188
3199
|
readonly translationOfBookValue: "translationOfBookValue";
|
|
3200
|
+
readonly userFeedbackTranslationUrl: "userFeedbackTranslationUrl";
|
|
3201
|
+
readonly userFeedbackTranslationUrlValue: "userFeedbackTranslationUrlValue";
|
|
3202
|
+
readonly userFeedbackContentUrl: "userFeedbackContentUrl";
|
|
3203
|
+
readonly userFeedbackContentUrlValue: "userFeedbackContentUrlValue";
|
|
3189
3204
|
readonly releaseDate: "releaseDate";
|
|
3190
3205
|
readonly releaseDateValue: "releaseDateValue";
|
|
3191
3206
|
readonly releaseKind: "releaseKind";
|
|
@@ -4336,6 +4351,7 @@ declare class Builder extends BaseBuilder {
|
|
|
4336
4351
|
extractorTag?: string | string[];
|
|
4337
4352
|
extractorInternal?: string | string[];
|
|
4338
4353
|
sourceBB?: number[] | number[][];
|
|
4354
|
+
bitFingerprint?: string | string[];
|
|
4339
4355
|
levelCEFRp?: string | string[];
|
|
4340
4356
|
levelCEFR?: string | string[];
|
|
4341
4357
|
levelILR?: string | string[];
|
|
@@ -4353,6 +4369,8 @@ declare class Builder extends BaseBuilder {
|
|
|
4353
4369
|
publications?: string | string[];
|
|
4354
4370
|
relatedBook?: string | string[];
|
|
4355
4371
|
translationOfBook?: string;
|
|
4372
|
+
userFeedbackTranslationUrl?: string;
|
|
4373
|
+
userFeedbackContentUrl?: string;
|
|
4356
4374
|
author?: string | string[];
|
|
4357
4375
|
subject?: string | string[];
|
|
4358
4376
|
date?: string;
|
|
@@ -5595,6 +5613,10 @@ interface BitmarkOptions {
|
|
|
5595
5613
|
* Generate debug information in the output.
|
|
5596
5614
|
*/
|
|
5597
5615
|
debugGenerationInline?: boolean;
|
|
5616
|
+
/**
|
|
5617
|
+
* Generate table cell content without breakscaping text.
|
|
5618
|
+
*/
|
|
5619
|
+
noBreakscaping?: boolean;
|
|
5598
5620
|
}
|
|
5599
5621
|
/**
|
|
5600
5622
|
* Bitmark generator options
|
|
@@ -6124,7 +6146,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
|
|
|
6124
6146
|
protected enter_caption(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6125
6147
|
protected enter_width(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6126
6148
|
protected enter_height(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6127
|
-
protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]):
|
|
6149
|
+
protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]): boolean;
|
|
6128
6150
|
protected enter_cardBitsValue(node: NodeInfo, route: NodeInfo[]): void;
|
|
6129
6151
|
protected exit_cardBitsValue(_node: NodeInfo, _route: NodeInfo[]): void;
|
|
6130
6152
|
protected enter_body(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
@@ -6489,6 +6511,12 @@ declare class HtmlTableParser {
|
|
|
6489
6511
|
private listItemNode;
|
|
6490
6512
|
private taskItemNode;
|
|
6491
6513
|
private imageNode;
|
|
6514
|
+
private isMathTag;
|
|
6515
|
+
private latexNode;
|
|
6516
|
+
private latexFromMath;
|
|
6517
|
+
private findLatexAnnotation;
|
|
6518
|
+
private textContent;
|
|
6519
|
+
private localName;
|
|
6492
6520
|
/** Trim leading/trailing whitespace from inline content (edges only). */
|
|
6493
6521
|
private trimInline;
|
|
6494
6522
|
}
|
|
@@ -6754,6 +6782,11 @@ interface ConvertHtmlTableOptions {
|
|
|
6754
6782
|
* Keep unmappable HTML tags as literal text instead of unwrapping them (HTML -> bits only).
|
|
6755
6783
|
*/
|
|
6756
6784
|
keepUnknownTags?: boolean;
|
|
6785
|
+
/**
|
|
6786
|
+
* Disable breakscaping when generating bitmark table cell content from HTML.
|
|
6787
|
+
* Useful when cells already contain raw bitmark that should pass through untouched.
|
|
6788
|
+
*/
|
|
6789
|
+
noBreakscaping?: boolean;
|
|
6757
6790
|
/**
|
|
6758
6791
|
* Specify a file to write the output to
|
|
6759
6792
|
*/
|
|
@@ -7342,6 +7375,9 @@ declare class HtmlTableGenerator {
|
|
|
7342
7375
|
private listTag;
|
|
7343
7376
|
private listItemToHtml;
|
|
7344
7377
|
private imageToHtml;
|
|
7378
|
+
private textToHtml;
|
|
7379
|
+
private inlineImageTokenToHtml;
|
|
7380
|
+
private latexToHtml;
|
|
7345
7381
|
private escapeText;
|
|
7346
7382
|
private escapeAttr;
|
|
7347
7383
|
}
|
|
@@ -789,6 +789,7 @@ declare const ConfigKey: {
|
|
|
789
789
|
readonly property_bubbleTag: "@bubbleTag";
|
|
790
790
|
readonly property_extractorTag: "@extractorTag";
|
|
791
791
|
readonly property_extractorInternal: "@extractorInternal";
|
|
792
|
+
readonly property_bitFingerprint: "@bitFingerprint";
|
|
792
793
|
readonly property_buttonCaption: "@buttonCaption";
|
|
793
794
|
readonly property_callToActionUrl: "@callToActionUrl";
|
|
794
795
|
readonly property_caption: "@caption";
|
|
@@ -850,6 +851,8 @@ declare const ConfigKey: {
|
|
|
850
851
|
readonly property_externalLinkText: "@externalLinkText";
|
|
851
852
|
readonly property_feedbackEngine: "@feedbackEngine";
|
|
852
853
|
readonly property_feedbackType: "@feedbackType";
|
|
854
|
+
readonly property_userFeedbackTranslationUrl: "@userFeedbackTranslationUrl";
|
|
855
|
+
readonly property_userFeedbackContentUrl: "@userFeedbackContentUrl";
|
|
853
856
|
readonly property_flashcardSet: "@flashcardSet";
|
|
854
857
|
readonly property_focusX: "@focusX";
|
|
855
858
|
readonly property_focusY: "@focusY";
|
|
@@ -1742,6 +1745,7 @@ interface BitJson {
|
|
|
1742
1745
|
extractorTag: string | string[];
|
|
1743
1746
|
extractorInternal: string | string[];
|
|
1744
1747
|
sourceBB?: number[] | number[][];
|
|
1748
|
+
bitFingerprint: string | string[];
|
|
1745
1749
|
levelCEFRp: string;
|
|
1746
1750
|
levelCEFR: string;
|
|
1747
1751
|
levelILR: string;
|
|
@@ -1760,6 +1764,8 @@ interface BitJson {
|
|
|
1760
1764
|
publisherName: string;
|
|
1761
1765
|
publications: string | string[];
|
|
1762
1766
|
relatedBook: string | string[];
|
|
1767
|
+
userFeedbackTranslationUrl: string;
|
|
1768
|
+
userFeedbackContentUrl: string;
|
|
1763
1769
|
author: string | string[];
|
|
1764
1770
|
subject: string | string[];
|
|
1765
1771
|
date: string;
|
|
@@ -2364,6 +2370,7 @@ interface Bit {
|
|
|
2364
2370
|
extractorTag?: Property;
|
|
2365
2371
|
extractorInternal?: Property;
|
|
2366
2372
|
sourceBB?: number[][];
|
|
2373
|
+
bitFingerprint?: Property;
|
|
2367
2374
|
levelCEFRp?: Property;
|
|
2368
2375
|
levelCEFR?: Property;
|
|
2369
2376
|
levelILR?: Property;
|
|
@@ -2381,6 +2388,8 @@ interface Bit {
|
|
|
2381
2388
|
publications?: Property;
|
|
2382
2389
|
relatedBook?: Property;
|
|
2383
2390
|
translationOfBook?: Property;
|
|
2391
|
+
userFeedbackTranslationUrl?: Property;
|
|
2392
|
+
userFeedbackContentUrl?: Property;
|
|
2384
2393
|
author?: Property;
|
|
2385
2394
|
subject?: Property;
|
|
2386
2395
|
date?: Property;
|
|
@@ -2710,6 +2719,8 @@ declare const NodeType: {
|
|
|
2710
2719
|
readonly bits: "bits";
|
|
2711
2720
|
readonly bitsValue: "bitsValue";
|
|
2712
2721
|
readonly bitType: "bitType";
|
|
2722
|
+
readonly bitFingerprint: "bitFingerprint";
|
|
2723
|
+
readonly bitFingerprintValue: "bitFingerprintValue";
|
|
2713
2724
|
readonly blockId: "blockId";
|
|
2714
2725
|
readonly blockIdValue: "blockIdValue";
|
|
2715
2726
|
readonly body: "body";
|
|
@@ -3186,6 +3197,10 @@ declare const NodeType: {
|
|
|
3186
3197
|
readonly relatedBookValue: "relatedBookValue";
|
|
3187
3198
|
readonly translationOfBook: "translationOfBook";
|
|
3188
3199
|
readonly translationOfBookValue: "translationOfBookValue";
|
|
3200
|
+
readonly userFeedbackTranslationUrl: "userFeedbackTranslationUrl";
|
|
3201
|
+
readonly userFeedbackTranslationUrlValue: "userFeedbackTranslationUrlValue";
|
|
3202
|
+
readonly userFeedbackContentUrl: "userFeedbackContentUrl";
|
|
3203
|
+
readonly userFeedbackContentUrlValue: "userFeedbackContentUrlValue";
|
|
3189
3204
|
readonly releaseDate: "releaseDate";
|
|
3190
3205
|
readonly releaseDateValue: "releaseDateValue";
|
|
3191
3206
|
readonly releaseKind: "releaseKind";
|
|
@@ -4336,6 +4351,7 @@ declare class Builder extends BaseBuilder {
|
|
|
4336
4351
|
extractorTag?: string | string[];
|
|
4337
4352
|
extractorInternal?: string | string[];
|
|
4338
4353
|
sourceBB?: number[] | number[][];
|
|
4354
|
+
bitFingerprint?: string | string[];
|
|
4339
4355
|
levelCEFRp?: string | string[];
|
|
4340
4356
|
levelCEFR?: string | string[];
|
|
4341
4357
|
levelILR?: string | string[];
|
|
@@ -4353,6 +4369,8 @@ declare class Builder extends BaseBuilder {
|
|
|
4353
4369
|
publications?: string | string[];
|
|
4354
4370
|
relatedBook?: string | string[];
|
|
4355
4371
|
translationOfBook?: string;
|
|
4372
|
+
userFeedbackTranslationUrl?: string;
|
|
4373
|
+
userFeedbackContentUrl?: string;
|
|
4356
4374
|
author?: string | string[];
|
|
4357
4375
|
subject?: string | string[];
|
|
4358
4376
|
date?: string;
|
|
@@ -5595,6 +5613,10 @@ interface BitmarkOptions {
|
|
|
5595
5613
|
* Generate debug information in the output.
|
|
5596
5614
|
*/
|
|
5597
5615
|
debugGenerationInline?: boolean;
|
|
5616
|
+
/**
|
|
5617
|
+
* Generate table cell content without breakscaping text.
|
|
5618
|
+
*/
|
|
5619
|
+
noBreakscaping?: boolean;
|
|
5598
5620
|
}
|
|
5599
5621
|
/**
|
|
5600
5622
|
* Bitmark generator options
|
|
@@ -6124,7 +6146,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
|
|
|
6124
6146
|
protected enter_caption(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6125
6147
|
protected enter_width(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6126
6148
|
protected enter_height(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6127
|
-
protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]):
|
|
6149
|
+
protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]): boolean;
|
|
6128
6150
|
protected enter_cardBitsValue(node: NodeInfo, route: NodeInfo[]): void;
|
|
6129
6151
|
protected exit_cardBitsValue(_node: NodeInfo, _route: NodeInfo[]): void;
|
|
6130
6152
|
protected enter_body(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
@@ -6489,6 +6511,12 @@ declare class HtmlTableParser {
|
|
|
6489
6511
|
private listItemNode;
|
|
6490
6512
|
private taskItemNode;
|
|
6491
6513
|
private imageNode;
|
|
6514
|
+
private isMathTag;
|
|
6515
|
+
private latexNode;
|
|
6516
|
+
private latexFromMath;
|
|
6517
|
+
private findLatexAnnotation;
|
|
6518
|
+
private textContent;
|
|
6519
|
+
private localName;
|
|
6492
6520
|
/** Trim leading/trailing whitespace from inline content (edges only). */
|
|
6493
6521
|
private trimInline;
|
|
6494
6522
|
}
|
|
@@ -6754,6 +6782,11 @@ interface ConvertHtmlTableOptions {
|
|
|
6754
6782
|
* Keep unmappable HTML tags as literal text instead of unwrapping them (HTML -> bits only).
|
|
6755
6783
|
*/
|
|
6756
6784
|
keepUnknownTags?: boolean;
|
|
6785
|
+
/**
|
|
6786
|
+
* Disable breakscaping when generating bitmark table cell content from HTML.
|
|
6787
|
+
* Useful when cells already contain raw bitmark that should pass through untouched.
|
|
6788
|
+
*/
|
|
6789
|
+
noBreakscaping?: boolean;
|
|
6757
6790
|
/**
|
|
6758
6791
|
* Specify a file to write the output to
|
|
6759
6792
|
*/
|
|
@@ -7342,6 +7375,9 @@ declare class HtmlTableGenerator {
|
|
|
7342
7375
|
private listTag;
|
|
7343
7376
|
private listItemToHtml;
|
|
7344
7377
|
private imageToHtml;
|
|
7378
|
+
private textToHtml;
|
|
7379
|
+
private inlineImageTokenToHtml;
|
|
7380
|
+
private latexToHtml;
|
|
7345
7381
|
private escapeText;
|
|
7346
7382
|
private escapeAttr;
|
|
7347
7383
|
}
|
|
@@ -1304,6 +1304,7 @@ var propertyKeys = {
|
|
|
1304
1304
|
property_bubbleTag: "@bubbleTag",
|
|
1305
1305
|
property_extractorTag: "@extractorTag",
|
|
1306
1306
|
property_extractorInternal: "@extractorInternal",
|
|
1307
|
+
property_bitFingerprint: "@bitFingerprint",
|
|
1307
1308
|
property_buttonCaption: "@buttonCaption",
|
|
1308
1309
|
property_callToActionUrl: "@callToActionUrl",
|
|
1309
1310
|
property_caption: "@caption",
|
|
@@ -1365,6 +1366,8 @@ var propertyKeys = {
|
|
|
1365
1366
|
property_externalLinkText: "@externalLinkText",
|
|
1366
1367
|
property_feedbackEngine: "@feedbackEngine",
|
|
1367
1368
|
property_feedbackType: "@feedbackType",
|
|
1369
|
+
property_userFeedbackTranslationUrl: "@userFeedbackTranslationUrl",
|
|
1370
|
+
property_userFeedbackContentUrl: "@userFeedbackContentUrl",
|
|
1368
1371
|
property_flashcardSet: "@flashcardSet",
|
|
1369
1372
|
property_focusX: "@focusX",
|
|
1370
1373
|
property_focusY: "@focusY",
|
|
@@ -3829,16 +3832,25 @@ var CARDSETS = {
|
|
|
3829
3832
|
},
|
|
3830
3833
|
{
|
|
3831
3834
|
key: ConfigKey.property_tableRowSpan,
|
|
3835
|
+
// HTML-C2: contribute a `rowspan` attribute onto the enclosing
|
|
3836
|
+
// cell element (`<th>`/`<td>`).
|
|
3837
|
+
htmlKey: { "@el": { "@attr": { rowspan: "$" } } },
|
|
3832
3838
|
description: "Number of rows the cell spans.",
|
|
3833
3839
|
format: TagFormat.number
|
|
3834
3840
|
},
|
|
3835
3841
|
{
|
|
3836
3842
|
key: ConfigKey.property_tableColSpan,
|
|
3843
|
+
// HTML-C2: contribute a `colspan` attribute onto the enclosing
|
|
3844
|
+
// cell element (`<th>`/`<td>`).
|
|
3845
|
+
htmlKey: { "@el": { "@attr": { colspan: "$" } } },
|
|
3837
3846
|
description: "Number of columns the cell spans.",
|
|
3838
3847
|
format: TagFormat.number
|
|
3839
3848
|
},
|
|
3840
3849
|
{
|
|
3841
3850
|
key: ConfigKey.property_tableScope,
|
|
3851
|
+
// HTML-C2: contribute a `scope` attribute onto the enclosing
|
|
3852
|
+
// cell element (`<th>`/`<td>`).
|
|
3853
|
+
htmlKey: { "@el": { "@attr": { scope: "$" } } },
|
|
3842
3854
|
description: "Scope attribute for header cells.",
|
|
3843
3855
|
format: TagFormat.plainText
|
|
3844
3856
|
},
|
|
@@ -3956,6 +3968,9 @@ var CARDSETS = {
|
|
|
3956
3968
|
key: ConfigKey.property_tableRowSpan,
|
|
3957
3969
|
jsonKey: "rowspan",
|
|
3958
3970
|
exportJsonKey: { rowspan: "$" },
|
|
3971
|
+
// HTML-C2: contribute a `rowspan` attribute onto the enclosing
|
|
3972
|
+
// cell element (`<th>`/`<td>`).
|
|
3973
|
+
htmlKey: { "@el": { "@attr": { rowspan: "$" } } },
|
|
3959
3974
|
description: "Number of rows the cell spans.",
|
|
3960
3975
|
format: TagFormat.number
|
|
3961
3976
|
},
|
|
@@ -3963,6 +3978,9 @@ var CARDSETS = {
|
|
|
3963
3978
|
key: ConfigKey.property_tableColSpan,
|
|
3964
3979
|
jsonKey: "colspan",
|
|
3965
3980
|
exportJsonKey: { colspan: "$" },
|
|
3981
|
+
// HTML-C2: contribute a `colspan` attribute onto the enclosing
|
|
3982
|
+
// cell element (`<th>`/`<td>`).
|
|
3983
|
+
htmlKey: { "@el": { "@attr": { colspan: "$" } } },
|
|
3966
3984
|
description: "Number of columns the cell spans.",
|
|
3967
3985
|
format: TagFormat.number
|
|
3968
3986
|
},
|
|
@@ -3970,6 +3988,9 @@ var CARDSETS = {
|
|
|
3970
3988
|
key: ConfigKey.property_tableScope,
|
|
3971
3989
|
jsonKey: "scope",
|
|
3972
3990
|
exportJsonKey: { scope: "$" },
|
|
3991
|
+
// HTML-C2: contribute a `scope` attribute onto the enclosing
|
|
3992
|
+
// cell element (`<th>`/`<td>`).
|
|
3993
|
+
htmlKey: { "@el": { "@attr": { scope: "$" } } },
|
|
3973
3994
|
description: "Scope attribute for header cells.",
|
|
3974
3995
|
format: TagFormat.plainText
|
|
3975
3996
|
},
|
|
@@ -4576,6 +4597,12 @@ var GROUPS = {
|
|
|
4576
4597
|
format: TagFormat.coordinates,
|
|
4577
4598
|
maxCount: Count.infinity
|
|
4578
4599
|
},
|
|
4600
|
+
{
|
|
4601
|
+
key: ConfigKey.property_bitFingerprint,
|
|
4602
|
+
description: "Fingerprint(s) used by the AI extractor to identify the bit (font, style, color, pixels, etc.)",
|
|
4603
|
+
format: TagFormat.plainText,
|
|
4604
|
+
maxCount: Count.infinity
|
|
4605
|
+
},
|
|
4579
4606
|
{
|
|
4580
4607
|
key: ConfigKey.property_levelCEFRp,
|
|
4581
4608
|
description: "The CEFRp level for the bit",
|
|
@@ -5780,6 +5807,16 @@ var GROUPS = {
|
|
|
5780
5807
|
description: "External Id of the translated book",
|
|
5781
5808
|
format: TagFormat.plainText
|
|
5782
5809
|
},
|
|
5810
|
+
{
|
|
5811
|
+
key: ConfigKey.property_userFeedbackTranslationUrl,
|
|
5812
|
+
description: "URL to an external feedback form for book translation feedback",
|
|
5813
|
+
format: TagFormat.plainText
|
|
5814
|
+
},
|
|
5815
|
+
{
|
|
5816
|
+
key: ConfigKey.property_userFeedbackContentUrl,
|
|
5817
|
+
description: "URL to an external feedback form for book content feedback",
|
|
5818
|
+
format: TagFormat.plainText
|
|
5819
|
+
},
|
|
5783
5820
|
{
|
|
5784
5821
|
key: ConfigKey.property_duration,
|
|
5785
5822
|
description: "The duration of the book",
|
|
@@ -10159,7 +10196,18 @@ var BITS = {
|
|
|
10159
10196
|
since: "5.12.0",
|
|
10160
10197
|
baseBitType: BitType2._standard,
|
|
10161
10198
|
description: "Extractor blueprint bit, used to provide blueprint information about extractors",
|
|
10162
|
-
textFormatDefault: TextFormat2.json
|
|
10199
|
+
textFormatDefault: TextFormat2.json,
|
|
10200
|
+
tags: [
|
|
10201
|
+
{
|
|
10202
|
+
key: ConfigKey.group_resourceBitTags,
|
|
10203
|
+
description: "Resource bit tags for the blueprint reference image"
|
|
10204
|
+
},
|
|
10205
|
+
{
|
|
10206
|
+
key: ConfigKey.group_resourceImage,
|
|
10207
|
+
description: "Optional uncropped reference page image, used so authoring tools can compute crops against the original page dimensions"
|
|
10208
|
+
}
|
|
10209
|
+
],
|
|
10210
|
+
resourceAttachmentAllowed: false
|
|
10163
10211
|
},
|
|
10164
10212
|
[BitType2.extractorInformation]: {
|
|
10165
10213
|
since: "3.8.0",
|
|
@@ -10882,7 +10930,9 @@ var BITS = {
|
|
|
10882
10930
|
{
|
|
10883
10931
|
key: ConfigKey.property_caption,
|
|
10884
10932
|
description: "Caption for the table image, used to provide a description for the image",
|
|
10885
|
-
format: TagFormat.bitmarkText
|
|
10933
|
+
format: TagFormat.bitmarkText,
|
|
10934
|
+
// HTML-10 / HTML-C2: render as the table's `<caption>` (see table bit).
|
|
10935
|
+
htmlKey: { "@el": "caption", "@children": "$" }
|
|
10886
10936
|
},
|
|
10887
10937
|
{
|
|
10888
10938
|
key: ConfigKey.group_backgroundWallpaper,
|
|
@@ -12573,7 +12623,12 @@ var BITS = {
|
|
|
12573
12623
|
{
|
|
12574
12624
|
key: ConfigKey.property_caption,
|
|
12575
12625
|
description: "Caption for the table, used to define the title of the table",
|
|
12576
|
-
format: TagFormat.bitmarkText
|
|
12626
|
+
format: TagFormat.bitmarkText,
|
|
12627
|
+
// HTML-10 / HTML-C2: a bit-level caption renders as the table's
|
|
12628
|
+
// `<caption>` — placed inside the idiomatic `<table>` container as
|
|
12629
|
+
// its first child. Outside a table context it falls back to the
|
|
12630
|
+
// residual carrier.
|
|
12631
|
+
htmlKey: { "@el": "caption", "@children": "$" }
|
|
12577
12632
|
},
|
|
12578
12633
|
{
|
|
12579
12634
|
key: ConfigKey.property_tableFixedHeader,
|
|
@@ -12658,7 +12713,9 @@ var BITS = {
|
|
|
12658
12713
|
{
|
|
12659
12714
|
key: ConfigKey.property_caption,
|
|
12660
12715
|
description: "Caption for the table image, used to provide a description for the image",
|
|
12661
|
-
format: TagFormat.bitmarkText
|
|
12716
|
+
format: TagFormat.bitmarkText,
|
|
12717
|
+
// HTML-10 / HTML-C2: render as the table's `<caption>` (see table bit).
|
|
12718
|
+
htmlKey: { "@el": "caption", "@children": "$" }
|
|
12662
12719
|
},
|
|
12663
12720
|
{
|
|
12664
12721
|
key: ConfigKey.group_backgroundWallpaper,
|
|
@@ -13848,7 +13905,7 @@ var instance2 = new Config();
|
|
|
13848
13905
|
// src/generated/package_info.ts
|
|
13849
13906
|
var PACKAGE_INFO = {
|
|
13850
13907
|
"name": "@gmb/bitmark-parser-generator",
|
|
13851
|
-
"version": "5.
|
|
13908
|
+
"version": "5.29.0",
|
|
13852
13909
|
"author": "Get More Brain Ltd",
|
|
13853
13910
|
"license": "ISC",
|
|
13854
13911
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
@@ -14261,6 +14318,8 @@ var NodeType = {
|
|
|
14261
14318
|
// bit
|
|
14262
14319
|
bitType: "bitType",
|
|
14263
14320
|
// bit type
|
|
14321
|
+
bitFingerprint: "bitFingerprint",
|
|
14322
|
+
bitFingerprintValue: "bitFingerprintValue",
|
|
14264
14323
|
blockId: "blockId",
|
|
14265
14324
|
blockIdValue: "blockIdValue",
|
|
14266
14325
|
body: "body",
|
|
@@ -14738,6 +14797,10 @@ var NodeType = {
|
|
|
14738
14797
|
relatedBookValue: "relatedBookValue",
|
|
14739
14798
|
translationOfBook: "translationOfBook",
|
|
14740
14799
|
translationOfBookValue: "translationOfBookValue",
|
|
14800
|
+
userFeedbackTranslationUrl: "userFeedbackTranslationUrl",
|
|
14801
|
+
userFeedbackTranslationUrlValue: "userFeedbackTranslationUrlValue",
|
|
14802
|
+
userFeedbackContentUrl: "userFeedbackContentUrl",
|
|
14803
|
+
userFeedbackContentUrlValue: "userFeedbackContentUrlValue",
|
|
14741
14804
|
releaseDate: "releaseDate",
|
|
14742
14805
|
releaseDateValue: "releaseDateValue",
|
|
14743
14806
|
releaseKind: "releaseKind",
|
|
@@ -27885,6 +27948,12 @@ var Builder = class extends BaseBuilder {
|
|
|
27885
27948
|
options
|
|
27886
27949
|
),
|
|
27887
27950
|
sourceBB: this.normaliseSourceBB(data.sourceBB),
|
|
27951
|
+
bitFingerprint: this.toAstProperty(
|
|
27952
|
+
bitType,
|
|
27953
|
+
ConfigKey.property_bitFingerprint,
|
|
27954
|
+
data.bitFingerprint,
|
|
27955
|
+
options
|
|
27956
|
+
),
|
|
27888
27957
|
levelCEFRp: this.toAstProperty(
|
|
27889
27958
|
bitType,
|
|
27890
27959
|
ConfigKey.property_levelCEFRp,
|
|
@@ -27947,6 +28016,18 @@ var Builder = class extends BaseBuilder {
|
|
|
27947
28016
|
data.translationOfBook,
|
|
27948
28017
|
options
|
|
27949
28018
|
),
|
|
28019
|
+
userFeedbackTranslationUrl: this.toAstProperty(
|
|
28020
|
+
bitType,
|
|
28021
|
+
ConfigKey.property_userFeedbackTranslationUrl,
|
|
28022
|
+
data.userFeedbackTranslationUrl,
|
|
28023
|
+
options
|
|
28024
|
+
),
|
|
28025
|
+
userFeedbackContentUrl: this.toAstProperty(
|
|
28026
|
+
bitType,
|
|
28027
|
+
ConfigKey.property_userFeedbackContentUrl,
|
|
28028
|
+
data.userFeedbackContentUrl,
|
|
28029
|
+
options
|
|
28030
|
+
),
|
|
27950
28031
|
author: this.toAstProperty(bitType, ConfigKey.property_author, data.author, options),
|
|
27951
28032
|
subject: this.toAstProperty(bitType, ConfigKey.property_subject, data.subject, options),
|
|
27952
28033
|
date: this.toAstProperty(bitType, ConfigKey.property_date, data.date, options),
|
|
@@ -31738,7 +31819,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
31738
31819
|
this.writeNL();
|
|
31739
31820
|
}
|
|
31740
31821
|
const content = cell.content ?? instance3.EMPTY_STRING;
|
|
31741
|
-
|
|
31822
|
+
const options = this.options.noBreakscaping ? { noBreakscaping: true } : void 0;
|
|
31823
|
+
this.writeTextOrValue(content, this.textFormat, TextLocation2.body, options);
|
|
31742
31824
|
}
|
|
31743
31825
|
writeTableCellProperty(name, value) {
|
|
31744
31826
|
this.writeOPA();
|
|
@@ -33217,6 +33299,8 @@ var MARK_TO_TAG = {
|
|
|
33217
33299
|
highlight: "mark",
|
|
33218
33300
|
code: "code"
|
|
33219
33301
|
};
|
|
33302
|
+
var INLINE_IMAGE_RE = /==([^=]*(?:=(?!=)[^=]*)*)==\|imageInline:([^|\s]+)((?:\|(?:@?[A-Za-z][A-Za-z0-9_-]*:[^|\s]+|#[^|\s]*))*)\|?/g;
|
|
33303
|
+
var MAX_IMAGE_DIMENSION = 9999;
|
|
33220
33304
|
var HtmlTableGenerator = class {
|
|
33221
33305
|
constructor() {
|
|
33222
33306
|
__publicField(this, "indentUnit", " ");
|
|
@@ -33335,6 +33419,8 @@ var HtmlTableGenerator = class {
|
|
|
33335
33419
|
case "image":
|
|
33336
33420
|
case "imageInline":
|
|
33337
33421
|
return this.imageToHtml(node);
|
|
33422
|
+
case "latex":
|
|
33423
|
+
return this.latexToHtml(node);
|
|
33338
33424
|
default:
|
|
33339
33425
|
return this.inlineToHtml([node]);
|
|
33340
33426
|
}
|
|
@@ -33345,8 +33431,9 @@ var HtmlTableGenerator = class {
|
|
|
33345
33431
|
inlineNodeToHtml(node) {
|
|
33346
33432
|
if (node.type === "hardBreak") return "<br>";
|
|
33347
33433
|
if (node.type === "image" || node.type === "imageInline") return this.imageToHtml(node);
|
|
33434
|
+
if (node.type === "latex") return this.latexToHtml(node);
|
|
33348
33435
|
if (node.type === "text") {
|
|
33349
|
-
return this.wrapMarks(this.
|
|
33436
|
+
return this.wrapMarks(this.textToHtml(node.text ?? ""), node.marks);
|
|
33350
33437
|
}
|
|
33351
33438
|
if (node.content) return this.inlineToHtml(node.content);
|
|
33352
33439
|
return this.escapeText(node.text ?? "");
|
|
@@ -33424,6 +33511,44 @@ var HtmlTableGenerator = class {
|
|
|
33424
33511
|
}
|
|
33425
33512
|
return `<img ${parts.join(" ")}>`;
|
|
33426
33513
|
}
|
|
33514
|
+
textToHtml(text) {
|
|
33515
|
+
let html = "";
|
|
33516
|
+
let lastIndex = 0;
|
|
33517
|
+
for (const match of text.matchAll(INLINE_IMAGE_RE)) {
|
|
33518
|
+
const index = match.index ?? 0;
|
|
33519
|
+
html += this.escapeText(text.slice(lastIndex, index));
|
|
33520
|
+
html += this.inlineImageTokenToHtml(match);
|
|
33521
|
+
lastIndex = index + match[0].length;
|
|
33522
|
+
}
|
|
33523
|
+
html += this.escapeText(text.slice(lastIndex));
|
|
33524
|
+
return html;
|
|
33525
|
+
}
|
|
33526
|
+
inlineImageTokenToHtml(match) {
|
|
33527
|
+
const attrs = {
|
|
33528
|
+
alt: match[1],
|
|
33529
|
+
src: match[2]
|
|
33530
|
+
};
|
|
33531
|
+
const rawAttrs = match[3] ?? "";
|
|
33532
|
+
for (const attr of rawAttrs.split("|")) {
|
|
33533
|
+
if (!attr || attr.startsWith("#")) continue;
|
|
33534
|
+
const colon = attr.indexOf(":");
|
|
33535
|
+
if (colon < 1) continue;
|
|
33536
|
+
const key = attr.slice(0, colon).replace(/^@/, "");
|
|
33537
|
+
const value = attr.slice(colon + 1);
|
|
33538
|
+
if (key === "width" || key === "height") {
|
|
33539
|
+
const n = Number.parseInt(value, 10);
|
|
33540
|
+
if (!Number.isNaN(n) && n > 0 && n <= MAX_IMAGE_DIMENSION) attrs[key] = n;
|
|
33541
|
+
} else if (key === "class" || key === "title") {
|
|
33542
|
+
attrs[key] = value;
|
|
33543
|
+
}
|
|
33544
|
+
}
|
|
33545
|
+
return this.imageToHtml({ type: "imageInline", attrs });
|
|
33546
|
+
}
|
|
33547
|
+
// --- formulas -------------------------------------------------------------
|
|
33548
|
+
latexToHtml(node) {
|
|
33549
|
+
const formula = node.attrs?.formula ?? "";
|
|
33550
|
+
return `<math alttext="${this.escapeAttr(formula)}"></math>`;
|
|
33551
|
+
}
|
|
33427
33552
|
// --- escaping -------------------------------------------------------------
|
|
33428
33553
|
escapeText(text) {
|
|
33429
33554
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -33735,6 +33860,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
33735
33860
|
this.addProperty(this.bitJson, k, values, { array: true });
|
|
33736
33861
|
}
|
|
33737
33862
|
}
|
|
33863
|
+
return false;
|
|
33738
33864
|
}
|
|
33739
33865
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> cardBits -> cardBitsValue
|
|
33740
33866
|
enter_cardBitsValue(node, route) {
|
|
@@ -42769,7 +42895,7 @@ var IMPLIED_CLOSE = {
|
|
|
42769
42895
|
p: /* @__PURE__ */ new Set(["p"]),
|
|
42770
42896
|
option: /* @__PURE__ */ new Set(["option"])
|
|
42771
42897
|
};
|
|
42772
|
-
var TAG_RE = /<(\/)?([a-zA-Z][a-zA-Z0-9
|
|
42898
|
+
var TAG_RE = /<(\/)?([a-zA-Z][a-zA-Z0-9:-]*)((?:\s+(?:"[^"]*"|'[^']*'|[^<>"'])*)?)(\/)?>/g;
|
|
42773
42899
|
var ATTR_RE = /([a-zA-Z_:][a-zA-Z0-9:._-]*)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'>]+))?/g;
|
|
42774
42900
|
function parseAttrs(raw) {
|
|
42775
42901
|
const attrs = {};
|
|
@@ -43100,6 +43226,9 @@ var HtmlTableParser = class {
|
|
|
43100
43226
|
if (name === "img") {
|
|
43101
43227
|
return [this.imageNode(el, true)];
|
|
43102
43228
|
}
|
|
43229
|
+
if (this.isMathTag(name)) {
|
|
43230
|
+
return [this.latexNode(el)];
|
|
43231
|
+
}
|
|
43103
43232
|
const markType = MARK_TAGS[name];
|
|
43104
43233
|
if (markType) {
|
|
43105
43234
|
return this.inlineNodes(el.children, [...marks, { type: markType }]);
|
|
@@ -43216,6 +43345,43 @@ var HtmlTableParser = class {
|
|
|
43216
43345
|
if (el.attrs.class) attrs.class = el.attrs.class;
|
|
43217
43346
|
return { type: inline ? "imageInline" : "image", attrs };
|
|
43218
43347
|
}
|
|
43348
|
+
// --- formulas -------------------------------------------------------------
|
|
43349
|
+
isMathTag(name) {
|
|
43350
|
+
return this.localName(name) === "math";
|
|
43351
|
+
}
|
|
43352
|
+
latexNode(el) {
|
|
43353
|
+
return {
|
|
43354
|
+
type: "latex",
|
|
43355
|
+
attrs: {
|
|
43356
|
+
formula: this.latexFromMath(el)
|
|
43357
|
+
}
|
|
43358
|
+
};
|
|
43359
|
+
}
|
|
43360
|
+
latexFromMath(el) {
|
|
43361
|
+
const alt = el.attrs.alttext ?? el.attrs.alt ?? el.attrs.title;
|
|
43362
|
+
if (alt != null) return decodeEntities(alt);
|
|
43363
|
+
const annotation = this.findLatexAnnotation(el);
|
|
43364
|
+
if (annotation) return this.textContent(annotation).trim();
|
|
43365
|
+
return this.textContent(el).trim();
|
|
43366
|
+
}
|
|
43367
|
+
findLatexAnnotation(el) {
|
|
43368
|
+
for (const child of el.children) {
|
|
43369
|
+
if (!isElement(child)) continue;
|
|
43370
|
+
const lowerEncoding = (child.attrs.encoding ?? "").toLowerCase();
|
|
43371
|
+
if (this.localName(child.name) === "annotation" && (/\btex\b/.test(lowerEncoding) || /\blatex\b/.test(lowerEncoding))) {
|
|
43372
|
+
return child;
|
|
43373
|
+
}
|
|
43374
|
+
const nested = this.findLatexAnnotation(child);
|
|
43375
|
+
if (nested) return nested;
|
|
43376
|
+
}
|
|
43377
|
+
return void 0;
|
|
43378
|
+
}
|
|
43379
|
+
textContent(el) {
|
|
43380
|
+
return el.children.map((child) => isElement(child) ? this.textContent(child) : decodeEntities(child.value)).join("").replace(/\s+/g, " ");
|
|
43381
|
+
}
|
|
43382
|
+
localName(name) {
|
|
43383
|
+
return name.includes(":") ? name.slice(name.indexOf(":") + 1) : name;
|
|
43384
|
+
}
|
|
43219
43385
|
// --- whitespace -----------------------------------------------------------
|
|
43220
43386
|
/** Trim leading/trailing whitespace from inline content (edges only). */
|
|
43221
43387
|
trimInline(nodes) {
|
|
@@ -43870,7 +44036,10 @@ var BitmarkParserGenerator = class {
|
|
|
43870
44036
|
outputFile: opts.outputFile,
|
|
43871
44037
|
fileOptions: opts.fileOptions,
|
|
43872
44038
|
jsonOptions: opts.jsonOptions,
|
|
43873
|
-
bitmarkOptions:
|
|
44039
|
+
bitmarkOptions: {
|
|
44040
|
+
...opts.bitmarkOptions,
|
|
44041
|
+
...opts.noBreakscaping ? { noBreakscaping: true } : {}
|
|
44042
|
+
}
|
|
43874
44043
|
});
|
|
43875
44044
|
}
|
|
43876
44045
|
const outputFormat = opts.outputFormat ?? "html";
|