@manuscripts/transform 2.1.1-LEAN-3336-23 → 2.1.1-LEAN-3336-24
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/cjs/jats/importer/jats-body-transformations.js +1 -1
- package/dist/cjs/schema/nodes/table_element.js +1 -1
- package/dist/cjs/transformer/decode.js +11 -15
- package/dist/es/jats/importer/jats-body-transformations.js +1 -1
- package/dist/es/schema/nodes/table_element.js +1 -1
- package/dist/es/transformer/decode.js +11 -15
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.tableElement = void 0;
|
|
19
19
|
exports.tableElement = {
|
|
20
|
-
content: '
|
|
20
|
+
content: '(table | placeholder) table_colgroup? table_element_footer? figcaption? (listing | placeholder)',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
paragraphStyle: { default: '' },
|
|
@@ -573,20 +573,16 @@ class Decoder {
|
|
|
573
573
|
comments.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
574
574
|
const content = [table];
|
|
575
575
|
if (tableColGroup) {
|
|
576
|
-
content.
|
|
576
|
+
content.push(tableColGroup);
|
|
577
577
|
}
|
|
578
578
|
if (tableElementFooter) {
|
|
579
579
|
content.push(tableElementFooter);
|
|
580
580
|
}
|
|
581
581
|
content.push(figcaption);
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
else {
|
|
587
|
-
const listing = schema_1.schema.nodes.listing.create();
|
|
588
|
-
content.push(listing);
|
|
589
|
-
}
|
|
582
|
+
const listing = model.listingID
|
|
583
|
+
? this.createListing(model.listingID)
|
|
584
|
+
: schema_1.schema.nodes.listing.create();
|
|
585
|
+
content.push(listing);
|
|
590
586
|
return schema_1.schema.nodes.table_element.createChecked({
|
|
591
587
|
id: model._id,
|
|
592
588
|
table: model.containedObjectID,
|
|
@@ -775,26 +771,26 @@ class Decoder {
|
|
|
775
771
|
this.allowMissingElements = allowMissingElements;
|
|
776
772
|
}
|
|
777
773
|
createTable(model) {
|
|
778
|
-
const
|
|
779
|
-
const tableModel = this.getModel(
|
|
774
|
+
const tableID = model.containedObjectID;
|
|
775
|
+
const tableModel = this.getModel(tableID);
|
|
780
776
|
let table;
|
|
781
777
|
if (tableModel) {
|
|
782
778
|
table = this.decode(tableModel);
|
|
783
779
|
}
|
|
784
780
|
else if (this.allowMissingElements) {
|
|
785
781
|
table = schema_1.schema.nodes.placeholder.create({
|
|
786
|
-
id:
|
|
782
|
+
id: tableID,
|
|
787
783
|
label: 'A table',
|
|
788
784
|
});
|
|
789
785
|
}
|
|
790
786
|
else {
|
|
791
|
-
throw new errors_1.MissingElement(
|
|
787
|
+
throw new errors_1.MissingElement(tableID);
|
|
792
788
|
}
|
|
793
789
|
return table;
|
|
794
790
|
}
|
|
795
791
|
createTableColGroup(model) {
|
|
796
|
-
const
|
|
797
|
-
const tableModel = this.getModel(
|
|
792
|
+
const tableID = model.containedObjectID;
|
|
793
|
+
const tableModel = this.getModel(tableID);
|
|
798
794
|
if (!tableModel || !tableModel.contents.includes('<colgroup>')) {
|
|
799
795
|
return undefined;
|
|
800
796
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const tableElement = {
|
|
17
|
-
content: '
|
|
17
|
+
content: '(table | placeholder) table_colgroup? table_element_footer? figcaption? (listing | placeholder)',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
paragraphStyle: { default: '' },
|
|
@@ -564,20 +564,16 @@ export class Decoder {
|
|
|
564
564
|
comments.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
565
565
|
const content = [table];
|
|
566
566
|
if (tableColGroup) {
|
|
567
|
-
content.
|
|
567
|
+
content.push(tableColGroup);
|
|
568
568
|
}
|
|
569
569
|
if (tableElementFooter) {
|
|
570
570
|
content.push(tableElementFooter);
|
|
571
571
|
}
|
|
572
572
|
content.push(figcaption);
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
else {
|
|
578
|
-
const listing = schema.nodes.listing.create();
|
|
579
|
-
content.push(listing);
|
|
580
|
-
}
|
|
573
|
+
const listing = model.listingID
|
|
574
|
+
? this.createListing(model.listingID)
|
|
575
|
+
: schema.nodes.listing.create();
|
|
576
|
+
content.push(listing);
|
|
581
577
|
return schema.nodes.table_element.createChecked({
|
|
582
578
|
id: model._id,
|
|
583
579
|
table: model.containedObjectID,
|
|
@@ -766,26 +762,26 @@ export class Decoder {
|
|
|
766
762
|
this.allowMissingElements = allowMissingElements;
|
|
767
763
|
}
|
|
768
764
|
createTable(model) {
|
|
769
|
-
const
|
|
770
|
-
const tableModel = this.getModel(
|
|
765
|
+
const tableID = model.containedObjectID;
|
|
766
|
+
const tableModel = this.getModel(tableID);
|
|
771
767
|
let table;
|
|
772
768
|
if (tableModel) {
|
|
773
769
|
table = this.decode(tableModel);
|
|
774
770
|
}
|
|
775
771
|
else if (this.allowMissingElements) {
|
|
776
772
|
table = schema.nodes.placeholder.create({
|
|
777
|
-
id:
|
|
773
|
+
id: tableID,
|
|
778
774
|
label: 'A table',
|
|
779
775
|
});
|
|
780
776
|
}
|
|
781
777
|
else {
|
|
782
|
-
throw new MissingElement(
|
|
778
|
+
throw new MissingElement(tableID);
|
|
783
779
|
}
|
|
784
780
|
return table;
|
|
785
781
|
}
|
|
786
782
|
createTableColGroup(model) {
|
|
787
|
-
const
|
|
788
|
-
const tableModel = this.getModel(
|
|
783
|
+
const tableID = model.containedObjectID;
|
|
784
|
+
const tableModel = this.getModel(tableID);
|
|
789
785
|
if (!tableModel || !tableModel.contents.includes('<colgroup>')) {
|
|
790
786
|
return undefined;
|
|
791
787
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "2.1.1-LEAN-3336-
|
|
4
|
+
"version": "2.1.1-LEAN-3336-24",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|