@manuscripts/transform 1.3.7-LEAN-2707-V2 → 1.3.8
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/index.js +1 -0
- package/dist/cjs/jats/importer/jats-body-transformations.js +1 -1
- package/dist/cjs/jats/jats-exporter.js +0 -5
- package/dist/cjs/lib/core-section-categories.js +29 -0
- package/dist/cjs/schema/index.js +0 -15
- package/dist/cjs/schema/nodes/comment_list.js +1 -0
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/transformer/decode.js +15 -71
- package/dist/cjs/transformer/encode.js +6 -36
- package/dist/cjs/transformer/html.js +1 -1
- package/dist/cjs/transformer/node-types.js +1 -2
- package/dist/cjs/transformer/section-category.js +6 -10
- package/dist/es/index.js +1 -0
- package/dist/es/jats/importer/jats-body-transformations.js +2 -2
- package/dist/es/jats/jats-exporter.js +0 -5
- package/dist/es/lib/core-section-categories.js +26 -0
- package/dist/es/schema/index.js +0 -15
- package/dist/es/schema/nodes/comment_list.js +1 -0
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/transformer/decode.js +15 -71
- package/dist/es/transformer/encode.js +6 -36
- package/dist/es/transformer/html.js +1 -1
- package/dist/es/transformer/node-types.js +1 -2
- package/dist/es/transformer/section-category.js +5 -6
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/core-section-categories.d.ts +8 -0
- package/dist/types/schema/index.d.ts +0 -5
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/decode.d.ts +0 -5
- package/dist/types/transformer/section-category.d.ts +1 -1
- package/package.json +1 -2
- package/dist/cjs/schema/nodes/affiliation.js +0 -23
- package/dist/cjs/schema/nodes/affiliation_list.js +0 -10
- package/dist/cjs/schema/nodes/contributor.js +0 -15
- package/dist/cjs/schema/nodes/contributor_list.js +0 -10
- package/dist/cjs/schema/nodes/meta_section.js +0 -26
- package/dist/es/schema/nodes/affiliation.js +0 -19
- package/dist/es/schema/nodes/affiliation_list.js +0 -7
- package/dist/es/schema/nodes/contributor.js +0 -12
- package/dist/es/schema/nodes/contributor_list.js +0 -7
- package/dist/es/schema/nodes/meta_section.js +0 -23
- package/dist/types/schema/nodes/affiliation.d.ts +0 -24
- package/dist/types/schema/nodes/affiliation_list.d.ts +0 -10
- package/dist/types/schema/nodes/contributor.d.ts +0 -18
- package/dist/types/schema/nodes/contributor_list.d.ts +0 -10
- package/dist/types/schema/nodes/meta_section.d.ts +0 -25
package/dist/cjs/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.isSectionLabelNode = void 0;
|
|
18
|
+
__exportStar(require("./lib/core-section-categories"), exports);
|
|
18
19
|
__exportStar(require("./lib/table-cell-styles"), exports);
|
|
19
20
|
__exportStar(require("./lib/utils"), exports);
|
|
20
21
|
__exportStar(require("./mathjax"), exports);
|
|
@@ -25,7 +25,7 @@ const createSectionContainer = (type, createElement) => {
|
|
|
25
25
|
sectionContainer.setAttribute('sec-type', sectionCategory ? (0, transformer_1.chooseSecType)(sectionCategory) : '');
|
|
26
26
|
const title = createElement('title');
|
|
27
27
|
title.textContent = sectionCategory
|
|
28
|
-
? (0, transformer_1.
|
|
28
|
+
? (0, transformer_1.getCoreSectionTitles)(sectionCategory)[0]
|
|
29
29
|
: ' ';
|
|
30
30
|
sectionContainer.appendChild(title);
|
|
31
31
|
return sectionContainer;
|
|
@@ -598,11 +598,6 @@ class JATSExporter {
|
|
|
598
598
|
this.createSerializer = () => {
|
|
599
599
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
600
600
|
const nodes = {
|
|
601
|
-
contributor_list: () => '',
|
|
602
|
-
contributor: () => '',
|
|
603
|
-
affiliation_list: () => '',
|
|
604
|
-
affiliation: () => '',
|
|
605
|
-
meta_section: () => '',
|
|
606
601
|
attribution: () => ['attrib', 0],
|
|
607
602
|
bibliography_element: () => '',
|
|
608
603
|
bibliography_item: () => '',
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coreSectionCategories = void 0;
|
|
4
|
+
exports.coreSectionCategories = [
|
|
5
|
+
{
|
|
6
|
+
_id: 'MPSectionCategory:abstracts',
|
|
7
|
+
name: 'Abstracts',
|
|
8
|
+
desc: 'Abstracts section for grouping',
|
|
9
|
+
objectType: 'MPSectionCategory',
|
|
10
|
+
titles: [],
|
|
11
|
+
priority: 120,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
_id: 'MPSectionCategory:backmatter',
|
|
15
|
+
name: 'Backmatter',
|
|
16
|
+
desc: 'Backmatter section for grouping',
|
|
17
|
+
objectType: 'MPSectionCategory',
|
|
18
|
+
titles: [],
|
|
19
|
+
priority: 170,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
_id: 'MPSectionCategory:body',
|
|
23
|
+
name: 'Body',
|
|
24
|
+
desc: 'Body section for grouping',
|
|
25
|
+
objectType: 'MPSectionCategory',
|
|
26
|
+
titles: [],
|
|
27
|
+
priority: 190,
|
|
28
|
+
},
|
|
29
|
+
];
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -32,8 +32,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
exports.schema = void 0;
|
|
33
33
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
34
34
|
const marks_1 = require("./marks");
|
|
35
|
-
const affiliation_1 = require("./nodes/affiliation");
|
|
36
|
-
const affiliation_list_1 = require("./nodes/affiliation_list");
|
|
37
35
|
const attribution_1 = require("./nodes/attribution");
|
|
38
36
|
const bibliography_element_1 = require("./nodes/bibliography_element");
|
|
39
37
|
const bibliography_item_1 = require("./nodes/bibliography_item");
|
|
@@ -44,8 +42,6 @@ const caption_title_1 = require("./nodes/caption_title");
|
|
|
44
42
|
const citation_1 = require("./nodes/citation");
|
|
45
43
|
const comment_1 = require("./nodes/comment");
|
|
46
44
|
const comment_list_1 = require("./nodes/comment_list");
|
|
47
|
-
const contributor_1 = require("./nodes/contributor");
|
|
48
|
-
const contributor_list_1 = require("./nodes/contributor_list");
|
|
49
45
|
const cross_reference_1 = require("./nodes/cross_reference");
|
|
50
46
|
const doc_1 = require("./nodes/doc");
|
|
51
47
|
const equation_1 = require("./nodes/equation");
|
|
@@ -70,7 +66,6 @@ const list_1 = require("./nodes/list");
|
|
|
70
66
|
const listing_1 = require("./nodes/listing");
|
|
71
67
|
const listing_element_1 = require("./nodes/listing_element");
|
|
72
68
|
const manuscript_1 = require("./nodes/manuscript");
|
|
73
|
-
const meta_section_1 = require("./nodes/meta_section");
|
|
74
69
|
const missing_figure_1 = require("./nodes/missing_figure");
|
|
75
70
|
const paragraph_1 = require("./nodes/paragraph");
|
|
76
71
|
const placeholder_1 = require("./nodes/placeholder");
|
|
@@ -135,11 +130,6 @@ __exportStar(require("./nodes/table_row"), exports);
|
|
|
135
130
|
__exportStar(require("./nodes/text"), exports);
|
|
136
131
|
__exportStar(require("./nodes/toc_element"), exports);
|
|
137
132
|
__exportStar(require("./nodes/toc_section"), exports);
|
|
138
|
-
__exportStar(require("./nodes/affiliation"), exports);
|
|
139
|
-
__exportStar(require("./nodes/affiliation_list"), exports);
|
|
140
|
-
__exportStar(require("./nodes/meta_section"), exports);
|
|
141
|
-
__exportStar(require("./nodes/contributor_list"), exports);
|
|
142
|
-
__exportStar(require("./nodes/contributor"), exports);
|
|
143
133
|
exports.schema = new prosemirror_model_1.Schema({
|
|
144
134
|
marks: {
|
|
145
135
|
bold: marks_1.bold,
|
|
@@ -210,10 +200,5 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
210
200
|
text: text_1.text,
|
|
211
201
|
toc_element: toc_element_1.tocElement,
|
|
212
202
|
toc_section: toc_section_1.tocSection,
|
|
213
|
-
affiliation: affiliation_1.affiliation,
|
|
214
|
-
meta_section: meta_section_1.metaSection,
|
|
215
|
-
affiliation_list: affiliation_list_1.affiliationList,
|
|
216
|
-
contributor_list: contributor_list_1.contributorList,
|
|
217
|
-
contributor: contributor_1.contributor,
|
|
218
203
|
},
|
|
219
204
|
});
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.manuscript = void 0;
|
|
19
19
|
exports.manuscript = {
|
|
20
|
-
content: '(section | sections)+
|
|
20
|
+
content: '(section | sections)+ comment_list',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
},
|
|
@@ -60,8 +60,6 @@ exports.getModelsByType = getModelsByType;
|
|
|
60
60
|
const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(a.priority) - Number(b.priority);
|
|
61
61
|
exports.sortSectionsByPriority = sortSectionsByPriority;
|
|
62
62
|
const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Section).sort(exports.sortSectionsByPriority);
|
|
63
|
-
const getAffiliations = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Affiliation);
|
|
64
|
-
const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
|
|
65
63
|
const isManuscriptNode = (model) => model !== null;
|
|
66
64
|
exports.isManuscriptNode = isManuscriptNode;
|
|
67
65
|
const isParagraphElement = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.ParagraphElement);
|
|
@@ -71,46 +69,6 @@ const hasParentSection = (id) => (section) => section.path &&
|
|
|
71
69
|
section.path.length > 1 &&
|
|
72
70
|
section.path[section.path.length - 2] === id;
|
|
73
71
|
class Decoder {
|
|
74
|
-
createAffiliationListNode() {
|
|
75
|
-
const affiliationNodes = getAffiliations(this.modelMap)
|
|
76
|
-
.map((affiliation) => this.decode(affiliation))
|
|
77
|
-
.filter(Boolean);
|
|
78
|
-
return schema_1.schema.nodes.affiliation_list.createAndFill({}, affiliationNodes);
|
|
79
|
-
}
|
|
80
|
-
createContributorListNode() {
|
|
81
|
-
const contributorNodes = getContributors(this.modelMap)
|
|
82
|
-
.map((contributor) => this.decode(contributor))
|
|
83
|
-
.filter(Boolean);
|
|
84
|
-
return schema_1.schema.nodes.contributor_list.createAndFill({}, contributorNodes);
|
|
85
|
-
}
|
|
86
|
-
createMetaSectionNode() {
|
|
87
|
-
const affiliationListNode = this.createAffiliationListNode();
|
|
88
|
-
const contributorListNode = this.createContributorListNode();
|
|
89
|
-
const commentListNode = this.createCommentListNode();
|
|
90
|
-
return schema_1.schema.nodes.meta_section.createAndFill({}, [
|
|
91
|
-
affiliationListNode,
|
|
92
|
-
contributorListNode,
|
|
93
|
-
commentListNode,
|
|
94
|
-
]);
|
|
95
|
-
}
|
|
96
|
-
createCommentListNode() {
|
|
97
|
-
return schema_1.schema.nodes.comment_list.createAndFill({}, [
|
|
98
|
-
...this.comments.values(),
|
|
99
|
-
]);
|
|
100
|
-
}
|
|
101
|
-
createRootSectionNodes() {
|
|
102
|
-
let rootSections = getSections(this.modelMap).filter((section) => !section.path || section.path.length <= 1);
|
|
103
|
-
rootSections = this.addGeneratedLabels(rootSections);
|
|
104
|
-
const rootSectionNodes = rootSections
|
|
105
|
-
.map(this.decode)
|
|
106
|
-
.filter(exports.isManuscriptNode);
|
|
107
|
-
if (!rootSectionNodes.length) {
|
|
108
|
-
rootSectionNodes.push(schema_1.schema.nodes.section.createAndFill({
|
|
109
|
-
id: (0, id_1.generateNodeID)(schema_1.schema.nodes.section),
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
return rootSectionNodes;
|
|
113
|
-
}
|
|
114
72
|
createCommentsNode(model) {
|
|
115
73
|
const comments = [];
|
|
116
74
|
for (const comment of this.getComments(model)) {
|
|
@@ -592,32 +550,6 @@ class Decoder {
|
|
|
592
550
|
originalText: model.originalText,
|
|
593
551
|
});
|
|
594
552
|
},
|
|
595
|
-
[json_schema_1.ObjectTypes.Affiliation]: (data) => {
|
|
596
|
-
const model = data;
|
|
597
|
-
return schema_1.schema.nodes.affiliation.create({
|
|
598
|
-
id: model._id,
|
|
599
|
-
institution: model.institution,
|
|
600
|
-
addressLine1: model.addressLine1,
|
|
601
|
-
addressLine2: model.addressLine2,
|
|
602
|
-
addressLine3: model.addressLine3,
|
|
603
|
-
postCode: model.postCode,
|
|
604
|
-
country: model.country,
|
|
605
|
-
email: model.email,
|
|
606
|
-
});
|
|
607
|
-
},
|
|
608
|
-
[json_schema_1.ObjectTypes.Contributor]: (data) => {
|
|
609
|
-
const model = data;
|
|
610
|
-
return schema_1.schema.nodes.contributor.create({
|
|
611
|
-
id: model._id,
|
|
612
|
-
role: model.role,
|
|
613
|
-
affiliations: model.affiliations,
|
|
614
|
-
bibliographicName: model.bibliographicName,
|
|
615
|
-
userID: model.userID,
|
|
616
|
-
invitationID: model.invitationID,
|
|
617
|
-
isCorresponding: model.isCorresponding,
|
|
618
|
-
ORCIDIdentifier: model.ORCIDIdentifier,
|
|
619
|
-
});
|
|
620
|
-
},
|
|
621
553
|
};
|
|
622
554
|
this.decode = (model) => {
|
|
623
555
|
if (!this.creators[model.objectType]) {
|
|
@@ -628,9 +560,21 @@ class Decoder {
|
|
|
628
560
|
};
|
|
629
561
|
this.getModel = (id) => this.modelMap.get(id);
|
|
630
562
|
this.createArticleNode = (manuscriptID) => {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
const
|
|
563
|
+
let rootSections = getSections(this.modelMap).filter((section) => !section.path || section.path.length <= 1);
|
|
564
|
+
rootSections = this.addGeneratedLabels(rootSections);
|
|
565
|
+
const rootSectionNodes = rootSections
|
|
566
|
+
.map(this.decode)
|
|
567
|
+
.filter(exports.isManuscriptNode);
|
|
568
|
+
if (!rootSectionNodes.length) {
|
|
569
|
+
rootSectionNodes.push(schema_1.schema.nodes.section.createAndFill({
|
|
570
|
+
id: (0, id_1.generateNodeID)(schema_1.schema.nodes.section),
|
|
571
|
+
}));
|
|
572
|
+
}
|
|
573
|
+
const contents = rootSectionNodes;
|
|
574
|
+
const comments = schema_1.schema.nodes.comment_list.createAndFill({}, [
|
|
575
|
+
...this.comments.values(),
|
|
576
|
+
]);
|
|
577
|
+
contents.push(comments);
|
|
634
578
|
return schema_1.schema.nodes.manuscript.create({
|
|
635
579
|
id: manuscriptID || this.getManuscriptID(),
|
|
636
580
|
}, contents);
|
|
@@ -500,24 +500,6 @@ const encoders = {
|
|
|
500
500
|
.map((childNode) => childNode.attrs.id)
|
|
501
501
|
.filter((id) => id),
|
|
502
502
|
}),
|
|
503
|
-
affiliation: (node) => ({
|
|
504
|
-
institution: node.attrs.institution,
|
|
505
|
-
addressLine1: node.attrs.addressLine1,
|
|
506
|
-
addressLine2: node.attrs.addressLine2,
|
|
507
|
-
addressLine3: node.attrs.addressLine3,
|
|
508
|
-
postCode: node.attrs.postCode,
|
|
509
|
-
country: node.attrs.country,
|
|
510
|
-
email: node.attrs.email,
|
|
511
|
-
}),
|
|
512
|
-
contributor: (node) => ({
|
|
513
|
-
role: node.attrs.role,
|
|
514
|
-
affiliations: node.attrs.affiliations,
|
|
515
|
-
bibliographicName: node.attrs.bibliographicName,
|
|
516
|
-
userID: node.attrs.userID,
|
|
517
|
-
invitationID: node.attrs.invitationID,
|
|
518
|
-
isCorresponding: node.attrs.isCorresponding,
|
|
519
|
-
ORCIDIdentifier: node.attrs.ORCIDIdentifier,
|
|
520
|
-
}),
|
|
521
503
|
};
|
|
522
504
|
const modelData = (node, parent, path, priority) => {
|
|
523
505
|
const encoder = encoders[node.type.name];
|
|
@@ -557,7 +539,7 @@ const encode = (node) => {
|
|
|
557
539
|
if ((0, schema_1.isHighlightMarkerNode)(child)) {
|
|
558
540
|
return;
|
|
559
541
|
}
|
|
560
|
-
if (child.type === schema_1.schema.nodes.
|
|
542
|
+
if (child.type === schema_1.schema.nodes.comment_list) {
|
|
561
543
|
return;
|
|
562
544
|
}
|
|
563
545
|
if (placeholders.includes(child.type.name)) {
|
|
@@ -571,26 +553,14 @@ const encode = (node) => {
|
|
|
571
553
|
child.forEach(addModel(path.concat(child.attrs.id), child));
|
|
572
554
|
};
|
|
573
555
|
node.forEach((cNode) => {
|
|
574
|
-
if (cNode.type === schema_1.schema.nodes.
|
|
575
|
-
|
|
556
|
+
if (cNode.type === schema_1.schema.nodes.comment_list) {
|
|
557
|
+
cNode.forEach((child) => {
|
|
558
|
+
const { model } = (0, exports.modelFromNode)(child, cNode, [], priority);
|
|
559
|
+
models.set(model._id, model);
|
|
560
|
+
});
|
|
576
561
|
}
|
|
577
562
|
});
|
|
578
563
|
node.forEach(addModel([], node));
|
|
579
564
|
return models;
|
|
580
565
|
};
|
|
581
566
|
exports.encode = encode;
|
|
582
|
-
const processMetaSectionNode = (node, models, priority) => {
|
|
583
|
-
processNodeRecursively(node, models, priority);
|
|
584
|
-
};
|
|
585
|
-
const processNodeRecursively = (node, models, priority) => {
|
|
586
|
-
if ((!node.content || node.content.size === 0) &&
|
|
587
|
-
node_types_1.nodeTypesMap.get(node.type)) {
|
|
588
|
-
const { model } = (0, exports.modelFromNode)(node, node, [], priority);
|
|
589
|
-
models.set(model._id, model);
|
|
590
|
-
}
|
|
591
|
-
else {
|
|
592
|
-
node.forEach((child) => {
|
|
593
|
-
processNodeRecursively(child, models, priority);
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
};
|
|
@@ -260,7 +260,7 @@ class HTMLTransformer {
|
|
|
260
260
|
};
|
|
261
261
|
return ['span', attrs];
|
|
262
262
|
};
|
|
263
|
-
nodes.
|
|
263
|
+
nodes.comment_list = () => '';
|
|
264
264
|
const serializer = new prosemirror_model_1.DOMSerializer(nodes, marks);
|
|
265
265
|
return serializer.serializeFragment(fragment, { document });
|
|
266
266
|
};
|
|
@@ -53,8 +53,7 @@ exports.nodeTypesMap = new Map([
|
|
|
53
53
|
[schema_1.schema.nodes.table_element, json_schema_1.ObjectTypes.TableElement],
|
|
54
54
|
[schema_1.schema.nodes.toc_element, json_schema_1.ObjectTypes.TOCElement],
|
|
55
55
|
[schema_1.schema.nodes.toc_section, json_schema_1.ObjectTypes.Section],
|
|
56
|
-
[schema_1.schema.nodes.
|
|
57
|
-
[schema_1.schema.nodes.meta_section, json_schema_1.ObjectTypes.MetaSection],
|
|
56
|
+
[schema_1.schema.nodes.comment_list, json_schema_1.ObjectTypes.MetaSection],
|
|
58
57
|
]);
|
|
59
58
|
const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
|
|
60
59
|
exports.isExecutableNodeType = isExecutableNodeType;
|
|
@@ -14,13 +14,10 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.chooseSectionCategoryFromTitle = exports.chooseSectionCategory = exports.chooseSectionCategoryByType = exports.chooseSecType = exports.chooseJatsFnType = exports.buildSectionCategory = exports.guessSectionCategory = exports.chooseSectionLableName = exports.chooseSectionNodeType = exports.isAnySectionNode = exports.
|
|
22
|
-
const section_categories_json_1 = __importDefault(require("@manuscripts/data/dist/shared/section-categories.json"));
|
|
18
|
+
exports.chooseSectionCategoryFromTitle = exports.chooseSectionCategory = exports.chooseSectionCategoryByType = exports.chooseSecType = exports.chooseJatsFnType = exports.buildSectionCategory = exports.guessSectionCategory = exports.chooseSectionLableName = exports.chooseSectionNodeType = exports.isAnySectionNode = exports.getCoreSectionTitles = void 0;
|
|
23
19
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
|
+
const core_section_categories_1 = require("../lib/core-section-categories");
|
|
24
21
|
const schema_1 = require("../schema");
|
|
25
22
|
const sectionNodeTypes = [
|
|
26
23
|
schema_1.schema.nodes.bibliography_section,
|
|
@@ -29,15 +26,14 @@ const sectionNodeTypes = [
|
|
|
29
26
|
schema_1.schema.nodes.section,
|
|
30
27
|
schema_1.schema.nodes.toc_section,
|
|
31
28
|
];
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const category = sectionCategoriesMap.get(sectionCategory);
|
|
29
|
+
const getCoreSectionTitles = (sectionCategory) => {
|
|
30
|
+
const category = core_section_categories_1.coreSectionCategories.find((section) => section._id === sectionCategory);
|
|
35
31
|
if (category) {
|
|
36
32
|
return category.titles.length ? category.titles : [' '];
|
|
37
33
|
}
|
|
38
|
-
throw new Error(`${sectionCategory} not found in
|
|
34
|
+
throw new Error(`${sectionCategory} not found in core sections`);
|
|
39
35
|
};
|
|
40
|
-
exports.
|
|
36
|
+
exports.getCoreSectionTitles = getCoreSectionTitles;
|
|
41
37
|
const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
|
|
42
38
|
exports.isAnySectionNode = isAnySectionNode;
|
|
43
39
|
const chooseSectionNodeType = (category) => {
|
package/dist/es/index.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { chooseSectionCategoryByType, chooseSecType,
|
|
16
|
+
import { chooseSectionCategoryByType, chooseSecType, getCoreSectionTitles, } from '../../transformer';
|
|
17
17
|
const removeNodeFromParent = (node) => node.parentNode && node.parentNode.removeChild(node);
|
|
18
18
|
const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
19
19
|
const createSectionContainer = (type, createElement) => {
|
|
@@ -22,7 +22,7 @@ const createSectionContainer = (type, createElement) => {
|
|
|
22
22
|
sectionContainer.setAttribute('sec-type', sectionCategory ? chooseSecType(sectionCategory) : '');
|
|
23
23
|
const title = createElement('title');
|
|
24
24
|
title.textContent = sectionCategory
|
|
25
|
-
?
|
|
25
|
+
? getCoreSectionTitles(sectionCategory)[0]
|
|
26
26
|
: ' ';
|
|
27
27
|
sectionContainer.appendChild(title);
|
|
28
28
|
return sectionContainer;
|
|
@@ -591,11 +591,6 @@ export class JATSExporter {
|
|
|
591
591
|
this.createSerializer = () => {
|
|
592
592
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
593
593
|
const nodes = {
|
|
594
|
-
contributor_list: () => '',
|
|
595
|
-
contributor: () => '',
|
|
596
|
-
affiliation_list: () => '',
|
|
597
|
-
affiliation: () => '',
|
|
598
|
-
meta_section: () => '',
|
|
599
594
|
attribution: () => ['attrib', 0],
|
|
600
595
|
bibliography_element: () => '',
|
|
601
596
|
bibliography_item: () => '',
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const coreSectionCategories = [
|
|
2
|
+
{
|
|
3
|
+
_id: 'MPSectionCategory:abstracts',
|
|
4
|
+
name: 'Abstracts',
|
|
5
|
+
desc: 'Abstracts section for grouping',
|
|
6
|
+
objectType: 'MPSectionCategory',
|
|
7
|
+
titles: [],
|
|
8
|
+
priority: 120,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
_id: 'MPSectionCategory:backmatter',
|
|
12
|
+
name: 'Backmatter',
|
|
13
|
+
desc: 'Backmatter section for grouping',
|
|
14
|
+
objectType: 'MPSectionCategory',
|
|
15
|
+
titles: [],
|
|
16
|
+
priority: 170,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
_id: 'MPSectionCategory:body',
|
|
20
|
+
name: 'Body',
|
|
21
|
+
desc: 'Body section for grouping',
|
|
22
|
+
objectType: 'MPSectionCategory',
|
|
23
|
+
titles: [],
|
|
24
|
+
priority: 190,
|
|
25
|
+
},
|
|
26
|
+
];
|
package/dist/es/schema/index.js
CHANGED
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Schema } from 'prosemirror-model';
|
|
17
17
|
import { bold, code, italic, smallcaps, strikethrough, styled, subscript, superscript, tracked_delete, tracked_insert, underline, } from './marks';
|
|
18
|
-
import { affiliation } from './nodes/affiliation';
|
|
19
|
-
import { affiliationList } from './nodes/affiliation_list';
|
|
20
18
|
import { attribution } from './nodes/attribution';
|
|
21
19
|
import { bibliographyElement } from './nodes/bibliography_element';
|
|
22
20
|
import { bibliographyItem } from './nodes/bibliography_item';
|
|
@@ -27,8 +25,6 @@ import { captionTitle } from './nodes/caption_title';
|
|
|
27
25
|
import { citation } from './nodes/citation';
|
|
28
26
|
import { comment } from './nodes/comment';
|
|
29
27
|
import { commentList } from './nodes/comment_list';
|
|
30
|
-
import { contributor } from './nodes/contributor';
|
|
31
|
-
import { contributorList } from './nodes/contributor_list';
|
|
32
28
|
import { crossReference } from './nodes/cross_reference';
|
|
33
29
|
import { doc } from './nodes/doc';
|
|
34
30
|
import { equation } from './nodes/equation';
|
|
@@ -53,7 +49,6 @@ import { bulletList, listItem, orderedList } from './nodes/list';
|
|
|
53
49
|
import { listing } from './nodes/listing';
|
|
54
50
|
import { listingElement } from './nodes/listing_element';
|
|
55
51
|
import { manuscript } from './nodes/manuscript';
|
|
56
|
-
import { metaSection } from './nodes/meta_section';
|
|
57
52
|
import { missingFigure } from './nodes/missing_figure';
|
|
58
53
|
import { paragraph } from './nodes/paragraph';
|
|
59
54
|
import { placeholder } from './nodes/placeholder';
|
|
@@ -118,11 +113,6 @@ export * from './nodes/table_row';
|
|
|
118
113
|
export * from './nodes/text';
|
|
119
114
|
export * from './nodes/toc_element';
|
|
120
115
|
export * from './nodes/toc_section';
|
|
121
|
-
export * from './nodes/affiliation';
|
|
122
|
-
export * from './nodes/affiliation_list';
|
|
123
|
-
export * from './nodes/meta_section';
|
|
124
|
-
export * from './nodes/contributor_list';
|
|
125
|
-
export * from './nodes/contributor';
|
|
126
116
|
export const schema = new Schema({
|
|
127
117
|
marks: {
|
|
128
118
|
bold,
|
|
@@ -193,10 +183,5 @@ export const schema = new Schema({
|
|
|
193
183
|
text,
|
|
194
184
|
toc_element: tocElement,
|
|
195
185
|
toc_section: tocSection,
|
|
196
|
-
affiliation,
|
|
197
|
-
meta_section: metaSection,
|
|
198
|
-
affiliation_list: affiliationList,
|
|
199
|
-
contributor_list: contributorList,
|
|
200
|
-
contributor: contributor,
|
|
201
186
|
},
|
|
202
187
|
});
|
|
@@ -51,8 +51,6 @@ export const getModelsByType = (modelMap, objectType) => {
|
|
|
51
51
|
};
|
|
52
52
|
export const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(a.priority) - Number(b.priority);
|
|
53
53
|
const getSections = (modelMap) => getModelsByType(modelMap, ObjectTypes.Section).sort(sortSectionsByPriority);
|
|
54
|
-
const getAffiliations = (modelMap) => getModelsByType(modelMap, ObjectTypes.Affiliation);
|
|
55
|
-
const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
|
|
56
54
|
export const isManuscriptNode = (model) => model !== null;
|
|
57
55
|
const isParagraphElement = hasObjectType(ObjectTypes.ParagraphElement);
|
|
58
56
|
const isFootnote = hasObjectType(ObjectTypes.Footnote);
|
|
@@ -61,46 +59,6 @@ const hasParentSection = (id) => (section) => section.path &&
|
|
|
61
59
|
section.path.length > 1 &&
|
|
62
60
|
section.path[section.path.length - 2] === id;
|
|
63
61
|
export class Decoder {
|
|
64
|
-
createAffiliationListNode() {
|
|
65
|
-
const affiliationNodes = getAffiliations(this.modelMap)
|
|
66
|
-
.map((affiliation) => this.decode(affiliation))
|
|
67
|
-
.filter(Boolean);
|
|
68
|
-
return schema.nodes.affiliation_list.createAndFill({}, affiliationNodes);
|
|
69
|
-
}
|
|
70
|
-
createContributorListNode() {
|
|
71
|
-
const contributorNodes = getContributors(this.modelMap)
|
|
72
|
-
.map((contributor) => this.decode(contributor))
|
|
73
|
-
.filter(Boolean);
|
|
74
|
-
return schema.nodes.contributor_list.createAndFill({}, contributorNodes);
|
|
75
|
-
}
|
|
76
|
-
createMetaSectionNode() {
|
|
77
|
-
const affiliationListNode = this.createAffiliationListNode();
|
|
78
|
-
const contributorListNode = this.createContributorListNode();
|
|
79
|
-
const commentListNode = this.createCommentListNode();
|
|
80
|
-
return schema.nodes.meta_section.createAndFill({}, [
|
|
81
|
-
affiliationListNode,
|
|
82
|
-
contributorListNode,
|
|
83
|
-
commentListNode,
|
|
84
|
-
]);
|
|
85
|
-
}
|
|
86
|
-
createCommentListNode() {
|
|
87
|
-
return schema.nodes.comment_list.createAndFill({}, [
|
|
88
|
-
...this.comments.values(),
|
|
89
|
-
]);
|
|
90
|
-
}
|
|
91
|
-
createRootSectionNodes() {
|
|
92
|
-
let rootSections = getSections(this.modelMap).filter((section) => !section.path || section.path.length <= 1);
|
|
93
|
-
rootSections = this.addGeneratedLabels(rootSections);
|
|
94
|
-
const rootSectionNodes = rootSections
|
|
95
|
-
.map(this.decode)
|
|
96
|
-
.filter(isManuscriptNode);
|
|
97
|
-
if (!rootSectionNodes.length) {
|
|
98
|
-
rootSectionNodes.push(schema.nodes.section.createAndFill({
|
|
99
|
-
id: generateNodeID(schema.nodes.section),
|
|
100
|
-
}));
|
|
101
|
-
}
|
|
102
|
-
return rootSectionNodes;
|
|
103
|
-
}
|
|
104
62
|
createCommentsNode(model) {
|
|
105
63
|
const comments = [];
|
|
106
64
|
for (const comment of this.getComments(model)) {
|
|
@@ -582,32 +540,6 @@ export class Decoder {
|
|
|
582
540
|
originalText: model.originalText,
|
|
583
541
|
});
|
|
584
542
|
},
|
|
585
|
-
[ObjectTypes.Affiliation]: (data) => {
|
|
586
|
-
const model = data;
|
|
587
|
-
return schema.nodes.affiliation.create({
|
|
588
|
-
id: model._id,
|
|
589
|
-
institution: model.institution,
|
|
590
|
-
addressLine1: model.addressLine1,
|
|
591
|
-
addressLine2: model.addressLine2,
|
|
592
|
-
addressLine3: model.addressLine3,
|
|
593
|
-
postCode: model.postCode,
|
|
594
|
-
country: model.country,
|
|
595
|
-
email: model.email,
|
|
596
|
-
});
|
|
597
|
-
},
|
|
598
|
-
[ObjectTypes.Contributor]: (data) => {
|
|
599
|
-
const model = data;
|
|
600
|
-
return schema.nodes.contributor.create({
|
|
601
|
-
id: model._id,
|
|
602
|
-
role: model.role,
|
|
603
|
-
affiliations: model.affiliations,
|
|
604
|
-
bibliographicName: model.bibliographicName,
|
|
605
|
-
userID: model.userID,
|
|
606
|
-
invitationID: model.invitationID,
|
|
607
|
-
isCorresponding: model.isCorresponding,
|
|
608
|
-
ORCIDIdentifier: model.ORCIDIdentifier,
|
|
609
|
-
});
|
|
610
|
-
},
|
|
611
543
|
};
|
|
612
544
|
this.decode = (model) => {
|
|
613
545
|
if (!this.creators[model.objectType]) {
|
|
@@ -618,9 +550,21 @@ export class Decoder {
|
|
|
618
550
|
};
|
|
619
551
|
this.getModel = (id) => this.modelMap.get(id);
|
|
620
552
|
this.createArticleNode = (manuscriptID) => {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
const
|
|
553
|
+
let rootSections = getSections(this.modelMap).filter((section) => !section.path || section.path.length <= 1);
|
|
554
|
+
rootSections = this.addGeneratedLabels(rootSections);
|
|
555
|
+
const rootSectionNodes = rootSections
|
|
556
|
+
.map(this.decode)
|
|
557
|
+
.filter(isManuscriptNode);
|
|
558
|
+
if (!rootSectionNodes.length) {
|
|
559
|
+
rootSectionNodes.push(schema.nodes.section.createAndFill({
|
|
560
|
+
id: generateNodeID(schema.nodes.section),
|
|
561
|
+
}));
|
|
562
|
+
}
|
|
563
|
+
const contents = rootSectionNodes;
|
|
564
|
+
const comments = schema.nodes.comment_list.createAndFill({}, [
|
|
565
|
+
...this.comments.values(),
|
|
566
|
+
]);
|
|
567
|
+
contents.push(comments);
|
|
624
568
|
return schema.nodes.manuscript.create({
|
|
625
569
|
id: manuscriptID || this.getManuscriptID(),
|
|
626
570
|
}, contents);
|
|
@@ -492,24 +492,6 @@ const encoders = {
|
|
|
492
492
|
.map((childNode) => childNode.attrs.id)
|
|
493
493
|
.filter((id) => id),
|
|
494
494
|
}),
|
|
495
|
-
affiliation: (node) => ({
|
|
496
|
-
institution: node.attrs.institution,
|
|
497
|
-
addressLine1: node.attrs.addressLine1,
|
|
498
|
-
addressLine2: node.attrs.addressLine2,
|
|
499
|
-
addressLine3: node.attrs.addressLine3,
|
|
500
|
-
postCode: node.attrs.postCode,
|
|
501
|
-
country: node.attrs.country,
|
|
502
|
-
email: node.attrs.email,
|
|
503
|
-
}),
|
|
504
|
-
contributor: (node) => ({
|
|
505
|
-
role: node.attrs.role,
|
|
506
|
-
affiliations: node.attrs.affiliations,
|
|
507
|
-
bibliographicName: node.attrs.bibliographicName,
|
|
508
|
-
userID: node.attrs.userID,
|
|
509
|
-
invitationID: node.attrs.invitationID,
|
|
510
|
-
isCorresponding: node.attrs.isCorresponding,
|
|
511
|
-
ORCIDIdentifier: node.attrs.ORCIDIdentifier,
|
|
512
|
-
}),
|
|
513
495
|
};
|
|
514
496
|
const modelData = (node, parent, path, priority) => {
|
|
515
497
|
const encoder = encoders[node.type.name];
|
|
@@ -548,7 +530,7 @@ export const encode = (node) => {
|
|
|
548
530
|
if (isHighlightMarkerNode(child)) {
|
|
549
531
|
return;
|
|
550
532
|
}
|
|
551
|
-
if (child.type === schema.nodes.
|
|
533
|
+
if (child.type === schema.nodes.comment_list) {
|
|
552
534
|
return;
|
|
553
535
|
}
|
|
554
536
|
if (placeholders.includes(child.type.name)) {
|
|
@@ -562,25 +544,13 @@ export const encode = (node) => {
|
|
|
562
544
|
child.forEach(addModel(path.concat(child.attrs.id), child));
|
|
563
545
|
};
|
|
564
546
|
node.forEach((cNode) => {
|
|
565
|
-
if (cNode.type === schema.nodes.
|
|
566
|
-
|
|
547
|
+
if (cNode.type === schema.nodes.comment_list) {
|
|
548
|
+
cNode.forEach((child) => {
|
|
549
|
+
const { model } = modelFromNode(child, cNode, [], priority);
|
|
550
|
+
models.set(model._id, model);
|
|
551
|
+
});
|
|
567
552
|
}
|
|
568
553
|
});
|
|
569
554
|
node.forEach(addModel([], node));
|
|
570
555
|
return models;
|
|
571
556
|
};
|
|
572
|
-
const processMetaSectionNode = (node, models, priority) => {
|
|
573
|
-
processNodeRecursively(node, models, priority);
|
|
574
|
-
};
|
|
575
|
-
const processNodeRecursively = (node, models, priority) => {
|
|
576
|
-
if ((!node.content || node.content.size === 0) &&
|
|
577
|
-
nodeTypesMap.get(node.type)) {
|
|
578
|
-
const { model } = modelFromNode(node, node, [], priority);
|
|
579
|
-
models.set(model._id, model);
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
node.forEach((child) => {
|
|
583
|
-
processNodeRecursively(child, models, priority);
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
};
|
|
@@ -254,7 +254,7 @@ export class HTMLTransformer {
|
|
|
254
254
|
};
|
|
255
255
|
return ['span', attrs];
|
|
256
256
|
};
|
|
257
|
-
nodes.
|
|
257
|
+
nodes.comment_list = () => '';
|
|
258
258
|
const serializer = new DOMSerializer(nodes, marks);
|
|
259
259
|
return serializer.serializeFragment(fragment, { document });
|
|
260
260
|
};
|
|
@@ -50,8 +50,7 @@ export const nodeTypesMap = new Map([
|
|
|
50
50
|
[schema.nodes.table_element, ObjectTypes.TableElement],
|
|
51
51
|
[schema.nodes.toc_element, ObjectTypes.TOCElement],
|
|
52
52
|
[schema.nodes.toc_section, ObjectTypes.Section],
|
|
53
|
-
[schema.nodes.
|
|
54
|
-
[schema.nodes.meta_section, ObjectTypes.MetaSection],
|
|
53
|
+
[schema.nodes.comment_list, ObjectTypes.MetaSection],
|
|
55
54
|
]);
|
|
56
55
|
export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
|
|
57
56
|
export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
|
+
import { coreSectionCategories } from '../lib/core-section-categories';
|
|
18
18
|
import { schema } from '../schema';
|
|
19
19
|
const sectionNodeTypes = [
|
|
20
20
|
schema.nodes.bibliography_section,
|
|
@@ -23,13 +23,12 @@ const sectionNodeTypes = [
|
|
|
23
23
|
schema.nodes.section,
|
|
24
24
|
schema.nodes.toc_section,
|
|
25
25
|
];
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const category = sectionCategoriesMap.get(sectionCategory);
|
|
26
|
+
export const getCoreSectionTitles = (sectionCategory) => {
|
|
27
|
+
const category = coreSectionCategories.find((section) => section._id === sectionCategory);
|
|
29
28
|
if (category) {
|
|
30
29
|
return category.titles.length ? category.titles : [' '];
|
|
31
30
|
}
|
|
32
|
-
throw new Error(`${sectionCategory} not found in
|
|
31
|
+
throw new Error(`${sectionCategory} not found in core sections`);
|
|
33
32
|
};
|
|
34
33
|
export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
|
|
35
34
|
export const chooseSectionNodeType = (category) => {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -64,9 +64,4 @@ export * from './nodes/table_row';
|
|
|
64
64
|
export * from './nodes/text';
|
|
65
65
|
export * from './nodes/toc_element';
|
|
66
66
|
export * from './nodes/toc_section';
|
|
67
|
-
export * from './nodes/affiliation';
|
|
68
|
-
export * from './nodes/affiliation_list';
|
|
69
|
-
export * from './nodes/meta_section';
|
|
70
|
-
export * from './nodes/contributor_list';
|
|
71
|
-
export * from './nodes/contributor';
|
|
72
67
|
export declare const schema: Schema<Nodes, Marks>;
|
|
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
|
|
|
17
17
|
import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
|
|
18
18
|
import { EditorView, NodeView } from 'prosemirror-view';
|
|
19
19
|
export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
|
|
20
|
-
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keywords_group' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section'
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keywords_group' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
|
@@ -25,11 +25,6 @@ export declare class Decoder {
|
|
|
25
25
|
private readonly allowMissingElements;
|
|
26
26
|
private comments;
|
|
27
27
|
private creators;
|
|
28
|
-
private createAffiliationListNode;
|
|
29
|
-
private createContributorListNode;
|
|
30
|
-
private createMetaSectionNode;
|
|
31
|
-
private createCommentListNode;
|
|
32
|
-
private createRootSectionNodes;
|
|
33
28
|
private createCommentsNode;
|
|
34
29
|
private getComments;
|
|
35
30
|
private extractListing;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Element } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNode, ManuscriptNodeType } from '../schema';
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const getCoreSectionTitles: (sectionCategory: SectionCategory) => string[];
|
|
19
19
|
export declare const isAnySectionNode: (node: ManuscriptNode) => boolean;
|
|
20
20
|
export type SectionCategory = 'MPSectionCategory:abstract' | 'MPSectionCategory:abstract-teaser' | 'MPSectionCategory:abstract-graphical' | 'MPSectionCategory:acknowledgement' | 'MPSectionCategory:availability' | 'MPSectionCategory:bibliography' | 'MPSectionCategory:conclusions' | 'MPSectionCategory:discussion' | 'MPSectionCategory:endnotes' | 'MPSectionCategory:introduction' | 'MPSectionCategory:keywords' | 'MPSectionCategory:materials-method' | 'MPSectionCategory:results' | 'MPSectionCategory:toc' | 'MPSectionCategory:floating-element' | 'MPSectionCategory:appendices' | 'MPSectionCategory:competing-interests' | 'MPSectionCategory:financial-disclosure' | 'MPSectionCategory:con' | 'MPSectionCategory:deceased' | 'MPSectionCategory:equal' | 'MPSectionCategory:present-address' | 'MPSectionCategory:presented-at' | 'MPSectionCategory:previously-at' | 'MPSectionCategory:supplementary-material' | 'MPSectionCategory:supported-by' | 'MPSectionCategory:ethics-statement' | 'MPSectionCategory:body' | 'MPSectionCategory:abstracts' | 'MPSectionCategory:backmatter';
|
|
21
21
|
export type SecType = 'abstract' | 'abstract-teaser' | 'abstract-graphical' | 'acknowledgments' | 'availability' | 'bibliography' | 'conclusions' | 'data-availability' | 'discussion' | 'endnotes' | 'intro' | 'keywords' | 'materials' | 'methods' | 'results' | 'toc' | 'floating-element' | 'appendices' | 'competing-interests' | 'financial-disclosure' | 'con' | 'deceased' | 'equal' | 'present-address' | 'presented-at' | 'previously-at' | 'supplementary-material' | 'supported-by' | 'ethics-statement' | 'abstracts' | 'body' | 'backmatter';
|
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": "1.3.
|
|
4
|
+
"version": "1.3.8",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|
|
44
44
|
"@babel/preset-typescript": "^7.18.6",
|
|
45
45
|
"@jats4r/dtds": "^0.0.8",
|
|
46
|
-
"@manuscripts/data": "^1.0.2",
|
|
47
46
|
"@manuscripts/eslint-config": "^0.5.1",
|
|
48
47
|
"@types/debug": "^4.1.7",
|
|
49
48
|
"@types/jest": "^29.2.4",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAffiliationNode = exports.affiliation = void 0;
|
|
4
|
-
exports.affiliation = {
|
|
5
|
-
attrs: {
|
|
6
|
-
id: { default: '' },
|
|
7
|
-
institution: { default: '' },
|
|
8
|
-
department: { default: '' },
|
|
9
|
-
addressLine1: { default: '' },
|
|
10
|
-
addressLine2: { default: '' },
|
|
11
|
-
addressLine3: { default: '' },
|
|
12
|
-
postCode: { default: '' },
|
|
13
|
-
country: { default: '' },
|
|
14
|
-
email: {
|
|
15
|
-
default: {
|
|
16
|
-
href: undefined,
|
|
17
|
-
text: undefined,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
const isAffiliationNode = (node) => node.type === node.type.schema.nodes.affiliation;
|
|
23
|
-
exports.isAffiliationNode = isAffiliationNode;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.affiliationList = void 0;
|
|
4
|
-
exports.affiliationList = {
|
|
5
|
-
content: 'affiliation*',
|
|
6
|
-
attrs: {
|
|
7
|
-
id: { default: 'AFFILIATION_LIST' },
|
|
8
|
-
},
|
|
9
|
-
toDOM: () => ['section', 0],
|
|
10
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.contributor = void 0;
|
|
4
|
-
exports.contributor = {
|
|
5
|
-
attrs: {
|
|
6
|
-
id: { default: '' },
|
|
7
|
-
role: { default: '' },
|
|
8
|
-
affiliations: { default: [] },
|
|
9
|
-
bibliographicName: { default: {} },
|
|
10
|
-
userID: { default: '' },
|
|
11
|
-
invitationID: { default: '' },
|
|
12
|
-
isCorresponding: { default: undefined },
|
|
13
|
-
ORCIDIdentifier: { default: '' },
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.contributorList = void 0;
|
|
4
|
-
exports.contributorList = {
|
|
5
|
-
content: 'contributor*',
|
|
6
|
-
attrs: {
|
|
7
|
-
id: { default: 'CONTRIBUTOR_LIST' },
|
|
8
|
-
},
|
|
9
|
-
toDOM: () => ['section', 0],
|
|
10
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2019 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.metaSection = void 0;
|
|
19
|
-
exports.metaSection = {
|
|
20
|
-
content: 'affiliation_list contributor_list comment_list',
|
|
21
|
-
attrs: {
|
|
22
|
-
id: { default: 'META_SECTION' },
|
|
23
|
-
},
|
|
24
|
-
group: 'block sections',
|
|
25
|
-
toDOM: () => ['section', 0],
|
|
26
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const affiliation = {
|
|
2
|
-
attrs: {
|
|
3
|
-
id: { default: '' },
|
|
4
|
-
institution: { default: '' },
|
|
5
|
-
department: { default: '' },
|
|
6
|
-
addressLine1: { default: '' },
|
|
7
|
-
addressLine2: { default: '' },
|
|
8
|
-
addressLine3: { default: '' },
|
|
9
|
-
postCode: { default: '' },
|
|
10
|
-
country: { default: '' },
|
|
11
|
-
email: {
|
|
12
|
-
default: {
|
|
13
|
-
href: undefined,
|
|
14
|
-
text: undefined,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
export const isAffiliationNode = (node) => node.type === node.type.schema.nodes.affiliation;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const contributor = {
|
|
2
|
-
attrs: {
|
|
3
|
-
id: { default: '' },
|
|
4
|
-
role: { default: '' },
|
|
5
|
-
affiliations: { default: [] },
|
|
6
|
-
bibliographicName: { default: {} },
|
|
7
|
-
userID: { default: '' },
|
|
8
|
-
invitationID: { default: '' },
|
|
9
|
-
isCorresponding: { default: undefined },
|
|
10
|
-
ORCIDIdentifier: { default: '' },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export const metaSection = {
|
|
17
|
-
content: 'affiliation_list contributor_list comment_list',
|
|
18
|
-
attrs: {
|
|
19
|
-
id: { default: 'META_SECTION' },
|
|
20
|
-
},
|
|
21
|
-
group: 'block sections',
|
|
22
|
-
toDOM: () => ['section', 0],
|
|
23
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
-
import { ManuscriptNode } from '../types';
|
|
3
|
-
interface Email {
|
|
4
|
-
href: string;
|
|
5
|
-
text: string;
|
|
6
|
-
}
|
|
7
|
-
interface Attrs {
|
|
8
|
-
id: string;
|
|
9
|
-
objectType: string;
|
|
10
|
-
institution: string;
|
|
11
|
-
department: string;
|
|
12
|
-
addressLine1: string;
|
|
13
|
-
addressLine2: string;
|
|
14
|
-
addressLine3: string;
|
|
15
|
-
postCode: string;
|
|
16
|
-
country: string;
|
|
17
|
-
email: Email;
|
|
18
|
-
}
|
|
19
|
-
export interface AffiliationNode extends ManuscriptNode {
|
|
20
|
-
attrs: Attrs;
|
|
21
|
-
}
|
|
22
|
-
export declare const affiliation: NodeSpec;
|
|
23
|
-
export declare const isAffiliationNode: (node: ManuscriptNode) => node is AffiliationNode;
|
|
24
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
-
import { ManuscriptNode } from '../types';
|
|
3
|
-
interface Attrs {
|
|
4
|
-
id: string;
|
|
5
|
-
}
|
|
6
|
-
export interface AffiliationListNode extends ManuscriptNode {
|
|
7
|
-
attrs: Attrs;
|
|
8
|
-
}
|
|
9
|
-
export declare const affiliationList: NodeSpec;
|
|
10
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Affiliation, BibliographicName } from '@manuscripts/json-schema';
|
|
2
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
3
|
-
import { ManuscriptNode } from '../types';
|
|
4
|
-
interface Attrs {
|
|
5
|
-
id: string;
|
|
6
|
-
role: string;
|
|
7
|
-
affiliations: Affiliation[];
|
|
8
|
-
bibliographicName: BibliographicName;
|
|
9
|
-
userID: string;
|
|
10
|
-
invitationID: string;
|
|
11
|
-
isCorresponding: boolean;
|
|
12
|
-
ORCIDIdentifier: string;
|
|
13
|
-
}
|
|
14
|
-
export interface ContributorNode extends ManuscriptNode {
|
|
15
|
-
attrs: Attrs;
|
|
16
|
-
}
|
|
17
|
-
export declare const contributor: NodeSpec;
|
|
18
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
-
import { ManuscriptNode } from '../types';
|
|
3
|
-
interface Attrs {
|
|
4
|
-
id: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ContributorListNode extends ManuscriptNode {
|
|
7
|
-
attrs: Attrs;
|
|
8
|
-
}
|
|
9
|
-
export declare const contributorList: NodeSpec;
|
|
10
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
-
import { ManuscriptNode } from '../types';
|
|
18
|
-
interface Attrs {
|
|
19
|
-
id: string;
|
|
20
|
-
}
|
|
21
|
-
export interface MetaSectionNode extends ManuscriptNode {
|
|
22
|
-
attrs: Attrs;
|
|
23
|
-
}
|
|
24
|
-
export declare const metaSection: NodeSpec;
|
|
25
|
-
export {};
|