@manuscripts/transform 2.3.10-LEAN-3595.0 → 2.3.10
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/jats-exporter.js +1 -1
- package/dist/cjs/schema/index.js +0 -2
- package/dist/cjs/schema/nodes/author_notes.js +2 -9
- package/dist/cjs/schema/nodes/backmatter.js +3 -2
- package/dist/cjs/schema/nodes/contributors.js +1 -1
- package/dist/cjs/schema/nodes/corresp.js +2 -13
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/schema/nodes/title.js +1 -0
- package/dist/cjs/transformer/decode.js +28 -35
- package/dist/cjs/transformer/encode.js +3 -11
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +1 -1
- package/dist/es/jats/jats-exporter.js +1 -1
- package/dist/es/schema/index.js +0 -2
- package/dist/es/schema/nodes/author_notes.js +2 -9
- package/dist/es/schema/nodes/backmatter.js +3 -2
- package/dist/es/schema/nodes/contributors.js +1 -1
- package/dist/es/schema/nodes/corresp.js +1 -11
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/schema/nodes/title.js +1 -0
- package/dist/es/transformer/decode.js +28 -35
- package/dist/es/transformer/encode.js +3 -11
- package/dist/es/version.js +1 -1
- package/dist/types/lib/table-cell-styles.d.ts +1 -1
- package/dist/types/schema/index.d.ts +0 -2
- package/dist/types/schema/nodes/corresp.d.ts +0 -1
- package/dist/types/schema/nodes/title.d.ts +1 -0
- package/dist/types/transformer/decode.d.ts +0 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -594,7 +594,7 @@ class JATSExporter {
|
|
|
594
594
|
this.createSerializer = () => {
|
|
595
595
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
596
596
|
const nodes = {
|
|
597
|
-
author_notes: () => '',
|
|
597
|
+
author_notes: () => ['author-notes', 0],
|
|
598
598
|
corresp: () => '',
|
|
599
599
|
title: () => '',
|
|
600
600
|
affiliations: () => '',
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -150,8 +150,6 @@ __exportStar(require("./nodes/affiliations"), exports);
|
|
|
150
150
|
__exportStar(require("./nodes/contributors"), exports);
|
|
151
151
|
__exportStar(require("./nodes/supplement"), exports);
|
|
152
152
|
__exportStar(require("./nodes/supplements"), exports);
|
|
153
|
-
__exportStar(require("./nodes/corresp"), exports);
|
|
154
|
-
__exportStar(require("./nodes/author_notes"), exports);
|
|
155
153
|
exports.schema = new prosemirror_model_1.Schema({
|
|
156
154
|
marks: {
|
|
157
155
|
bold: marks_1.bold,
|
|
@@ -21,14 +21,7 @@ exports.authorNotes = {
|
|
|
21
21
|
id: { default: '' },
|
|
22
22
|
dataTracked: { default: null },
|
|
23
23
|
},
|
|
24
|
-
content: '
|
|
24
|
+
content: '(corresp | footnote | paragraph)+',
|
|
25
25
|
group: 'block element',
|
|
26
|
-
toDOM: (
|
|
27
|
-
'div',
|
|
28
|
-
{
|
|
29
|
-
class: 'author-notes',
|
|
30
|
-
id: node.attrs.id,
|
|
31
|
-
},
|
|
32
|
-
0,
|
|
33
|
-
],
|
|
26
|
+
toDOM: () => ['author-notes', 0],
|
|
34
27
|
};
|
|
@@ -18,10 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.backmatter = void 0;
|
|
19
19
|
exports.backmatter = {
|
|
20
20
|
content: 'sections*',
|
|
21
|
-
atom: true,
|
|
22
21
|
attrs: {
|
|
23
22
|
id: { default: '' },
|
|
23
|
+
placeholder: { default: ' ' },
|
|
24
24
|
},
|
|
25
|
-
group: 'block',
|
|
25
|
+
group: 'block element',
|
|
26
|
+
parseDOM: [{ tag: 'div.backmatter' }],
|
|
26
27
|
toDOM: () => ['div', { class: 'backmatter' }, 0],
|
|
27
28
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.corresp = void 0;
|
|
4
4
|
exports.corresp = {
|
|
5
5
|
content: 'inline*',
|
|
6
6
|
attrs: {
|
|
@@ -9,16 +9,5 @@ exports.corresp = {
|
|
|
9
9
|
dataTracked: { default: null },
|
|
10
10
|
},
|
|
11
11
|
group: 'block',
|
|
12
|
-
toDOM: (
|
|
13
|
-
return [
|
|
14
|
-
'div',
|
|
15
|
-
{
|
|
16
|
-
class: 'corresp',
|
|
17
|
-
id: node.attrs.id,
|
|
18
|
-
},
|
|
19
|
-
0,
|
|
20
|
-
];
|
|
21
|
-
},
|
|
12
|
+
toDOM: () => ['corresp', 0],
|
|
22
13
|
};
|
|
23
|
-
const isCorrespNode = (node) => node.type === node.type.schema.nodes.corresp;
|
|
24
|
-
exports.isCorrespNode = isCorrespNode;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isManuscriptNode = exports.manuscript = void 0;
|
|
19
19
|
exports.manuscript = {
|
|
20
|
-
content: 'title? contributors? affiliations?
|
|
20
|
+
content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
doi: { default: '' },
|
|
@@ -63,8 +63,8 @@ const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(
|
|
|
63
63
|
exports.sortSectionsByPriority = sortSectionsByPriority;
|
|
64
64
|
const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Section).sort(exports.sortSectionsByPriority);
|
|
65
65
|
const getAffiliations = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Affiliation);
|
|
66
|
-
const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
|
|
67
66
|
const getAuthorNotes = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.AuthorNotes);
|
|
67
|
+
const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
|
|
68
68
|
const getKeywordElements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordsElement);
|
|
69
69
|
const getSupplements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Supplement);
|
|
70
70
|
const getKeywordGroups = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordGroup);
|
|
@@ -87,24 +87,31 @@ 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
|
+
}
|
|
90
93
|
return schema_1.schema.nodes.affiliations.createAndFill({}, affiliations);
|
|
91
94
|
}
|
|
92
95
|
createContributorsNode() {
|
|
93
96
|
const contributors = getContributors(this.modelMap)
|
|
94
97
|
.map((c) => this.decode(c))
|
|
95
98
|
.filter(Boolean);
|
|
96
|
-
const
|
|
97
|
-
return schema_1.schema.nodes.contributors.createAndFill({}, content);
|
|
98
|
-
}
|
|
99
|
-
createAuthorNotesNode() {
|
|
100
|
-
return getAuthorNotes(this.modelMap)
|
|
99
|
+
const authorNotes = getAuthorNotes(this.modelMap)
|
|
101
100
|
.map((authorNote) => this.decode(authorNote))
|
|
102
101
|
.filter(Boolean);
|
|
102
|
+
const content = [...contributors, ...authorNotes];
|
|
103
|
+
if (!content.length) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return schema_1.schema.nodes.contributors.createAndFill({}, content);
|
|
103
107
|
}
|
|
104
108
|
createKeywordsNode() {
|
|
105
109
|
const elements = getKeywordElements(this.modelMap)
|
|
106
110
|
.map((e) => this.decode(e))
|
|
107
111
|
.filter(Boolean);
|
|
112
|
+
if (!elements.length) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
108
115
|
return schema_1.schema.nodes.keywords.createAndFill({}, [
|
|
109
116
|
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Keywords')),
|
|
110
117
|
...elements,
|
|
@@ -114,6 +121,9 @@ class Decoder {
|
|
|
114
121
|
const elements = getSupplements(this.modelMap)
|
|
115
122
|
.map((e) => this.decode(e))
|
|
116
123
|
.filter(Boolean);
|
|
124
|
+
if (!elements.length) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
117
127
|
return schema_1.schema.nodes.supplements.createAndFill({}, [
|
|
118
128
|
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('SupplementaryMaterials')),
|
|
119
129
|
...elements,
|
|
@@ -146,11 +156,7 @@ class Decoder {
|
|
|
146
156
|
const abstracts = schema_1.schema.nodes.abstracts.createAndFill({}, groups[section_group_type_1.abstractsType._id]);
|
|
147
157
|
const body = schema_1.schema.nodes.body.createAndFill({}, groups[section_group_type_1.bodyType._id]);
|
|
148
158
|
const backmatter = schema_1.schema.nodes.backmatter.createAndFill({}, groups[section_group_type_1.backmatterType._id]);
|
|
149
|
-
return
|
|
150
|
-
abstracts,
|
|
151
|
-
body,
|
|
152
|
-
backmatter,
|
|
153
|
-
};
|
|
159
|
+
return [abstracts, body, backmatter];
|
|
154
160
|
}
|
|
155
161
|
createCommentNodes(model) {
|
|
156
162
|
const comments = [];
|
|
@@ -523,12 +529,9 @@ class Decoder {
|
|
|
523
529
|
[json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
|
|
524
530
|
const model = data;
|
|
525
531
|
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
526
|
-
return schema_1.schema.nodes.author_notes.
|
|
532
|
+
return schema_1.schema.nodes.author_notes.create({
|
|
527
533
|
id: model._id,
|
|
528
|
-
},
|
|
529
|
-
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Correspondence')),
|
|
530
|
-
...content,
|
|
531
|
-
]);
|
|
534
|
+
}, content);
|
|
532
535
|
},
|
|
533
536
|
[json_schema_1.ObjectTypes.Corresponding]: (data) => {
|
|
534
537
|
const model = data;
|
|
@@ -721,26 +724,16 @@ class Decoder {
|
|
|
721
724
|
};
|
|
722
725
|
this.getModel = (id) => this.modelMap.get(id);
|
|
723
726
|
this.createArticleNode = (manuscriptID) => {
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
const contents = [
|
|
733
|
-
title,
|
|
734
|
-
contributors,
|
|
735
|
-
affiliations,
|
|
736
|
-
...authorNotes,
|
|
737
|
-
keywords,
|
|
738
|
-
suppl,
|
|
739
|
-
abstracts,
|
|
740
|
-
body,
|
|
741
|
-
backmatter,
|
|
742
|
-
comments,
|
|
727
|
+
const nodes = [
|
|
728
|
+
this.createTitleNode(),
|
|
729
|
+
this.createContributorsNode(),
|
|
730
|
+
this.createAffiliationsNode(),
|
|
731
|
+
this.createKeywordsNode(),
|
|
732
|
+
this.createSupplementsNode(),
|
|
733
|
+
...this.createContentSections(),
|
|
734
|
+
this.createCommentsNode(),
|
|
743
735
|
];
|
|
736
|
+
const contents = nodes.filter((node) => node !== false);
|
|
744
737
|
return schema_1.schema.nodes.manuscript.create({
|
|
745
738
|
id: manuscriptID || this.getManuscriptID(),
|
|
746
739
|
doi: this.getManuscriptDOI() || '',
|
|
@@ -206,16 +206,6 @@ const containedParagraphIDs = (node) => {
|
|
|
206
206
|
const paragraphNodeType = node.type.schema.nodes.paragraph;
|
|
207
207
|
return containedObjectIDs(node, [paragraphNodeType]);
|
|
208
208
|
};
|
|
209
|
-
const containedAuthorNotesIDs = (node) => {
|
|
210
|
-
const correspNodeType = node.type.schema.nodes.corresp;
|
|
211
|
-
const footnoteNodetype = node.type.schema.nodes.footnote;
|
|
212
|
-
const paragraphNodeType = node.type.schema.nodes.paragraph;
|
|
213
|
-
return containedObjectIDs(node, [
|
|
214
|
-
correspNodeType,
|
|
215
|
-
footnoteNodetype,
|
|
216
|
-
paragraphNodeType,
|
|
217
|
-
]);
|
|
218
|
-
};
|
|
219
209
|
const containedBibliographyItemIDs = (node) => {
|
|
220
210
|
const bibliographyItemNodeType = node.type.schema.nodes.bibliography_item;
|
|
221
211
|
return containedObjectIDs(node, [bibliographyItemNodeType]);
|
|
@@ -284,6 +274,7 @@ const encoders = {
|
|
|
284
274
|
title: (0, exports.inlineContents)(node),
|
|
285
275
|
subtitle: node.attrs.subtitle,
|
|
286
276
|
runningTitle: node.attrs.runningTitle,
|
|
277
|
+
placeholder: node.attrs.placeholder,
|
|
287
278
|
_id: node.attrs._id,
|
|
288
279
|
}),
|
|
289
280
|
bibliography_element: (node) => ({
|
|
@@ -407,7 +398,7 @@ const encoders = {
|
|
|
407
398
|
containedObjectIDs: tableElementFooterContainedIDs(node),
|
|
408
399
|
}),
|
|
409
400
|
author_notes: (node) => ({
|
|
410
|
-
containedObjectIDs:
|
|
401
|
+
containedObjectIDs: containedObjectIDs(node),
|
|
411
402
|
}),
|
|
412
403
|
footnotes_section: (node, parent, path, priority) => ({
|
|
413
404
|
category: (0, section_category_1.buildSectionCategory)(node),
|
|
@@ -568,6 +559,7 @@ exports.modelFromNode = modelFromNode;
|
|
|
568
559
|
const containerTypes = [
|
|
569
560
|
schema_1.schema.nodes.affiliations,
|
|
570
561
|
schema_1.schema.nodes.contributors,
|
|
562
|
+
schema_1.schema.nodes.affiliations,
|
|
571
563
|
schema_1.schema.nodes.keywords,
|
|
572
564
|
schema_1.schema.nodes.supplements,
|
|
573
565
|
schema_1.schema.nodes.abstracts,
|
package/dist/cjs/version.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import mime from 'mime';
|
|
17
17
|
import { DOMParser, Fragment } from 'prosemirror-model';
|
|
18
|
-
import { schema } from '../../schema';
|
|
18
|
+
import { schema, } from '../../schema';
|
|
19
19
|
import { chooseSectionCategory } from '../../transformer';
|
|
20
20
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
21
21
|
const chooseContentType = (graphicNode) => {
|
|
@@ -586,7 +586,7 @@ export class JATSExporter {
|
|
|
586
586
|
this.createSerializer = () => {
|
|
587
587
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
588
588
|
const nodes = {
|
|
589
|
-
author_notes: () => '',
|
|
589
|
+
author_notes: () => ['author-notes', 0],
|
|
590
590
|
corresp: () => '',
|
|
591
591
|
title: () => '',
|
|
592
592
|
affiliations: () => '',
|
package/dist/es/schema/index.js
CHANGED
|
@@ -133,8 +133,6 @@ export * from './nodes/affiliations';
|
|
|
133
133
|
export * from './nodes/contributors';
|
|
134
134
|
export * from './nodes/supplement';
|
|
135
135
|
export * from './nodes/supplements';
|
|
136
|
-
export * from './nodes/corresp';
|
|
137
|
-
export * from './nodes/author_notes';
|
|
138
136
|
export const schema = new Schema({
|
|
139
137
|
marks: {
|
|
140
138
|
bold,
|
|
@@ -18,14 +18,7 @@ export const authorNotes = {
|
|
|
18
18
|
id: { default: '' },
|
|
19
19
|
dataTracked: { default: null },
|
|
20
20
|
},
|
|
21
|
-
content: '
|
|
21
|
+
content: '(corresp | footnote | paragraph)+',
|
|
22
22
|
group: 'block element',
|
|
23
|
-
toDOM: (
|
|
24
|
-
'div',
|
|
25
|
-
{
|
|
26
|
-
class: 'author-notes',
|
|
27
|
-
id: node.attrs.id,
|
|
28
|
-
},
|
|
29
|
-
0,
|
|
30
|
-
],
|
|
23
|
+
toDOM: () => ['author-notes', 0],
|
|
31
24
|
};
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export const backmatter = {
|
|
17
17
|
content: 'sections*',
|
|
18
|
-
atom: true,
|
|
19
18
|
attrs: {
|
|
20
19
|
id: { default: '' },
|
|
20
|
+
placeholder: { default: ' ' },
|
|
21
21
|
},
|
|
22
|
-
group: 'block',
|
|
22
|
+
group: 'block element',
|
|
23
|
+
parseDOM: [{ tag: 'div.backmatter' }],
|
|
23
24
|
toDOM: () => ['div', { class: 'backmatter' }, 0],
|
|
24
25
|
};
|
|
@@ -6,15 +6,5 @@ export const corresp = {
|
|
|
6
6
|
dataTracked: { default: null },
|
|
7
7
|
},
|
|
8
8
|
group: 'block',
|
|
9
|
-
toDOM: (
|
|
10
|
-
return [
|
|
11
|
-
'div',
|
|
12
|
-
{
|
|
13
|
-
class: 'corresp',
|
|
14
|
-
id: node.attrs.id,
|
|
15
|
-
},
|
|
16
|
-
0,
|
|
17
|
-
];
|
|
18
|
-
},
|
|
9
|
+
toDOM: () => ['corresp', 0],
|
|
19
10
|
};
|
|
20
|
-
export const isCorrespNode = (node) => node.type === node.type.schema.nodes.corresp;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const manuscript = {
|
|
17
|
-
content: 'title? contributors? affiliations?
|
|
17
|
+
content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
doi: { default: '' },
|
|
@@ -54,8 +54,8 @@ export const getModelsByType = (modelMap, objectType) => {
|
|
|
54
54
|
export const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(a.priority) - Number(b.priority);
|
|
55
55
|
const getSections = (modelMap) => getModelsByType(modelMap, ObjectTypes.Section).sort(sortSectionsByPriority);
|
|
56
56
|
const getAffiliations = (modelMap) => getModelsByType(modelMap, ObjectTypes.Affiliation);
|
|
57
|
-
const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
|
|
58
57
|
const getAuthorNotes = (modelMap) => getModelsByType(modelMap, ObjectTypes.AuthorNotes);
|
|
58
|
+
const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
|
|
59
59
|
const getKeywordElements = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordsElement);
|
|
60
60
|
const getSupplements = (modelMap) => getModelsByType(modelMap, ObjectTypes.Supplement);
|
|
61
61
|
const getKeywordGroups = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordGroup);
|
|
@@ -78,24 +78,31 @@ 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
|
+
}
|
|
81
84
|
return schema.nodes.affiliations.createAndFill({}, affiliations);
|
|
82
85
|
}
|
|
83
86
|
createContributorsNode() {
|
|
84
87
|
const contributors = getContributors(this.modelMap)
|
|
85
88
|
.map((c) => this.decode(c))
|
|
86
89
|
.filter(Boolean);
|
|
87
|
-
const
|
|
88
|
-
return schema.nodes.contributors.createAndFill({}, content);
|
|
89
|
-
}
|
|
90
|
-
createAuthorNotesNode() {
|
|
91
|
-
return getAuthorNotes(this.modelMap)
|
|
90
|
+
const authorNotes = getAuthorNotes(this.modelMap)
|
|
92
91
|
.map((authorNote) => this.decode(authorNote))
|
|
93
92
|
.filter(Boolean);
|
|
93
|
+
const content = [...contributors, ...authorNotes];
|
|
94
|
+
if (!content.length) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return schema.nodes.contributors.createAndFill({}, content);
|
|
94
98
|
}
|
|
95
99
|
createKeywordsNode() {
|
|
96
100
|
const elements = getKeywordElements(this.modelMap)
|
|
97
101
|
.map((e) => this.decode(e))
|
|
98
102
|
.filter(Boolean);
|
|
103
|
+
if (!elements.length) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
99
106
|
return schema.nodes.keywords.createAndFill({}, [
|
|
100
107
|
schema.nodes.section_title.create({}, schema.text('Keywords')),
|
|
101
108
|
...elements,
|
|
@@ -105,6 +112,9 @@ export class Decoder {
|
|
|
105
112
|
const elements = getSupplements(this.modelMap)
|
|
106
113
|
.map((e) => this.decode(e))
|
|
107
114
|
.filter(Boolean);
|
|
115
|
+
if (!elements.length) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
108
118
|
return schema.nodes.supplements.createAndFill({}, [
|
|
109
119
|
schema.nodes.section_title.create({}, schema.text('SupplementaryMaterials')),
|
|
110
120
|
...elements,
|
|
@@ -137,11 +147,7 @@ export class Decoder {
|
|
|
137
147
|
const abstracts = schema.nodes.abstracts.createAndFill({}, groups[abstractsType._id]);
|
|
138
148
|
const body = schema.nodes.body.createAndFill({}, groups[bodyType._id]);
|
|
139
149
|
const backmatter = schema.nodes.backmatter.createAndFill({}, groups[backmatterType._id]);
|
|
140
|
-
return
|
|
141
|
-
abstracts,
|
|
142
|
-
body,
|
|
143
|
-
backmatter,
|
|
144
|
-
};
|
|
150
|
+
return [abstracts, body, backmatter];
|
|
145
151
|
}
|
|
146
152
|
createCommentNodes(model) {
|
|
147
153
|
const comments = [];
|
|
@@ -514,12 +520,9 @@ export class Decoder {
|
|
|
514
520
|
[ObjectTypes.AuthorNotes]: (data) => {
|
|
515
521
|
const model = data;
|
|
516
522
|
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
517
|
-
return schema.nodes.author_notes.
|
|
523
|
+
return schema.nodes.author_notes.create({
|
|
518
524
|
id: model._id,
|
|
519
|
-
},
|
|
520
|
-
schema.nodes.section_title.create({}, schema.text('Correspondence')),
|
|
521
|
-
...content,
|
|
522
|
-
]);
|
|
525
|
+
}, content);
|
|
523
526
|
},
|
|
524
527
|
[ObjectTypes.Corresponding]: (data) => {
|
|
525
528
|
const model = data;
|
|
@@ -712,26 +715,16 @@ export class Decoder {
|
|
|
712
715
|
};
|
|
713
716
|
this.getModel = (id) => this.modelMap.get(id);
|
|
714
717
|
this.createArticleNode = (manuscriptID) => {
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
const contents = [
|
|
724
|
-
title,
|
|
725
|
-
contributors,
|
|
726
|
-
affiliations,
|
|
727
|
-
...authorNotes,
|
|
728
|
-
keywords,
|
|
729
|
-
suppl,
|
|
730
|
-
abstracts,
|
|
731
|
-
body,
|
|
732
|
-
backmatter,
|
|
733
|
-
comments,
|
|
718
|
+
const nodes = [
|
|
719
|
+
this.createTitleNode(),
|
|
720
|
+
this.createContributorsNode(),
|
|
721
|
+
this.createAffiliationsNode(),
|
|
722
|
+
this.createKeywordsNode(),
|
|
723
|
+
this.createSupplementsNode(),
|
|
724
|
+
...this.createContentSections(),
|
|
725
|
+
this.createCommentsNode(),
|
|
734
726
|
];
|
|
727
|
+
const contents = nodes.filter((node) => node !== false);
|
|
735
728
|
return schema.nodes.manuscript.create({
|
|
736
729
|
id: manuscriptID || this.getManuscriptID(),
|
|
737
730
|
doi: this.getManuscriptDOI() || '',
|
|
@@ -198,16 +198,6 @@ const containedParagraphIDs = (node) => {
|
|
|
198
198
|
const paragraphNodeType = node.type.schema.nodes.paragraph;
|
|
199
199
|
return containedObjectIDs(node, [paragraphNodeType]);
|
|
200
200
|
};
|
|
201
|
-
const containedAuthorNotesIDs = (node) => {
|
|
202
|
-
const correspNodeType = node.type.schema.nodes.corresp;
|
|
203
|
-
const footnoteNodetype = node.type.schema.nodes.footnote;
|
|
204
|
-
const paragraphNodeType = node.type.schema.nodes.paragraph;
|
|
205
|
-
return containedObjectIDs(node, [
|
|
206
|
-
correspNodeType,
|
|
207
|
-
footnoteNodetype,
|
|
208
|
-
paragraphNodeType,
|
|
209
|
-
]);
|
|
210
|
-
};
|
|
211
201
|
const containedBibliographyItemIDs = (node) => {
|
|
212
202
|
const bibliographyItemNodeType = node.type.schema.nodes.bibliography_item;
|
|
213
203
|
return containedObjectIDs(node, [bibliographyItemNodeType]);
|
|
@@ -276,6 +266,7 @@ const encoders = {
|
|
|
276
266
|
title: inlineContents(node),
|
|
277
267
|
subtitle: node.attrs.subtitle,
|
|
278
268
|
runningTitle: node.attrs.runningTitle,
|
|
269
|
+
placeholder: node.attrs.placeholder,
|
|
279
270
|
_id: node.attrs._id,
|
|
280
271
|
}),
|
|
281
272
|
bibliography_element: (node) => ({
|
|
@@ -399,7 +390,7 @@ const encoders = {
|
|
|
399
390
|
containedObjectIDs: tableElementFooterContainedIDs(node),
|
|
400
391
|
}),
|
|
401
392
|
author_notes: (node) => ({
|
|
402
|
-
containedObjectIDs:
|
|
393
|
+
containedObjectIDs: containedObjectIDs(node),
|
|
403
394
|
}),
|
|
404
395
|
footnotes_section: (node, parent, path, priority) => ({
|
|
405
396
|
category: buildSectionCategory(node),
|
|
@@ -559,6 +550,7 @@ export const modelFromNode = (node, parent, path, priority) => {
|
|
|
559
550
|
const containerTypes = [
|
|
560
551
|
schema.nodes.affiliations,
|
|
561
552
|
schema.nodes.contributors,
|
|
553
|
+
schema.nodes.affiliations,
|
|
562
554
|
schema.nodes.keywords,
|
|
563
555
|
schema.nodes.supplements,
|
|
564
556
|
schema.nodes.abstracts,
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.10
|
|
1
|
+
export const VERSION = "2.3.10";
|
|
@@ -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 = typeof TABLE_CELL_STYLES[number];
|
|
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;
|
|
@@ -71,6 +71,4 @@ export * from './nodes/affiliations';
|
|
|
71
71
|
export * from './nodes/contributors';
|
|
72
72
|
export * from './nodes/supplement';
|
|
73
73
|
export * from './nodes/supplements';
|
|
74
|
-
export * from './nodes/corresp';
|
|
75
|
-
export * from './nodes/author_notes';
|
|
76
74
|
export declare const schema: Schema<Nodes, Marks>;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.3.10
|
|
1
|
+
export declare const VERSION = "2.3.10";
|
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.10
|
|
4
|
+
"version": "2.3.10",
|
|
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.10",
|
|
34
|
+
"@manuscripts/library": "1.3.9",
|
|
35
35
|
"debug": "^4.3.4",
|
|
36
36
|
"jszip": "^3.10.1",
|
|
37
37
|
"mime": "^3.0.0",
|