jats-xml 1.1.0 → 1.1.2
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/README.md +1 -1
- package/dist/jats.d.ts +18 -0
- package/dist/jats.d.ts.map +1 -1
- package/dist/jats.js +111 -28
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -55,6 +55,6 @@ As of v1.0.0 this package is [ESM only](https://gist.github.com/sindresorhus/a39
|
|
|
55
55
|
<p style="text-align: center; color: #aaa; padding-top: 50px">
|
|
56
56
|
Made with love by
|
|
57
57
|
<a href="https://continuous.foundation" target="_blank" style="color: #aaa">
|
|
58
|
-
Continuous Science Foundation <img src="https://
|
|
58
|
+
Continuous Science Foundation <img src="https://cdn.curvenote.com/static/site/csf/icon.svg" style="height: 1em" />
|
|
59
59
|
</a>
|
|
60
60
|
</p>
|
package/dist/jats.d.ts
CHANGED
|
@@ -28,6 +28,20 @@ export declare class Jats {
|
|
|
28
28
|
get pmid(): string | undefined;
|
|
29
29
|
get publicationDates(): PubDate[];
|
|
30
30
|
get publicationDate(): PubDate | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* JATS `<history>` can include multiple `<date date-type="...">` nodes,
|
|
33
|
+
* often including an "accepted" date that is a better default for project/page `date`.
|
|
34
|
+
*/
|
|
35
|
+
get historyDates(): GenericParent[];
|
|
36
|
+
get historyAcceptedDate(): GenericParent | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Some sources store important dates under:
|
|
39
|
+
* `<article-meta><pub-history><event><date date-type="...">...</date></event></pub-history>`.
|
|
40
|
+
*/
|
|
41
|
+
get pubHistoryDates(): GenericParent[];
|
|
42
|
+
private findPubHistoryDateByType;
|
|
43
|
+
get pubHistoryPubDate(): GenericParent | undefined;
|
|
44
|
+
get pubHistoryAcceptedDate(): GenericParent | undefined;
|
|
31
45
|
get license(): License | undefined;
|
|
32
46
|
get keywordGroup(): KeywordGroup | undefined;
|
|
33
47
|
/** The first keywords */
|
|
@@ -47,7 +61,11 @@ export declare class Jats {
|
|
|
47
61
|
get body(): Body | undefined;
|
|
48
62
|
get back(): Back | undefined;
|
|
49
63
|
get subArticles(): SubArticle[];
|
|
64
|
+
/** First `ref-list` in back matter. */
|
|
50
65
|
get refList(): RefList | undefined;
|
|
66
|
+
/** All `ref-list` elements under `back`, in document order. */
|
|
67
|
+
get refLists(): RefList[];
|
|
68
|
+
/** Every `ref` from every `ref-list` under `back`, in document order. */
|
|
51
69
|
get references(): Reference[];
|
|
52
70
|
sort(): void;
|
|
53
71
|
serialize(opts?: WriteOptions): string;
|
package/dist/jats.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jats.d.ts","sourceRoot":"","sources":["../src/jats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,aAAa,CAAC;AAI9D,OAAO,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIjF,OAAO,KAAK,EACV,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,OAAO,EACP,SAAS,EACT,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,OAAO,EACP,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,WAAW,EACX,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,WAAW,EAEZ,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAEL,KAAK,oBAAoB,EAI1B,MAAM,YAAY,CAAC;AAEpB,KAAK,OAAO,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"j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EAAE,CAU9B;IAED,IAAI,mBAAmB,IAAI,WAAW,EAAE,CAEvC;IAED,IAAI,IAAI,IAAI,IAAI,GAAG,SAAS,CAE3B;IAED,IAAI,IAAI,IAAI,IAAI,GAAG,SAAS,CAE3B;IAED,IAAI,WAAW,IAAI,UAAU,EAAE,CAE9B;IAED,uCAAuC;IACvC,IAAI,OAAO,IAAI,OAAO,GAAG,SAAS,CAEjC;IAED,+DAA+D;IAC/D,IAAI,QAAQ,IAAI,OAAO,EAAE,CAGxB;IAED,yEAAyE;IACzE,IAAI,UAAU,IAAI,SAAS,EAAE,CAE5B;IAED,IAAI;IAeJ,SAAS,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM;CAoBvC"}
|
package/dist/jats.js
CHANGED
|
@@ -9,10 +9,34 @@ import { tic } from 'myst-cli-utils';
|
|
|
9
9
|
import { articleMetaOrder, tableWrapOrder } from './order.js';
|
|
10
10
|
import { serializeJatsXml, convertToUnist, convertToXml, toDate, } from 'jats-utils';
|
|
11
11
|
function select(selector, node) {
|
|
12
|
-
var _a;
|
|
13
|
-
|
|
12
|
+
var _a, _b;
|
|
13
|
+
try {
|
|
14
|
+
return ((_a = unistSelect(selector, node)) !== null && _a !== void 0 ? _a : undefined);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const nodeType = (_b = node === null || node === void 0 ? void 0 : node.type) !== null && _b !== void 0 ? _b : '(undefined)';
|
|
18
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
19
|
+
throw new Error(`[jats-xml/select] selector="${selector}" nodeType="${nodeType}" failed: ${msg}`);
|
|
20
|
+
}
|
|
14
21
|
}
|
|
15
22
|
const DEFAULT_DOCTYPE = 'article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD with MathML3 v1.3 20210610//EN" "http://jats.nlm.nih.gov/publishing/1.3/JATS-archivearticle1-3-mathml3.dtd"';
|
|
23
|
+
/**
|
|
24
|
+
* Drop comments and whitespace-only text nodes introduced by xml-js when
|
|
25
|
+
* `captureSpacesBetweenElements` is true (ignorable XML whitespace).
|
|
26
|
+
*/
|
|
27
|
+
function significantChildElements(elements) {
|
|
28
|
+
return elements === null || elements === void 0 ? void 0 : elements.filter((elem) => {
|
|
29
|
+
var _a;
|
|
30
|
+
if (elem.type === 'comment')
|
|
31
|
+
return false;
|
|
32
|
+
if (elem.type === 'text') {
|
|
33
|
+
const t = String((_a = elem.text) !== null && _a !== void 0 ? _a : '');
|
|
34
|
+
if (!t.trim())
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
16
40
|
export class Jats {
|
|
17
41
|
constructor(data, opts) {
|
|
18
42
|
var _a, _b;
|
|
@@ -21,14 +45,19 @@ export class Jats {
|
|
|
21
45
|
if (opts === null || opts === void 0 ? void 0 : opts.source)
|
|
22
46
|
this.source = opts.source;
|
|
23
47
|
try {
|
|
24
|
-
this.raw = xml2js(data, {
|
|
48
|
+
this.raw = xml2js(data, {
|
|
49
|
+
compact: false,
|
|
50
|
+
// Preserve whitespace-only text nodes between elements. This is usually unnecessary except inside <preformat>.
|
|
51
|
+
// convertToUnist drops these outside preformat so other content is processed independent of arbitrary xml whitespace.
|
|
52
|
+
captureSpacesBetweenElements: true,
|
|
53
|
+
});
|
|
25
54
|
}
|
|
26
55
|
catch (error) {
|
|
27
56
|
throw new Error('Problem parsing the JATS document, please ensure it is XML');
|
|
28
57
|
}
|
|
29
58
|
const { declaration, elements } = this.raw;
|
|
30
59
|
this.declaration = declaration === null || declaration === void 0 ? void 0 : declaration.attributes;
|
|
31
|
-
const filteredElements = elements
|
|
60
|
+
const filteredElements = significantChildElements(elements);
|
|
32
61
|
if ((filteredElements === null || filteredElements === void 0 ? void 0 : filteredElements.length) && filteredElements[0].type !== 'doctype') {
|
|
33
62
|
(_a = this.log) === null || _a === void 0 ? void 0 : _a.warn('JATS is missing DOCTYPE declaration');
|
|
34
63
|
filteredElements.unshift({ type: 'doctype' });
|
|
@@ -44,46 +73,51 @@ export class Jats {
|
|
|
44
73
|
(_b = this.log) === null || _b === void 0 ? void 0 : _b.debug(toc('Parsed and converted JATS to unist tree in %s'));
|
|
45
74
|
}
|
|
46
75
|
get frontmatter() {
|
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
76
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
48
77
|
const title = this.articleTitle;
|
|
49
78
|
const subtitle = this.articleSubtitle;
|
|
50
79
|
const short_title = this.articleAltTitle;
|
|
51
80
|
let date;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
81
|
+
// Prefer a fully-specified publication date (day/month/year).
|
|
82
|
+
// If publication date is incomplete (e.g. year-only), fall back to history accepted date.
|
|
83
|
+
const preferredDateNode = (_c = (_b = (_a = this.publicationDate) !== null && _a !== void 0 ? _a : this.pubHistoryPubDate) !== null && _b !== void 0 ? _b : this.pubHistoryAcceptedDate) !== null && _c !== void 0 ? _c : this.historyAcceptedDate;
|
|
84
|
+
if (preferredDateNode) {
|
|
85
|
+
const d = toDate(preferredDateNode);
|
|
86
|
+
if (d) {
|
|
87
|
+
const year = d.getUTCFullYear();
|
|
88
|
+
const month = (d.getUTCMonth() + 1).toString().padStart(2, '0');
|
|
89
|
+
const day = d.getUTCDate().toString().padStart(2, '0');
|
|
58
90
|
date = `${year}-${month}-${day}`;
|
|
59
91
|
}
|
|
60
92
|
}
|
|
61
|
-
const authors = (
|
|
93
|
+
const authors = (_d = this.articleAuthors) === null || _d === void 0 ? void 0 : _d.map((auth) => {
|
|
62
94
|
return processContributor(auth);
|
|
63
95
|
});
|
|
64
|
-
const affiliations = (
|
|
96
|
+
const affiliations = (_e = this.articleAffiliations) === null || _e === void 0 ? void 0 : _e.map((aff) => {
|
|
65
97
|
return processAffiliation(aff);
|
|
66
98
|
});
|
|
67
|
-
const keywords = (
|
|
68
|
-
const
|
|
99
|
+
const keywords = (_g = (_f = this.keywords) === null || _f === void 0 ? void 0 : _f.map((k) => toText(k))) !== null && _g !== void 0 ? _g : [];
|
|
100
|
+
const subjectScope = (_h = this.articleCategories) !== null && _h !== void 0 ? _h : this.front;
|
|
101
|
+
const journalCollSubject = select(`${Tags.subjGroup}[subj-group-type="hwp-journal-coll"] ${Tags.subject}`, subjectScope);
|
|
102
|
+
const articleSubject = journalCollSubject !== null && journalCollSubject !== void 0 ? journalCollSubject : select(Tags.subject, subjectScope);
|
|
69
103
|
const journalTitle = select(Tags.journalTitle, this.front);
|
|
70
104
|
const license = this.license;
|
|
71
105
|
let licenseString = null;
|
|
72
106
|
if (license === null || license === void 0 ? void 0 : license['xlink:href']) {
|
|
73
107
|
licenseString = license['xlink:href'];
|
|
74
108
|
}
|
|
75
|
-
else if (select('[type=ali
|
|
76
|
-
licenseString = toText(select('[type=ali
|
|
109
|
+
else if (license && select('[type=ali\\:license_ref]', license)) {
|
|
110
|
+
licenseString = toText(select('[type=ali\\:license_ref]', license));
|
|
77
111
|
}
|
|
78
112
|
else if (selectAll('ext-link', license).length === 1) {
|
|
79
113
|
// this should only happen if there is only one ext-link
|
|
80
|
-
licenseString = (
|
|
114
|
+
licenseString = (_j = select('ext-link', license)['xlink:href']) !== null && _j !== void 0 ? _j : null;
|
|
81
115
|
}
|
|
82
116
|
else if (license) {
|
|
83
117
|
licenseString = toText(license);
|
|
84
118
|
}
|
|
85
119
|
let openAccess;
|
|
86
|
-
const licenseType = (
|
|
120
|
+
const licenseType = (_k = license === null || license === void 0 ? void 0 : license['license-type']) === null || _k === void 0 ? void 0 : _k.toLowerCase();
|
|
87
121
|
if (licenseType && ['openaccess', 'open-access'].includes(licenseType)) {
|
|
88
122
|
openAccess = true;
|
|
89
123
|
}
|
|
@@ -100,7 +134,7 @@ export class Jats {
|
|
|
100
134
|
title: title ? toText(title) : undefined,
|
|
101
135
|
subtitle: subtitle ? toText(subtitle) : undefined,
|
|
102
136
|
short_title: short_title ? toText(short_title) : undefined,
|
|
103
|
-
doi: (
|
|
137
|
+
doi: (_l = this.doi) !== null && _l !== void 0 ? _l : undefined,
|
|
104
138
|
identifiers,
|
|
105
139
|
date,
|
|
106
140
|
authors: authors.length ? authors : undefined,
|
|
@@ -108,7 +142,7 @@ export class Jats {
|
|
|
108
142
|
affiliations: affiliations.length ? affiliations : undefined,
|
|
109
143
|
keywords: keywords.length ? keywords : undefined,
|
|
110
144
|
venue: journalTitle ? { title: toText(journalTitle) } : undefined,
|
|
111
|
-
subject:
|
|
145
|
+
subject: articleSubject ? toText(articleSubject) : undefined,
|
|
112
146
|
license: licenseString !== null && licenseString !== void 0 ? licenseString : undefined,
|
|
113
147
|
open_access: openAccess,
|
|
114
148
|
}, { property: 'frontmatter', messages: {} });
|
|
@@ -140,6 +174,49 @@ export class Jats {
|
|
|
140
174
|
get publicationDate() {
|
|
141
175
|
return this.publicationDates.find((d) => !!select(Tags.day, d));
|
|
142
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* JATS `<history>` can include multiple `<date date-type="...">` nodes,
|
|
179
|
+
* often including an "accepted" date that is a better default for project/page `date`.
|
|
180
|
+
*/
|
|
181
|
+
get historyDates() {
|
|
182
|
+
var _a;
|
|
183
|
+
return selectAll('history date', (_a = this.articleMeta) !== null && _a !== void 0 ? _a : this.front);
|
|
184
|
+
}
|
|
185
|
+
get historyAcceptedDate() {
|
|
186
|
+
const accepted = this.historyDates.find((d) => {
|
|
187
|
+
var _a;
|
|
188
|
+
const dt = String((_a = d['date-type']) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
189
|
+
return dt === 'accepted' || dt === 'accept';
|
|
190
|
+
});
|
|
191
|
+
if (accepted && select(Tags.day, accepted))
|
|
192
|
+
return accepted;
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Some sources store important dates under:
|
|
197
|
+
* `<article-meta><pub-history><event><date date-type="...">...</date></event></pub-history>`.
|
|
198
|
+
*/
|
|
199
|
+
get pubHistoryDates() {
|
|
200
|
+
var _a;
|
|
201
|
+
return selectAll('pub-history event date', (_a = this.articleMeta) !== null && _a !== void 0 ? _a : this.front);
|
|
202
|
+
}
|
|
203
|
+
findPubHistoryDateByType(types) {
|
|
204
|
+
const wanted = new Set(types.map((t) => t.toLowerCase()));
|
|
205
|
+
const found = this.pubHistoryDates.find((d) => {
|
|
206
|
+
var _a;
|
|
207
|
+
const dt = String((_a = d['date-type']) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
208
|
+
return wanted.has(dt);
|
|
209
|
+
});
|
|
210
|
+
if (found && select(Tags.day, found))
|
|
211
|
+
return found;
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
get pubHistoryPubDate() {
|
|
215
|
+
return this.findPubHistoryDateByType(['pub', 'published', 'publication']);
|
|
216
|
+
}
|
|
217
|
+
get pubHistoryAcceptedDate() {
|
|
218
|
+
return this.findPubHistoryDateByType(['accepted', 'accept']);
|
|
219
|
+
}
|
|
143
220
|
get license() {
|
|
144
221
|
return select(Tags.license, this.permissions);
|
|
145
222
|
}
|
|
@@ -203,11 +280,19 @@ export class Jats {
|
|
|
203
280
|
get subArticles() {
|
|
204
281
|
return selectAll(Tags.subArticle, this.tree);
|
|
205
282
|
}
|
|
283
|
+
/** First `ref-list` in back matter. */
|
|
206
284
|
get refList() {
|
|
207
|
-
return
|
|
285
|
+
return this.refLists[0];
|
|
208
286
|
}
|
|
287
|
+
/** All `ref-list` elements under `back`, in document order. */
|
|
288
|
+
get refLists() {
|
|
289
|
+
if (!this.back)
|
|
290
|
+
return [];
|
|
291
|
+
return selectAll(Tags.refList, this.back);
|
|
292
|
+
}
|
|
293
|
+
/** Every `ref` from every `ref-list` under `back`, in document order. */
|
|
209
294
|
get references() {
|
|
210
|
-
return selectAll(Tags.ref,
|
|
295
|
+
return this.refLists.flatMap((list) => selectAll(Tags.ref, list));
|
|
211
296
|
}
|
|
212
297
|
sort() {
|
|
213
298
|
var _a;
|
|
@@ -241,14 +326,12 @@ export class Jats {
|
|
|
241
326
|
}
|
|
242
327
|
}
|
|
243
328
|
function hasSingleArticle(element) {
|
|
244
|
-
var _a;
|
|
245
329
|
if (element.name === 'article') {
|
|
246
330
|
return true;
|
|
247
331
|
}
|
|
248
|
-
if (element.name === 'pmc-articleset'
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
return true;
|
|
332
|
+
if (element.name === 'pmc-articleset') {
|
|
333
|
+
const children = significantChildElements(element.elements);
|
|
334
|
+
return (children === null || children === void 0 ? void 0 : children.length) === 1 && children[0].name === 'article';
|
|
252
335
|
}
|
|
253
336
|
return false;
|
|
254
337
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = '1.1.
|
|
1
|
+
const version = '1.1.2';
|
|
2
2
|
export default version;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jats-xml",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Types and utilities for working with JATS in Typescript",
|
|
5
|
-
"author": "Rowan Cockett <rowan@
|
|
5
|
+
"author": "Rowan Cockett <rowan@continuousfoundation.org>",
|
|
6
6
|
"homepage": "https://github.com/continuous-foundation/jats",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"adm-zip": "^0.5.10",
|
|
42
42
|
"doi-utils": "^2.0.6",
|
|
43
|
-
"jats-tags": "^1.1.
|
|
44
|
-
"jats-utils": "^1.1.
|
|
43
|
+
"jats-tags": "^1.1.2",
|
|
44
|
+
"jats-utils": "^1.1.2",
|
|
45
45
|
"myst-cli-utils": "^2.0.11",
|
|
46
46
|
"myst-common": "^1.7.5",
|
|
47
47
|
"myst-frontmatter": "^1.7.5",
|