@manuscripts/transform 2.0.4-LEAN-3083-3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/jats/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 +1 -4
- package/dist/cjs/schema/nodes/contributor.js +1 -3
- 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 +23 -4
- package/dist/cjs/transformer/encode.js +8 -4
- 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 +1 -4
- package/dist/es/schema/nodes/contributor.js +1 -3
- 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 +23 -4
- package/dist/es/transformer/encode.js +8 -4
- 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 +0 -2
- package/dist/types/schema/nodes/contributor.d.ts +2 -4
- 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 +1 -1
|
@@ -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,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isAffiliationNode = exports.affiliation = void 0;
|
|
4
4
|
exports.affiliation = {
|
|
5
|
-
content: 'inline*',
|
|
6
5
|
attrs: {
|
|
7
6
|
id: { default: '' },
|
|
8
7
|
institution: { default: '' },
|
|
@@ -12,8 +11,6 @@ exports.affiliation = {
|
|
|
12
11
|
addressLine3: { default: '' },
|
|
13
12
|
postCode: { default: '' },
|
|
14
13
|
country: { default: '' },
|
|
15
|
-
county: { default: '' },
|
|
16
|
-
city: { default: '' },
|
|
17
14
|
priority: { default: undefined },
|
|
18
15
|
email: {
|
|
19
16
|
default: {
|
|
@@ -23,7 +20,7 @@ exports.affiliation = {
|
|
|
23
20
|
},
|
|
24
21
|
dataTracked: { default: null },
|
|
25
22
|
},
|
|
26
|
-
group: 'block',
|
|
23
|
+
group: 'block element',
|
|
27
24
|
parseDOM: [
|
|
28
25
|
{
|
|
29
26
|
tag: 'div.affiliation',
|
|
@@ -6,7 +6,6 @@ exports.contributor = {
|
|
|
6
6
|
attrs: {
|
|
7
7
|
id: { default: '' },
|
|
8
8
|
role: { default: '' },
|
|
9
|
-
email: { default: '' },
|
|
10
9
|
affiliations: { default: [] },
|
|
11
10
|
footnote: { default: undefined },
|
|
12
11
|
corresp: { default: undefined },
|
|
@@ -14,13 +13,12 @@ exports.contributor = {
|
|
|
14
13
|
userID: { default: undefined },
|
|
15
14
|
invitationID: { default: undefined },
|
|
16
15
|
isCorresponding: { default: undefined },
|
|
17
|
-
isJointContributor: { default: undefined },
|
|
18
16
|
ORCIDIdentifier: { default: undefined },
|
|
19
17
|
priority: { default: undefined },
|
|
20
18
|
dataTracked: { default: null },
|
|
21
19
|
contents: { default: '' },
|
|
22
20
|
},
|
|
23
|
-
group: 'block',
|
|
21
|
+
group: 'block element',
|
|
24
22
|
toDOM: (node) => {
|
|
25
23
|
const contributorNode = node;
|
|
26
24
|
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,8 +628,6 @@ class Decoder {
|
|
|
618
628
|
addressLine3: model.addressLine3,
|
|
619
629
|
postCode: model.postCode,
|
|
620
630
|
country: model.country,
|
|
621
|
-
county: model.county,
|
|
622
|
-
city: model.city,
|
|
623
631
|
email: model.email,
|
|
624
632
|
department: model.department,
|
|
625
633
|
priority: model.priority,
|
|
@@ -631,8 +639,6 @@ class Decoder {
|
|
|
631
639
|
id: model._id,
|
|
632
640
|
role: model.role,
|
|
633
641
|
affiliations: model.affiliations,
|
|
634
|
-
email: model.email,
|
|
635
|
-
isJointContributor: model.isJointContributor,
|
|
636
642
|
bibliographicName: model.bibliographicName,
|
|
637
643
|
userID: model.userID,
|
|
638
644
|
invitationID: model.invitationID,
|
|
@@ -643,6 +649,17 @@ class Decoder {
|
|
|
643
649
|
priority: model.priority,
|
|
644
650
|
}, schema_1.schema.text('_'));
|
|
645
651
|
},
|
|
652
|
+
[json_schema_1.ObjectTypes.Supplement]: (data) => {
|
|
653
|
+
var _a, _b;
|
|
654
|
+
const model = data;
|
|
655
|
+
return schema_1.schema.nodes.supplement.create({
|
|
656
|
+
id: model._id,
|
|
657
|
+
href: model.href,
|
|
658
|
+
mimeType: (_a = model.MIME) === null || _a === void 0 ? void 0 : _a.split('/')[0],
|
|
659
|
+
mimeSubType: (_b = model.MIME) === null || _b === void 0 ? void 0 : _b.split('/')[1],
|
|
660
|
+
title: model.title,
|
|
661
|
+
});
|
|
662
|
+
},
|
|
646
663
|
};
|
|
647
664
|
this.decode = (model) => {
|
|
648
665
|
if (!this.creators[model.objectType]) {
|
|
@@ -657,6 +674,7 @@ class Decoder {
|
|
|
657
674
|
const contributors = this.createContributorsNode();
|
|
658
675
|
const affiliations = this.createAffiliationsNode();
|
|
659
676
|
const keywords = this.createKeywordsNode();
|
|
677
|
+
const suppl = this.createSupplementsNode();
|
|
660
678
|
const { abstracts, body, backmatter } = this.createContentSections();
|
|
661
679
|
const comments = this.createCommentsNode();
|
|
662
680
|
const contents = [
|
|
@@ -664,6 +682,7 @@ class Decoder {
|
|
|
664
682
|
contributors,
|
|
665
683
|
affiliations,
|
|
666
684
|
keywords,
|
|
685
|
+
suppl,
|
|
667
686
|
abstracts,
|
|
668
687
|
body,
|
|
669
688
|
backmatter,
|
|
@@ -508,11 +508,8 @@ 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,
|
|
512
511
|
postCode: node.attrs.postCode,
|
|
513
512
|
country: node.attrs.country,
|
|
514
|
-
county: node.attrs.county,
|
|
515
|
-
city: node.attrs.city,
|
|
516
513
|
email: node.attrs.email,
|
|
517
514
|
priority: node.attrs.priority,
|
|
518
515
|
}),
|
|
@@ -523,12 +520,18 @@ const encoders = {
|
|
|
523
520
|
userID: node.attrs.userID,
|
|
524
521
|
invitationID: node.attrs.invitationID,
|
|
525
522
|
isCorresponding: node.attrs.isCorresponding,
|
|
526
|
-
isJointContributor: node.attrs.isJointContributor,
|
|
527
523
|
ORCIDIdentifier: node.attrs.ORCIDIdentifier,
|
|
528
524
|
footnote: node.attrs.footnote,
|
|
529
525
|
corresp: node.attrs.corresp,
|
|
530
526
|
priority: node.attrs.priority,
|
|
531
527
|
}),
|
|
528
|
+
supplement: (node) => ({
|
|
529
|
+
href: node.attrs.href,
|
|
530
|
+
title: node.attrs.title,
|
|
531
|
+
MIME: node.attrs.mimeType && node.attrs.mimeSubType
|
|
532
|
+
? [node.attrs.mimeType, node.attrs.mimeSubType].join('/')
|
|
533
|
+
: '',
|
|
534
|
+
}),
|
|
532
535
|
};
|
|
533
536
|
const modelData = (node, parent, path, priority) => {
|
|
534
537
|
const encoder = encoders[node.type.name];
|
|
@@ -557,6 +560,7 @@ const containerTypes = [
|
|
|
557
560
|
schema_1.schema.nodes.contributors,
|
|
558
561
|
schema_1.schema.nodes.affiliations,
|
|
559
562
|
schema_1.schema.nodes.keywords,
|
|
563
|
+
schema_1.schema.nodes.supplements,
|
|
560
564
|
schema_1.schema.nodes.abstracts,
|
|
561
565
|
schema_1.schema.nodes.body,
|
|
562
566
|
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,5 +1,4 @@
|
|
|
1
1
|
export const affiliation = {
|
|
2
|
-
content: 'inline*',
|
|
3
2
|
attrs: {
|
|
4
3
|
id: { default: '' },
|
|
5
4
|
institution: { default: '' },
|
|
@@ -9,8 +8,6 @@ export const affiliation = {
|
|
|
9
8
|
addressLine3: { default: '' },
|
|
10
9
|
postCode: { default: '' },
|
|
11
10
|
country: { default: '' },
|
|
12
|
-
county: { default: '' },
|
|
13
|
-
city: { default: '' },
|
|
14
11
|
priority: { default: undefined },
|
|
15
12
|
email: {
|
|
16
13
|
default: {
|
|
@@ -20,7 +17,7 @@ export const affiliation = {
|
|
|
20
17
|
},
|
|
21
18
|
dataTracked: { default: null },
|
|
22
19
|
},
|
|
23
|
-
group: 'block',
|
|
20
|
+
group: 'block element',
|
|
24
21
|
parseDOM: [
|
|
25
22
|
{
|
|
26
23
|
tag: 'div.affiliation',
|
|
@@ -3,7 +3,6 @@ export const contributor = {
|
|
|
3
3
|
attrs: {
|
|
4
4
|
id: { default: '' },
|
|
5
5
|
role: { default: '' },
|
|
6
|
-
email: { default: '' },
|
|
7
6
|
affiliations: { default: [] },
|
|
8
7
|
footnote: { default: undefined },
|
|
9
8
|
corresp: { default: undefined },
|
|
@@ -11,13 +10,12 @@ export const contributor = {
|
|
|
11
10
|
userID: { default: undefined },
|
|
12
11
|
invitationID: { default: undefined },
|
|
13
12
|
isCorresponding: { default: undefined },
|
|
14
|
-
isJointContributor: { default: undefined },
|
|
15
13
|
ORCIDIdentifier: { default: undefined },
|
|
16
14
|
priority: { default: undefined },
|
|
17
15
|
dataTracked: { default: null },
|
|
18
16
|
contents: { default: '' },
|
|
19
17
|
},
|
|
20
|
-
group: 'block',
|
|
18
|
+
group: 'block element',
|
|
21
19
|
toDOM: (node) => {
|
|
22
20
|
const contributorNode = node;
|
|
23
21
|
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,8 +619,6 @@ export class Decoder {
|
|
|
609
619
|
addressLine3: model.addressLine3,
|
|
610
620
|
postCode: model.postCode,
|
|
611
621
|
country: model.country,
|
|
612
|
-
county: model.county,
|
|
613
|
-
city: model.city,
|
|
614
622
|
email: model.email,
|
|
615
623
|
department: model.department,
|
|
616
624
|
priority: model.priority,
|
|
@@ -622,8 +630,6 @@ export class Decoder {
|
|
|
622
630
|
id: model._id,
|
|
623
631
|
role: model.role,
|
|
624
632
|
affiliations: model.affiliations,
|
|
625
|
-
email: model.email,
|
|
626
|
-
isJointContributor: model.isJointContributor,
|
|
627
633
|
bibliographicName: model.bibliographicName,
|
|
628
634
|
userID: model.userID,
|
|
629
635
|
invitationID: model.invitationID,
|
|
@@ -634,6 +640,17 @@ export class Decoder {
|
|
|
634
640
|
priority: model.priority,
|
|
635
641
|
}, schema.text('_'));
|
|
636
642
|
},
|
|
643
|
+
[ObjectTypes.Supplement]: (data) => {
|
|
644
|
+
var _a, _b;
|
|
645
|
+
const model = data;
|
|
646
|
+
return schema.nodes.supplement.create({
|
|
647
|
+
id: model._id,
|
|
648
|
+
href: model.href,
|
|
649
|
+
mimeType: (_a = model.MIME) === null || _a === void 0 ? void 0 : _a.split('/')[0],
|
|
650
|
+
mimeSubType: (_b = model.MIME) === null || _b === void 0 ? void 0 : _b.split('/')[1],
|
|
651
|
+
title: model.title,
|
|
652
|
+
});
|
|
653
|
+
},
|
|
637
654
|
};
|
|
638
655
|
this.decode = (model) => {
|
|
639
656
|
if (!this.creators[model.objectType]) {
|
|
@@ -648,6 +665,7 @@ export class Decoder {
|
|
|
648
665
|
const contributors = this.createContributorsNode();
|
|
649
666
|
const affiliations = this.createAffiliationsNode();
|
|
650
667
|
const keywords = this.createKeywordsNode();
|
|
668
|
+
const suppl = this.createSupplementsNode();
|
|
651
669
|
const { abstracts, body, backmatter } = this.createContentSections();
|
|
652
670
|
const comments = this.createCommentsNode();
|
|
653
671
|
const contents = [
|
|
@@ -655,6 +673,7 @@ export class Decoder {
|
|
|
655
673
|
contributors,
|
|
656
674
|
affiliations,
|
|
657
675
|
keywords,
|
|
676
|
+
suppl,
|
|
658
677
|
abstracts,
|
|
659
678
|
body,
|
|
660
679
|
backmatter,
|
|
@@ -500,11 +500,8 @@ 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,
|
|
504
503
|
postCode: node.attrs.postCode,
|
|
505
504
|
country: node.attrs.country,
|
|
506
|
-
county: node.attrs.county,
|
|
507
|
-
city: node.attrs.city,
|
|
508
505
|
email: node.attrs.email,
|
|
509
506
|
priority: node.attrs.priority,
|
|
510
507
|
}),
|
|
@@ -515,12 +512,18 @@ const encoders = {
|
|
|
515
512
|
userID: node.attrs.userID,
|
|
516
513
|
invitationID: node.attrs.invitationID,
|
|
517
514
|
isCorresponding: node.attrs.isCorresponding,
|
|
518
|
-
isJointContributor: node.attrs.isJointContributor,
|
|
519
515
|
ORCIDIdentifier: node.attrs.ORCIDIdentifier,
|
|
520
516
|
footnote: node.attrs.footnote,
|
|
521
517
|
corresp: node.attrs.corresp,
|
|
522
518
|
priority: node.attrs.priority,
|
|
523
519
|
}),
|
|
520
|
+
supplement: (node) => ({
|
|
521
|
+
href: node.attrs.href,
|
|
522
|
+
title: node.attrs.title,
|
|
523
|
+
MIME: node.attrs.mimeType && node.attrs.mimeSubType
|
|
524
|
+
? [node.attrs.mimeType, node.attrs.mimeSubType].join('/')
|
|
525
|
+
: '',
|
|
526
|
+
}),
|
|
524
527
|
};
|
|
525
528
|
const modelData = (node, parent, path, priority) => {
|
|
526
529
|
const encoder = encoders[node.type.name];
|
|
@@ -548,6 +551,7 @@ const containerTypes = [
|
|
|
548
551
|
schema.nodes.contributors,
|
|
549
552
|
schema.nodes.affiliations,
|
|
550
553
|
schema.nodes.keywords,
|
|
554
|
+
schema.nodes.supplements,
|
|
551
555
|
schema.nodes.abstracts,
|
|
552
556
|
schema.nodes.body,
|
|
553
557
|
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,18 +1,16 @@
|
|
|
1
|
-
import { BibliographicName } from '@manuscripts/json-schema';
|
|
1
|
+
import { Affiliation, 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: Affiliation[];
|
|
8
8
|
bibliographicName: BibliographicName;
|
|
9
9
|
userID: string;
|
|
10
|
-
email: string;
|
|
11
10
|
invitationID: string;
|
|
12
11
|
isCorresponding: boolean;
|
|
13
12
|
ORCIDIdentifier: string;
|
|
14
13
|
priority: number;
|
|
15
|
-
isJointContributor: boolean;
|
|
16
14
|
}
|
|
17
15
|
export interface ContributorNode extends ManuscriptNode {
|
|
18
16
|
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.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|