@manuscripts/transform 2.1.2-LEAN-3092-0 → 2.1.3-LEAN-3092-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-front-parser.js +5 -0
- package/dist/cjs/jats/importer/parse-jats-article.js +2 -1
- package/dist/cjs/jats/jats-exporter.js +7 -7
- package/dist/es/jats/importer/jats-front-parser.js +5 -0
- package/dist/es/jats/importer/parse-jats-article.js +2 -1
- package/dist/es/jats/jats-exporter.js +7 -7
- package/dist/types/jats/importer/jats-front-parser.d.ts +1 -0
- package/package.json +1 -1
|
@@ -45,6 +45,11 @@ exports.jatsFrontParser = {
|
|
|
45
45
|
}
|
|
46
46
|
return titles;
|
|
47
47
|
},
|
|
48
|
+
parseDOI(front) {
|
|
49
|
+
var _a;
|
|
50
|
+
const doi = front === null || front === void 0 ? void 0 : front.querySelector('article-meta > article-id[pub-id-type="doi"]');
|
|
51
|
+
return (_a = doi === null || doi === void 0 ? void 0 : doi.textContent) !== null && _a !== void 0 ? _a : undefined;
|
|
52
|
+
},
|
|
48
53
|
parseCounts(counts) {
|
|
49
54
|
var _a, _b, _c, _d, _e;
|
|
50
55
|
if (counts) {
|
|
@@ -31,6 +31,7 @@ const parseJATSFront = (doc, front) => {
|
|
|
31
31
|
const createElement = createElementFn(doc);
|
|
32
32
|
const journal = jats_front_parser_1.jatsFrontParser.parseJournal(front.querySelector('journal-meta'));
|
|
33
33
|
const titles = jats_front_parser_1.jatsFrontParser.parseTitles(front.querySelector('article-meta > title-group'), createElement);
|
|
34
|
+
const DOI = jats_front_parser_1.jatsFrontParser.parseDOI(front);
|
|
34
35
|
const { affiliations, affiliationIDs } = jats_front_parser_1.jatsFrontParser.parseAffiliations([
|
|
35
36
|
...front.querySelectorAll('article-meta > contrib-group > aff'),
|
|
36
37
|
]);
|
|
@@ -45,7 +46,7 @@ const parseJATSFront = (doc, front) => {
|
|
|
45
46
|
], affiliationIDs, footnoteIDs, correspondingIDs);
|
|
46
47
|
const history = jats_front_parser_1.jatsFrontParser.parseDates(front.querySelector('article-meta > history'));
|
|
47
48
|
const counts = jats_front_parser_1.jatsFrontParser.parseCounts(front.querySelector('article-meta counts'));
|
|
48
|
-
const manuscript = Object.assign(Object.assign(Object.assign({}, (0, builders_1.buildManuscript)()), counts), history);
|
|
49
|
+
const manuscript = Object.assign(Object.assign(Object.assign(Object.assign({}, (0, builders_1.buildManuscript)()), counts), history), { DOI });
|
|
49
50
|
return generateIDs([
|
|
50
51
|
manuscript,
|
|
51
52
|
titles,
|
|
@@ -249,7 +249,7 @@ class JATSExporter {
|
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
this.buildFront = (doi, id, links) => {
|
|
252
|
-
var _a, _b, _c, _d;
|
|
252
|
+
var _a, _b, _c, _d, _e;
|
|
253
253
|
const manuscript = (0, project_bundle_1.findManuscript)(this.modelMap);
|
|
254
254
|
const titles = (0, project_bundle_1.findTitles)(this.modelMap);
|
|
255
255
|
const front = this.document.createElement('front');
|
|
@@ -312,10 +312,10 @@ class JATSExporter {
|
|
|
312
312
|
articleID.textContent = id;
|
|
313
313
|
articleMeta.appendChild(articleID);
|
|
314
314
|
}
|
|
315
|
-
if (doi) {
|
|
315
|
+
if (doi || manuscript.DOI) {
|
|
316
316
|
const articleID = this.document.createElement('article-id');
|
|
317
317
|
articleID.setAttribute('pub-id-type', 'doi');
|
|
318
|
-
articleID.textContent = doi;
|
|
318
|
+
articleID.textContent = (_a = manuscript.DOI) !== null && _a !== void 0 ? _a : doi;
|
|
319
319
|
articleMeta.appendChild(articleID);
|
|
320
320
|
}
|
|
321
321
|
const titleGroup = this.document.createElement('title-group');
|
|
@@ -350,14 +350,14 @@ class JATSExporter {
|
|
|
350
350
|
for (const supplement of supplements) {
|
|
351
351
|
const supplementaryMaterial = this.document.createElement('supplementary-material');
|
|
352
352
|
supplementaryMaterial.setAttribute('id', normalizeID(supplement._id));
|
|
353
|
-
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (
|
|
354
|
-
const mimeType = (
|
|
355
|
-
const mimeSubType = (
|
|
353
|
+
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (_b = supplement.href) !== null && _b !== void 0 ? _b : '');
|
|
354
|
+
const mimeType = (_c = supplement.MIME) === null || _c === void 0 ? void 0 : _c.split('/')[0];
|
|
355
|
+
const mimeSubType = (_d = supplement.MIME) === null || _d === void 0 ? void 0 : _d.split('/')[1];
|
|
356
356
|
supplementaryMaterial.setAttribute('mimetype', mimeType !== null && mimeType !== void 0 ? mimeType : '');
|
|
357
357
|
supplementaryMaterial.setAttribute('mime-subtype', mimeSubType !== null && mimeSubType !== void 0 ? mimeSubType : '');
|
|
358
358
|
const caption = this.document.createElement('caption');
|
|
359
359
|
const title = this.document.createElement('title');
|
|
360
|
-
title.textContent = (
|
|
360
|
+
title.textContent = (_e = supplement.title) !== null && _e !== void 0 ? _e : '';
|
|
361
361
|
caption.append(title);
|
|
362
362
|
supplementaryMaterial.append(caption);
|
|
363
363
|
articleMeta.append(supplementaryMaterial);
|
|
@@ -39,6 +39,11 @@ export const jatsFrontParser = {
|
|
|
39
39
|
}
|
|
40
40
|
return titles;
|
|
41
41
|
},
|
|
42
|
+
parseDOI(front) {
|
|
43
|
+
var _a;
|
|
44
|
+
const doi = front === null || front === void 0 ? void 0 : front.querySelector('article-meta > article-id[pub-id-type="doi"]');
|
|
45
|
+
return (_a = doi === null || doi === void 0 ? void 0 : doi.textContent) !== null && _a !== void 0 ? _a : undefined;
|
|
46
|
+
},
|
|
42
47
|
parseCounts(counts) {
|
|
43
48
|
var _a, _b, _c, _d, _e;
|
|
44
49
|
if (counts) {
|
|
@@ -28,6 +28,7 @@ export const parseJATSFront = (doc, front) => {
|
|
|
28
28
|
const createElement = createElementFn(doc);
|
|
29
29
|
const journal = jatsFrontParser.parseJournal(front.querySelector('journal-meta'));
|
|
30
30
|
const titles = jatsFrontParser.parseTitles(front.querySelector('article-meta > title-group'), createElement);
|
|
31
|
+
const DOI = jatsFrontParser.parseDOI(front);
|
|
31
32
|
const { affiliations, affiliationIDs } = jatsFrontParser.parseAffiliations([
|
|
32
33
|
...front.querySelectorAll('article-meta > contrib-group > aff'),
|
|
33
34
|
]);
|
|
@@ -42,7 +43,7 @@ export const parseJATSFront = (doc, front) => {
|
|
|
42
43
|
], affiliationIDs, footnoteIDs, correspondingIDs);
|
|
43
44
|
const history = jatsFrontParser.parseDates(front.querySelector('article-meta > history'));
|
|
44
45
|
const counts = jatsFrontParser.parseCounts(front.querySelector('article-meta counts'));
|
|
45
|
-
const manuscript = Object.assign(Object.assign(Object.assign({}, buildManuscript()), counts), history);
|
|
46
|
+
const manuscript = Object.assign(Object.assign(Object.assign(Object.assign({}, buildManuscript()), counts), history), { DOI });
|
|
46
47
|
return generateIDs([
|
|
47
48
|
manuscript,
|
|
48
49
|
titles,
|
|
@@ -241,7 +241,7 @@ export class JATSExporter {
|
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
243
|
this.buildFront = (doi, id, links) => {
|
|
244
|
-
var _a, _b, _c, _d;
|
|
244
|
+
var _a, _b, _c, _d, _e;
|
|
245
245
|
const manuscript = findManuscript(this.modelMap);
|
|
246
246
|
const titles = findTitles(this.modelMap);
|
|
247
247
|
const front = this.document.createElement('front');
|
|
@@ -304,10 +304,10 @@ export class JATSExporter {
|
|
|
304
304
|
articleID.textContent = id;
|
|
305
305
|
articleMeta.appendChild(articleID);
|
|
306
306
|
}
|
|
307
|
-
if (doi) {
|
|
307
|
+
if (doi || manuscript.DOI) {
|
|
308
308
|
const articleID = this.document.createElement('article-id');
|
|
309
309
|
articleID.setAttribute('pub-id-type', 'doi');
|
|
310
|
-
articleID.textContent = doi;
|
|
310
|
+
articleID.textContent = (_a = manuscript.DOI) !== null && _a !== void 0 ? _a : doi;
|
|
311
311
|
articleMeta.appendChild(articleID);
|
|
312
312
|
}
|
|
313
313
|
const titleGroup = this.document.createElement('title-group');
|
|
@@ -342,14 +342,14 @@ export class JATSExporter {
|
|
|
342
342
|
for (const supplement of supplements) {
|
|
343
343
|
const supplementaryMaterial = this.document.createElement('supplementary-material');
|
|
344
344
|
supplementaryMaterial.setAttribute('id', normalizeID(supplement._id));
|
|
345
|
-
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (
|
|
346
|
-
const mimeType = (
|
|
347
|
-
const mimeSubType = (
|
|
345
|
+
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (_b = supplement.href) !== null && _b !== void 0 ? _b : '');
|
|
346
|
+
const mimeType = (_c = supplement.MIME) === null || _c === void 0 ? void 0 : _c.split('/')[0];
|
|
347
|
+
const mimeSubType = (_d = supplement.MIME) === null || _d === void 0 ? void 0 : _d.split('/')[1];
|
|
348
348
|
supplementaryMaterial.setAttribute('mimetype', mimeType !== null && mimeType !== void 0 ? mimeType : '');
|
|
349
349
|
supplementaryMaterial.setAttribute('mime-subtype', mimeSubType !== null && mimeSubType !== void 0 ? mimeSubType : '');
|
|
350
350
|
const caption = this.document.createElement('caption');
|
|
351
351
|
const title = this.document.createElement('title');
|
|
352
|
-
title.textContent = (
|
|
352
|
+
title.textContent = (_e = supplement.title) !== null && _e !== void 0 ? _e : '';
|
|
353
353
|
caption.append(title);
|
|
354
354
|
supplementaryMaterial.append(caption);
|
|
355
355
|
articleMeta.append(supplementaryMaterial);
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const jatsFrontParser: {
|
|
17
17
|
parseTitles(element: Element | null, createElement: (tagName: string) => HTMLElement): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Titles>;
|
|
18
|
+
parseDOI(front: Element | null): string | undefined;
|
|
18
19
|
parseCounts(counts: Element | null): {
|
|
19
20
|
wordCount: number | undefined;
|
|
20
21
|
figureCount: number | undefined;
|
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.1.
|
|
4
|
+
"version": "2.1.3-LEAN-3092-0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|