@manuscripts/transform 2.3.9-LEAN-3307.0 → 2.3.9
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/schema/nodes/backmatter.js +2 -3
- package/dist/cjs/schema/nodes/manuscript.js +1 -0
- package/dist/cjs/schema/nodes/title.js +0 -1
- package/dist/cjs/transformer/decode.js +30 -22
- package/dist/cjs/transformer/encode.js +0 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/schema/nodes/backmatter.js +2 -3
- package/dist/es/schema/nodes/manuscript.js +1 -0
- package/dist/es/schema/nodes/title.js +0 -1
- package/dist/es/transformer/decode.js +30 -22
- package/dist/es/transformer/encode.js +0 -1
- package/dist/es/version.js +1 -1
- package/dist/types/lib/table-cell-styles.d.ts +1 -1
- package/dist/types/schema/nodes/manuscript.d.ts +1 -0
- package/dist/types/schema/nodes/title.d.ts +0 -1
- package/dist/types/transformer/decode.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -18,11 +18,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.backmatter = void 0;
|
|
19
19
|
exports.backmatter = {
|
|
20
20
|
content: 'sections*',
|
|
21
|
+
atom: true,
|
|
21
22
|
attrs: {
|
|
22
23
|
id: { default: '' },
|
|
23
|
-
placeholder: { default: ' ' },
|
|
24
24
|
},
|
|
25
|
-
group: 'block
|
|
26
|
-
parseDOM: [{ tag: 'div.backmatter' }],
|
|
25
|
+
group: 'block',
|
|
27
26
|
toDOM: () => ['div', { class: 'backmatter' }, 0],
|
|
28
27
|
};
|
|
@@ -87,9 +87,6 @@ class Decoder {
|
|
|
87
87
|
const affiliations = getAffiliations(this.modelMap)
|
|
88
88
|
.map((a) => this.decode(a))
|
|
89
89
|
.filter(Boolean);
|
|
90
|
-
if (!affiliations.length) {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
90
|
return schema_1.schema.nodes.affiliations.createAndFill({}, affiliations);
|
|
94
91
|
}
|
|
95
92
|
createContributorsNode() {
|
|
@@ -100,18 +97,12 @@ class Decoder {
|
|
|
100
97
|
.map((authorNote) => this.decode(authorNote))
|
|
101
98
|
.filter(Boolean);
|
|
102
99
|
const content = [...contributors, ...authorNotes];
|
|
103
|
-
if (!content.length) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
100
|
return schema_1.schema.nodes.contributors.createAndFill({}, content);
|
|
107
101
|
}
|
|
108
102
|
createKeywordsNode() {
|
|
109
103
|
const elements = getKeywordElements(this.modelMap)
|
|
110
104
|
.map((e) => this.decode(e))
|
|
111
105
|
.filter(Boolean);
|
|
112
|
-
if (!elements.length) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
106
|
return schema_1.schema.nodes.keywords.createAndFill({}, [
|
|
116
107
|
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Keywords')),
|
|
117
108
|
...elements,
|
|
@@ -121,9 +112,6 @@ class Decoder {
|
|
|
121
112
|
const elements = getSupplements(this.modelMap)
|
|
122
113
|
.map((e) => this.decode(e))
|
|
123
114
|
.filter(Boolean);
|
|
124
|
-
if (!elements.length) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
115
|
return schema_1.schema.nodes.supplements.createAndFill({}, [
|
|
128
116
|
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('SupplementaryMaterials')),
|
|
129
117
|
...elements,
|
|
@@ -156,7 +144,11 @@ class Decoder {
|
|
|
156
144
|
const abstracts = schema_1.schema.nodes.abstracts.createAndFill({}, groups[section_group_type_1.abstractsType._id]);
|
|
157
145
|
const body = schema_1.schema.nodes.body.createAndFill({}, groups[section_group_type_1.bodyType._id]);
|
|
158
146
|
const backmatter = schema_1.schema.nodes.backmatter.createAndFill({}, groups[section_group_type_1.backmatterType._id]);
|
|
159
|
-
return
|
|
147
|
+
return {
|
|
148
|
+
abstracts,
|
|
149
|
+
body,
|
|
150
|
+
backmatter,
|
|
151
|
+
};
|
|
160
152
|
}
|
|
161
153
|
createCommentNodes(model) {
|
|
162
154
|
const comments = [];
|
|
@@ -724,18 +716,27 @@ class Decoder {
|
|
|
724
716
|
};
|
|
725
717
|
this.getModel = (id) => this.modelMap.get(id);
|
|
726
718
|
this.createArticleNode = (manuscriptID) => {
|
|
727
|
-
const
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
719
|
+
const title = this.createTitleNode();
|
|
720
|
+
const contributors = this.createContributorsNode();
|
|
721
|
+
const affiliations = this.createAffiliationsNode();
|
|
722
|
+
const keywords = this.createKeywordsNode();
|
|
723
|
+
const suppl = this.createSupplementsNode();
|
|
724
|
+
const { abstracts, body, backmatter } = this.createContentSections();
|
|
725
|
+
const comments = this.createCommentsNode();
|
|
726
|
+
const contents = [
|
|
727
|
+
title,
|
|
728
|
+
contributors,
|
|
729
|
+
affiliations,
|
|
730
|
+
keywords,
|
|
731
|
+
suppl,
|
|
732
|
+
abstracts,
|
|
733
|
+
body,
|
|
734
|
+
backmatter,
|
|
735
|
+
comments,
|
|
735
736
|
];
|
|
736
|
-
const contents = nodes.filter((node) => node !== false);
|
|
737
737
|
return schema_1.schema.nodes.manuscript.create({
|
|
738
738
|
id: manuscriptID || this.getManuscriptID(),
|
|
739
|
+
doi: this.getManuscriptDOI() || '',
|
|
739
740
|
}, contents);
|
|
740
741
|
};
|
|
741
742
|
this.addGeneratedLabels = (sections) => {
|
|
@@ -781,6 +782,13 @@ class Decoder {
|
|
|
781
782
|
}
|
|
782
783
|
}
|
|
783
784
|
};
|
|
785
|
+
this.getManuscriptDOI = () => {
|
|
786
|
+
for (const item of this.modelMap.values()) {
|
|
787
|
+
if ((0, object_types_1.isManuscript)(item)) {
|
|
788
|
+
return item.DOI;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
};
|
|
784
792
|
this.getFigcaption = (model) => {
|
|
785
793
|
const titleNode = schema_1.schema.nodes.caption_title.create();
|
|
786
794
|
const captionTitle = model.title
|
|
@@ -274,7 +274,6 @@ const encoders = {
|
|
|
274
274
|
title: (0, exports.inlineContents)(node),
|
|
275
275
|
subtitle: node.attrs.subtitle,
|
|
276
276
|
runningTitle: node.attrs.runningTitle,
|
|
277
|
-
placeholder: node.attrs.placeholder,
|
|
278
277
|
_id: node.attrs._id,
|
|
279
278
|
}),
|
|
280
279
|
bibliography_element: (node) => ({
|
package/dist/cjs/version.js
CHANGED
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export const backmatter = {
|
|
17
17
|
content: 'sections*',
|
|
18
|
+
atom: true,
|
|
18
19
|
attrs: {
|
|
19
20
|
id: { default: '' },
|
|
20
|
-
placeholder: { default: ' ' },
|
|
21
21
|
},
|
|
22
|
-
group: 'block
|
|
23
|
-
parseDOM: [{ tag: 'div.backmatter' }],
|
|
22
|
+
group: 'block',
|
|
24
23
|
toDOM: () => ['div', { class: 'backmatter' }, 0],
|
|
25
24
|
};
|
|
@@ -78,9 +78,6 @@ export class Decoder {
|
|
|
78
78
|
const affiliations = getAffiliations(this.modelMap)
|
|
79
79
|
.map((a) => this.decode(a))
|
|
80
80
|
.filter(Boolean);
|
|
81
|
-
if (!affiliations.length) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
81
|
return schema.nodes.affiliations.createAndFill({}, affiliations);
|
|
85
82
|
}
|
|
86
83
|
createContributorsNode() {
|
|
@@ -91,18 +88,12 @@ export class Decoder {
|
|
|
91
88
|
.map((authorNote) => this.decode(authorNote))
|
|
92
89
|
.filter(Boolean);
|
|
93
90
|
const content = [...contributors, ...authorNotes];
|
|
94
|
-
if (!content.length) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
91
|
return schema.nodes.contributors.createAndFill({}, content);
|
|
98
92
|
}
|
|
99
93
|
createKeywordsNode() {
|
|
100
94
|
const elements = getKeywordElements(this.modelMap)
|
|
101
95
|
.map((e) => this.decode(e))
|
|
102
96
|
.filter(Boolean);
|
|
103
|
-
if (!elements.length) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
97
|
return schema.nodes.keywords.createAndFill({}, [
|
|
107
98
|
schema.nodes.section_title.create({}, schema.text('Keywords')),
|
|
108
99
|
...elements,
|
|
@@ -112,9 +103,6 @@ export class Decoder {
|
|
|
112
103
|
const elements = getSupplements(this.modelMap)
|
|
113
104
|
.map((e) => this.decode(e))
|
|
114
105
|
.filter(Boolean);
|
|
115
|
-
if (!elements.length) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
106
|
return schema.nodes.supplements.createAndFill({}, [
|
|
119
107
|
schema.nodes.section_title.create({}, schema.text('SupplementaryMaterials')),
|
|
120
108
|
...elements,
|
|
@@ -147,7 +135,11 @@ export class Decoder {
|
|
|
147
135
|
const abstracts = schema.nodes.abstracts.createAndFill({}, groups[abstractsType._id]);
|
|
148
136
|
const body = schema.nodes.body.createAndFill({}, groups[bodyType._id]);
|
|
149
137
|
const backmatter = schema.nodes.backmatter.createAndFill({}, groups[backmatterType._id]);
|
|
150
|
-
return
|
|
138
|
+
return {
|
|
139
|
+
abstracts,
|
|
140
|
+
body,
|
|
141
|
+
backmatter,
|
|
142
|
+
};
|
|
151
143
|
}
|
|
152
144
|
createCommentNodes(model) {
|
|
153
145
|
const comments = [];
|
|
@@ -715,18 +707,27 @@ export class Decoder {
|
|
|
715
707
|
};
|
|
716
708
|
this.getModel = (id) => this.modelMap.get(id);
|
|
717
709
|
this.createArticleNode = (manuscriptID) => {
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
710
|
+
const title = this.createTitleNode();
|
|
711
|
+
const contributors = this.createContributorsNode();
|
|
712
|
+
const affiliations = this.createAffiliationsNode();
|
|
713
|
+
const keywords = this.createKeywordsNode();
|
|
714
|
+
const suppl = this.createSupplementsNode();
|
|
715
|
+
const { abstracts, body, backmatter } = this.createContentSections();
|
|
716
|
+
const comments = this.createCommentsNode();
|
|
717
|
+
const contents = [
|
|
718
|
+
title,
|
|
719
|
+
contributors,
|
|
720
|
+
affiliations,
|
|
721
|
+
keywords,
|
|
722
|
+
suppl,
|
|
723
|
+
abstracts,
|
|
724
|
+
body,
|
|
725
|
+
backmatter,
|
|
726
|
+
comments,
|
|
726
727
|
];
|
|
727
|
-
const contents = nodes.filter((node) => node !== false);
|
|
728
728
|
return schema.nodes.manuscript.create({
|
|
729
729
|
id: manuscriptID || this.getManuscriptID(),
|
|
730
|
+
doi: this.getManuscriptDOI() || '',
|
|
730
731
|
}, contents);
|
|
731
732
|
};
|
|
732
733
|
this.addGeneratedLabels = (sections) => {
|
|
@@ -772,6 +773,13 @@ export class Decoder {
|
|
|
772
773
|
}
|
|
773
774
|
}
|
|
774
775
|
};
|
|
776
|
+
this.getManuscriptDOI = () => {
|
|
777
|
+
for (const item of this.modelMap.values()) {
|
|
778
|
+
if (isManuscript(item)) {
|
|
779
|
+
return item.DOI;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
};
|
|
775
783
|
this.getFigcaption = (model) => {
|
|
776
784
|
const titleNode = schema.nodes.caption_title.create();
|
|
777
785
|
const captionTitle = model.title
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.9
|
|
1
|
+
export const VERSION = "2.3.9";
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export declare const TABLE_CELL_STYLES: readonly ["backgroundColor", "border-top", "border-right", "border-bottom", "border-left", "verticalAlign", "textAlign"];
|
|
17
|
-
export type TableCellStyleKey =
|
|
17
|
+
export type TableCellStyleKey = typeof TABLE_CELL_STYLES[number];
|
|
18
18
|
export declare const serializeTableCellStyles: (styles: {
|
|
19
19
|
backgroundColor?: string | null | undefined;
|
|
20
20
|
"border-top"?: string | null | undefined;
|
|
@@ -41,6 +41,7 @@ export declare class Decoder {
|
|
|
41
41
|
addGeneratedLabels: (sections: Section[]) => Section[];
|
|
42
42
|
parseContents: (contents: string, wrapper?: string, commentAnnotations?: CommentAnnotation[], options?: ParseOptions) => ManuscriptNode;
|
|
43
43
|
private getManuscriptID;
|
|
44
|
+
private getManuscriptDOI;
|
|
44
45
|
private getFigcaption;
|
|
45
46
|
private createTable;
|
|
46
47
|
private createTableColGroup;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.3.9
|
|
1
|
+
export declare const VERSION = "2.3.9";
|
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.3.9
|
|
4
|
+
"version": "2.3.9",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"version": "yarn build"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@manuscripts/json-schema": "2.2.
|
|
34
|
-
"@manuscripts/library": "1.3.
|
|
33
|
+
"@manuscripts/json-schema": "2.2.8",
|
|
34
|
+
"@manuscripts/library": "1.3.7",
|
|
35
35
|
"debug": "^4.3.4",
|
|
36
36
|
"jszip": "^3.10.1",
|
|
37
37
|
"mime": "^3.0.0",
|