@manuscripts/transform 2.3.9 → 2.3.10-LEAN-3595.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/cjs/jats/jats-exporter.js +1 -1
- package/dist/cjs/schema/index.js +2 -0
- package/dist/cjs/schema/nodes/author_notes.js +9 -2
- package/dist/cjs/schema/nodes/contributors.js +1 -1
- package/dist/cjs/schema/nodes/corresp.js +13 -2
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/transformer/decode.js +13 -6
- package/dist/cjs/transformer/encode.js +11 -2
- 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 +2 -0
- package/dist/es/schema/nodes/author_notes.js +9 -2
- package/dist/es/schema/nodes/contributors.js +1 -1
- package/dist/es/schema/nodes/corresp.js +11 -1
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/transformer/decode.js +13 -6
- package/dist/es/transformer/encode.js +11 -2
- package/dist/es/version.js +1 -1
- package/dist/types/schema/index.d.ts +2 -0
- package/dist/types/schema/nodes/corresp.d.ts +1 -0
- package/dist/types/transformer/decode.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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: () => '',
|
|
598
598
|
corresp: () => '',
|
|
599
599
|
title: () => '',
|
|
600
600
|
affiliations: () => '',
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -150,6 +150,8 @@ __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);
|
|
153
155
|
exports.schema = new prosemirror_model_1.Schema({
|
|
154
156
|
marks: {
|
|
155
157
|
bold: marks_1.bold,
|
|
@@ -21,7 +21,14 @@ exports.authorNotes = {
|
|
|
21
21
|
id: { default: '' },
|
|
22
22
|
dataTracked: { default: null },
|
|
23
23
|
},
|
|
24
|
-
content: '(corresp | footnote | paragraph)+',
|
|
24
|
+
content: 'section_title (corresp | footnote | paragraph)+',
|
|
25
25
|
group: 'block element',
|
|
26
|
-
toDOM: () => [
|
|
26
|
+
toDOM: (node) => [
|
|
27
|
+
'div',
|
|
28
|
+
{
|
|
29
|
+
class: 'author-notes',
|
|
30
|
+
id: node.attrs.id,
|
|
31
|
+
},
|
|
32
|
+
0,
|
|
33
|
+
],
|
|
27
34
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.corresp = void 0;
|
|
3
|
+
exports.isCorrespNode = exports.corresp = void 0;
|
|
4
4
|
exports.corresp = {
|
|
5
5
|
content: 'inline*',
|
|
6
6
|
attrs: {
|
|
@@ -9,5 +9,16 @@ exports.corresp = {
|
|
|
9
9
|
dataTracked: { default: null },
|
|
10
10
|
},
|
|
11
11
|
group: 'block',
|
|
12
|
-
toDOM: () =>
|
|
12
|
+
toDOM: (node) => {
|
|
13
|
+
return [
|
|
14
|
+
'div',
|
|
15
|
+
{
|
|
16
|
+
class: 'corresp',
|
|
17
|
+
id: node.attrs.id,
|
|
18
|
+
},
|
|
19
|
+
0,
|
|
20
|
+
];
|
|
21
|
+
},
|
|
13
22
|
};
|
|
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? keywords? supplements? abstracts body backmatter comments',
|
|
20
|
+
content: 'title? contributors? affiliations? author_notes? 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 getAuthorNotes = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.AuthorNotes);
|
|
67
66
|
const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
|
|
67
|
+
const getAuthorNotes = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.AuthorNotes);
|
|
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);
|
|
@@ -93,11 +93,13 @@ class Decoder {
|
|
|
93
93
|
const contributors = getContributors(this.modelMap)
|
|
94
94
|
.map((c) => this.decode(c))
|
|
95
95
|
.filter(Boolean);
|
|
96
|
-
const
|
|
96
|
+
const content = [...contributors];
|
|
97
|
+
return schema_1.schema.nodes.contributors.createAndFill({}, content);
|
|
98
|
+
}
|
|
99
|
+
createAuthorNotesNode() {
|
|
100
|
+
return getAuthorNotes(this.modelMap)
|
|
97
101
|
.map((authorNote) => this.decode(authorNote))
|
|
98
102
|
.filter(Boolean);
|
|
99
|
-
const content = [...contributors, ...authorNotes];
|
|
100
|
-
return schema_1.schema.nodes.contributors.createAndFill({}, content);
|
|
101
103
|
}
|
|
102
104
|
createKeywordsNode() {
|
|
103
105
|
const elements = getKeywordElements(this.modelMap)
|
|
@@ -521,9 +523,12 @@ class Decoder {
|
|
|
521
523
|
[json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
|
|
522
524
|
const model = data;
|
|
523
525
|
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
524
|
-
return schema_1.schema.nodes.author_notes.
|
|
526
|
+
return schema_1.schema.nodes.author_notes.createAndFill({
|
|
525
527
|
id: model._id,
|
|
526
|
-
},
|
|
528
|
+
}, [
|
|
529
|
+
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Correspondence')),
|
|
530
|
+
...content,
|
|
531
|
+
]);
|
|
527
532
|
},
|
|
528
533
|
[json_schema_1.ObjectTypes.Corresponding]: (data) => {
|
|
529
534
|
const model = data;
|
|
@@ -719,6 +724,7 @@ class Decoder {
|
|
|
719
724
|
const title = this.createTitleNode();
|
|
720
725
|
const contributors = this.createContributorsNode();
|
|
721
726
|
const affiliations = this.createAffiliationsNode();
|
|
727
|
+
const authorNotes = this.createAuthorNotesNode();
|
|
722
728
|
const keywords = this.createKeywordsNode();
|
|
723
729
|
const suppl = this.createSupplementsNode();
|
|
724
730
|
const { abstracts, body, backmatter } = this.createContentSections();
|
|
@@ -727,6 +733,7 @@ class Decoder {
|
|
|
727
733
|
title,
|
|
728
734
|
contributors,
|
|
729
735
|
affiliations,
|
|
736
|
+
...authorNotes,
|
|
730
737
|
keywords,
|
|
731
738
|
suppl,
|
|
732
739
|
abstracts,
|
|
@@ -206,6 +206,16 @@ 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
|
+
};
|
|
209
219
|
const containedBibliographyItemIDs = (node) => {
|
|
210
220
|
const bibliographyItemNodeType = node.type.schema.nodes.bibliography_item;
|
|
211
221
|
return containedObjectIDs(node, [bibliographyItemNodeType]);
|
|
@@ -397,7 +407,7 @@ const encoders = {
|
|
|
397
407
|
containedObjectIDs: tableElementFooterContainedIDs(node),
|
|
398
408
|
}),
|
|
399
409
|
author_notes: (node) => ({
|
|
400
|
-
containedObjectIDs:
|
|
410
|
+
containedObjectIDs: containedAuthorNotesIDs(node),
|
|
401
411
|
}),
|
|
402
412
|
footnotes_section: (node, parent, path, priority) => ({
|
|
403
413
|
category: (0, section_category_1.buildSectionCategory)(node),
|
|
@@ -558,7 +568,6 @@ exports.modelFromNode = modelFromNode;
|
|
|
558
568
|
const containerTypes = [
|
|
559
569
|
schema_1.schema.nodes.affiliations,
|
|
560
570
|
schema_1.schema.nodes.contributors,
|
|
561
|
-
schema_1.schema.nodes.affiliations,
|
|
562
571
|
schema_1.schema.nodes.keywords,
|
|
563
572
|
schema_1.schema.nodes.supplements,
|
|
564
573
|
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
|
|
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: () => '',
|
|
590
590
|
corresp: () => '',
|
|
591
591
|
title: () => '',
|
|
592
592
|
affiliations: () => '',
|
package/dist/es/schema/index.js
CHANGED
|
@@ -133,6 +133,8 @@ 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';
|
|
136
138
|
export const schema = new Schema({
|
|
137
139
|
marks: {
|
|
138
140
|
bold,
|
|
@@ -18,7 +18,14 @@ export const authorNotes = {
|
|
|
18
18
|
id: { default: '' },
|
|
19
19
|
dataTracked: { default: null },
|
|
20
20
|
},
|
|
21
|
-
content: '(corresp | footnote | paragraph)+',
|
|
21
|
+
content: 'section_title (corresp | footnote | paragraph)+',
|
|
22
22
|
group: 'block element',
|
|
23
|
-
toDOM: () => [
|
|
23
|
+
toDOM: (node) => [
|
|
24
|
+
'div',
|
|
25
|
+
{
|
|
26
|
+
class: 'author-notes',
|
|
27
|
+
id: node.attrs.id,
|
|
28
|
+
},
|
|
29
|
+
0,
|
|
30
|
+
],
|
|
24
31
|
};
|
|
@@ -6,5 +6,15 @@ export const corresp = {
|
|
|
6
6
|
dataTracked: { default: null },
|
|
7
7
|
},
|
|
8
8
|
group: 'block',
|
|
9
|
-
toDOM: () =>
|
|
9
|
+
toDOM: (node) => {
|
|
10
|
+
return [
|
|
11
|
+
'div',
|
|
12
|
+
{
|
|
13
|
+
class: 'corresp',
|
|
14
|
+
id: node.attrs.id,
|
|
15
|
+
},
|
|
16
|
+
0,
|
|
17
|
+
];
|
|
18
|
+
},
|
|
10
19
|
};
|
|
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? keywords? supplements? abstracts body backmatter comments',
|
|
17
|
+
content: 'title? contributors? affiliations? author_notes? 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 getAuthorNotes = (modelMap) => getModelsByType(modelMap, ObjectTypes.AuthorNotes);
|
|
58
57
|
const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
|
|
58
|
+
const getAuthorNotes = (modelMap) => getModelsByType(modelMap, ObjectTypes.AuthorNotes);
|
|
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);
|
|
@@ -84,11 +84,13 @@ export class Decoder {
|
|
|
84
84
|
const contributors = getContributors(this.modelMap)
|
|
85
85
|
.map((c) => this.decode(c))
|
|
86
86
|
.filter(Boolean);
|
|
87
|
-
const
|
|
87
|
+
const content = [...contributors];
|
|
88
|
+
return schema.nodes.contributors.createAndFill({}, content);
|
|
89
|
+
}
|
|
90
|
+
createAuthorNotesNode() {
|
|
91
|
+
return getAuthorNotes(this.modelMap)
|
|
88
92
|
.map((authorNote) => this.decode(authorNote))
|
|
89
93
|
.filter(Boolean);
|
|
90
|
-
const content = [...contributors, ...authorNotes];
|
|
91
|
-
return schema.nodes.contributors.createAndFill({}, content);
|
|
92
94
|
}
|
|
93
95
|
createKeywordsNode() {
|
|
94
96
|
const elements = getKeywordElements(this.modelMap)
|
|
@@ -512,9 +514,12 @@ export class Decoder {
|
|
|
512
514
|
[ObjectTypes.AuthorNotes]: (data) => {
|
|
513
515
|
const model = data;
|
|
514
516
|
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
515
|
-
return schema.nodes.author_notes.
|
|
517
|
+
return schema.nodes.author_notes.createAndFill({
|
|
516
518
|
id: model._id,
|
|
517
|
-
},
|
|
519
|
+
}, [
|
|
520
|
+
schema.nodes.section_title.create({}, schema.text('Correspondence')),
|
|
521
|
+
...content,
|
|
522
|
+
]);
|
|
518
523
|
},
|
|
519
524
|
[ObjectTypes.Corresponding]: (data) => {
|
|
520
525
|
const model = data;
|
|
@@ -710,6 +715,7 @@ export class Decoder {
|
|
|
710
715
|
const title = this.createTitleNode();
|
|
711
716
|
const contributors = this.createContributorsNode();
|
|
712
717
|
const affiliations = this.createAffiliationsNode();
|
|
718
|
+
const authorNotes = this.createAuthorNotesNode();
|
|
713
719
|
const keywords = this.createKeywordsNode();
|
|
714
720
|
const suppl = this.createSupplementsNode();
|
|
715
721
|
const { abstracts, body, backmatter } = this.createContentSections();
|
|
@@ -718,6 +724,7 @@ export class Decoder {
|
|
|
718
724
|
title,
|
|
719
725
|
contributors,
|
|
720
726
|
affiliations,
|
|
727
|
+
...authorNotes,
|
|
721
728
|
keywords,
|
|
722
729
|
suppl,
|
|
723
730
|
abstracts,
|
|
@@ -198,6 +198,16 @@ 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
|
+
};
|
|
201
211
|
const containedBibliographyItemIDs = (node) => {
|
|
202
212
|
const bibliographyItemNodeType = node.type.schema.nodes.bibliography_item;
|
|
203
213
|
return containedObjectIDs(node, [bibliographyItemNodeType]);
|
|
@@ -389,7 +399,7 @@ const encoders = {
|
|
|
389
399
|
containedObjectIDs: tableElementFooterContainedIDs(node),
|
|
390
400
|
}),
|
|
391
401
|
author_notes: (node) => ({
|
|
392
|
-
containedObjectIDs:
|
|
402
|
+
containedObjectIDs: containedAuthorNotesIDs(node),
|
|
393
403
|
}),
|
|
394
404
|
footnotes_section: (node, parent, path, priority) => ({
|
|
395
405
|
category: buildSectionCategory(node),
|
|
@@ -549,7 +559,6 @@ export const modelFromNode = (node, parent, path, priority) => {
|
|
|
549
559
|
const containerTypes = [
|
|
550
560
|
schema.nodes.affiliations,
|
|
551
561
|
schema.nodes.contributors,
|
|
552
|
-
schema.nodes.affiliations,
|
|
553
562
|
schema.nodes.keywords,
|
|
554
563
|
schema.nodes.supplements,
|
|
555
564
|
schema.nodes.abstracts,
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.
|
|
1
|
+
export const VERSION = "2.3.10-LEAN-3595.0";
|
|
@@ -71,4 +71,6 @@ 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';
|
|
74
76
|
export declare const schema: Schema<Nodes, Marks>;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.3.
|
|
1
|
+
export declare const VERSION = "2.3.10-LEAN-3595.0";
|
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.
|
|
4
|
+
"version": "2.3.10-LEAN-3595.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|