@manuscripts/transform 1.3.0-LEAN-2615 → 1.3.0-LEAN-2505-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 +3 -6
- package/dist/cjs/jats/importer/jats-body-transformations.js +1 -5
- package/dist/cjs/jats/importer/jats-comments.js +1 -2
- package/dist/cjs/jats/importer/jats-front-parser.js +24 -27
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +6 -10
- package/dist/cjs/jats/importer/jats-reference-parser.js +17 -18
- package/dist/cjs/lib/utils.js +1 -9
- package/dist/cjs/schema/nodes/comment_list.js +2 -1
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/transformer/decode.js +4 -6
- package/dist/cjs/transformer/labels.js +1 -2
- package/dist/es/jats/importer/jats-body-dom-parser.js +3 -6
- package/dist/es/jats/importer/jats-body-transformations.js +1 -5
- package/dist/es/jats/importer/jats-comments.js +1 -2
- package/dist/es/jats/importer/jats-front-parser.js +24 -27
- package/dist/es/jats/importer/jats-journal-meta-parser.js +6 -10
- package/dist/es/jats/importer/jats-reference-parser.js +17 -18
- package/dist/es/lib/utils.js +0 -7
- package/dist/es/schema/nodes/comment_list.js +2 -1
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/transformer/decode.js +4 -6
- package/dist/es/transformer/labels.js +1 -2
- package/dist/types/lib/utils.d.ts +0 -1
- package/package.json +1 -1
|
@@ -649,11 +649,10 @@ const nodes = [
|
|
|
649
649
|
tag: 'xref[ref-type="bibr"]',
|
|
650
650
|
node: 'citation',
|
|
651
651
|
getAttrs: (node) => {
|
|
652
|
-
var _a;
|
|
653
652
|
const element = node;
|
|
654
653
|
return {
|
|
655
654
|
rid: element.getAttribute('rid'),
|
|
656
|
-
contents:
|
|
655
|
+
contents: element.textContent,
|
|
657
656
|
};
|
|
658
657
|
},
|
|
659
658
|
},
|
|
@@ -661,11 +660,10 @@ const nodes = [
|
|
|
661
660
|
tag: 'xref[ref-type="fn"]',
|
|
662
661
|
node: 'inline_footnote',
|
|
663
662
|
getAttrs: (node) => {
|
|
664
|
-
var _a;
|
|
665
663
|
const element = node;
|
|
666
664
|
return {
|
|
667
665
|
rid: element.getAttribute('rid'),
|
|
668
|
-
contents:
|
|
666
|
+
contents: element.textContent,
|
|
669
667
|
};
|
|
670
668
|
},
|
|
671
669
|
},
|
|
@@ -673,11 +671,10 @@ const nodes = [
|
|
|
673
671
|
tag: 'xref',
|
|
674
672
|
node: 'cross_reference',
|
|
675
673
|
getAttrs: (node) => {
|
|
676
|
-
var _a;
|
|
677
674
|
const element = node;
|
|
678
675
|
return {
|
|
679
676
|
rid: element.getAttribute('rid'),
|
|
680
|
-
label:
|
|
677
|
+
label: element.textContent,
|
|
681
678
|
};
|
|
682
679
|
},
|
|
683
680
|
},
|
|
@@ -215,7 +215,6 @@ exports.jatsBodyTransformations = {
|
|
|
215
215
|
body.append(backmatterContainer);
|
|
216
216
|
},
|
|
217
217
|
mapFootnotesToSections(doc, backmatterContainer, createElement) {
|
|
218
|
-
var _a;
|
|
219
218
|
const footnoteGroups = [...doc.querySelectorAll('fn[fn-type]')];
|
|
220
219
|
for (const footnote of footnoteGroups) {
|
|
221
220
|
const type = footnote.getAttribute('fn-type') || '';
|
|
@@ -225,10 +224,7 @@ exports.jatsBodyTransformations = {
|
|
|
225
224
|
const title = footnote.querySelector('p[content-type="fn-title"]');
|
|
226
225
|
if (title) {
|
|
227
226
|
const sectionTitleElement = createElement('title');
|
|
228
|
-
|
|
229
|
-
if (titleTextContent) {
|
|
230
|
-
sectionTitleElement.textContent = titleTextContent;
|
|
231
|
-
}
|
|
227
|
+
sectionTitleElement.textContent = title.textContent;
|
|
232
228
|
removeNodeFromParent(title);
|
|
233
229
|
section.append(sectionTitleElement);
|
|
234
230
|
}
|
|
@@ -21,8 +21,7 @@ const transformer_1 = require("../../transformer");
|
|
|
21
21
|
const DEFAULT_ANNOTATION_COLOR = 'rgb(250, 224, 150)';
|
|
22
22
|
const DEFAULT_PROFILE_ID = 'MPUserProfile:0000000000000000000000000000000000000001';
|
|
23
23
|
const parseProcessingInstruction = (node) => {
|
|
24
|
-
|
|
25
|
-
const value = `<AuthorQuery ${(_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()} />`;
|
|
24
|
+
const value = `<AuthorQuery ${node.textContent} />`;
|
|
26
25
|
const processingInstruction = new DOMParser().parseFromString(value, 'application/xml').firstElementChild;
|
|
27
26
|
if (processingInstruction) {
|
|
28
27
|
const queryText = processingInstruction.getAttribute('queryText');
|
|
@@ -20,7 +20,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.jatsFrontParser = void 0;
|
|
22
22
|
const debug_1 = __importDefault(require("debug"));
|
|
23
|
-
const utils_1 = require("../../lib/utils");
|
|
24
23
|
const builders_1 = require("../../transformer/builders");
|
|
25
24
|
const jats_journal_meta_parser_1 = require("./jats-journal-meta-parser");
|
|
26
25
|
const warn = (0, debug_1.default)('manuscripts-transform');
|
|
@@ -75,10 +74,11 @@ exports.jatsFrontParser = {
|
|
|
75
74
|
}
|
|
76
75
|
const history = {};
|
|
77
76
|
const dateToTimestamp = (dateElement) => {
|
|
77
|
+
var _a, _b;
|
|
78
78
|
const selectors = ['year', 'month', 'day'];
|
|
79
79
|
const values = [];
|
|
80
80
|
for (const selector of selectors) {
|
|
81
|
-
const value = (0
|
|
81
|
+
const value = (_b = (_a = dateElement.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
82
82
|
if (!value || isNaN(+value)) {
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
@@ -118,17 +118,17 @@ exports.jatsFrontParser = {
|
|
|
118
118
|
return history;
|
|
119
119
|
},
|
|
120
120
|
parseSupplements(supplementNodes) {
|
|
121
|
-
var _a, _b, _c, _d;
|
|
121
|
+
var _a, _b, _c, _d, _e;
|
|
122
122
|
if (!supplementNodes || supplementNodes.length === 0) {
|
|
123
123
|
return [];
|
|
124
124
|
}
|
|
125
125
|
const supplements = [];
|
|
126
126
|
for (const supplementNode of supplementNodes) {
|
|
127
|
-
const supplTitle = (
|
|
128
|
-
const href = (
|
|
127
|
+
const supplTitle = (_b = (_a = supplementNode.querySelector('caption > title')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : '';
|
|
128
|
+
const href = (_c = supplementNode.getAttributeNS(XLINK_NAMESPACE, 'href')) !== null && _c !== void 0 ? _c : '';
|
|
129
129
|
const supplementaryMaterial = (0, builders_1.buildSupplementaryMaterial)(supplTitle, href);
|
|
130
|
-
const mimeType = (
|
|
131
|
-
const mimeSubtype = (
|
|
130
|
+
const mimeType = (_d = supplementNode.getAttribute('mimetype')) !== null && _d !== void 0 ? _d : '';
|
|
131
|
+
const mimeSubtype = (_e = supplementNode.getAttribute('mime-subtype')) !== null && _e !== void 0 ? _e : '';
|
|
132
132
|
if (mimeType && mimeSubtype) {
|
|
133
133
|
supplementaryMaterial.MIME = [mimeType, mimeSubtype].join('/');
|
|
134
134
|
}
|
|
@@ -139,10 +139,10 @@ exports.jatsFrontParser = {
|
|
|
139
139
|
parseAffiliationNodes(affiliationNodes) {
|
|
140
140
|
const affiliationIDs = new Map();
|
|
141
141
|
const affiliations = affiliationNodes.map((affiliationNode, priority) => {
|
|
142
|
-
var _a, _b;
|
|
142
|
+
var _a, _b, _c, _d, _e;
|
|
143
143
|
const affiliation = (0, builders_1.buildAffiliation)('', priority);
|
|
144
144
|
for (const node of affiliationNode.querySelectorAll('institution')) {
|
|
145
|
-
const content =
|
|
145
|
+
const content = node.textContent;
|
|
146
146
|
if (!content) {
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
@@ -157,25 +157,22 @@ exports.jatsFrontParser = {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
affiliation.addressLine1 =
|
|
160
|
-
(
|
|
161
|
-
undefined;
|
|
160
|
+
((_a = affiliationNode.querySelector('addr-line:nth-of-type(1)')) === null || _a === void 0 ? void 0 : _a.textContent) || undefined;
|
|
162
161
|
affiliation.addressLine2 =
|
|
163
|
-
(
|
|
164
|
-
undefined;
|
|
162
|
+
((_b = affiliationNode.querySelector('addr-line:nth-of-type(2)')) === null || _b === void 0 ? void 0 : _b.textContent) || undefined;
|
|
165
163
|
affiliation.addressLine3 =
|
|
166
|
-
(
|
|
167
|
-
undefined;
|
|
164
|
+
((_c = affiliationNode.querySelector('addr-line:nth-of-type(3)')) === null || _c === void 0 ? void 0 : _c.textContent) || undefined;
|
|
168
165
|
const emailNode = affiliationNode.querySelector('email');
|
|
169
166
|
if (emailNode) {
|
|
170
167
|
affiliation.email = {
|
|
171
168
|
href: emailNode.getAttributeNS(XLINK_NAMESPACE, 'href') || undefined,
|
|
172
|
-
text:
|
|
169
|
+
text: emailNode.textContent || undefined,
|
|
173
170
|
};
|
|
174
171
|
}
|
|
175
172
|
affiliation.postCode =
|
|
176
|
-
(
|
|
173
|
+
((_d = affiliationNode.querySelector('postal-code')) === null || _d === void 0 ? void 0 : _d.textContent) || undefined;
|
|
177
174
|
affiliation.country =
|
|
178
|
-
(
|
|
175
|
+
((_e = affiliationNode.querySelector('country')) === null || _e === void 0 ? void 0 : _e.textContent) || undefined;
|
|
179
176
|
const id = affiliationNode.getAttribute('id');
|
|
180
177
|
if (id) {
|
|
181
178
|
affiliationIDs.set(id, affiliation._id);
|
|
@@ -205,13 +202,13 @@ exports.jatsFrontParser = {
|
|
|
205
202
|
parseCorrespNodes(correspNodes) {
|
|
206
203
|
const correspondingIDs = new Map();
|
|
207
204
|
const correspondingList = correspNodes.map((correspNode) => {
|
|
208
|
-
var _a
|
|
205
|
+
var _a;
|
|
209
206
|
const label = correspNode.querySelector('label');
|
|
210
207
|
if (label) {
|
|
211
208
|
label.remove();
|
|
212
209
|
}
|
|
213
|
-
const corresponding = (0, builders_1.buildCorresp)((
|
|
214
|
-
corresponding.label = (
|
|
210
|
+
const corresponding = (0, builders_1.buildCorresp)((_a = correspNode.textContent) !== null && _a !== void 0 ? _a : '');
|
|
211
|
+
corresponding.label = (label === null || label === void 0 ? void 0 : label.textContent) || undefined;
|
|
215
212
|
const id = correspNode.getAttribute('id');
|
|
216
213
|
if (id) {
|
|
217
214
|
correspondingIDs.set(id, corresponding._id);
|
|
@@ -225,13 +222,13 @@ exports.jatsFrontParser = {
|
|
|
225
222
|
},
|
|
226
223
|
parseAuthorNodes(authorNodes, affiliationIDs, footnoteIDs, correspondingIDs) {
|
|
227
224
|
return authorNodes.map((authorNode, priority) => {
|
|
228
|
-
var _a, _b;
|
|
225
|
+
var _a, _b, _c;
|
|
229
226
|
const name = (0, builders_1.buildBibliographicName)({});
|
|
230
|
-
const given = (
|
|
227
|
+
const given = (_a = authorNode.querySelector('name > given-names')) === null || _a === void 0 ? void 0 : _a.textContent;
|
|
231
228
|
if (given) {
|
|
232
229
|
name.given = given;
|
|
233
230
|
}
|
|
234
|
-
const surname = (
|
|
231
|
+
const surname = (_b = authorNode.querySelector('name > surname')) === null || _b === void 0 ? void 0 : _b.textContent;
|
|
235
232
|
if (surname) {
|
|
236
233
|
name.family = surname;
|
|
237
234
|
}
|
|
@@ -240,7 +237,7 @@ exports.jatsFrontParser = {
|
|
|
240
237
|
if (corresponding) {
|
|
241
238
|
contributor.isCorresponding = corresponding;
|
|
242
239
|
}
|
|
243
|
-
const orcid = (
|
|
240
|
+
const orcid = (_c = authorNode.querySelector('contrib-id[contrib-id-type="orcid"]')) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
244
241
|
if (orcid) {
|
|
245
242
|
contributor.ORCIDIdentifier = orcid;
|
|
246
243
|
}
|
|
@@ -256,7 +253,7 @@ exports.jatsFrontParser = {
|
|
|
256
253
|
if (footnoteId) {
|
|
257
254
|
const authorFootNoteRef = {
|
|
258
255
|
noteID: footnoteId,
|
|
259
|
-
noteLabel:
|
|
256
|
+
noteLabel: xrefNode.textContent || '',
|
|
260
257
|
};
|
|
261
258
|
contributor.footnote.push(authorFootNoteRef);
|
|
262
259
|
}
|
|
@@ -267,7 +264,7 @@ exports.jatsFrontParser = {
|
|
|
267
264
|
if (correspId) {
|
|
268
265
|
const authorCorrespRef = {
|
|
269
266
|
correspID: correspId,
|
|
270
|
-
correspLabel:
|
|
267
|
+
correspLabel: xrefNode.textContent || '',
|
|
271
268
|
};
|
|
272
269
|
contributor.corresp.push(authorCorrespRef);
|
|
273
270
|
}
|
|
@@ -16,14 +16,12 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.parseJournalMeta = exports.parseJournalISSNs = exports.parseJournalAbbreviatedTitles = exports.parseJournalIdentifiers = void 0;
|
|
19
|
-
const utils_1 = require("../../lib/utils");
|
|
20
19
|
const parseJournalIdentifiers = (journalMeta) => {
|
|
21
|
-
var _a, _b;
|
|
22
20
|
const output = [];
|
|
23
21
|
const elements = journalMeta.querySelectorAll('journal-id');
|
|
24
22
|
for (const element of elements) {
|
|
25
23
|
const journalIDType = element.getAttribute('journal-id-type');
|
|
26
|
-
const journalID =
|
|
24
|
+
const journalID = element.textContent;
|
|
27
25
|
if (journalID !== null && journalIDType != null) {
|
|
28
26
|
output.push({ journalIDType, journalID });
|
|
29
27
|
}
|
|
@@ -35,12 +33,11 @@ const parseJournalIdentifiers = (journalMeta) => {
|
|
|
35
33
|
};
|
|
36
34
|
exports.parseJournalIdentifiers = parseJournalIdentifiers;
|
|
37
35
|
const parseJournalAbbreviatedTitles = (journalMeta) => {
|
|
38
|
-
var _a, _b;
|
|
39
36
|
const output = [];
|
|
40
37
|
const elements = journalMeta.querySelectorAll('journal-title-group > abbrev-journal-title');
|
|
41
38
|
for (const element of elements) {
|
|
42
39
|
const abbrevType = element.getAttribute('abbrev-type');
|
|
43
|
-
const abbreviatedTitle =
|
|
40
|
+
const abbreviatedTitle = element.textContent;
|
|
44
41
|
if (abbreviatedTitle !== null && abbrevType !== null) {
|
|
45
42
|
output.push({ abbreviatedTitle, abbrevType });
|
|
46
43
|
}
|
|
@@ -52,12 +49,11 @@ const parseJournalAbbreviatedTitles = (journalMeta) => {
|
|
|
52
49
|
};
|
|
53
50
|
exports.parseJournalAbbreviatedTitles = parseJournalAbbreviatedTitles;
|
|
54
51
|
const parseJournalISSNs = (journalMeta) => {
|
|
55
|
-
var _a, _b;
|
|
56
52
|
const output = [];
|
|
57
53
|
const elements = journalMeta.querySelectorAll('issn');
|
|
58
54
|
for (const element of elements) {
|
|
59
55
|
const publicationType = element.getAttribute('pub-type');
|
|
60
|
-
const ISSN =
|
|
56
|
+
const ISSN = element.textContent;
|
|
61
57
|
if (publicationType !== null && ISSN !== null) {
|
|
62
58
|
output.push({ publicationType, ISSN });
|
|
63
59
|
}
|
|
@@ -69,13 +65,13 @@ const parseJournalISSNs = (journalMeta) => {
|
|
|
69
65
|
};
|
|
70
66
|
exports.parseJournalISSNs = parseJournalISSNs;
|
|
71
67
|
const parseJournalMeta = (journalMeta) => {
|
|
72
|
-
var _a, _b;
|
|
68
|
+
var _a, _b, _c, _d;
|
|
73
69
|
return {
|
|
74
70
|
abbreviatedTitles: (0, exports.parseJournalAbbreviatedTitles)(journalMeta),
|
|
75
71
|
journalIdentifiers: (0, exports.parseJournalIdentifiers)(journalMeta),
|
|
76
72
|
ISSNs: (0, exports.parseJournalISSNs)(journalMeta),
|
|
77
|
-
publisherName: (
|
|
78
|
-
title: (
|
|
73
|
+
publisherName: (_b = (_a = journalMeta.querySelector('publisher > publisher-name')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : undefined,
|
|
74
|
+
title: (_d = (_c = journalMeta.querySelector('journal-title-group > journal-title')) === null || _c === void 0 ? void 0 : _c.textContent) !== null && _d !== void 0 ? _d : undefined,
|
|
79
75
|
};
|
|
80
76
|
};
|
|
81
77
|
exports.parseJournalMeta = parseJournalMeta;
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.jatsReferenceParser = void 0;
|
|
19
|
-
const utils_1 = require("../../lib/utils");
|
|
20
19
|
const builders_1 = require("../../transformer/builders");
|
|
21
20
|
const jats_comments_1 = require("./jats-comments");
|
|
22
21
|
const jats_parser_utils_1 = require("./jats-parser-utils");
|
|
@@ -35,7 +34,7 @@ exports.jatsReferenceParser = {
|
|
|
35
34
|
const referenceIDs = new Map();
|
|
36
35
|
const referenceQueries = new Map();
|
|
37
36
|
const references = referenceNodes.map((referenceNode) => {
|
|
38
|
-
var _a;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
39
38
|
const publicationType = referenceNode.getAttribute('publication-type');
|
|
40
39
|
const authorNodes = [
|
|
41
40
|
...referenceNode.querySelectorAll('person-group[person-group-type="author"] > *'),
|
|
@@ -45,7 +44,7 @@ exports.jatsReferenceParser = {
|
|
|
45
44
|
});
|
|
46
45
|
const titleNode = referenceNode.querySelector('article-title');
|
|
47
46
|
if (titleNode) {
|
|
48
|
-
bibliographyItem.title = (
|
|
47
|
+
bibliographyItem.title = (0, jats_parser_utils_1.htmlFromJatsNode)(titleNode, createElement);
|
|
49
48
|
}
|
|
50
49
|
const queriesText = [];
|
|
51
50
|
const mixedCitation = referenceNode.querySelector('mixed-citation');
|
|
@@ -64,63 +63,63 @@ exports.jatsReferenceParser = {
|
|
|
64
63
|
}
|
|
65
64
|
if (authorNodes.length <= 0) {
|
|
66
65
|
mixedCitation === null || mixedCitation === void 0 ? void 0 : mixedCitation.childNodes.forEach((item) => {
|
|
67
|
-
var _a, _b
|
|
66
|
+
var _a, _b;
|
|
68
67
|
if (item.nodeType === Node.TEXT_NODE &&
|
|
69
68
|
((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.match(/[A-Za-z]+/g))) {
|
|
70
|
-
bibliographyItem.literal = (
|
|
69
|
+
bibliographyItem.literal = (_b = mixedCitation.textContent) !== null && _b !== void 0 ? _b : '';
|
|
71
70
|
return bibliographyItem;
|
|
72
71
|
}
|
|
73
72
|
});
|
|
74
73
|
}
|
|
75
|
-
const source = (
|
|
74
|
+
const source = (_a = referenceNode.querySelector('source')) === null || _a === void 0 ? void 0 : _a.textContent;
|
|
76
75
|
if (source) {
|
|
77
76
|
bibliographyItem['container-title'] = source;
|
|
78
77
|
}
|
|
79
|
-
const volume = (
|
|
78
|
+
const volume = (_b = referenceNode.querySelector('volume')) === null || _b === void 0 ? void 0 : _b.textContent;
|
|
80
79
|
if (volume) {
|
|
81
80
|
bibliographyItem.volume = volume;
|
|
82
81
|
}
|
|
83
|
-
const issue = (
|
|
82
|
+
const issue = (_c = referenceNode.querySelector('issue')) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
84
83
|
if (issue) {
|
|
85
84
|
bibliographyItem.issue = issue;
|
|
86
85
|
}
|
|
87
|
-
const supplement = (
|
|
86
|
+
const supplement = (_d = referenceNode.querySelector('supplement')) === null || _d === void 0 ? void 0 : _d.textContent;
|
|
88
87
|
if (supplement) {
|
|
89
88
|
bibliographyItem.supplement = supplement;
|
|
90
89
|
}
|
|
91
|
-
const fpage = (
|
|
92
|
-
const lpage = (
|
|
90
|
+
const fpage = (_e = referenceNode.querySelector('fpage')) === null || _e === void 0 ? void 0 : _e.textContent;
|
|
91
|
+
const lpage = (_f = referenceNode.querySelector('lpage')) === null || _f === void 0 ? void 0 : _f.textContent;
|
|
93
92
|
if (fpage) {
|
|
94
93
|
bibliographyItem.page = lpage ? `${fpage}-${lpage}` : fpage;
|
|
95
94
|
}
|
|
96
|
-
const year = (
|
|
95
|
+
const year = (_g = referenceNode.querySelector('year')) === null || _g === void 0 ? void 0 : _g.textContent;
|
|
97
96
|
if (year) {
|
|
98
97
|
bibliographyItem.issued = (0, builders_1.buildBibliographicDate)({
|
|
99
98
|
'date-parts': [[year]],
|
|
100
99
|
});
|
|
101
100
|
}
|
|
102
|
-
const doi = (
|
|
101
|
+
const doi = (_h = referenceNode.querySelector('pub-id[pub-id-type="doi"]')) === null || _h === void 0 ? void 0 : _h.textContent;
|
|
103
102
|
if (doi) {
|
|
104
103
|
bibliographyItem.DOI = doi;
|
|
105
104
|
}
|
|
106
105
|
const authors = [];
|
|
107
106
|
authorNodes.forEach((authorNode) => {
|
|
108
|
-
var _a;
|
|
107
|
+
var _a, _b, _c;
|
|
109
108
|
const name = (0, builders_1.buildBibliographicName)({});
|
|
110
|
-
const given = (
|
|
109
|
+
const given = (_a = authorNode.querySelector('given-names')) === null || _a === void 0 ? void 0 : _a.textContent;
|
|
111
110
|
if (given) {
|
|
112
111
|
name.given = given;
|
|
113
112
|
}
|
|
114
|
-
const family = (
|
|
113
|
+
const family = (_b = authorNode.querySelector('surname')) === null || _b === void 0 ? void 0 : _b.textContent;
|
|
115
114
|
if (family) {
|
|
116
115
|
name.family = family;
|
|
117
116
|
}
|
|
118
|
-
const suffix = (
|
|
117
|
+
const suffix = (_c = authorNode.querySelector('suffix')) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
119
118
|
if (suffix) {
|
|
120
119
|
name.suffix = suffix;
|
|
121
120
|
}
|
|
122
121
|
if (authorNode.nodeName === 'collab') {
|
|
123
|
-
name.literal =
|
|
122
|
+
name.literal = authorNode.textContent;
|
|
124
123
|
}
|
|
125
124
|
authors.push(name);
|
|
126
125
|
});
|
package/dist/cjs/lib/utils.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.findParentNodeClosestToPos = exports.isInBibliographySection = exports.isInGraphicalAbstractSection = exports.findNodePositions = exports.iterateChildren = void 0;
|
|
19
19
|
const bibliography_section_1 = require("../schema/nodes/bibliography_section");
|
|
20
20
|
const graphical_abstract_section_1 = require("../schema/nodes/graphical_abstract_section");
|
|
21
21
|
function* iterateChildren(node, recurse = false) {
|
|
@@ -75,11 +75,3 @@ const findParentNodeClosestToPos = ($pos, predicate) => {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
exports.findParentNodeClosestToPos = findParentNodeClosestToPos;
|
|
78
|
-
const getTrimmedTextContent = (node, querySelector) => {
|
|
79
|
-
var _a, _b;
|
|
80
|
-
if (!node) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
84
|
-
};
|
|
85
|
-
exports.getTrimmedTextContent = getTrimmedTextContent;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.manuscript = void 0;
|
|
19
19
|
exports.manuscript = {
|
|
20
|
-
content: '(section | sections)+ comment_list
|
|
20
|
+
content: '(section | sections)+ comment_list',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
},
|
|
@@ -571,12 +571,10 @@ class Decoder {
|
|
|
571
571
|
}));
|
|
572
572
|
}
|
|
573
573
|
const contents = rootSectionNodes;
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
contents.push(comments);
|
|
579
|
-
}
|
|
574
|
+
const comments = schema_1.schema.nodes.comment_list.createAndFill({}, [
|
|
575
|
+
...this.comments.values(),
|
|
576
|
+
]);
|
|
577
|
+
contents.push(comments);
|
|
580
578
|
return schema_1.schema.nodes.manuscript.create({
|
|
581
579
|
id: manuscriptID || this.getManuscriptID(),
|
|
582
580
|
}, contents);
|
|
@@ -65,7 +65,6 @@ const buildTargets = (fragment, manuscript) => {
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
fragment.descendants((node) => {
|
|
68
|
-
var _a;
|
|
69
68
|
if (node.type.name in counters) {
|
|
70
69
|
const isInGraphicalAbstract = figures.indexOf(node.attrs.id) > -1;
|
|
71
70
|
if (isInGraphicalAbstract) {
|
|
@@ -76,7 +75,7 @@ const buildTargets = (fragment, manuscript) => {
|
|
|
76
75
|
type: node.type.name,
|
|
77
76
|
id: node.attrs.id,
|
|
78
77
|
label,
|
|
79
|
-
caption:
|
|
78
|
+
caption: node.textContent,
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
81
|
});
|
|
@@ -643,11 +643,10 @@ const nodes = [
|
|
|
643
643
|
tag: 'xref[ref-type="bibr"]',
|
|
644
644
|
node: 'citation',
|
|
645
645
|
getAttrs: (node) => {
|
|
646
|
-
var _a;
|
|
647
646
|
const element = node;
|
|
648
647
|
return {
|
|
649
648
|
rid: element.getAttribute('rid'),
|
|
650
|
-
contents:
|
|
649
|
+
contents: element.textContent,
|
|
651
650
|
};
|
|
652
651
|
},
|
|
653
652
|
},
|
|
@@ -655,11 +654,10 @@ const nodes = [
|
|
|
655
654
|
tag: 'xref[ref-type="fn"]',
|
|
656
655
|
node: 'inline_footnote',
|
|
657
656
|
getAttrs: (node) => {
|
|
658
|
-
var _a;
|
|
659
657
|
const element = node;
|
|
660
658
|
return {
|
|
661
659
|
rid: element.getAttribute('rid'),
|
|
662
|
-
contents:
|
|
660
|
+
contents: element.textContent,
|
|
663
661
|
};
|
|
664
662
|
},
|
|
665
663
|
},
|
|
@@ -667,11 +665,10 @@ const nodes = [
|
|
|
667
665
|
tag: 'xref',
|
|
668
666
|
node: 'cross_reference',
|
|
669
667
|
getAttrs: (node) => {
|
|
670
|
-
var _a;
|
|
671
668
|
const element = node;
|
|
672
669
|
return {
|
|
673
670
|
rid: element.getAttribute('rid'),
|
|
674
|
-
label:
|
|
671
|
+
label: element.textContent,
|
|
675
672
|
};
|
|
676
673
|
},
|
|
677
674
|
},
|
|
@@ -212,7 +212,6 @@ export const jatsBodyTransformations = {
|
|
|
212
212
|
body.append(backmatterContainer);
|
|
213
213
|
},
|
|
214
214
|
mapFootnotesToSections(doc, backmatterContainer, createElement) {
|
|
215
|
-
var _a;
|
|
216
215
|
const footnoteGroups = [...doc.querySelectorAll('fn[fn-type]')];
|
|
217
216
|
for (const footnote of footnoteGroups) {
|
|
218
217
|
const type = footnote.getAttribute('fn-type') || '';
|
|
@@ -222,10 +221,7 @@ export const jatsBodyTransformations = {
|
|
|
222
221
|
const title = footnote.querySelector('p[content-type="fn-title"]');
|
|
223
222
|
if (title) {
|
|
224
223
|
const sectionTitleElement = createElement('title');
|
|
225
|
-
|
|
226
|
-
if (titleTextContent) {
|
|
227
|
-
sectionTitleElement.textContent = titleTextContent;
|
|
228
|
-
}
|
|
224
|
+
sectionTitleElement.textContent = title.textContent;
|
|
229
225
|
removeNodeFromParent(title);
|
|
230
226
|
section.append(sectionTitleElement);
|
|
231
227
|
}
|
|
@@ -18,8 +18,7 @@ import { buildComment, buildContribution, isCommentAnnotation, isHighlightableMo
|
|
|
18
18
|
const DEFAULT_ANNOTATION_COLOR = 'rgb(250, 224, 150)';
|
|
19
19
|
const DEFAULT_PROFILE_ID = 'MPUserProfile:0000000000000000000000000000000000000001';
|
|
20
20
|
export const parseProcessingInstruction = (node) => {
|
|
21
|
-
|
|
22
|
-
const value = `<AuthorQuery ${(_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()} />`;
|
|
21
|
+
const value = `<AuthorQuery ${node.textContent} />`;
|
|
23
22
|
const processingInstruction = new DOMParser().parseFromString(value, 'application/xml').firstElementChild;
|
|
24
23
|
if (processingInstruction) {
|
|
25
24
|
const queryText = processingInstruction.getAttribute('queryText');
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import debug from 'debug';
|
|
17
|
-
import { getTrimmedTextContent } from '../../lib/utils';
|
|
18
17
|
import { buildAffiliation, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildSupplementaryMaterial, } from '../../transformer/builders';
|
|
19
18
|
import { parseJournalMeta } from './jats-journal-meta-parser';
|
|
20
19
|
const warn = debug('manuscripts-transform');
|
|
@@ -69,10 +68,11 @@ export const jatsFrontParser = {
|
|
|
69
68
|
}
|
|
70
69
|
const history = {};
|
|
71
70
|
const dateToTimestamp = (dateElement) => {
|
|
71
|
+
var _a, _b;
|
|
72
72
|
const selectors = ['year', 'month', 'day'];
|
|
73
73
|
const values = [];
|
|
74
74
|
for (const selector of selectors) {
|
|
75
|
-
const value =
|
|
75
|
+
const value = (_b = (_a = dateElement.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
76
76
|
if (!value || isNaN(+value)) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
@@ -112,17 +112,17 @@ export const jatsFrontParser = {
|
|
|
112
112
|
return history;
|
|
113
113
|
},
|
|
114
114
|
parseSupplements(supplementNodes) {
|
|
115
|
-
var _a, _b, _c, _d;
|
|
115
|
+
var _a, _b, _c, _d, _e;
|
|
116
116
|
if (!supplementNodes || supplementNodes.length === 0) {
|
|
117
117
|
return [];
|
|
118
118
|
}
|
|
119
119
|
const supplements = [];
|
|
120
120
|
for (const supplementNode of supplementNodes) {
|
|
121
|
-
const supplTitle = (_a =
|
|
122
|
-
const href = (
|
|
121
|
+
const supplTitle = (_b = (_a = supplementNode.querySelector('caption > title')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : '';
|
|
122
|
+
const href = (_c = supplementNode.getAttributeNS(XLINK_NAMESPACE, 'href')) !== null && _c !== void 0 ? _c : '';
|
|
123
123
|
const supplementaryMaterial = buildSupplementaryMaterial(supplTitle, href);
|
|
124
|
-
const mimeType = (
|
|
125
|
-
const mimeSubtype = (
|
|
124
|
+
const mimeType = (_d = supplementNode.getAttribute('mimetype')) !== null && _d !== void 0 ? _d : '';
|
|
125
|
+
const mimeSubtype = (_e = supplementNode.getAttribute('mime-subtype')) !== null && _e !== void 0 ? _e : '';
|
|
126
126
|
if (mimeType && mimeSubtype) {
|
|
127
127
|
supplementaryMaterial.MIME = [mimeType, mimeSubtype].join('/');
|
|
128
128
|
}
|
|
@@ -133,10 +133,10 @@ export const jatsFrontParser = {
|
|
|
133
133
|
parseAffiliationNodes(affiliationNodes) {
|
|
134
134
|
const affiliationIDs = new Map();
|
|
135
135
|
const affiliations = affiliationNodes.map((affiliationNode, priority) => {
|
|
136
|
-
var _a, _b;
|
|
136
|
+
var _a, _b, _c, _d, _e;
|
|
137
137
|
const affiliation = buildAffiliation('', priority);
|
|
138
138
|
for (const node of affiliationNode.querySelectorAll('institution')) {
|
|
139
|
-
const content =
|
|
139
|
+
const content = node.textContent;
|
|
140
140
|
if (!content) {
|
|
141
141
|
continue;
|
|
142
142
|
}
|
|
@@ -151,25 +151,22 @@ export const jatsFrontParser = {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
affiliation.addressLine1 =
|
|
154
|
-
|
|
155
|
-
undefined;
|
|
154
|
+
((_a = affiliationNode.querySelector('addr-line:nth-of-type(1)')) === null || _a === void 0 ? void 0 : _a.textContent) || undefined;
|
|
156
155
|
affiliation.addressLine2 =
|
|
157
|
-
|
|
158
|
-
undefined;
|
|
156
|
+
((_b = affiliationNode.querySelector('addr-line:nth-of-type(2)')) === null || _b === void 0 ? void 0 : _b.textContent) || undefined;
|
|
159
157
|
affiliation.addressLine3 =
|
|
160
|
-
|
|
161
|
-
undefined;
|
|
158
|
+
((_c = affiliationNode.querySelector('addr-line:nth-of-type(3)')) === null || _c === void 0 ? void 0 : _c.textContent) || undefined;
|
|
162
159
|
const emailNode = affiliationNode.querySelector('email');
|
|
163
160
|
if (emailNode) {
|
|
164
161
|
affiliation.email = {
|
|
165
162
|
href: emailNode.getAttributeNS(XLINK_NAMESPACE, 'href') || undefined,
|
|
166
|
-
text:
|
|
163
|
+
text: emailNode.textContent || undefined,
|
|
167
164
|
};
|
|
168
165
|
}
|
|
169
166
|
affiliation.postCode =
|
|
170
|
-
|
|
167
|
+
((_d = affiliationNode.querySelector('postal-code')) === null || _d === void 0 ? void 0 : _d.textContent) || undefined;
|
|
171
168
|
affiliation.country =
|
|
172
|
-
|
|
169
|
+
((_e = affiliationNode.querySelector('country')) === null || _e === void 0 ? void 0 : _e.textContent) || undefined;
|
|
173
170
|
const id = affiliationNode.getAttribute('id');
|
|
174
171
|
if (id) {
|
|
175
172
|
affiliationIDs.set(id, affiliation._id);
|
|
@@ -199,13 +196,13 @@ export const jatsFrontParser = {
|
|
|
199
196
|
parseCorrespNodes(correspNodes) {
|
|
200
197
|
const correspondingIDs = new Map();
|
|
201
198
|
const correspondingList = correspNodes.map((correspNode) => {
|
|
202
|
-
var _a
|
|
199
|
+
var _a;
|
|
203
200
|
const label = correspNode.querySelector('label');
|
|
204
201
|
if (label) {
|
|
205
202
|
label.remove();
|
|
206
203
|
}
|
|
207
|
-
const corresponding = buildCorresp((
|
|
208
|
-
corresponding.label = (
|
|
204
|
+
const corresponding = buildCorresp((_a = correspNode.textContent) !== null && _a !== void 0 ? _a : '');
|
|
205
|
+
corresponding.label = (label === null || label === void 0 ? void 0 : label.textContent) || undefined;
|
|
209
206
|
const id = correspNode.getAttribute('id');
|
|
210
207
|
if (id) {
|
|
211
208
|
correspondingIDs.set(id, corresponding._id);
|
|
@@ -219,13 +216,13 @@ export const jatsFrontParser = {
|
|
|
219
216
|
},
|
|
220
217
|
parseAuthorNodes(authorNodes, affiliationIDs, footnoteIDs, correspondingIDs) {
|
|
221
218
|
return authorNodes.map((authorNode, priority) => {
|
|
222
|
-
var _a, _b;
|
|
219
|
+
var _a, _b, _c;
|
|
223
220
|
const name = buildBibliographicName({});
|
|
224
|
-
const given =
|
|
221
|
+
const given = (_a = authorNode.querySelector('name > given-names')) === null || _a === void 0 ? void 0 : _a.textContent;
|
|
225
222
|
if (given) {
|
|
226
223
|
name.given = given;
|
|
227
224
|
}
|
|
228
|
-
const surname =
|
|
225
|
+
const surname = (_b = authorNode.querySelector('name > surname')) === null || _b === void 0 ? void 0 : _b.textContent;
|
|
229
226
|
if (surname) {
|
|
230
227
|
name.family = surname;
|
|
231
228
|
}
|
|
@@ -234,7 +231,7 @@ export const jatsFrontParser = {
|
|
|
234
231
|
if (corresponding) {
|
|
235
232
|
contributor.isCorresponding = corresponding;
|
|
236
233
|
}
|
|
237
|
-
const orcid =
|
|
234
|
+
const orcid = (_c = authorNode.querySelector('contrib-id[contrib-id-type="orcid"]')) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
238
235
|
if (orcid) {
|
|
239
236
|
contributor.ORCIDIdentifier = orcid;
|
|
240
237
|
}
|
|
@@ -250,7 +247,7 @@ export const jatsFrontParser = {
|
|
|
250
247
|
if (footnoteId) {
|
|
251
248
|
const authorFootNoteRef = {
|
|
252
249
|
noteID: footnoteId,
|
|
253
|
-
noteLabel:
|
|
250
|
+
noteLabel: xrefNode.textContent || '',
|
|
254
251
|
};
|
|
255
252
|
contributor.footnote.push(authorFootNoteRef);
|
|
256
253
|
}
|
|
@@ -261,7 +258,7 @@ export const jatsFrontParser = {
|
|
|
261
258
|
if (correspId) {
|
|
262
259
|
const authorCorrespRef = {
|
|
263
260
|
correspID: correspId,
|
|
264
|
-
correspLabel:
|
|
261
|
+
correspLabel: xrefNode.textContent || '',
|
|
265
262
|
};
|
|
266
263
|
contributor.corresp.push(authorCorrespRef);
|
|
267
264
|
}
|
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { getTrimmedTextContent } from '../../lib/utils';
|
|
17
16
|
export const parseJournalIdentifiers = (journalMeta) => {
|
|
18
|
-
var _a, _b;
|
|
19
17
|
const output = [];
|
|
20
18
|
const elements = journalMeta.querySelectorAll('journal-id');
|
|
21
19
|
for (const element of elements) {
|
|
22
20
|
const journalIDType = element.getAttribute('journal-id-type');
|
|
23
|
-
const journalID =
|
|
21
|
+
const journalID = element.textContent;
|
|
24
22
|
if (journalID !== null && journalIDType != null) {
|
|
25
23
|
output.push({ journalIDType, journalID });
|
|
26
24
|
}
|
|
@@ -31,12 +29,11 @@ export const parseJournalIdentifiers = (journalMeta) => {
|
|
|
31
29
|
return output;
|
|
32
30
|
};
|
|
33
31
|
export const parseJournalAbbreviatedTitles = (journalMeta) => {
|
|
34
|
-
var _a, _b;
|
|
35
32
|
const output = [];
|
|
36
33
|
const elements = journalMeta.querySelectorAll('journal-title-group > abbrev-journal-title');
|
|
37
34
|
for (const element of elements) {
|
|
38
35
|
const abbrevType = element.getAttribute('abbrev-type');
|
|
39
|
-
const abbreviatedTitle =
|
|
36
|
+
const abbreviatedTitle = element.textContent;
|
|
40
37
|
if (abbreviatedTitle !== null && abbrevType !== null) {
|
|
41
38
|
output.push({ abbreviatedTitle, abbrevType });
|
|
42
39
|
}
|
|
@@ -47,12 +44,11 @@ export const parseJournalAbbreviatedTitles = (journalMeta) => {
|
|
|
47
44
|
return output;
|
|
48
45
|
};
|
|
49
46
|
export const parseJournalISSNs = (journalMeta) => {
|
|
50
|
-
var _a, _b;
|
|
51
47
|
const output = [];
|
|
52
48
|
const elements = journalMeta.querySelectorAll('issn');
|
|
53
49
|
for (const element of elements) {
|
|
54
50
|
const publicationType = element.getAttribute('pub-type');
|
|
55
|
-
const ISSN =
|
|
51
|
+
const ISSN = element.textContent;
|
|
56
52
|
if (publicationType !== null && ISSN !== null) {
|
|
57
53
|
output.push({ publicationType, ISSN });
|
|
58
54
|
}
|
|
@@ -63,12 +59,12 @@ export const parseJournalISSNs = (journalMeta) => {
|
|
|
63
59
|
return output;
|
|
64
60
|
};
|
|
65
61
|
export const parseJournalMeta = (journalMeta) => {
|
|
66
|
-
var _a, _b;
|
|
62
|
+
var _a, _b, _c, _d;
|
|
67
63
|
return {
|
|
68
64
|
abbreviatedTitles: parseJournalAbbreviatedTitles(journalMeta),
|
|
69
65
|
journalIdentifiers: parseJournalIdentifiers(journalMeta),
|
|
70
66
|
ISSNs: parseJournalISSNs(journalMeta),
|
|
71
|
-
publisherName: (_a =
|
|
72
|
-
title: (
|
|
67
|
+
publisherName: (_b = (_a = journalMeta.querySelector('publisher > publisher-name')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : undefined,
|
|
68
|
+
title: (_d = (_c = journalMeta.querySelector('journal-title-group > journal-title')) === null || _c === void 0 ? void 0 : _c.textContent) !== null && _d !== void 0 ? _d : undefined,
|
|
73
69
|
};
|
|
74
70
|
};
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { getTrimmedTextContent } from '../../lib/utils';
|
|
17
16
|
import { buildAuxiliaryObjectReference, buildBibliographicDate, buildBibliographicName, buildBibliographyItem, buildCitation, } from '../../transformer/builders';
|
|
18
17
|
import { parseProcessingInstruction } from './jats-comments';
|
|
19
18
|
import { flatten, htmlFromJatsNode } from './jats-parser-utils';
|
|
@@ -32,7 +31,7 @@ export const jatsReferenceParser = {
|
|
|
32
31
|
const referenceIDs = new Map();
|
|
33
32
|
const referenceQueries = new Map();
|
|
34
33
|
const references = referenceNodes.map((referenceNode) => {
|
|
35
|
-
var _a;
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36
35
|
const publicationType = referenceNode.getAttribute('publication-type');
|
|
37
36
|
const authorNodes = [
|
|
38
37
|
...referenceNode.querySelectorAll('person-group[person-group-type="author"] > *'),
|
|
@@ -42,7 +41,7 @@ export const jatsReferenceParser = {
|
|
|
42
41
|
});
|
|
43
42
|
const titleNode = referenceNode.querySelector('article-title');
|
|
44
43
|
if (titleNode) {
|
|
45
|
-
bibliographyItem.title =
|
|
44
|
+
bibliographyItem.title = htmlFromJatsNode(titleNode, createElement);
|
|
46
45
|
}
|
|
47
46
|
const queriesText = [];
|
|
48
47
|
const mixedCitation = referenceNode.querySelector('mixed-citation');
|
|
@@ -61,63 +60,63 @@ export const jatsReferenceParser = {
|
|
|
61
60
|
}
|
|
62
61
|
if (authorNodes.length <= 0) {
|
|
63
62
|
mixedCitation === null || mixedCitation === void 0 ? void 0 : mixedCitation.childNodes.forEach((item) => {
|
|
64
|
-
var _a, _b
|
|
63
|
+
var _a, _b;
|
|
65
64
|
if (item.nodeType === Node.TEXT_NODE &&
|
|
66
65
|
((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.match(/[A-Za-z]+/g))) {
|
|
67
|
-
bibliographyItem.literal = (
|
|
66
|
+
bibliographyItem.literal = (_b = mixedCitation.textContent) !== null && _b !== void 0 ? _b : '';
|
|
68
67
|
return bibliographyItem;
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
70
|
}
|
|
72
|
-
const source =
|
|
71
|
+
const source = (_a = referenceNode.querySelector('source')) === null || _a === void 0 ? void 0 : _a.textContent;
|
|
73
72
|
if (source) {
|
|
74
73
|
bibliographyItem['container-title'] = source;
|
|
75
74
|
}
|
|
76
|
-
const volume =
|
|
75
|
+
const volume = (_b = referenceNode.querySelector('volume')) === null || _b === void 0 ? void 0 : _b.textContent;
|
|
77
76
|
if (volume) {
|
|
78
77
|
bibliographyItem.volume = volume;
|
|
79
78
|
}
|
|
80
|
-
const issue =
|
|
79
|
+
const issue = (_c = referenceNode.querySelector('issue')) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
81
80
|
if (issue) {
|
|
82
81
|
bibliographyItem.issue = issue;
|
|
83
82
|
}
|
|
84
|
-
const supplement =
|
|
83
|
+
const supplement = (_d = referenceNode.querySelector('supplement')) === null || _d === void 0 ? void 0 : _d.textContent;
|
|
85
84
|
if (supplement) {
|
|
86
85
|
bibliographyItem.supplement = supplement;
|
|
87
86
|
}
|
|
88
|
-
const fpage =
|
|
89
|
-
const lpage =
|
|
87
|
+
const fpage = (_e = referenceNode.querySelector('fpage')) === null || _e === void 0 ? void 0 : _e.textContent;
|
|
88
|
+
const lpage = (_f = referenceNode.querySelector('lpage')) === null || _f === void 0 ? void 0 : _f.textContent;
|
|
90
89
|
if (fpage) {
|
|
91
90
|
bibliographyItem.page = lpage ? `${fpage}-${lpage}` : fpage;
|
|
92
91
|
}
|
|
93
|
-
const year =
|
|
92
|
+
const year = (_g = referenceNode.querySelector('year')) === null || _g === void 0 ? void 0 : _g.textContent;
|
|
94
93
|
if (year) {
|
|
95
94
|
bibliographyItem.issued = buildBibliographicDate({
|
|
96
95
|
'date-parts': [[year]],
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
|
-
const doi =
|
|
98
|
+
const doi = (_h = referenceNode.querySelector('pub-id[pub-id-type="doi"]')) === null || _h === void 0 ? void 0 : _h.textContent;
|
|
100
99
|
if (doi) {
|
|
101
100
|
bibliographyItem.DOI = doi;
|
|
102
101
|
}
|
|
103
102
|
const authors = [];
|
|
104
103
|
authorNodes.forEach((authorNode) => {
|
|
105
|
-
var _a;
|
|
104
|
+
var _a, _b, _c;
|
|
106
105
|
const name = buildBibliographicName({});
|
|
107
|
-
const given =
|
|
106
|
+
const given = (_a = authorNode.querySelector('given-names')) === null || _a === void 0 ? void 0 : _a.textContent;
|
|
108
107
|
if (given) {
|
|
109
108
|
name.given = given;
|
|
110
109
|
}
|
|
111
|
-
const family =
|
|
110
|
+
const family = (_b = authorNode.querySelector('surname')) === null || _b === void 0 ? void 0 : _b.textContent;
|
|
112
111
|
if (family) {
|
|
113
112
|
name.family = family;
|
|
114
113
|
}
|
|
115
|
-
const suffix =
|
|
114
|
+
const suffix = (_c = authorNode.querySelector('suffix')) === null || _c === void 0 ? void 0 : _c.textContent;
|
|
116
115
|
if (suffix) {
|
|
117
116
|
name.suffix = suffix;
|
|
118
117
|
}
|
|
119
118
|
if (authorNode.nodeName === 'collab') {
|
|
120
|
-
name.literal =
|
|
119
|
+
name.literal = authorNode.textContent;
|
|
121
120
|
}
|
|
122
121
|
authors.push(name);
|
|
123
122
|
});
|
package/dist/es/lib/utils.js
CHANGED
|
@@ -67,10 +67,3 @@ export const findParentNodeClosestToPos = ($pos, predicate) => {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
export const getTrimmedTextContent = (node, querySelector) => {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
if (!node) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
76
|
-
};
|
|
@@ -561,12 +561,10 @@ export class Decoder {
|
|
|
561
561
|
}));
|
|
562
562
|
}
|
|
563
563
|
const contents = rootSectionNodes;
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
contents.push(comments);
|
|
569
|
-
}
|
|
564
|
+
const comments = schema.nodes.comment_list.createAndFill({}, [
|
|
565
|
+
...this.comments.values(),
|
|
566
|
+
]);
|
|
567
|
+
contents.push(comments);
|
|
570
568
|
return schema.nodes.manuscript.create({
|
|
571
569
|
id: manuscriptID || this.getManuscriptID(),
|
|
572
570
|
}, contents);
|
|
@@ -62,7 +62,6 @@ export const buildTargets = (fragment, manuscript) => {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
fragment.descendants((node) => {
|
|
65
|
-
var _a;
|
|
66
65
|
if (node.type.name in counters) {
|
|
67
66
|
const isInGraphicalAbstract = figures.indexOf(node.attrs.id) > -1;
|
|
68
67
|
if (isInGraphicalAbstract) {
|
|
@@ -73,7 +72,7 @@ export const buildTargets = (fragment, manuscript) => {
|
|
|
73
72
|
type: node.type.name,
|
|
74
73
|
id: node.attrs.id,
|
|
75
74
|
label,
|
|
76
|
-
caption:
|
|
75
|
+
caption: node.textContent,
|
|
77
76
|
});
|
|
78
77
|
}
|
|
79
78
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "1.3.0-LEAN-
|
|
4
|
+
"version": "1.3.0-LEAN-2505-1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|