@manuscripts/transform 2.3.16-LEAN-3753.0 → 2.3.18-LEAN-3753.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 -7
- package/dist/cjs/transformer/encode.js +11 -2
- package/dist/cjs/version.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 -7
- package/dist/es/transformer/encode.js +11 -2
- 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 +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 +2 -2
|
@@ -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);
|
|
@@ -96,15 +96,17 @@ class Decoder {
|
|
|
96
96
|
const contributors = getContributors(this.modelMap)
|
|
97
97
|
.map((c) => this.decode(c))
|
|
98
98
|
.filter(Boolean);
|
|
99
|
-
const
|
|
100
|
-
.map((authorNote) => this.decode(authorNote))
|
|
101
|
-
.filter(Boolean);
|
|
102
|
-
const content = [...contributors, ...authorNotes];
|
|
99
|
+
const content = [...contributors];
|
|
103
100
|
if (!content.length) {
|
|
104
101
|
return false;
|
|
105
102
|
}
|
|
106
103
|
return schema_1.schema.nodes.contributors.createAndFill({}, content);
|
|
107
104
|
}
|
|
105
|
+
createAuthorNotesNode() {
|
|
106
|
+
return getAuthorNotes(this.modelMap)
|
|
107
|
+
.map((authorNote) => this.decode(authorNote))
|
|
108
|
+
.filter(Boolean);
|
|
109
|
+
}
|
|
108
110
|
createKeywordsNode() {
|
|
109
111
|
const elements = getKeywordElements(this.modelMap)
|
|
110
112
|
.map((e) => this.decode(e))
|
|
@@ -518,9 +520,12 @@ class Decoder {
|
|
|
518
520
|
[json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
|
|
519
521
|
const model = data;
|
|
520
522
|
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
521
|
-
return schema_1.schema.nodes.author_notes.
|
|
523
|
+
return schema_1.schema.nodes.author_notes.createAndFill({
|
|
522
524
|
id: model._id,
|
|
523
|
-
},
|
|
525
|
+
}, [
|
|
526
|
+
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Correspondence')),
|
|
527
|
+
...content,
|
|
528
|
+
]);
|
|
524
529
|
},
|
|
525
530
|
[json_schema_1.ObjectTypes.Corresponding]: (data) => {
|
|
526
531
|
const model = data;
|
|
@@ -715,6 +720,7 @@ class Decoder {
|
|
|
715
720
|
this.createTitleNode(),
|
|
716
721
|
this.createContributorsNode(),
|
|
717
722
|
this.createAffiliationsNode(),
|
|
723
|
+
...this.createAuthorNotesNode(),
|
|
718
724
|
this.createKeywordsNode(),
|
|
719
725
|
this.createSupplementsNode(),
|
|
720
726
|
...this.createContentSections(),
|
|
@@ -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]);
|
|
@@ -398,7 +408,7 @@ const encoders = {
|
|
|
398
408
|
containedObjectIDs: tableElementFooterContainedIDs(node),
|
|
399
409
|
}),
|
|
400
410
|
author_notes: (node) => ({
|
|
401
|
-
containedObjectIDs:
|
|
411
|
+
containedObjectIDs: containedAuthorNotesIDs(node),
|
|
402
412
|
}),
|
|
403
413
|
footnotes_section: (node, parent, path, priority) => ({
|
|
404
414
|
category: (0, section_category_1.buildSectionCategory)(node),
|
|
@@ -559,7 +569,6 @@ exports.modelFromNode = modelFromNode;
|
|
|
559
569
|
const containerTypes = [
|
|
560
570
|
schema_1.schema.nodes.affiliations,
|
|
561
571
|
schema_1.schema.nodes.contributors,
|
|
562
|
-
schema_1.schema.nodes.affiliations,
|
|
563
572
|
schema_1.schema.nodes.keywords,
|
|
564
573
|
schema_1.schema.nodes.supplements,
|
|
565
574
|
schema_1.schema.nodes.abstracts,
|
package/dist/cjs/version.js
CHANGED
|
@@ -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);
|
|
@@ -87,15 +87,17 @@ export class Decoder {
|
|
|
87
87
|
const contributors = getContributors(this.modelMap)
|
|
88
88
|
.map((c) => this.decode(c))
|
|
89
89
|
.filter(Boolean);
|
|
90
|
-
const
|
|
91
|
-
.map((authorNote) => this.decode(authorNote))
|
|
92
|
-
.filter(Boolean);
|
|
93
|
-
const content = [...contributors, ...authorNotes];
|
|
90
|
+
const content = [...contributors];
|
|
94
91
|
if (!content.length) {
|
|
95
92
|
return false;
|
|
96
93
|
}
|
|
97
94
|
return schema.nodes.contributors.createAndFill({}, content);
|
|
98
95
|
}
|
|
96
|
+
createAuthorNotesNode() {
|
|
97
|
+
return getAuthorNotes(this.modelMap)
|
|
98
|
+
.map((authorNote) => this.decode(authorNote))
|
|
99
|
+
.filter(Boolean);
|
|
100
|
+
}
|
|
99
101
|
createKeywordsNode() {
|
|
100
102
|
const elements = getKeywordElements(this.modelMap)
|
|
101
103
|
.map((e) => this.decode(e))
|
|
@@ -509,9 +511,12 @@ export class Decoder {
|
|
|
509
511
|
[ObjectTypes.AuthorNotes]: (data) => {
|
|
510
512
|
const model = data;
|
|
511
513
|
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
512
|
-
return schema.nodes.author_notes.
|
|
514
|
+
return schema.nodes.author_notes.createAndFill({
|
|
513
515
|
id: model._id,
|
|
514
|
-
},
|
|
516
|
+
}, [
|
|
517
|
+
schema.nodes.section_title.create({}, schema.text('Correspondence')),
|
|
518
|
+
...content,
|
|
519
|
+
]);
|
|
515
520
|
},
|
|
516
521
|
[ObjectTypes.Corresponding]: (data) => {
|
|
517
522
|
const model = data;
|
|
@@ -706,6 +711,7 @@ export class Decoder {
|
|
|
706
711
|
this.createTitleNode(),
|
|
707
712
|
this.createContributorsNode(),
|
|
708
713
|
this.createAffiliationsNode(),
|
|
714
|
+
...this.createAuthorNotesNode(),
|
|
709
715
|
this.createKeywordsNode(),
|
|
710
716
|
this.createSupplementsNode(),
|
|
711
717
|
...this.createContentSections(),
|
|
@@ -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]);
|
|
@@ -390,7 +400,7 @@ const encoders = {
|
|
|
390
400
|
containedObjectIDs: tableElementFooterContainedIDs(node),
|
|
391
401
|
}),
|
|
392
402
|
author_notes: (node) => ({
|
|
393
|
-
containedObjectIDs:
|
|
403
|
+
containedObjectIDs: containedAuthorNotesIDs(node),
|
|
394
404
|
}),
|
|
395
405
|
footnotes_section: (node, parent, path, priority) => ({
|
|
396
406
|
category: buildSectionCategory(node),
|
|
@@ -550,7 +560,6 @@ export const modelFromNode = (node, parent, path, priority) => {
|
|
|
550
560
|
const containerTypes = [
|
|
551
561
|
schema.nodes.affiliations,
|
|
552
562
|
schema.nodes.contributors,
|
|
553
|
-
schema.nodes.affiliations,
|
|
554
563
|
schema.nodes.keywords,
|
|
555
564
|
schema.nodes.supplements,
|
|
556
565
|
schema.nodes.abstracts,
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.
|
|
1
|
+
export const VERSION = "2.3.18-LEAN-3753.0";
|
|
@@ -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;
|
|
@@ -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.18-LEAN-3753.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.18-LEAN-3753.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -79,4 +79,4 @@
|
|
|
79
79
|
"rimraf": "^3.0.2",
|
|
80
80
|
"typescript": "^4.0.5"
|
|
81
81
|
}
|
|
82
|
-
}
|
|
82
|
+
}
|