@manuscripts/transform 2.0.4 → 2.1.1
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/importer/jats-body-dom-parser.js +20 -1
- package/dist/cjs/jats/importer/jats-body-transformations.js +14 -0
- package/dist/cjs/jats/importer/jats-front-parser.js +0 -19
- package/dist/cjs/jats/importer/parse-jats-article.js +1 -4
- package/dist/cjs/jats/jats-exporter.js +2 -0
- package/dist/cjs/schema/index.js +6 -0
- package/dist/cjs/schema/nodes/affiliation.js +4 -1
- package/dist/cjs/schema/nodes/contributor.js +3 -1
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/schema/nodes/supplement.js +63 -0
- package/dist/cjs/schema/nodes/supplements.js +45 -0
- package/dist/cjs/transformer/decode.js +27 -0
- package/dist/cjs/transformer/encode.js +12 -0
- package/dist/cjs/transformer/node-types.js +1 -0
- package/dist/es/jats/importer/jats-body-dom-parser.js +20 -1
- package/dist/es/jats/importer/jats-body-transformations.js +14 -0
- package/dist/es/jats/importer/jats-front-parser.js +1 -20
- package/dist/es/jats/importer/parse-jats-article.js +1 -4
- package/dist/es/jats/jats-exporter.js +2 -0
- package/dist/es/schema/index.js +6 -0
- package/dist/es/schema/nodes/affiliation.js +4 -1
- package/dist/es/schema/nodes/contributor.js +3 -1
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/schema/nodes/supplement.js +60 -0
- package/dist/es/schema/nodes/supplements.js +42 -0
- package/dist/es/transformer/decode.js +27 -0
- package/dist/es/transformer/encode.js +12 -0
- package/dist/es/transformer/node-types.js +1 -0
- package/dist/types/jats/importer/jats-body-transformations.d.ts +1 -0
- package/dist/types/jats/importer/jats-front-parser.d.ts +0 -1
- package/dist/types/schema/index.d.ts +2 -0
- package/dist/types/schema/nodes/affiliation.d.ts +2 -0
- package/dist/types/schema/nodes/contributor.d.ts +4 -2
- package/dist/types/schema/nodes/supplement.d.ts +29 -0
- package/dist/types/schema/nodes/supplements.d.ts +25 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/decode.d.ts +1 -0
- package/package.json +2 -2
|
@@ -430,6 +430,25 @@ const nodes = [
|
|
|
430
430
|
tag: 'sec[sec-type="keywords"]',
|
|
431
431
|
node: 'keywords',
|
|
432
432
|
},
|
|
433
|
+
{
|
|
434
|
+
tag: 'sec[sec-type="supplementary-material"]',
|
|
435
|
+
node: 'supplements',
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
tag: 'supplementary-material',
|
|
439
|
+
node: 'supplement',
|
|
440
|
+
getAttrs: (node) => {
|
|
441
|
+
var _a;
|
|
442
|
+
const element = node;
|
|
443
|
+
return {
|
|
444
|
+
id: element.getAttribute('id'),
|
|
445
|
+
href: element.getAttributeNS(XLINK_NAMESPACE, 'href'),
|
|
446
|
+
mimeType: element.getAttribute('mimetype'),
|
|
447
|
+
mimeSubType: element.getAttribute('mime-subtype'),
|
|
448
|
+
title: (_a = element.querySelector('title')) === null || _a === void 0 ? void 0 : _a.textContent,
|
|
449
|
+
};
|
|
450
|
+
},
|
|
451
|
+
},
|
|
433
452
|
{
|
|
434
453
|
tag: 'sec[sec-type="abstracts"]',
|
|
435
454
|
node: 'abstracts',
|
|
@@ -526,7 +545,7 @@ const nodes = [
|
|
|
526
545
|
{
|
|
527
546
|
tag: 'title',
|
|
528
547
|
node: 'section_title',
|
|
529
|
-
context: 'section/|footnotes_section/|bibliography_section/|keywords/',
|
|
548
|
+
context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/',
|
|
530
549
|
},
|
|
531
550
|
{
|
|
532
551
|
tag: 'title',
|
|
@@ -287,4 +287,18 @@ exports.jatsBodyTransformations = {
|
|
|
287
287
|
body.prepend(section);
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
|
+
createSuppleMaterials(document, body, createElement) {
|
|
291
|
+
const suppleMaterials = [
|
|
292
|
+
...document.querySelectorAll('article-meta > supplementary-material'),
|
|
293
|
+
];
|
|
294
|
+
if (suppleMaterials.length > 0) {
|
|
295
|
+
const section = createElement('sec');
|
|
296
|
+
section.setAttribute('sec-type', 'supplementary-material');
|
|
297
|
+
const title = createElement('title');
|
|
298
|
+
title.textContent = 'supplementary-material';
|
|
299
|
+
section.append(title);
|
|
300
|
+
section.append(...suppleMaterials);
|
|
301
|
+
body.prepend(section);
|
|
302
|
+
}
|
|
303
|
+
},
|
|
290
304
|
};
|
|
@@ -128,25 +128,6 @@ exports.jatsFrontParser = {
|
|
|
128
128
|
}
|
|
129
129
|
return history;
|
|
130
130
|
},
|
|
131
|
-
parseSupplements(elements) {
|
|
132
|
-
var _a, _b, _c, _d;
|
|
133
|
-
if (!(elements === null || elements === void 0 ? void 0 : elements.length)) {
|
|
134
|
-
return [];
|
|
135
|
-
}
|
|
136
|
-
const supplements = [];
|
|
137
|
-
for (const element of elements) {
|
|
138
|
-
const title = (_a = (0, utils_1.getTrimmedTextContent)(element, 'caption > title')) !== null && _a !== void 0 ? _a : '';
|
|
139
|
-
const href = (_b = element.getAttributeNS(XLINK_NAMESPACE, 'href')) !== null && _b !== void 0 ? _b : '';
|
|
140
|
-
const supplement = (0, transformer_1.buildSupplementaryMaterial)(title, href);
|
|
141
|
-
const mimeType = (_c = element.getAttribute('mimetype')) !== null && _c !== void 0 ? _c : '';
|
|
142
|
-
const mimeSubtype = (_d = element.getAttribute('mime-subtype')) !== null && _d !== void 0 ? _d : '';
|
|
143
|
-
if (mimeType && mimeSubtype) {
|
|
144
|
-
supplement.MIME = [mimeType, mimeSubtype].join('/');
|
|
145
|
-
}
|
|
146
|
-
supplements.push(supplement);
|
|
147
|
-
}
|
|
148
|
-
return supplements;
|
|
149
|
-
},
|
|
150
131
|
parseAffiliations(elements) {
|
|
151
132
|
const affiliationIDs = new Map();
|
|
152
133
|
const affiliations = elements.map((element, priority) => {
|
|
@@ -43,9 +43,6 @@ const parseJATSFront = (doc, front) => {
|
|
|
43
43
|
const authors = jats_front_parser_1.jatsFrontParser.parseContributors([
|
|
44
44
|
...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
|
|
45
45
|
], affiliationIDs, footnoteIDs, correspondingIDs);
|
|
46
|
-
const supplements = jats_front_parser_1.jatsFrontParser.parseSupplements([
|
|
47
|
-
...front.querySelectorAll('article-meta > supplementary-material'),
|
|
48
|
-
]);
|
|
49
46
|
const history = jats_front_parser_1.jatsFrontParser.parseDates(front.querySelector('article-meta > history'));
|
|
50
47
|
const counts = jats_front_parser_1.jatsFrontParser.parseCounts(front.querySelector('article-meta counts'));
|
|
51
48
|
const manuscript = Object.assign(Object.assign(Object.assign({}, (0, builders_1.buildManuscript)()), counts), history);
|
|
@@ -57,7 +54,6 @@ const parseJATSFront = (doc, front) => {
|
|
|
57
54
|
...authors,
|
|
58
55
|
...affiliations,
|
|
59
56
|
...correspondingList,
|
|
60
|
-
...supplements,
|
|
61
57
|
]);
|
|
62
58
|
};
|
|
63
59
|
exports.parseJATSFront = parseJATSFront;
|
|
@@ -69,6 +65,7 @@ const parseJATSBody = (doc, body, references) => {
|
|
|
69
65
|
jats_body_transformations_1.jatsBodyTransformations.createBody(doc, body, createElement);
|
|
70
66
|
jats_body_transformations_1.jatsBodyTransformations.createAbstracts(doc, body, createElement);
|
|
71
67
|
jats_body_transformations_1.jatsBodyTransformations.createBackmatter(doc, body, createElement);
|
|
68
|
+
jats_body_transformations_1.jatsBodyTransformations.createSuppleMaterials(doc, body, createElement);
|
|
72
69
|
jats_body_transformations_1.jatsBodyTransformations.createKeywords(doc, body, createElement);
|
|
73
70
|
const node = jats_body_dom_parser_1.jatsBodyDOMParser.parse(body).firstChild;
|
|
74
71
|
if (!node) {
|
|
@@ -628,6 +628,8 @@ class JATSExporter {
|
|
|
628
628
|
body: () => ['body', 0],
|
|
629
629
|
abstracts: () => ['abstract', 0],
|
|
630
630
|
backmatter: () => ['backmatter', 0],
|
|
631
|
+
supplement: () => '',
|
|
632
|
+
supplements: () => '',
|
|
631
633
|
bibliography_section: (node) => [
|
|
632
634
|
'ref-list',
|
|
633
635
|
{ id: normalizeID(node.attrs.id) },
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -81,6 +81,8 @@ const pullquote_element_1 = require("./nodes/pullquote_element");
|
|
|
81
81
|
const section_1 = require("./nodes/section");
|
|
82
82
|
const section_label_1 = require("./nodes/section_label");
|
|
83
83
|
const section_title_1 = require("./nodes/section_title");
|
|
84
|
+
const supplement_1 = require("./nodes/supplement");
|
|
85
|
+
const supplements_1 = require("./nodes/supplements");
|
|
84
86
|
const table_1 = require("./nodes/table");
|
|
85
87
|
const table_col_1 = require("./nodes/table_col");
|
|
86
88
|
const table_element_1 = require("./nodes/table_element");
|
|
@@ -145,6 +147,8 @@ __exportStar(require("./nodes/table_element_footer"), exports);
|
|
|
145
147
|
__exportStar(require("./nodes/title"), exports);
|
|
146
148
|
__exportStar(require("./nodes/affiliations"), exports);
|
|
147
149
|
__exportStar(require("./nodes/contributors"), exports);
|
|
150
|
+
__exportStar(require("./nodes/supplement"), exports);
|
|
151
|
+
__exportStar(require("./nodes/supplements"), exports);
|
|
148
152
|
exports.schema = new prosemirror_model_1.Schema({
|
|
149
153
|
marks: {
|
|
150
154
|
bold: marks_1.bold,
|
|
@@ -224,5 +228,7 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
224
228
|
title: title_1.title,
|
|
225
229
|
affiliations: affiliations_1.affiliations,
|
|
226
230
|
contributors: contributors_1.contributors,
|
|
231
|
+
supplements: supplements_1.supplements,
|
|
232
|
+
supplement: supplement_1.supplement,
|
|
227
233
|
},
|
|
228
234
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isAffiliationNode = exports.affiliation = void 0;
|
|
4
4
|
exports.affiliation = {
|
|
5
|
+
content: 'inline*',
|
|
5
6
|
attrs: {
|
|
6
7
|
id: { default: '' },
|
|
7
8
|
institution: { default: '' },
|
|
@@ -11,6 +12,8 @@ exports.affiliation = {
|
|
|
11
12
|
addressLine3: { default: '' },
|
|
12
13
|
postCode: { default: '' },
|
|
13
14
|
country: { default: '' },
|
|
15
|
+
county: { default: '' },
|
|
16
|
+
city: { default: '' },
|
|
14
17
|
priority: { default: undefined },
|
|
15
18
|
email: {
|
|
16
19
|
default: {
|
|
@@ -20,7 +23,7 @@ exports.affiliation = {
|
|
|
20
23
|
},
|
|
21
24
|
dataTracked: { default: null },
|
|
22
25
|
},
|
|
23
|
-
group: 'block
|
|
26
|
+
group: 'block',
|
|
24
27
|
parseDOM: [
|
|
25
28
|
{
|
|
26
29
|
tag: 'div.affiliation',
|
|
@@ -6,6 +6,7 @@ exports.contributor = {
|
|
|
6
6
|
attrs: {
|
|
7
7
|
id: { default: '' },
|
|
8
8
|
role: { default: '' },
|
|
9
|
+
email: { default: '' },
|
|
9
10
|
affiliations: { default: [] },
|
|
10
11
|
footnote: { default: undefined },
|
|
11
12
|
corresp: { default: undefined },
|
|
@@ -13,12 +14,13 @@ exports.contributor = {
|
|
|
13
14
|
userID: { default: undefined },
|
|
14
15
|
invitationID: { default: undefined },
|
|
15
16
|
isCorresponding: { default: undefined },
|
|
17
|
+
isJointContributor: { default: undefined },
|
|
16
18
|
ORCIDIdentifier: { default: undefined },
|
|
17
19
|
priority: { default: undefined },
|
|
18
20
|
dataTracked: { default: null },
|
|
19
21
|
contents: { default: '' },
|
|
20
22
|
},
|
|
21
|
-
group: 'block
|
|
23
|
+
group: 'block',
|
|
22
24
|
toDOM: (node) => {
|
|
23
25
|
const contributorNode = node;
|
|
24
26
|
return [
|
|
@@ -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? abstracts body backmatter comments',
|
|
20
|
+
content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
},
|
|
@@ -0,0 +1,63 @@
|
|
|
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.supplement = void 0;
|
|
19
|
+
exports.supplement = {
|
|
20
|
+
attrs: {
|
|
21
|
+
id: { default: '' },
|
|
22
|
+
href: { default: '' },
|
|
23
|
+
mimeType: { default: '' },
|
|
24
|
+
mimeSubType: { default: '' },
|
|
25
|
+
title: { default: '' },
|
|
26
|
+
dataTracked: { default: null },
|
|
27
|
+
},
|
|
28
|
+
group: 'block',
|
|
29
|
+
parseDOM: [
|
|
30
|
+
{
|
|
31
|
+
tag: 'div.supplement',
|
|
32
|
+
getAttrs: (dom) => {
|
|
33
|
+
const el = dom;
|
|
34
|
+
const id = el.getAttribute('id');
|
|
35
|
+
const href = el.getAttribute('href');
|
|
36
|
+
const mimeType = el.getAttribute('mimeType');
|
|
37
|
+
const mimeSubType = el.getAttribute('mimeSubType');
|
|
38
|
+
const title = el.textContent;
|
|
39
|
+
return {
|
|
40
|
+
id,
|
|
41
|
+
href,
|
|
42
|
+
mimeType,
|
|
43
|
+
mimeSubType,
|
|
44
|
+
title,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
toDOM: (node) => {
|
|
50
|
+
const supplement = node;
|
|
51
|
+
return [
|
|
52
|
+
'div',
|
|
53
|
+
{
|
|
54
|
+
id: supplement.attrs.id,
|
|
55
|
+
class: 'Supplement',
|
|
56
|
+
href: node.attrs.href,
|
|
57
|
+
mimeType: node.attrs.mimeType,
|
|
58
|
+
mimeSubType: node.attrs.mimeSubType,
|
|
59
|
+
title: node.attrs.title,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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.supplements = void 0;
|
|
19
|
+
exports.supplements = {
|
|
20
|
+
content: 'section_title supplement*',
|
|
21
|
+
attrs: {
|
|
22
|
+
id: { default: '' },
|
|
23
|
+
dataTracked: { default: null },
|
|
24
|
+
},
|
|
25
|
+
group: 'block',
|
|
26
|
+
selectable: false,
|
|
27
|
+
parseDOM: [
|
|
28
|
+
{
|
|
29
|
+
tag: 'div.supplements',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
toDOM: (node) => {
|
|
33
|
+
const supplements = node;
|
|
34
|
+
return [
|
|
35
|
+
'div',
|
|
36
|
+
{
|
|
37
|
+
id: supplements.attrs.id,
|
|
38
|
+
class: 'supplements',
|
|
39
|
+
spellcheck: 'false',
|
|
40
|
+
contenteditable: false,
|
|
41
|
+
},
|
|
42
|
+
0,
|
|
43
|
+
];
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -64,6 +64,7 @@ const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_sc
|
|
|
64
64
|
const getAffiliations = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Affiliation);
|
|
65
65
|
const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
|
|
66
66
|
const getKeywordElements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordsElement);
|
|
67
|
+
const getSupplements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Supplement);
|
|
67
68
|
const getKeywordGroups = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordGroup);
|
|
68
69
|
const getKeywords = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Keyword);
|
|
69
70
|
const getTitles = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Titles)[0];
|
|
@@ -102,6 +103,15 @@ class Decoder {
|
|
|
102
103
|
...elements,
|
|
103
104
|
]);
|
|
104
105
|
}
|
|
106
|
+
createSupplementsNode() {
|
|
107
|
+
const elements = getSupplements(this.modelMap)
|
|
108
|
+
.map((e) => this.decode(e))
|
|
109
|
+
.filter(Boolean);
|
|
110
|
+
return schema_1.schema.nodes.supplements.createAndFill({}, [
|
|
111
|
+
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('SupplementaryMaterials')),
|
|
112
|
+
...elements,
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
105
115
|
createCommentsNode() {
|
|
106
116
|
return schema_1.schema.nodes.comments.createAndFill({}, [
|
|
107
117
|
...this.comments.values(),
|
|
@@ -618,6 +628,8 @@ class Decoder {
|
|
|
618
628
|
addressLine3: model.addressLine3,
|
|
619
629
|
postCode: model.postCode,
|
|
620
630
|
country: model.country,
|
|
631
|
+
county: model.county,
|
|
632
|
+
city: model.city,
|
|
621
633
|
email: model.email,
|
|
622
634
|
department: model.department,
|
|
623
635
|
priority: model.priority,
|
|
@@ -629,6 +641,8 @@ class Decoder {
|
|
|
629
641
|
id: model._id,
|
|
630
642
|
role: model.role,
|
|
631
643
|
affiliations: model.affiliations,
|
|
644
|
+
email: model.email,
|
|
645
|
+
isJointContributor: model.isJointContributor,
|
|
632
646
|
bibliographicName: model.bibliographicName,
|
|
633
647
|
userID: model.userID,
|
|
634
648
|
invitationID: model.invitationID,
|
|
@@ -639,6 +653,17 @@ class Decoder {
|
|
|
639
653
|
priority: model.priority,
|
|
640
654
|
}, schema_1.schema.text('_'));
|
|
641
655
|
},
|
|
656
|
+
[json_schema_1.ObjectTypes.Supplement]: (data) => {
|
|
657
|
+
var _a, _b;
|
|
658
|
+
const model = data;
|
|
659
|
+
return schema_1.schema.nodes.supplement.create({
|
|
660
|
+
id: model._id,
|
|
661
|
+
href: model.href,
|
|
662
|
+
mimeType: (_a = model.MIME) === null || _a === void 0 ? void 0 : _a.split('/')[0],
|
|
663
|
+
mimeSubType: (_b = model.MIME) === null || _b === void 0 ? void 0 : _b.split('/')[1],
|
|
664
|
+
title: model.title,
|
|
665
|
+
});
|
|
666
|
+
},
|
|
642
667
|
};
|
|
643
668
|
this.decode = (model) => {
|
|
644
669
|
if (!this.creators[model.objectType]) {
|
|
@@ -653,6 +678,7 @@ class Decoder {
|
|
|
653
678
|
const contributors = this.createContributorsNode();
|
|
654
679
|
const affiliations = this.createAffiliationsNode();
|
|
655
680
|
const keywords = this.createKeywordsNode();
|
|
681
|
+
const suppl = this.createSupplementsNode();
|
|
656
682
|
const { abstracts, body, backmatter } = this.createContentSections();
|
|
657
683
|
const comments = this.createCommentsNode();
|
|
658
684
|
const contents = [
|
|
@@ -660,6 +686,7 @@ class Decoder {
|
|
|
660
686
|
contributors,
|
|
661
687
|
affiliations,
|
|
662
688
|
keywords,
|
|
689
|
+
suppl,
|
|
663
690
|
abstracts,
|
|
664
691
|
body,
|
|
665
692
|
backmatter,
|
|
@@ -508,8 +508,11 @@ const encoders = {
|
|
|
508
508
|
addressLine1: node.attrs.addressLine1,
|
|
509
509
|
addressLine2: node.attrs.addressLine2,
|
|
510
510
|
addressLine3: node.attrs.addressLine3,
|
|
511
|
+
department: node.attrs.department,
|
|
511
512
|
postCode: node.attrs.postCode,
|
|
512
513
|
country: node.attrs.country,
|
|
514
|
+
county: node.attrs.county,
|
|
515
|
+
city: node.attrs.city,
|
|
513
516
|
email: node.attrs.email,
|
|
514
517
|
priority: node.attrs.priority,
|
|
515
518
|
}),
|
|
@@ -520,11 +523,19 @@ const encoders = {
|
|
|
520
523
|
userID: node.attrs.userID,
|
|
521
524
|
invitationID: node.attrs.invitationID,
|
|
522
525
|
isCorresponding: node.attrs.isCorresponding,
|
|
526
|
+
isJointContributor: node.attrs.isJointContributor,
|
|
523
527
|
ORCIDIdentifier: node.attrs.ORCIDIdentifier,
|
|
524
528
|
footnote: node.attrs.footnote,
|
|
525
529
|
corresp: node.attrs.corresp,
|
|
526
530
|
priority: node.attrs.priority,
|
|
527
531
|
}),
|
|
532
|
+
supplement: (node) => ({
|
|
533
|
+
href: node.attrs.href,
|
|
534
|
+
title: node.attrs.title,
|
|
535
|
+
MIME: node.attrs.mimeType && node.attrs.mimeSubType
|
|
536
|
+
? [node.attrs.mimeType, node.attrs.mimeSubType].join('/')
|
|
537
|
+
: '',
|
|
538
|
+
}),
|
|
528
539
|
};
|
|
529
540
|
const modelData = (node, parent, path, priority) => {
|
|
530
541
|
const encoder = encoders[node.type.name];
|
|
@@ -553,6 +564,7 @@ const containerTypes = [
|
|
|
553
564
|
schema_1.schema.nodes.contributors,
|
|
554
565
|
schema_1.schema.nodes.affiliations,
|
|
555
566
|
schema_1.schema.nodes.keywords,
|
|
567
|
+
schema_1.schema.nodes.supplements,
|
|
556
568
|
schema_1.schema.nodes.abstracts,
|
|
557
569
|
schema_1.schema.nodes.body,
|
|
558
570
|
schema_1.schema.nodes.backmatter,
|
|
@@ -61,6 +61,7 @@ exports.nodeTypesMap = new Map([
|
|
|
61
61
|
[schema_1.schema.nodes.contributors, json_schema_1.ObjectTypes.Section],
|
|
62
62
|
[schema_1.schema.nodes.affiliations, json_schema_1.ObjectTypes.Section],
|
|
63
63
|
[schema_1.schema.nodes.title, json_schema_1.ObjectTypes.Titles],
|
|
64
|
+
[schema_1.schema.nodes.supplement, json_schema_1.ObjectTypes.Supplement],
|
|
64
65
|
]);
|
|
65
66
|
const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
|
|
66
67
|
exports.isExecutableNodeType = isExecutableNodeType;
|
|
@@ -424,6 +424,25 @@ const nodes = [
|
|
|
424
424
|
tag: 'sec[sec-type="keywords"]',
|
|
425
425
|
node: 'keywords',
|
|
426
426
|
},
|
|
427
|
+
{
|
|
428
|
+
tag: 'sec[sec-type="supplementary-material"]',
|
|
429
|
+
node: 'supplements',
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
tag: 'supplementary-material',
|
|
433
|
+
node: 'supplement',
|
|
434
|
+
getAttrs: (node) => {
|
|
435
|
+
var _a;
|
|
436
|
+
const element = node;
|
|
437
|
+
return {
|
|
438
|
+
id: element.getAttribute('id'),
|
|
439
|
+
href: element.getAttributeNS(XLINK_NAMESPACE, 'href'),
|
|
440
|
+
mimeType: element.getAttribute('mimetype'),
|
|
441
|
+
mimeSubType: element.getAttribute('mime-subtype'),
|
|
442
|
+
title: (_a = element.querySelector('title')) === null || _a === void 0 ? void 0 : _a.textContent,
|
|
443
|
+
};
|
|
444
|
+
},
|
|
445
|
+
},
|
|
427
446
|
{
|
|
428
447
|
tag: 'sec[sec-type="abstracts"]',
|
|
429
448
|
node: 'abstracts',
|
|
@@ -520,7 +539,7 @@ const nodes = [
|
|
|
520
539
|
{
|
|
521
540
|
tag: 'title',
|
|
522
541
|
node: 'section_title',
|
|
523
|
-
context: 'section/|footnotes_section/|bibliography_section/|keywords/',
|
|
542
|
+
context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/',
|
|
524
543
|
},
|
|
525
544
|
{
|
|
526
545
|
tag: 'title',
|
|
@@ -284,4 +284,18 @@ export const jatsBodyTransformations = {
|
|
|
284
284
|
body.prepend(section);
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
|
+
createSuppleMaterials(document, body, createElement) {
|
|
288
|
+
const suppleMaterials = [
|
|
289
|
+
...document.querySelectorAll('article-meta > supplementary-material'),
|
|
290
|
+
];
|
|
291
|
+
if (suppleMaterials.length > 0) {
|
|
292
|
+
const section = createElement('sec');
|
|
293
|
+
section.setAttribute('sec-type', 'supplementary-material');
|
|
294
|
+
const title = createElement('title');
|
|
295
|
+
title.textContent = 'supplementary-material';
|
|
296
|
+
section.append(title);
|
|
297
|
+
section.append(...suppleMaterials);
|
|
298
|
+
body.prepend(section);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
287
301
|
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import debug from 'debug';
|
|
17
17
|
import { getTrimmedTextContent } from '../../lib/utils';
|
|
18
|
-
import { buildAffiliation, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildJournal,
|
|
18
|
+
import { buildAffiliation, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildJournal, buildTitles, } from '../../transformer';
|
|
19
19
|
import { parseJournalMeta } from './jats-journal-meta-parser';
|
|
20
20
|
import { htmlFromJatsNode } from './jats-parser-utils';
|
|
21
21
|
const warn = debug('manuscripts-transform');
|
|
@@ -122,25 +122,6 @@ export const jatsFrontParser = {
|
|
|
122
122
|
}
|
|
123
123
|
return history;
|
|
124
124
|
},
|
|
125
|
-
parseSupplements(elements) {
|
|
126
|
-
var _a, _b, _c, _d;
|
|
127
|
-
if (!(elements === null || elements === void 0 ? void 0 : elements.length)) {
|
|
128
|
-
return [];
|
|
129
|
-
}
|
|
130
|
-
const supplements = [];
|
|
131
|
-
for (const element of elements) {
|
|
132
|
-
const title = (_a = getTrimmedTextContent(element, 'caption > title')) !== null && _a !== void 0 ? _a : '';
|
|
133
|
-
const href = (_b = element.getAttributeNS(XLINK_NAMESPACE, 'href')) !== null && _b !== void 0 ? _b : '';
|
|
134
|
-
const supplement = buildSupplementaryMaterial(title, href);
|
|
135
|
-
const mimeType = (_c = element.getAttribute('mimetype')) !== null && _c !== void 0 ? _c : '';
|
|
136
|
-
const mimeSubtype = (_d = element.getAttribute('mime-subtype')) !== null && _d !== void 0 ? _d : '';
|
|
137
|
-
if (mimeType && mimeSubtype) {
|
|
138
|
-
supplement.MIME = [mimeType, mimeSubtype].join('/');
|
|
139
|
-
}
|
|
140
|
-
supplements.push(supplement);
|
|
141
|
-
}
|
|
142
|
-
return supplements;
|
|
143
|
-
},
|
|
144
125
|
parseAffiliations(elements) {
|
|
145
126
|
const affiliationIDs = new Map();
|
|
146
127
|
const affiliations = elements.map((element, priority) => {
|
|
@@ -40,9 +40,6 @@ export const parseJATSFront = (doc, front) => {
|
|
|
40
40
|
const authors = jatsFrontParser.parseContributors([
|
|
41
41
|
...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
|
|
42
42
|
], affiliationIDs, footnoteIDs, correspondingIDs);
|
|
43
|
-
const supplements = jatsFrontParser.parseSupplements([
|
|
44
|
-
...front.querySelectorAll('article-meta > supplementary-material'),
|
|
45
|
-
]);
|
|
46
43
|
const history = jatsFrontParser.parseDates(front.querySelector('article-meta > history'));
|
|
47
44
|
const counts = jatsFrontParser.parseCounts(front.querySelector('article-meta counts'));
|
|
48
45
|
const manuscript = Object.assign(Object.assign(Object.assign({}, buildManuscript()), counts), history);
|
|
@@ -54,7 +51,6 @@ export const parseJATSFront = (doc, front) => {
|
|
|
54
51
|
...authors,
|
|
55
52
|
...affiliations,
|
|
56
53
|
...correspondingList,
|
|
57
|
-
...supplements,
|
|
58
54
|
]);
|
|
59
55
|
};
|
|
60
56
|
export const parseJATSBody = (doc, body, references) => {
|
|
@@ -65,6 +61,7 @@ export const parseJATSBody = (doc, body, references) => {
|
|
|
65
61
|
jatsBodyTransformations.createBody(doc, body, createElement);
|
|
66
62
|
jatsBodyTransformations.createAbstracts(doc, body, createElement);
|
|
67
63
|
jatsBodyTransformations.createBackmatter(doc, body, createElement);
|
|
64
|
+
jatsBodyTransformations.createSuppleMaterials(doc, body, createElement);
|
|
68
65
|
jatsBodyTransformations.createKeywords(doc, body, createElement);
|
|
69
66
|
const node = jatsBodyDOMParser.parse(body).firstChild;
|
|
70
67
|
if (!node) {
|
|
@@ -620,6 +620,8 @@ export class JATSExporter {
|
|
|
620
620
|
body: () => ['body', 0],
|
|
621
621
|
abstracts: () => ['abstract', 0],
|
|
622
622
|
backmatter: () => ['backmatter', 0],
|
|
623
|
+
supplement: () => '',
|
|
624
|
+
supplements: () => '',
|
|
623
625
|
bibliography_section: (node) => [
|
|
624
626
|
'ref-list',
|
|
625
627
|
{ id: normalizeID(node.attrs.id) },
|
package/dist/es/schema/index.js
CHANGED
|
@@ -64,6 +64,8 @@ import { pullquoteElement } from './nodes/pullquote_element';
|
|
|
64
64
|
import { section } from './nodes/section';
|
|
65
65
|
import { sectionLabel } from './nodes/section_label';
|
|
66
66
|
import { sectionTitle } from './nodes/section_title';
|
|
67
|
+
import { supplement } from './nodes/supplement';
|
|
68
|
+
import { supplements } from './nodes/supplements';
|
|
67
69
|
import { table, tableBody } from './nodes/table';
|
|
68
70
|
import { tableCol, tableColGroup } from './nodes/table_col';
|
|
69
71
|
import { tableElement } from './nodes/table_element';
|
|
@@ -128,6 +130,8 @@ export * from './nodes/table_element_footer';
|
|
|
128
130
|
export * from './nodes/title';
|
|
129
131
|
export * from './nodes/affiliations';
|
|
130
132
|
export * from './nodes/contributors';
|
|
133
|
+
export * from './nodes/supplement';
|
|
134
|
+
export * from './nodes/supplements';
|
|
131
135
|
export const schema = new Schema({
|
|
132
136
|
marks: {
|
|
133
137
|
bold,
|
|
@@ -207,5 +211,7 @@ export const schema = new Schema({
|
|
|
207
211
|
title,
|
|
208
212
|
affiliations,
|
|
209
213
|
contributors,
|
|
214
|
+
supplements,
|
|
215
|
+
supplement,
|
|
210
216
|
},
|
|
211
217
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const affiliation = {
|
|
2
|
+
content: 'inline*',
|
|
2
3
|
attrs: {
|
|
3
4
|
id: { default: '' },
|
|
4
5
|
institution: { default: '' },
|
|
@@ -8,6 +9,8 @@ export const affiliation = {
|
|
|
8
9
|
addressLine3: { default: '' },
|
|
9
10
|
postCode: { default: '' },
|
|
10
11
|
country: { default: '' },
|
|
12
|
+
county: { default: '' },
|
|
13
|
+
city: { default: '' },
|
|
11
14
|
priority: { default: undefined },
|
|
12
15
|
email: {
|
|
13
16
|
default: {
|
|
@@ -17,7 +20,7 @@ export const affiliation = {
|
|
|
17
20
|
},
|
|
18
21
|
dataTracked: { default: null },
|
|
19
22
|
},
|
|
20
|
-
group: 'block
|
|
23
|
+
group: 'block',
|
|
21
24
|
parseDOM: [
|
|
22
25
|
{
|
|
23
26
|
tag: 'div.affiliation',
|
|
@@ -3,6 +3,7 @@ export const contributor = {
|
|
|
3
3
|
attrs: {
|
|
4
4
|
id: { default: '' },
|
|
5
5
|
role: { default: '' },
|
|
6
|
+
email: { default: '' },
|
|
6
7
|
affiliations: { default: [] },
|
|
7
8
|
footnote: { default: undefined },
|
|
8
9
|
corresp: { default: undefined },
|
|
@@ -10,12 +11,13 @@ export const contributor = {
|
|
|
10
11
|
userID: { default: undefined },
|
|
11
12
|
invitationID: { default: undefined },
|
|
12
13
|
isCorresponding: { default: undefined },
|
|
14
|
+
isJointContributor: { default: undefined },
|
|
13
15
|
ORCIDIdentifier: { default: undefined },
|
|
14
16
|
priority: { default: undefined },
|
|
15
17
|
dataTracked: { default: null },
|
|
16
18
|
contents: { default: '' },
|
|
17
19
|
},
|
|
18
|
-
group: 'block
|
|
20
|
+
group: 'block',
|
|
19
21
|
toDOM: (node) => {
|
|
20
22
|
const contributorNode = node;
|
|
21
23
|
return [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const manuscript = {
|
|
17
|
-
content: 'title? contributors? affiliations? keywords? abstracts body backmatter comments',
|
|
17
|
+
content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
},
|
|
@@ -0,0 +1,60 @@
|
|
|
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 supplement = {
|
|
17
|
+
attrs: {
|
|
18
|
+
id: { default: '' },
|
|
19
|
+
href: { default: '' },
|
|
20
|
+
mimeType: { default: '' },
|
|
21
|
+
mimeSubType: { default: '' },
|
|
22
|
+
title: { default: '' },
|
|
23
|
+
dataTracked: { default: null },
|
|
24
|
+
},
|
|
25
|
+
group: 'block',
|
|
26
|
+
parseDOM: [
|
|
27
|
+
{
|
|
28
|
+
tag: 'div.supplement',
|
|
29
|
+
getAttrs: (dom) => {
|
|
30
|
+
const el = dom;
|
|
31
|
+
const id = el.getAttribute('id');
|
|
32
|
+
const href = el.getAttribute('href');
|
|
33
|
+
const mimeType = el.getAttribute('mimeType');
|
|
34
|
+
const mimeSubType = el.getAttribute('mimeSubType');
|
|
35
|
+
const title = el.textContent;
|
|
36
|
+
return {
|
|
37
|
+
id,
|
|
38
|
+
href,
|
|
39
|
+
mimeType,
|
|
40
|
+
mimeSubType,
|
|
41
|
+
title,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
toDOM: (node) => {
|
|
47
|
+
const supplement = node;
|
|
48
|
+
return [
|
|
49
|
+
'div',
|
|
50
|
+
{
|
|
51
|
+
id: supplement.attrs.id,
|
|
52
|
+
class: 'Supplement',
|
|
53
|
+
href: node.attrs.href,
|
|
54
|
+
mimeType: node.attrs.mimeType,
|
|
55
|
+
mimeSubType: node.attrs.mimeSubType,
|
|
56
|
+
title: node.attrs.title,
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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 supplements = {
|
|
17
|
+
content: 'section_title supplement*',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
dataTracked: { default: null },
|
|
21
|
+
},
|
|
22
|
+
group: 'block',
|
|
23
|
+
selectable: false,
|
|
24
|
+
parseDOM: [
|
|
25
|
+
{
|
|
26
|
+
tag: 'div.supplements',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
toDOM: (node) => {
|
|
30
|
+
const supplements = node;
|
|
31
|
+
return [
|
|
32
|
+
'div',
|
|
33
|
+
{
|
|
34
|
+
id: supplements.attrs.id,
|
|
35
|
+
class: 'supplements',
|
|
36
|
+
spellcheck: 'false',
|
|
37
|
+
contenteditable: false,
|
|
38
|
+
},
|
|
39
|
+
0,
|
|
40
|
+
];
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -55,6 +55,7 @@ const getSections = (modelMap) => getModelsByType(modelMap, ObjectTypes.Section)
|
|
|
55
55
|
const getAffiliations = (modelMap) => getModelsByType(modelMap, ObjectTypes.Affiliation);
|
|
56
56
|
const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
|
|
57
57
|
const getKeywordElements = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordsElement);
|
|
58
|
+
const getSupplements = (modelMap) => getModelsByType(modelMap, ObjectTypes.Supplement);
|
|
58
59
|
const getKeywordGroups = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordGroup);
|
|
59
60
|
const getKeywords = (modelMap) => getModelsByType(modelMap, ObjectTypes.Keyword);
|
|
60
61
|
const getTitles = (modelMap) => getModelsByType(modelMap, ObjectTypes.Titles)[0];
|
|
@@ -93,6 +94,15 @@ export class Decoder {
|
|
|
93
94
|
...elements,
|
|
94
95
|
]);
|
|
95
96
|
}
|
|
97
|
+
createSupplementsNode() {
|
|
98
|
+
const elements = getSupplements(this.modelMap)
|
|
99
|
+
.map((e) => this.decode(e))
|
|
100
|
+
.filter(Boolean);
|
|
101
|
+
return schema.nodes.supplements.createAndFill({}, [
|
|
102
|
+
schema.nodes.section_title.create({}, schema.text('SupplementaryMaterials')),
|
|
103
|
+
...elements,
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
96
106
|
createCommentsNode() {
|
|
97
107
|
return schema.nodes.comments.createAndFill({}, [
|
|
98
108
|
...this.comments.values(),
|
|
@@ -609,6 +619,8 @@ export class Decoder {
|
|
|
609
619
|
addressLine3: model.addressLine3,
|
|
610
620
|
postCode: model.postCode,
|
|
611
621
|
country: model.country,
|
|
622
|
+
county: model.county,
|
|
623
|
+
city: model.city,
|
|
612
624
|
email: model.email,
|
|
613
625
|
department: model.department,
|
|
614
626
|
priority: model.priority,
|
|
@@ -620,6 +632,8 @@ export class Decoder {
|
|
|
620
632
|
id: model._id,
|
|
621
633
|
role: model.role,
|
|
622
634
|
affiliations: model.affiliations,
|
|
635
|
+
email: model.email,
|
|
636
|
+
isJointContributor: model.isJointContributor,
|
|
623
637
|
bibliographicName: model.bibliographicName,
|
|
624
638
|
userID: model.userID,
|
|
625
639
|
invitationID: model.invitationID,
|
|
@@ -630,6 +644,17 @@ export class Decoder {
|
|
|
630
644
|
priority: model.priority,
|
|
631
645
|
}, schema.text('_'));
|
|
632
646
|
},
|
|
647
|
+
[ObjectTypes.Supplement]: (data) => {
|
|
648
|
+
var _a, _b;
|
|
649
|
+
const model = data;
|
|
650
|
+
return schema.nodes.supplement.create({
|
|
651
|
+
id: model._id,
|
|
652
|
+
href: model.href,
|
|
653
|
+
mimeType: (_a = model.MIME) === null || _a === void 0 ? void 0 : _a.split('/')[0],
|
|
654
|
+
mimeSubType: (_b = model.MIME) === null || _b === void 0 ? void 0 : _b.split('/')[1],
|
|
655
|
+
title: model.title,
|
|
656
|
+
});
|
|
657
|
+
},
|
|
633
658
|
};
|
|
634
659
|
this.decode = (model) => {
|
|
635
660
|
if (!this.creators[model.objectType]) {
|
|
@@ -644,6 +669,7 @@ export class Decoder {
|
|
|
644
669
|
const contributors = this.createContributorsNode();
|
|
645
670
|
const affiliations = this.createAffiliationsNode();
|
|
646
671
|
const keywords = this.createKeywordsNode();
|
|
672
|
+
const suppl = this.createSupplementsNode();
|
|
647
673
|
const { abstracts, body, backmatter } = this.createContentSections();
|
|
648
674
|
const comments = this.createCommentsNode();
|
|
649
675
|
const contents = [
|
|
@@ -651,6 +677,7 @@ export class Decoder {
|
|
|
651
677
|
contributors,
|
|
652
678
|
affiliations,
|
|
653
679
|
keywords,
|
|
680
|
+
suppl,
|
|
654
681
|
abstracts,
|
|
655
682
|
body,
|
|
656
683
|
backmatter,
|
|
@@ -500,8 +500,11 @@ const encoders = {
|
|
|
500
500
|
addressLine1: node.attrs.addressLine1,
|
|
501
501
|
addressLine2: node.attrs.addressLine2,
|
|
502
502
|
addressLine3: node.attrs.addressLine3,
|
|
503
|
+
department: node.attrs.department,
|
|
503
504
|
postCode: node.attrs.postCode,
|
|
504
505
|
country: node.attrs.country,
|
|
506
|
+
county: node.attrs.county,
|
|
507
|
+
city: node.attrs.city,
|
|
505
508
|
email: node.attrs.email,
|
|
506
509
|
priority: node.attrs.priority,
|
|
507
510
|
}),
|
|
@@ -512,11 +515,19 @@ const encoders = {
|
|
|
512
515
|
userID: node.attrs.userID,
|
|
513
516
|
invitationID: node.attrs.invitationID,
|
|
514
517
|
isCorresponding: node.attrs.isCorresponding,
|
|
518
|
+
isJointContributor: node.attrs.isJointContributor,
|
|
515
519
|
ORCIDIdentifier: node.attrs.ORCIDIdentifier,
|
|
516
520
|
footnote: node.attrs.footnote,
|
|
517
521
|
corresp: node.attrs.corresp,
|
|
518
522
|
priority: node.attrs.priority,
|
|
519
523
|
}),
|
|
524
|
+
supplement: (node) => ({
|
|
525
|
+
href: node.attrs.href,
|
|
526
|
+
title: node.attrs.title,
|
|
527
|
+
MIME: node.attrs.mimeType && node.attrs.mimeSubType
|
|
528
|
+
? [node.attrs.mimeType, node.attrs.mimeSubType].join('/')
|
|
529
|
+
: '',
|
|
530
|
+
}),
|
|
520
531
|
};
|
|
521
532
|
const modelData = (node, parent, path, priority) => {
|
|
522
533
|
const encoder = encoders[node.type.name];
|
|
@@ -544,6 +555,7 @@ const containerTypes = [
|
|
|
544
555
|
schema.nodes.contributors,
|
|
545
556
|
schema.nodes.affiliations,
|
|
546
557
|
schema.nodes.keywords,
|
|
558
|
+
schema.nodes.supplements,
|
|
547
559
|
schema.nodes.abstracts,
|
|
548
560
|
schema.nodes.body,
|
|
549
561
|
schema.nodes.backmatter,
|
|
@@ -58,6 +58,7 @@ export const nodeTypesMap = new Map([
|
|
|
58
58
|
[schema.nodes.contributors, ObjectTypes.Section],
|
|
59
59
|
[schema.nodes.affiliations, ObjectTypes.Section],
|
|
60
60
|
[schema.nodes.title, ObjectTypes.Titles],
|
|
61
|
+
[schema.nodes.supplement, ObjectTypes.Supplement],
|
|
61
62
|
]);
|
|
62
63
|
export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
|
|
63
64
|
export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
|
|
@@ -34,4 +34,5 @@ export declare const jatsBodyTransformations: {
|
|
|
34
34
|
fixTables(body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
35
35
|
moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
36
36
|
createKeywords(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
37
|
+
createSuppleMaterials(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
37
38
|
};
|
|
@@ -58,7 +58,6 @@ export declare const jatsFrontParser: {
|
|
|
58
58
|
revisionReceiveDate?: number | undefined;
|
|
59
59
|
receiveDate?: number | undefined;
|
|
60
60
|
} | undefined;
|
|
61
|
-
parseSupplements(elements: Element[] | null): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Supplement>[];
|
|
62
61
|
parseAffiliations(elements: Element[]): {
|
|
63
62
|
affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
|
|
64
63
|
affiliationIDs: Map<string, string>;
|
|
@@ -70,4 +70,6 @@ export * from './nodes/table_element_footer';
|
|
|
70
70
|
export * from './nodes/title';
|
|
71
71
|
export * from './nodes/affiliations';
|
|
72
72
|
export * from './nodes/contributors';
|
|
73
|
+
export * from './nodes/supplement';
|
|
74
|
+
export * from './nodes/supplements';
|
|
73
75
|
export declare const schema: Schema<Nodes, Marks>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BibliographicName } from '@manuscripts/json-schema';
|
|
2
2
|
import { NodeSpec } from 'prosemirror-model';
|
|
3
3
|
import { ManuscriptNode } from '../types';
|
|
4
4
|
interface Attrs {
|
|
5
5
|
id: string;
|
|
6
6
|
role: string;
|
|
7
|
-
affiliations:
|
|
7
|
+
affiliations: string[];
|
|
8
8
|
bibliographicName: BibliographicName;
|
|
9
9
|
userID: string;
|
|
10
|
+
email: string;
|
|
10
11
|
invitationID: string;
|
|
11
12
|
isCorresponding: boolean;
|
|
12
13
|
ORCIDIdentifier: string;
|
|
13
14
|
priority: number;
|
|
15
|
+
isJointContributor: boolean;
|
|
14
16
|
}
|
|
15
17
|
export interface ContributorNode extends ManuscriptNode {
|
|
16
18
|
attrs: Attrs;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
href: string;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
mimeSubType: string;
|
|
23
|
+
title: string;
|
|
24
|
+
}
|
|
25
|
+
export interface SupplementNode extends ManuscriptNode {
|
|
26
|
+
attrs: Attrs;
|
|
27
|
+
}
|
|
28
|
+
export declare const supplement: NodeSpec;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 SupplementsNode extends ManuscriptNode {
|
|
22
|
+
attrs: Attrs;
|
|
23
|
+
}
|
|
24
|
+
export declare const supplements: NodeSpec;
|
|
25
|
+
export {};
|
|
@@ -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' | 'comments' | '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' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | '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' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors';
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comments' | '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' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | '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' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
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.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -78,4 +78,4 @@
|
|
|
78
78
|
"rimraf": "^3.0.2",
|
|
79
79
|
"typescript": "^4.0.5"
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|