@manuscripts/transform 2.3.38-LEAN-3911.0 → 2.6.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/__tests__/data/project-dump.json +825 -0
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/jats/importer/index.js +22 -0
- package/dist/cjs/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +34 -273
- package/dist/cjs/jats/importer/jats-body-transformations.js +22 -74
- package/dist/cjs/jats/importer/jats-comments.js +104 -27
- package/dist/cjs/jats/importer/jats-front-parser.js +321 -0
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +1 -8
- package/dist/cjs/jats/importer/jats-parser-utils.js +5 -43
- package/dist/cjs/jats/importer/jats-reference-parser.js +23 -16
- package/dist/cjs/jats/importer/jats-references.js +18 -18
- package/dist/cjs/jats/importer/parse-jats-article.js +79 -40
- package/dist/cjs/jats/index.js +7 -7
- package/dist/cjs/jats/{exporter/jats-exporter.js → jats-exporter.js} +398 -264
- package/dist/cjs/jats/{exporter/jats-versions.js → jats-versions.js} +3 -1
- package/dist/cjs/lib/utils.js +1 -12
- package/dist/cjs/transformer/__tests__/__helpers__/doc.js +37 -0
- package/dist/cjs/transformer/builders.js +219 -0
- package/dist/cjs/transformer/decode.js +898 -0
- package/dist/cjs/transformer/document-object-types.js +31 -0
- package/dist/cjs/transformer/encode.js +674 -0
- package/dist/cjs/{jats/importer/create-article-node.js → transformer/filename.js} +9 -10
- package/dist/cjs/transformer/footnote-category.js +20 -0
- package/dist/cjs/transformer/footnotes-order.js +60 -0
- package/dist/cjs/transformer/highlight-markers.js +138 -0
- package/dist/cjs/transformer/html.js +400 -0
- package/dist/cjs/transformer/id.js +5 -10
- package/dist/cjs/transformer/index.js +18 -0
- package/dist/cjs/{jats/exporter → transformer}/labels.js +5 -4
- package/dist/cjs/transformer/manuscript-dependencies.js +21 -0
- package/dist/cjs/transformer/model-map.js +26 -0
- package/dist/cjs/{lib/deafults.js → transformer/models.js} +1 -3
- package/dist/cjs/transformer/node-names.js +1 -0
- package/dist/cjs/transformer/object-types.js +57 -0
- package/dist/cjs/transformer/project-bundle.js +94 -0
- package/dist/cjs/transformer/serializer.js +23 -0
- package/dist/cjs/transformer/timestamp.js +20 -0
- package/dist/cjs/transformer/update-identifiers.js +93 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/__tests__/data/project-dump.json +825 -0
- package/dist/es/index.js +5 -5
- package/dist/{types/jats/importer/create-article-node.d.ts → es/jats/importer/index.js} +2 -3
- package/dist/es/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +35 -274
- package/dist/es/jats/importer/jats-body-transformations.js +22 -74
- package/dist/es/jats/importer/jats-comments.js +101 -26
- package/dist/es/jats/importer/jats-front-parser.js +315 -0
- package/dist/es/jats/importer/jats-journal-meta-parser.js +0 -6
- package/dist/es/jats/importer/jats-parser-utils.js +6 -44
- package/dist/es/jats/importer/jats-reference-parser.js +23 -16
- package/dist/es/jats/importer/jats-references.js +18 -18
- package/dist/es/jats/importer/parse-jats-article.js +78 -41
- package/dist/es/jats/index.js +3 -5
- package/dist/es/jats/{exporter/jats-exporter.js → jats-exporter.js} +392 -258
- package/dist/es/jats/{exporter/jats-versions.js → jats-versions.js} +1 -0
- package/dist/es/lib/utils.js +0 -9
- package/dist/es/transformer/__tests__/__helpers__/doc.js +29 -0
- package/dist/es/transformer/builders.js +186 -0
- package/dist/es/transformer/decode.js +888 -0
- package/dist/es/transformer/document-object-types.js +28 -0
- package/dist/es/transformer/encode.js +664 -0
- package/dist/es/transformer/filename.js +23 -0
- package/dist/es/transformer/footnote-category.js +16 -0
- package/dist/es/transformer/footnotes-order.js +55 -0
- package/dist/es/transformer/highlight-markers.js +132 -0
- package/dist/es/transformer/html.js +393 -0
- package/dist/es/transformer/id.js +3 -8
- package/dist/es/transformer/index.js +16 -0
- package/dist/es/{jats/exporter → transformer}/labels.js +5 -4
- package/dist/es/transformer/manuscript-dependencies.js +17 -0
- package/dist/es/transformer/model-map.js +22 -0
- package/dist/es/{lib/deafults.js → transformer/models.js} +2 -2
- package/dist/es/transformer/node-names.js +1 -0
- package/dist/es/transformer/object-types.js +52 -0
- package/dist/es/transformer/project-bundle.js +85 -0
- package/dist/es/transformer/serializer.js +17 -0
- package/dist/es/transformer/timestamp.js +16 -0
- package/dist/es/transformer/update-identifiers.js +87 -0
- package/dist/es/version.js +1 -1
- package/dist/types/index.d.ts +6 -6
- package/dist/types/jats/importer/index.d.ts +16 -0
- package/dist/types/jats/importer/{jats-dom-parser.d.ts → jats-body-dom-parser.d.ts} +1 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +1 -5
- package/dist/types/jats/importer/jats-comments.d.ts +10 -4
- package/dist/types/jats/importer/jats-front-parser.d.ts +84 -0
- package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +0 -10
- package/dist/types/jats/importer/jats-references.d.ts +8 -19
- package/dist/types/jats/importer/parse-jats-article.d.ts +5 -12
- package/dist/types/jats/index.d.ts +3 -5
- package/dist/types/jats/{exporter/jats-exporter.d.ts → jats-exporter.d.ts} +29 -15
- package/dist/types/jats/{exporter/jats-versions.d.ts → jats-versions.d.ts} +1 -0
- package/dist/types/lib/utils.d.ts +0 -2
- package/dist/types/schema/nodes/bibliography_item.d.ts +3 -3
- package/dist/types/schema/nodes/contributor.d.ts +0 -10
- package/dist/types/schema/nodes/keyword_group.d.ts +0 -1
- package/dist/types/schema/nodes/manuscript.d.ts +7 -8
- package/dist/types/schema/nodes/title.d.ts +3 -0
- package/dist/types/transformer/__tests__/__helpers__/doc.d.ts +18 -0
- package/dist/types/transformer/builders.d.ts +61 -0
- package/dist/types/transformer/decode.d.ts +52 -0
- package/dist/types/transformer/document-object-types.d.ts +17 -0
- package/dist/types/transformer/encode.d.ts +29 -0
- package/dist/types/transformer/filename.d.ts +16 -0
- package/dist/types/transformer/footnote-category.d.ts +17 -0
- package/dist/{es/jats/importer/create-article-node.js → types/transformer/footnotes-order.d.ts} +8 -10
- package/dist/types/transformer/highlight-markers.d.ts +31 -0
- package/dist/types/transformer/html.d.ts +36 -0
- package/dist/types/transformer/id.d.ts +2 -5
- package/dist/types/transformer/index.d.ts +16 -0
- package/dist/types/{jats/exporter → transformer}/labels.d.ts +2 -2
- package/dist/types/transformer/manuscript-dependencies.d.ts +4 -0
- package/dist/types/transformer/model-map.d.ts +19 -0
- package/dist/types/transformer/models.d.ts +48 -0
- package/dist/types/transformer/object-types.d.ts +30 -0
- package/dist/types/transformer/project-bundle.d.ts +30 -0
- package/dist/types/transformer/serializer.d.ts +19 -0
- package/dist/types/{lib/deafults.d.ts → transformer/timestamp.d.ts} +2 -2
- package/dist/types/transformer/update-identifiers.d.ts +23 -0
- package/dist/types/types.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -2
- package/dist/cjs/jats/importer/jats-front-transformations.js +0 -79
- package/dist/es/jats/importer/jats-front-transformations.js +0 -76
- package/dist/types/jats/importer/jats-front-transformations.d.ts +0 -22
- package/dist/types/jats/types.d.ts +0 -1
- /package/dist/cjs/{jats/types.js → types.js} +0 -0
- /package/dist/es/{jats/types.js → types.js} +0 -0
|
@@ -23,18 +23,44 @@ const json_schema_1 = require("@manuscripts/json-schema");
|
|
|
23
23
|
const library_1 = require("@manuscripts/library");
|
|
24
24
|
const debug_1 = __importDefault(require("debug"));
|
|
25
25
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
26
|
-
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
27
26
|
const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
|
|
28
|
-
const html_1 = require("
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
27
|
+
const html_1 = require("../lib/html");
|
|
28
|
+
const styled_content_1 = require("../lib/styled-content");
|
|
29
|
+
const utils_1 = require("../lib/utils");
|
|
30
|
+
const schema_1 = require("../schema");
|
|
31
|
+
const filename_1 = require("../transformer/filename");
|
|
32
|
+
const labels_1 = require("../transformer/labels");
|
|
33
|
+
const node_types_1 = require("../transformer/node-types");
|
|
34
|
+
const object_types_1 = require("../transformer/object-types");
|
|
35
|
+
const project_bundle_1 = require("../transformer/project-bundle");
|
|
36
|
+
const section_category_1 = require("../transformer/section-category");
|
|
32
37
|
const jats_versions_1 = require("./jats-versions");
|
|
33
|
-
const labels_1 = require("./labels");
|
|
34
38
|
const warn = (0, debug_1.default)('manuscripts-transform');
|
|
35
39
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
36
40
|
const normalizeID = (id) => id.replace(/:/g, '_');
|
|
37
41
|
const parser = prosemirror_model_1.DOMParser.fromSchema(schema_1.schema);
|
|
42
|
+
const findChildNodeOfType = (node, nodeType) => {
|
|
43
|
+
for (const child of (0, utils_1.iterateChildren)(node)) {
|
|
44
|
+
if (child.type === nodeType) {
|
|
45
|
+
return child;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const isContributor = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Contributor);
|
|
50
|
+
const CREDIT_VOCAB_IDENTIFIER = 'https://dictionary.casrai.org/Contributor_Roles';
|
|
51
|
+
const chooseRoleVocabAttributes = (role) => {
|
|
52
|
+
if (role.uri && role.uri.startsWith(CREDIT_VOCAB_IDENTIFIER)) {
|
|
53
|
+
return {
|
|
54
|
+
vocab: 'credit',
|
|
55
|
+
'vocab-identifier': CREDIT_VOCAB_IDENTIFIER,
|
|
56
|
+
'vocab-term': role.name,
|
|
57
|
+
'vocab-term-identifier': role.uri,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
vocab: 'uncontrolled',
|
|
62
|
+
};
|
|
63
|
+
};
|
|
38
64
|
const insertAbstractNode = (articleMeta, abstractNode) => {
|
|
39
65
|
const siblings = [
|
|
40
66
|
'kwd-group',
|
|
@@ -72,24 +98,24 @@ const createDefaultIdGenerator = () => {
|
|
|
72
98
|
return `${element.localName}-${value}`;
|
|
73
99
|
};
|
|
74
100
|
};
|
|
75
|
-
const chooseRefType = (
|
|
76
|
-
switch (
|
|
77
|
-
case
|
|
78
|
-
case
|
|
101
|
+
const chooseRefType = (objectType) => {
|
|
102
|
+
switch (objectType) {
|
|
103
|
+
case json_schema_1.ObjectTypes.Figure:
|
|
104
|
+
case json_schema_1.ObjectTypes.FigureElement:
|
|
79
105
|
return 'fig';
|
|
80
|
-
case
|
|
106
|
+
case json_schema_1.ObjectTypes.Footnote:
|
|
81
107
|
return 'fn';
|
|
82
|
-
case
|
|
83
|
-
case
|
|
108
|
+
case json_schema_1.ObjectTypes.Table:
|
|
109
|
+
case json_schema_1.ObjectTypes.TableElement:
|
|
84
110
|
return 'table';
|
|
85
|
-
case
|
|
111
|
+
case json_schema_1.ObjectTypes.Section:
|
|
86
112
|
return 'sec';
|
|
87
|
-
case
|
|
88
|
-
case
|
|
113
|
+
case json_schema_1.ObjectTypes.Equation:
|
|
114
|
+
case json_schema_1.ObjectTypes.EquationElement:
|
|
89
115
|
return 'disp-formula';
|
|
90
116
|
}
|
|
91
117
|
};
|
|
92
|
-
const sortContributors = (a, b) => Number(a.
|
|
118
|
+
const sortContributors = (a, b) => Number(a.priority) - Number(b.priority);
|
|
93
119
|
const buildCitations = (citations) => citations.map((citation) => ({
|
|
94
120
|
citationID: citation.attrs.id,
|
|
95
121
|
citationItems: citation.attrs.rids.map((rid) => ({
|
|
@@ -102,57 +128,39 @@ const buildCitations = (citations) => citations.map((citation) => ({
|
|
|
102
128
|
exports.buildCitations = buildCitations;
|
|
103
129
|
class JATSExporter {
|
|
104
130
|
constructor() {
|
|
105
|
-
this.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return undefined;
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
_id: node.attrs.id,
|
|
114
|
-
issued: node.attrs.issued,
|
|
115
|
-
DOI: node.attrs.doi,
|
|
116
|
-
manuscriptID,
|
|
117
|
-
objectType: json_schema_1.ObjectTypes.BibliographyItem,
|
|
118
|
-
author: node.attrs.author,
|
|
119
|
-
'container-title': node.attrs.containerTitle,
|
|
120
|
-
volume: node.attrs.volume,
|
|
121
|
-
issue: node.attrs.issue,
|
|
122
|
-
supplement: node.attrs.supplement,
|
|
123
|
-
page: node.attrs.page,
|
|
124
|
-
title: node.attrs.title,
|
|
125
|
-
literal: node.attrs.literal,
|
|
126
|
-
type: node.attrs.type,
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
this.serializeToJATS = async (manuscriptNode, options) => {
|
|
131
|
-
var _a;
|
|
132
|
-
this.manuscriptNode = manuscriptNode;
|
|
133
|
-
this.generateCitationTexts(options.csl, manuscriptNode.attrs.id);
|
|
131
|
+
this.serializeToJATS = async (fragment, modelMap, manuscriptID, options) => {
|
|
132
|
+
const { version = '1.2', doi, id, frontMatterOnly = false, links, idGenerator, mediaPathGenerator, csl, } = options;
|
|
133
|
+
this.modelMap = modelMap;
|
|
134
|
+
this.models = Array.from(this.modelMap.values());
|
|
135
|
+
this.generateCitationTexts(fragment, csl);
|
|
134
136
|
this.createSerializer();
|
|
135
|
-
const versionIds = (0, jats_versions_1.selectVersionIds)(
|
|
137
|
+
const versionIds = (0, jats_versions_1.selectVersionIds)(version);
|
|
136
138
|
this.document = document.implementation.createDocument(null, 'article', document.implementation.createDocumentType('article', versionIds.publicId, versionIds.systemId));
|
|
137
139
|
const article = this.document.documentElement;
|
|
138
140
|
article.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', XLINK_NAMESPACE);
|
|
139
|
-
const front = this.buildFront(
|
|
141
|
+
const front = this.buildFront(doi, id, links);
|
|
140
142
|
article.appendChild(front);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
143
|
+
const manuscript = (0, project_bundle_1.findManuscriptById)(this.modelMap, manuscriptID);
|
|
144
|
+
article.setAttribute('article-type', manuscript.articleType || 'other');
|
|
145
|
+
if (!frontMatterOnly) {
|
|
146
|
+
this.labelTargets = (0, labels_1.buildTargets)(fragment);
|
|
147
|
+
const body = this.buildBody(fragment);
|
|
148
|
+
article.appendChild(body);
|
|
149
|
+
const back = this.buildBack(body);
|
|
150
|
+
this.moveCoiStatementToAuthorNotes(back, front);
|
|
151
|
+
article.appendChild(back);
|
|
152
|
+
this.unwrapBody(body);
|
|
153
|
+
this.moveAbstracts(front, body);
|
|
154
|
+
this.moveFloatsGroup(body, article);
|
|
155
|
+
this.removeBackContainer(body);
|
|
156
|
+
this.updateFootnoteTypes(front, back);
|
|
157
|
+
this.fillEmptyTableFooters(article);
|
|
158
|
+
this.fillEmptyFootnotes(article);
|
|
159
|
+
}
|
|
160
|
+
await this.rewriteIDs(idGenerator);
|
|
161
|
+
if (mediaPathGenerator) {
|
|
162
|
+
await this.rewriteMediaPaths(mediaPathGenerator);
|
|
163
|
+
}
|
|
156
164
|
return (0, w3c_xmlserializer_1.default)(this.document);
|
|
157
165
|
};
|
|
158
166
|
this.nodeFromJATS = (JATSFragment) => {
|
|
@@ -165,6 +173,19 @@ class JATSExporter {
|
|
|
165
173
|
template.innerHTML = JATSFragment;
|
|
166
174
|
return template.firstChild;
|
|
167
175
|
};
|
|
176
|
+
this.rewriteMediaPaths = async (generator) => {
|
|
177
|
+
const doc = this.document;
|
|
178
|
+
for (const fig of doc.querySelectorAll('fig')) {
|
|
179
|
+
for (const graphic of fig.querySelectorAll('graphic')) {
|
|
180
|
+
const newHref = await generator(graphic, fig.id);
|
|
181
|
+
graphic.setAttributeNS(XLINK_NAMESPACE, 'href', newHref);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
for (const suppl of doc.querySelectorAll('supplementary-material')) {
|
|
185
|
+
const newHref = await generator(suppl, suppl.id);
|
|
186
|
+
suppl.setAttributeNS(XLINK_NAMESPACE, 'href', newHref);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
168
189
|
this.rewriteIDs = async (generator = createDefaultIdGenerator()) => {
|
|
169
190
|
const ids = new Map();
|
|
170
191
|
for (const element of this.document.querySelectorAll('[id]')) {
|
|
@@ -206,14 +227,16 @@ class JATSExporter {
|
|
|
206
227
|
}
|
|
207
228
|
}
|
|
208
229
|
};
|
|
209
|
-
this.buildFront = (
|
|
210
|
-
var _a;
|
|
211
|
-
const
|
|
230
|
+
this.buildFront = (doi, id, links) => {
|
|
231
|
+
var _a, _b, _c, _d, _e;
|
|
232
|
+
const manuscript = (0, project_bundle_1.findManuscript)(this.modelMap);
|
|
233
|
+
const titles = (0, project_bundle_1.findTitles)(this.modelMap);
|
|
212
234
|
const front = this.document.createElement('front');
|
|
213
235
|
const journalMeta = this.document.createElement('journal-meta');
|
|
214
236
|
front.appendChild(journalMeta);
|
|
215
237
|
const articleMeta = this.document.createElement('article-meta');
|
|
216
238
|
front.appendChild(articleMeta);
|
|
239
|
+
const journal = [...this.modelMap.values()].find((model) => model.objectType === json_schema_1.ObjectTypes.Journal);
|
|
217
240
|
if (journal) {
|
|
218
241
|
if (journal.journalIdentifiers) {
|
|
219
242
|
for (const item of journal.journalIdentifiers) {
|
|
@@ -262,47 +285,109 @@ class JATSExporter {
|
|
|
262
285
|
journalMeta.appendChild(publisher);
|
|
263
286
|
}
|
|
264
287
|
}
|
|
265
|
-
if (
|
|
288
|
+
if (id) {
|
|
289
|
+
const articleID = this.document.createElement('article-id');
|
|
290
|
+
articleID.setAttribute('pub-id-type', 'publisher-id');
|
|
291
|
+
articleID.textContent = id;
|
|
292
|
+
articleMeta.appendChild(articleID);
|
|
293
|
+
}
|
|
294
|
+
if (doi || manuscript.DOI) {
|
|
266
295
|
const articleID = this.document.createElement('article-id');
|
|
267
296
|
articleID.setAttribute('pub-id-type', 'doi');
|
|
268
|
-
articleID.textContent =
|
|
297
|
+
articleID.textContent = (_a = manuscript.DOI) !== null && _a !== void 0 ? _a : doi;
|
|
269
298
|
articleMeta.appendChild(articleID);
|
|
270
299
|
}
|
|
271
300
|
const titleGroup = this.document.createElement('title-group');
|
|
272
301
|
articleMeta.appendChild(titleGroup);
|
|
273
302
|
this.buildContributors(articleMeta);
|
|
274
|
-
if (
|
|
303
|
+
if (links && links.self) {
|
|
304
|
+
for (const [key, value] of Object.entries(links.self)) {
|
|
305
|
+
const link = this.document.createElement('self-uri');
|
|
306
|
+
link.setAttribute('content-type', key);
|
|
307
|
+
link.setAttributeNS(XLINK_NAMESPACE, 'href', value);
|
|
308
|
+
articleMeta.appendChild(link);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (titles.title) {
|
|
275
312
|
const element = this.document.createElement('article-title');
|
|
276
|
-
this.setTitleContent(element,
|
|
313
|
+
this.setTitleContent(element, titles.title);
|
|
277
314
|
titleGroup.appendChild(element);
|
|
278
315
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
316
|
+
if (titles.subtitle) {
|
|
317
|
+
const element = this.document.createElement('subtitle');
|
|
318
|
+
this.setTitleContent(element, titles.subtitle);
|
|
319
|
+
titleGroup.appendChild(element);
|
|
320
|
+
}
|
|
321
|
+
if (titles.runningTitle) {
|
|
322
|
+
const element = this.document.createElement('alt-title');
|
|
323
|
+
element.setAttribute('alt-title-type', 'right-running');
|
|
324
|
+
this.setTitleContent(element, titles.runningTitle);
|
|
325
|
+
titleGroup.appendChild(element);
|
|
326
|
+
}
|
|
327
|
+
const supplements = [...this.modelMap.values()].filter((model) => model.objectType === json_schema_1.ObjectTypes.Supplement);
|
|
328
|
+
if (supplements && supplements.length > 0) {
|
|
329
|
+
for (const supplement of supplements) {
|
|
330
|
+
const supplementaryMaterial = this.document.createElement('supplementary-material');
|
|
331
|
+
supplementaryMaterial.setAttribute('id', normalizeID(supplement._id));
|
|
332
|
+
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (_b = supplement.href) !== null && _b !== void 0 ? _b : '');
|
|
333
|
+
const mimeType = (_c = supplement.MIME) === null || _c === void 0 ? void 0 : _c.split('/')[0];
|
|
334
|
+
const mimeSubType = (_d = supplement.MIME) === null || _d === void 0 ? void 0 : _d.split('/')[1];
|
|
335
|
+
supplementaryMaterial.setAttribute('mimetype', mimeType !== null && mimeType !== void 0 ? mimeType : '');
|
|
336
|
+
supplementaryMaterial.setAttribute('mime-subtype', mimeSubType !== null && mimeSubType !== void 0 ? mimeSubType : '');
|
|
337
|
+
const caption = this.document.createElement('caption');
|
|
338
|
+
const title = this.document.createElement('title');
|
|
339
|
+
title.textContent = (_e = supplement.title) !== null && _e !== void 0 ? _e : '';
|
|
340
|
+
caption.append(title);
|
|
341
|
+
supplementaryMaterial.append(caption);
|
|
342
|
+
articleMeta.append(supplementaryMaterial);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const history = articleMeta.querySelector('history') ||
|
|
346
|
+
this.document.createElement('history');
|
|
347
|
+
if (manuscript.acceptanceDate) {
|
|
348
|
+
const date = this.buildDateElement(manuscript.acceptanceDate, 'accepted');
|
|
349
|
+
history.appendChild(date);
|
|
350
|
+
}
|
|
351
|
+
if (manuscript.correctionDate) {
|
|
352
|
+
const date = this.buildDateElement(manuscript.correctionDate, 'corrected');
|
|
353
|
+
history.appendChild(date);
|
|
354
|
+
}
|
|
355
|
+
if (manuscript.retractionDate) {
|
|
356
|
+
const date = this.buildDateElement(manuscript.retractionDate, 'retracted');
|
|
357
|
+
history.appendChild(date);
|
|
358
|
+
}
|
|
359
|
+
if (manuscript.receiveDate) {
|
|
360
|
+
const date = this.buildDateElement(manuscript.receiveDate, 'received');
|
|
361
|
+
history.appendChild(date);
|
|
362
|
+
}
|
|
363
|
+
if (manuscript.revisionReceiveDate) {
|
|
364
|
+
const date = this.buildDateElement(manuscript.revisionReceiveDate, 'rev-recd');
|
|
365
|
+
history.appendChild(date);
|
|
366
|
+
}
|
|
367
|
+
if (manuscript.revisionRequestDate) {
|
|
368
|
+
const date = this.buildDateElement(manuscript.revisionRequestDate, 'rev-request');
|
|
369
|
+
history.appendChild(date);
|
|
370
|
+
}
|
|
371
|
+
if (history.childElementCount) {
|
|
372
|
+
articleMeta.appendChild(history);
|
|
373
|
+
}
|
|
294
374
|
this.buildKeywords(articleMeta);
|
|
295
375
|
let countingElements = [];
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
376
|
+
if (manuscript.genericCounts) {
|
|
377
|
+
const elements = manuscript.genericCounts.map((el) => {
|
|
378
|
+
const countingElement = this.buildCountingElement('count', el.count);
|
|
379
|
+
if (countingElement) {
|
|
380
|
+
countingElement.setAttribute('count-type', el.countType);
|
|
381
|
+
}
|
|
382
|
+
return countingElement;
|
|
383
|
+
});
|
|
384
|
+
countingElements.push(...elements);
|
|
385
|
+
}
|
|
386
|
+
countingElements.push(this.buildCountingElement('fig-count', manuscript.figureCount));
|
|
387
|
+
countingElements.push(this.buildCountingElement('table-count', manuscript.tableCount));
|
|
388
|
+
countingElements.push(this.buildCountingElement('equation-count', manuscript.equationCount));
|
|
389
|
+
countingElements.push(this.buildCountingElement('ref-count', manuscript.referencesCount));
|
|
390
|
+
countingElements.push(this.buildCountingElement('word-count', manuscript.wordCount));
|
|
306
391
|
countingElements = countingElements.filter((el) => el);
|
|
307
392
|
if (countingElements.length > 0) {
|
|
308
393
|
const counts = this.document.createElement('counts');
|
|
@@ -337,17 +422,16 @@ class JATSExporter {
|
|
|
337
422
|
return wordCount;
|
|
338
423
|
}
|
|
339
424
|
};
|
|
340
|
-
this.buildBody = () => {
|
|
425
|
+
this.buildBody = (fragment) => {
|
|
341
426
|
const body = this.document.createElement('body');
|
|
342
|
-
|
|
427
|
+
fragment.forEach((cFragment) => {
|
|
343
428
|
const serializedNode = this.serializeNode(cFragment);
|
|
344
429
|
body.append(...serializedNode.childNodes);
|
|
345
430
|
});
|
|
346
|
-
this.fixBody(body);
|
|
431
|
+
this.fixBody(body, fragment);
|
|
347
432
|
return body;
|
|
348
433
|
};
|
|
349
434
|
this.buildBack = (body) => {
|
|
350
|
-
var _a;
|
|
351
435
|
const back = this.document.createElement('back');
|
|
352
436
|
this.moveSectionsToBack(back, body);
|
|
353
437
|
const footnotesElements = this.document.querySelectorAll('sec > fn-group');
|
|
@@ -372,7 +456,7 @@ class JATSExporter {
|
|
|
372
456
|
back.appendChild(refList);
|
|
373
457
|
const [meta] = this.citationProvider.makeBibliography();
|
|
374
458
|
for (const id of meta.entry_ids) {
|
|
375
|
-
const
|
|
459
|
+
const bibliographyItem = this.modelMap.get(id[0]);
|
|
376
460
|
const ref = this.document.createElement('ref');
|
|
377
461
|
ref.setAttribute('id', normalizeID(id[0]));
|
|
378
462
|
const updateCitationPubType = (citationEl, pubType) => {
|
|
@@ -391,21 +475,21 @@ class JATSExporter {
|
|
|
391
475
|
citationEl.setAttribute('publication-type', 'journal');
|
|
392
476
|
}
|
|
393
477
|
};
|
|
394
|
-
if (
|
|
478
|
+
if (bibliographyItem.literal) {
|
|
395
479
|
const mixedCitation = this.document.createElement('mixed-citation');
|
|
396
|
-
updateCitationPubType(mixedCitation,
|
|
397
|
-
mixedCitation.textContent =
|
|
480
|
+
updateCitationPubType(mixedCitation, bibliographyItem.type);
|
|
481
|
+
mixedCitation.textContent = bibliographyItem.literal;
|
|
398
482
|
ref.appendChild(mixedCitation);
|
|
399
483
|
refList.appendChild(ref);
|
|
400
484
|
}
|
|
401
485
|
else {
|
|
402
486
|
const citation = this.document.createElement('element-citation');
|
|
403
|
-
updateCitationPubType(citation,
|
|
404
|
-
if (
|
|
487
|
+
updateCitationPubType(citation, bibliographyItem.type);
|
|
488
|
+
if (bibliographyItem.author) {
|
|
405
489
|
const personGroupNode = this.document.createElement('person-group');
|
|
406
490
|
personGroupNode.setAttribute('person-group-type', 'author');
|
|
407
491
|
citation.appendChild(personGroupNode);
|
|
408
|
-
|
|
492
|
+
bibliographyItem.author.forEach((author) => {
|
|
409
493
|
const name = this.document.createElement('string-name');
|
|
410
494
|
if (author.family) {
|
|
411
495
|
const node = this.document.createElement('surname');
|
|
@@ -427,8 +511,8 @@ class JATSExporter {
|
|
|
427
511
|
}
|
|
428
512
|
});
|
|
429
513
|
}
|
|
430
|
-
if (
|
|
431
|
-
const dateParts =
|
|
514
|
+
if (bibliographyItem.issued) {
|
|
515
|
+
const dateParts = bibliographyItem.issued['date-parts'];
|
|
432
516
|
if (dateParts && dateParts.length) {
|
|
433
517
|
const [[year, month, day]] = dateParts;
|
|
434
518
|
if (year) {
|
|
@@ -448,33 +532,33 @@ class JATSExporter {
|
|
|
448
532
|
}
|
|
449
533
|
}
|
|
450
534
|
}
|
|
451
|
-
if (
|
|
535
|
+
if (bibliographyItem.title) {
|
|
452
536
|
const node = this.document.createElement('article-title');
|
|
453
|
-
this.setTitleContent(node,
|
|
537
|
+
this.setTitleContent(node, bibliographyItem.title);
|
|
454
538
|
citation.appendChild(node);
|
|
455
539
|
}
|
|
456
|
-
if (
|
|
540
|
+
if (bibliographyItem['container-title']) {
|
|
457
541
|
const node = this.document.createElement('source');
|
|
458
|
-
node.textContent =
|
|
542
|
+
node.textContent = bibliographyItem['container-title'];
|
|
459
543
|
citation.appendChild(node);
|
|
460
544
|
}
|
|
461
|
-
if (
|
|
545
|
+
if (bibliographyItem.volume) {
|
|
462
546
|
const node = this.document.createElement('volume');
|
|
463
|
-
node.textContent = String(
|
|
547
|
+
node.textContent = String(bibliographyItem.volume);
|
|
464
548
|
citation.appendChild(node);
|
|
465
549
|
}
|
|
466
|
-
if (
|
|
550
|
+
if (bibliographyItem.issue) {
|
|
467
551
|
const node = this.document.createElement('issue');
|
|
468
|
-
node.textContent = String(
|
|
552
|
+
node.textContent = String(bibliographyItem.issue);
|
|
469
553
|
citation.appendChild(node);
|
|
470
554
|
}
|
|
471
|
-
if (
|
|
555
|
+
if (bibliographyItem.supplement) {
|
|
472
556
|
const node = this.document.createElement('supplement');
|
|
473
|
-
node.textContent =
|
|
557
|
+
node.textContent = bibliographyItem.supplement;
|
|
474
558
|
citation.appendChild(node);
|
|
475
559
|
}
|
|
476
|
-
if (
|
|
477
|
-
const pageString = String(
|
|
560
|
+
if (bibliographyItem.page) {
|
|
561
|
+
const pageString = String(bibliographyItem.page);
|
|
478
562
|
if (/^\d+$/.test(pageString)) {
|
|
479
563
|
const node = this.document.createElement('fpage');
|
|
480
564
|
node.textContent = pageString;
|
|
@@ -495,10 +579,10 @@ class JATSExporter {
|
|
|
495
579
|
citation.appendChild(node);
|
|
496
580
|
}
|
|
497
581
|
}
|
|
498
|
-
if (
|
|
582
|
+
if (bibliographyItem.DOI) {
|
|
499
583
|
const node = this.document.createElement('pub-id');
|
|
500
584
|
node.setAttribute('pub-id-type', 'doi');
|
|
501
|
-
node.textContent = String(
|
|
585
|
+
node.textContent = String(bibliographyItem.DOI);
|
|
502
586
|
citation.appendChild(node);
|
|
503
587
|
}
|
|
504
588
|
ref.appendChild(citation);
|
|
@@ -508,10 +592,11 @@ class JATSExporter {
|
|
|
508
592
|
return back;
|
|
509
593
|
};
|
|
510
594
|
this.createSerializer = () => {
|
|
595
|
+
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
511
596
|
const nodes = {
|
|
512
597
|
award: () => '',
|
|
513
598
|
awards: () => '',
|
|
514
|
-
box_element: () =>
|
|
599
|
+
box_element: (node) => createBoxElement(node),
|
|
515
600
|
author_notes: () => '',
|
|
516
601
|
corresp: () => '',
|
|
517
602
|
title: () => '',
|
|
@@ -572,25 +657,24 @@ class JATSExporter {
|
|
|
572
657
|
return xref;
|
|
573
658
|
},
|
|
574
659
|
cross_reference: (node) => {
|
|
575
|
-
var _a;
|
|
576
660
|
const cross = node;
|
|
577
661
|
const rids = cross.attrs.rids;
|
|
578
662
|
if (!rids.length) {
|
|
579
663
|
return cross.attrs.label;
|
|
580
664
|
}
|
|
581
665
|
const text = cross.attrs.customLabel || cross.attrs.label;
|
|
582
|
-
const
|
|
583
|
-
if (!
|
|
666
|
+
const model = getModel(rids[0]);
|
|
667
|
+
if (!model) {
|
|
584
668
|
warn('');
|
|
585
669
|
return text;
|
|
586
670
|
}
|
|
587
671
|
const xref = this.document.createElement('xref');
|
|
588
|
-
const type = chooseRefType(
|
|
672
|
+
const type = chooseRefType(model.objectType);
|
|
589
673
|
if (type) {
|
|
590
674
|
xref.setAttribute('ref-type', type);
|
|
591
675
|
}
|
|
592
676
|
else {
|
|
593
|
-
warn(`Unset ref-type for
|
|
677
|
+
warn(`Unset ref-type for objectType ${model.objectType}`);
|
|
594
678
|
}
|
|
595
679
|
xref.setAttribute('rid', normalizeID(rids.join(' ')));
|
|
596
680
|
xref.textContent = text;
|
|
@@ -662,10 +746,7 @@ class JATSExporter {
|
|
|
662
746
|
hard_break: () => '',
|
|
663
747
|
highlight_marker: () => '',
|
|
664
748
|
inline_footnote: (node) => {
|
|
665
|
-
const rids = node.attrs.rids.filter(
|
|
666
|
-
var _a;
|
|
667
|
-
return (_a = (0, prosemirror_utils_1.findChildrenByAttr)(this.manuscriptNode, (attrs) => attrs.id === rid)[0]) === null || _a === void 0 ? void 0 : _a.node;
|
|
668
|
-
});
|
|
749
|
+
const rids = node.attrs.rids.filter(getModel);
|
|
669
750
|
if (rids.length == 0) {
|
|
670
751
|
return '';
|
|
671
752
|
}
|
|
@@ -747,7 +828,7 @@ class JATSExporter {
|
|
|
747
828
|
id: normalizeID(node.attrs.id),
|
|
748
829
|
};
|
|
749
830
|
if (node.attrs.category) {
|
|
750
|
-
attrs['sec-type'] = (0,
|
|
831
|
+
attrs['sec-type'] = (0, section_category_1.chooseSecType)(node.attrs.category);
|
|
751
832
|
}
|
|
752
833
|
return ['sec', attrs, 0];
|
|
753
834
|
},
|
|
@@ -784,7 +865,14 @@ class JATSExporter {
|
|
|
784
865
|
italic: () => ['italic'],
|
|
785
866
|
smallcaps: () => ['sc'],
|
|
786
867
|
strikethrough: () => ['strike'],
|
|
787
|
-
styled: () =>
|
|
868
|
+
styled: (mark) => {
|
|
869
|
+
const inlineStyle = getModel(mark.attrs.rid);
|
|
870
|
+
const attrs = {};
|
|
871
|
+
if (inlineStyle && inlineStyle.title) {
|
|
872
|
+
attrs.style = (0, styled_content_1.normalizeStyleName)(inlineStyle.title);
|
|
873
|
+
}
|
|
874
|
+
return ['styled-content', attrs];
|
|
875
|
+
},
|
|
788
876
|
superscript: () => ['sup'],
|
|
789
877
|
subscript: () => ['sub'],
|
|
790
878
|
underline: () => ['underline'],
|
|
@@ -835,16 +923,14 @@ class JATSExporter {
|
|
|
835
923
|
}
|
|
836
924
|
};
|
|
837
925
|
const appendChildNodeOfType = (element, node, type) => {
|
|
838
|
-
|
|
839
|
-
const childNode = (_a = (0, prosemirror_utils_1.findChildrenByType)(node, type)[0]) === null || _a === void 0 ? void 0 : _a.node;
|
|
926
|
+
const childNode = findChildNodeOfType(node, type);
|
|
840
927
|
if (childNode) {
|
|
841
928
|
element.appendChild(this.serializeNode(childNode));
|
|
842
929
|
}
|
|
843
930
|
};
|
|
844
931
|
const appendTable = (element, node) => {
|
|
845
|
-
|
|
846
|
-
const
|
|
847
|
-
const colGroupNode = (_b = (0, prosemirror_utils_1.findChildrenByType)(node, node.type.schema.nodes.table_colgroup)[0]) === null || _b === void 0 ? void 0 : _b.node;
|
|
932
|
+
const tableNode = findChildNodeOfType(node, node.type.schema.nodes.table);
|
|
933
|
+
const colGroupNode = findChildNodeOfType(node, node.type.schema.nodes.table_colgroup);
|
|
848
934
|
if (!tableNode) {
|
|
849
935
|
return;
|
|
850
936
|
}
|
|
@@ -862,6 +948,13 @@ class JATSExporter {
|
|
|
862
948
|
}
|
|
863
949
|
element.appendChild(table);
|
|
864
950
|
};
|
|
951
|
+
const createBoxElement = (node) => {
|
|
952
|
+
const element = createElement(node, 'boxed-text');
|
|
953
|
+
appendLabels(element, node);
|
|
954
|
+
appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
955
|
+
processChildNodes(element, node, node.type.schema.nodes.section);
|
|
956
|
+
return element;
|
|
957
|
+
};
|
|
865
958
|
const createFigureElement = (node, nodeName, contentNodeType, figType) => {
|
|
866
959
|
const element = createElement(node, nodeName);
|
|
867
960
|
if (figType) {
|
|
@@ -872,7 +965,7 @@ class JATSExporter {
|
|
|
872
965
|
appendChildNodeOfType(element, node, node.type.schema.nodes.footnotes_element);
|
|
873
966
|
processChildNodes(element, node, contentNodeType);
|
|
874
967
|
appendAttributions(element, node);
|
|
875
|
-
if ((0,
|
|
968
|
+
if ((0, node_types_1.isExecutableNodeType)(node.type)) {
|
|
876
969
|
processExecutableNode(node, element);
|
|
877
970
|
}
|
|
878
971
|
return element;
|
|
@@ -884,14 +977,13 @@ class JATSExporter {
|
|
|
884
977
|
appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
885
978
|
appendTable(element, node);
|
|
886
979
|
appendChildNodeOfType(element, node, node.type.schema.nodes.table_element_footer);
|
|
887
|
-
if ((0,
|
|
980
|
+
if ((0, node_types_1.isExecutableNodeType)(node.type)) {
|
|
888
981
|
processExecutableNode(node, element);
|
|
889
982
|
}
|
|
890
983
|
return element;
|
|
891
984
|
};
|
|
892
985
|
const processExecutableNode = (node, element) => {
|
|
893
|
-
|
|
894
|
-
const listingNode = (_a = (0, prosemirror_utils_1.findChildrenByType)(node, node.type.schema.nodes.listing)[0]) === null || _a === void 0 ? void 0 : _a.node;
|
|
986
|
+
const listingNode = findChildNodeOfType(node, node.type.schema.nodes.listing);
|
|
895
987
|
if (listingNode) {
|
|
896
988
|
const { contents, languageKey } = listingNode.attrs;
|
|
897
989
|
if (contents && languageKey) {
|
|
@@ -909,7 +1001,7 @@ class JATSExporter {
|
|
|
909
1001
|
for (const attachment of attachments) {
|
|
910
1002
|
const p = this.document.createElement('p');
|
|
911
1003
|
caption.appendChild(p);
|
|
912
|
-
const filename = (0,
|
|
1004
|
+
const filename = (0, filename_1.generateAttachmentFilename)(`${listingNode.attrs.id}:${attachment.id}`, attachment.type);
|
|
913
1005
|
const supp = this.document.createElement('supplementary-material');
|
|
914
1006
|
supp.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', `suppl/${filename}`);
|
|
915
1007
|
const [mimeType, mimeSubType] = attachment.type.split('/');
|
|
@@ -925,25 +1017,25 @@ class JATSExporter {
|
|
|
925
1017
|
}
|
|
926
1018
|
};
|
|
927
1019
|
};
|
|
1020
|
+
this.serializeFragment = (fragment) => this.serializer.serializeFragment(fragment, {
|
|
1021
|
+
document: this.document,
|
|
1022
|
+
});
|
|
928
1023
|
this.serializeNode = (node) => this.serializer.serializeNode(node, {
|
|
929
1024
|
document: this.document,
|
|
930
1025
|
});
|
|
931
1026
|
this.validateContributor = (contributor) => {
|
|
932
|
-
if (!contributor.
|
|
933
|
-
throw new Error(`${contributor.
|
|
1027
|
+
if (!contributor.bibliographicName) {
|
|
1028
|
+
throw new Error(`${contributor._id} has no bibliographicName`);
|
|
934
1029
|
}
|
|
935
|
-
const { family, given } = contributor.
|
|
1030
|
+
const { family, given } = contributor.bibliographicName;
|
|
936
1031
|
if (!family && !given) {
|
|
937
|
-
throw new Error(`${contributor.
|
|
1032
|
+
throw new Error(`${contributor._id} has neither family nor given name`);
|
|
938
1033
|
}
|
|
939
1034
|
};
|
|
940
1035
|
this.buildContributors = (articleMeta) => {
|
|
941
|
-
const
|
|
942
|
-
const
|
|
943
|
-
.filter((
|
|
944
|
-
.sort(sortContributors);
|
|
945
|
-
const otherContributorsNodes = contributorNodes
|
|
946
|
-
.filter((n) => n.attrs.role !== 'author')
|
|
1036
|
+
const contributors = this.models.filter(isContributor);
|
|
1037
|
+
const authorContributors = contributors
|
|
1038
|
+
.filter((contributor) => contributor.role === 'author')
|
|
947
1039
|
.sort(sortContributors);
|
|
948
1040
|
const affiliationLabels = new Map();
|
|
949
1041
|
const creatAffiliationLabel = (rid) => {
|
|
@@ -961,11 +1053,11 @@ class JATSExporter {
|
|
|
961
1053
|
sup.textContent = String(content);
|
|
962
1054
|
return sup;
|
|
963
1055
|
};
|
|
964
|
-
if (
|
|
1056
|
+
if (authorContributors.length) {
|
|
965
1057
|
const contribGroup = this.document.createElement('contrib-group');
|
|
966
1058
|
contribGroup.setAttribute('content-type', 'authors');
|
|
967
1059
|
articleMeta.appendChild(contribGroup);
|
|
968
|
-
|
|
1060
|
+
authorContributors.forEach((contributor) => {
|
|
969
1061
|
try {
|
|
970
1062
|
this.validateContributor(contributor);
|
|
971
1063
|
}
|
|
@@ -975,25 +1067,39 @@ class JATSExporter {
|
|
|
975
1067
|
}
|
|
976
1068
|
const contrib = this.document.createElement('contrib');
|
|
977
1069
|
contrib.setAttribute('contrib-type', 'author');
|
|
978
|
-
contrib.setAttribute('id', normalizeID(contributor.
|
|
979
|
-
if (contributor.
|
|
1070
|
+
contrib.setAttribute('id', normalizeID(contributor._id));
|
|
1071
|
+
if (contributor.isCorresponding) {
|
|
980
1072
|
contrib.setAttribute('corresp', 'yes');
|
|
981
1073
|
}
|
|
982
|
-
if (contributor.
|
|
1074
|
+
if (contributor.ORCIDIdentifier) {
|
|
983
1075
|
const identifier = this.document.createElement('contrib-id');
|
|
984
1076
|
identifier.setAttribute('contrib-id-type', 'orcid');
|
|
985
|
-
identifier.textContent = contributor.
|
|
1077
|
+
identifier.textContent = contributor.ORCIDIdentifier;
|
|
986
1078
|
contrib.appendChild(identifier);
|
|
987
1079
|
}
|
|
988
1080
|
const name = this.buildContributorName(contributor);
|
|
989
1081
|
contrib.appendChild(name);
|
|
990
|
-
if (contributor.
|
|
1082
|
+
if (contributor.email) {
|
|
991
1083
|
const email = this.document.createElement('email');
|
|
992
|
-
email.textContent = contributor.
|
|
1084
|
+
email.textContent = contributor.email;
|
|
993
1085
|
contrib.appendChild(email);
|
|
994
1086
|
}
|
|
995
|
-
if (contributor.
|
|
996
|
-
contributor.
|
|
1087
|
+
if (contributor.roles) {
|
|
1088
|
+
contributor.roles.forEach((rid) => {
|
|
1089
|
+
const contributorRole = this.modelMap.get(rid);
|
|
1090
|
+
if (contributorRole) {
|
|
1091
|
+
const role = this.document.createElement('role');
|
|
1092
|
+
const attributes = chooseRoleVocabAttributes(contributorRole);
|
|
1093
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
1094
|
+
role.setAttribute(key, value);
|
|
1095
|
+
}
|
|
1096
|
+
role.textContent = contributorRole.name;
|
|
1097
|
+
contrib.appendChild(role);
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
if (contributor.affiliations) {
|
|
1102
|
+
contributor.affiliations.forEach((rid) => {
|
|
997
1103
|
const xref = this.document.createElement('xref');
|
|
998
1104
|
xref.setAttribute('ref-type', 'aff');
|
|
999
1105
|
xref.setAttribute('rid', normalizeID(rid));
|
|
@@ -1001,8 +1107,8 @@ class JATSExporter {
|
|
|
1001
1107
|
contrib.appendChild(xref);
|
|
1002
1108
|
});
|
|
1003
1109
|
}
|
|
1004
|
-
if (contributor.
|
|
1005
|
-
contributor.
|
|
1110
|
+
if (contributor.footnote) {
|
|
1111
|
+
contributor.footnote.map((note) => {
|
|
1006
1112
|
const xref = this.document.createElement('xref');
|
|
1007
1113
|
xref.setAttribute('ref-type', 'fn');
|
|
1008
1114
|
xref.setAttribute('rid', normalizeID(note.noteID));
|
|
@@ -1010,8 +1116,8 @@ class JATSExporter {
|
|
|
1010
1116
|
contrib.appendChild(xref);
|
|
1011
1117
|
});
|
|
1012
1118
|
}
|
|
1013
|
-
if (contributor.
|
|
1014
|
-
contributor.
|
|
1119
|
+
if (contributor.corresp) {
|
|
1120
|
+
contributor.corresp.map((corresp) => {
|
|
1015
1121
|
const xref = this.document.createElement('xref');
|
|
1016
1122
|
xref.setAttribute('ref-type', 'corresp');
|
|
1017
1123
|
xref.setAttribute('rid', normalizeID(corresp.correspID));
|
|
@@ -1021,10 +1127,13 @@ class JATSExporter {
|
|
|
1021
1127
|
}
|
|
1022
1128
|
contribGroup.appendChild(contrib);
|
|
1023
1129
|
});
|
|
1024
|
-
|
|
1130
|
+
const otherContributors = contributors
|
|
1131
|
+
.filter((contributor) => contributor.role !== 'author')
|
|
1132
|
+
.sort(sortContributors);
|
|
1133
|
+
if (otherContributors.length) {
|
|
1025
1134
|
const contribGroup = this.document.createElement('contrib-group');
|
|
1026
1135
|
articleMeta.appendChild(contribGroup);
|
|
1027
|
-
|
|
1136
|
+
otherContributors.forEach((contributor) => {
|
|
1028
1137
|
try {
|
|
1029
1138
|
this.validateContributor(contributor);
|
|
1030
1139
|
}
|
|
@@ -1033,16 +1142,30 @@ class JATSExporter {
|
|
|
1033
1142
|
return;
|
|
1034
1143
|
}
|
|
1035
1144
|
const contrib = this.document.createElement('contrib');
|
|
1036
|
-
contrib.setAttribute('id', normalizeID(contributor.
|
|
1145
|
+
contrib.setAttribute('id', normalizeID(contributor._id));
|
|
1037
1146
|
const name = this.buildContributorName(contributor);
|
|
1038
1147
|
contrib.appendChild(name);
|
|
1039
|
-
if (contributor.
|
|
1148
|
+
if (contributor.email) {
|
|
1040
1149
|
const email = this.document.createElement('email');
|
|
1041
|
-
email.textContent = contributor.
|
|
1150
|
+
email.textContent = contributor.email;
|
|
1042
1151
|
contrib.appendChild(email);
|
|
1043
1152
|
}
|
|
1044
|
-
if (contributor.
|
|
1045
|
-
contributor.
|
|
1153
|
+
if (contributor.roles) {
|
|
1154
|
+
contributor.roles.forEach((rid) => {
|
|
1155
|
+
const contributorRole = this.modelMap.get(rid);
|
|
1156
|
+
if (contributorRole) {
|
|
1157
|
+
const role = this.document.createElement('role');
|
|
1158
|
+
const attributes = chooseRoleVocabAttributes(contributorRole);
|
|
1159
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
1160
|
+
role.setAttribute(key, value);
|
|
1161
|
+
}
|
|
1162
|
+
role.textContent = contributorRole.name;
|
|
1163
|
+
contrib.appendChild(role);
|
|
1164
|
+
}
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
if (contributor.affiliations) {
|
|
1168
|
+
contributor.affiliations.forEach((rid) => {
|
|
1046
1169
|
const xref = this.document.createElement('xref');
|
|
1047
1170
|
xref.setAttribute('ref-type', 'aff');
|
|
1048
1171
|
xref.setAttribute('rid', normalizeID(rid));
|
|
@@ -1050,8 +1173,8 @@ class JATSExporter {
|
|
|
1050
1173
|
contrib.appendChild(xref);
|
|
1051
1174
|
});
|
|
1052
1175
|
}
|
|
1053
|
-
if (contributor.
|
|
1054
|
-
contributor.
|
|
1176
|
+
if (contributor.footnote) {
|
|
1177
|
+
contributor.footnote.map((note) => {
|
|
1055
1178
|
const xref = this.document.createElement('xref');
|
|
1056
1179
|
xref.setAttribute('ref-type', 'fn');
|
|
1057
1180
|
xref.setAttribute('rid', normalizeID(note.noteID));
|
|
@@ -1063,68 +1186,64 @@ class JATSExporter {
|
|
|
1063
1186
|
});
|
|
1064
1187
|
}
|
|
1065
1188
|
const affiliationRIDs = [];
|
|
1066
|
-
const sortedContributors = [
|
|
1067
|
-
...authorContributorNodes,
|
|
1068
|
-
...otherContributorsNodes,
|
|
1069
|
-
];
|
|
1189
|
+
const sortedContributors = [...authorContributors, ...otherContributors];
|
|
1070
1190
|
for (const contributor of sortedContributors) {
|
|
1071
|
-
if (contributor.
|
|
1072
|
-
affiliationRIDs.push(...contributor.
|
|
1191
|
+
if (contributor.affiliations) {
|
|
1192
|
+
affiliationRIDs.push(...contributor.affiliations);
|
|
1073
1193
|
}
|
|
1074
1194
|
}
|
|
1075
|
-
const affiliations = (0,
|
|
1195
|
+
const affiliations = this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Affiliation));
|
|
1076
1196
|
if (affiliations) {
|
|
1077
|
-
const usedAffiliations = affiliations.filter((affiliation) => affiliationRIDs.includes(affiliation.
|
|
1078
|
-
usedAffiliations.sort((a, b) => affiliationRIDs.indexOf(a.
|
|
1079
|
-
affiliationRIDs.indexOf(b.attrs.id));
|
|
1197
|
+
const usedAffiliations = affiliations.filter((affiliation) => affiliationRIDs.includes(affiliation._id));
|
|
1198
|
+
usedAffiliations.sort((a, b) => affiliationRIDs.indexOf(a._id) - affiliationRIDs.indexOf(b._id));
|
|
1080
1199
|
usedAffiliations.forEach((affiliation) => {
|
|
1081
1200
|
var _a, _b;
|
|
1082
1201
|
const aff = this.document.createElement('aff');
|
|
1083
|
-
aff.setAttribute('id', normalizeID(affiliation.
|
|
1202
|
+
aff.setAttribute('id', normalizeID(affiliation._id));
|
|
1084
1203
|
contribGroup.appendChild(aff);
|
|
1085
|
-
if (affiliation.
|
|
1204
|
+
if (affiliation.department) {
|
|
1086
1205
|
const department = this.document.createElement('institution');
|
|
1087
1206
|
department.setAttribute('content-type', 'dept');
|
|
1088
|
-
department.textContent = affiliation.
|
|
1207
|
+
department.textContent = affiliation.department;
|
|
1089
1208
|
aff.appendChild(department);
|
|
1090
1209
|
}
|
|
1091
|
-
if (affiliation.
|
|
1210
|
+
if (affiliation.institution) {
|
|
1092
1211
|
const institution = this.document.createElement('institution');
|
|
1093
|
-
institution.textContent = affiliation.
|
|
1212
|
+
institution.textContent = affiliation.institution;
|
|
1094
1213
|
aff.appendChild(institution);
|
|
1095
1214
|
}
|
|
1096
|
-
if (affiliation.
|
|
1215
|
+
if (affiliation.addressLine1) {
|
|
1097
1216
|
const addressLine = this.document.createElement('addr-line');
|
|
1098
|
-
addressLine.textContent = affiliation.
|
|
1217
|
+
addressLine.textContent = affiliation.addressLine1;
|
|
1099
1218
|
aff.appendChild(addressLine);
|
|
1100
1219
|
}
|
|
1101
|
-
if (affiliation.
|
|
1220
|
+
if (affiliation.addressLine2) {
|
|
1102
1221
|
const addressLine = this.document.createElement('addr-line');
|
|
1103
|
-
addressLine.textContent = affiliation.
|
|
1222
|
+
addressLine.textContent = affiliation.addressLine2;
|
|
1104
1223
|
aff.appendChild(addressLine);
|
|
1105
1224
|
}
|
|
1106
|
-
if (affiliation.
|
|
1225
|
+
if (affiliation.addressLine3) {
|
|
1107
1226
|
const addressLine = this.document.createElement('addr-line');
|
|
1108
|
-
addressLine.textContent = affiliation.
|
|
1227
|
+
addressLine.textContent = affiliation.addressLine3;
|
|
1109
1228
|
aff.appendChild(addressLine);
|
|
1110
1229
|
}
|
|
1111
|
-
if (affiliation.
|
|
1230
|
+
if (affiliation.city) {
|
|
1112
1231
|
const city = this.document.createElement('city');
|
|
1113
|
-
city.textContent = affiliation.
|
|
1232
|
+
city.textContent = affiliation.city;
|
|
1114
1233
|
aff.appendChild(city);
|
|
1115
1234
|
}
|
|
1116
|
-
if (affiliation.
|
|
1235
|
+
if (affiliation.country) {
|
|
1117
1236
|
const country = this.document.createElement('country');
|
|
1118
|
-
country.textContent = affiliation.
|
|
1237
|
+
country.textContent = affiliation.country;
|
|
1119
1238
|
aff.appendChild(country);
|
|
1120
1239
|
}
|
|
1121
|
-
if (affiliation.
|
|
1240
|
+
if (affiliation.email) {
|
|
1122
1241
|
const email = this.document.createElement('email');
|
|
1123
|
-
email.setAttributeNS(XLINK_NAMESPACE, 'href', (_a = affiliation.
|
|
1124
|
-
email.textContent = (_b = affiliation.
|
|
1242
|
+
email.setAttributeNS(XLINK_NAMESPACE, 'href', (_a = affiliation.email.href) !== null && _a !== void 0 ? _a : '');
|
|
1243
|
+
email.textContent = (_b = affiliation.email.text) !== null && _b !== void 0 ? _b : '';
|
|
1125
1244
|
aff.appendChild(email);
|
|
1126
1245
|
}
|
|
1127
|
-
const labelNumber = affiliationLabels.get(affiliation.
|
|
1246
|
+
const labelNumber = affiliationLabels.get(affiliation._id);
|
|
1128
1247
|
if (labelNumber) {
|
|
1129
1248
|
const label = this.document.createElement('label');
|
|
1130
1249
|
label.textContent = String(labelNumber);
|
|
@@ -1141,48 +1260,41 @@ class JATSExporter {
|
|
|
1141
1260
|
this.createAuthorNotesElement = () => {
|
|
1142
1261
|
var _a;
|
|
1143
1262
|
const authorNotesEl = this.document.createElement('author-notes');
|
|
1144
|
-
const
|
|
1145
|
-
if (
|
|
1146
|
-
this.appendModelsToAuthorNotes(authorNotesEl,
|
|
1263
|
+
const authorNotes = (_a = (0, json_schema_1.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1264
|
+
if (authorNotes) {
|
|
1265
|
+
this.appendModelsToAuthorNotes(authorNotesEl, authorNotes.containedObjectIDs);
|
|
1147
1266
|
}
|
|
1148
1267
|
return authorNotesEl;
|
|
1149
1268
|
};
|
|
1150
1269
|
this.appendCorrespondingToElement = (corresponding, element) => {
|
|
1151
1270
|
const correspondingEl = this.document.createElement('corresp');
|
|
1152
|
-
correspondingEl.setAttribute('id', normalizeID(corresponding.
|
|
1153
|
-
if (corresponding.
|
|
1271
|
+
correspondingEl.setAttribute('id', normalizeID(corresponding._id));
|
|
1272
|
+
if (corresponding.label) {
|
|
1154
1273
|
const labelEl = this.document.createElement('label');
|
|
1155
|
-
labelEl.textContent = corresponding.
|
|
1274
|
+
labelEl.textContent = corresponding.label;
|
|
1156
1275
|
correspondingEl.appendChild(labelEl);
|
|
1157
1276
|
}
|
|
1158
|
-
correspondingEl.append(corresponding.
|
|
1277
|
+
correspondingEl.append(corresponding.contents);
|
|
1159
1278
|
element.appendChild(correspondingEl);
|
|
1160
1279
|
};
|
|
1161
1280
|
this.appendParagraphToElement = (paragraph, element) => {
|
|
1162
|
-
const parsedDoc = new DOMParser().parseFromString(paragraph.
|
|
1281
|
+
const parsedDoc = new DOMParser().parseFromString(paragraph.contents, 'text/html');
|
|
1163
1282
|
const parsedParagraph = parsedDoc.body.querySelector('p');
|
|
1164
1283
|
if (parsedParagraph) {
|
|
1165
1284
|
const paragraphEl = this.document.createElement('p');
|
|
1166
1285
|
paragraphEl.innerHTML = parsedParagraph.innerHTML;
|
|
1167
|
-
paragraphEl.setAttribute('id', normalizeID(paragraph.
|
|
1286
|
+
paragraphEl.setAttribute('id', normalizeID(paragraph._id));
|
|
1168
1287
|
element.appendChild(paragraphEl);
|
|
1169
1288
|
}
|
|
1170
1289
|
};
|
|
1171
1290
|
this.appendFootnoteToElement = (footnote, element) => {
|
|
1172
1291
|
const footnoteEl = this.document.createElement('fn');
|
|
1173
|
-
footnoteEl.setAttribute('id', normalizeID(footnote.
|
|
1174
|
-
|
|
1175
|
-
const p = this.document.createElement('p');
|
|
1176
|
-
p.innerHTML = footnote.textContent;
|
|
1177
|
-
footnoteEl.appendChild(p);
|
|
1178
|
-
}
|
|
1179
|
-
else {
|
|
1180
|
-
footnoteEl.innerHTML = footnote.textContent;
|
|
1181
|
-
}
|
|
1292
|
+
footnoteEl.setAttribute('id', normalizeID(footnote._id));
|
|
1293
|
+
footnoteEl.innerHTML = footnote.contents;
|
|
1182
1294
|
element.appendChild(footnoteEl);
|
|
1183
1295
|
};
|
|
1184
|
-
this.fixBody = (body) => {
|
|
1185
|
-
|
|
1296
|
+
this.fixBody = (body, fragment) => {
|
|
1297
|
+
fragment.descendants((node) => {
|
|
1186
1298
|
if (node.attrs.id) {
|
|
1187
1299
|
if (node.attrs.titleSuppressed) {
|
|
1188
1300
|
const title = body.querySelector(`#${normalizeID(node.attrs.id)} > title`);
|
|
@@ -1200,7 +1312,7 @@ class JATSExporter {
|
|
|
1200
1312
|
label.remove();
|
|
1201
1313
|
}
|
|
1202
1314
|
}
|
|
1203
|
-
if ((0,
|
|
1315
|
+
if ((0, node_types_1.isNodeType)(node, 'general_table_footnote')) {
|
|
1204
1316
|
const generalTableFootnote = body.querySelector(`#${normalizeID(node.attrs.id)}`);
|
|
1205
1317
|
if (generalTableFootnote) {
|
|
1206
1318
|
Array.from(generalTableFootnote.childNodes).forEach((cn) => {
|
|
@@ -1209,7 +1321,7 @@ class JATSExporter {
|
|
|
1209
1321
|
generalTableFootnote.remove();
|
|
1210
1322
|
}
|
|
1211
1323
|
}
|
|
1212
|
-
if ((0,
|
|
1324
|
+
if ((0, node_types_1.isNodeType)(node, 'table_element')) {
|
|
1213
1325
|
const tableElement = body.querySelector(`#${normalizeID(node.attrs.id)}`);
|
|
1214
1326
|
if (tableElement) {
|
|
1215
1327
|
for (const childNode of tableElement.childNodes) {
|
|
@@ -1443,36 +1555,36 @@ class JATSExporter {
|
|
|
1443
1555
|
};
|
|
1444
1556
|
this.buildContributorName = (contributor) => {
|
|
1445
1557
|
const name = this.document.createElement('name');
|
|
1446
|
-
if (contributor.
|
|
1558
|
+
if (contributor.bibliographicName.family) {
|
|
1447
1559
|
const surname = this.document.createElement('surname');
|
|
1448
|
-
surname.textContent = contributor.
|
|
1560
|
+
surname.textContent = contributor.bibliographicName.family;
|
|
1449
1561
|
name.appendChild(surname);
|
|
1450
1562
|
}
|
|
1451
|
-
if (contributor.
|
|
1563
|
+
if (contributor.bibliographicName.given) {
|
|
1452
1564
|
const givenNames = this.document.createElement('given-names');
|
|
1453
|
-
givenNames.textContent = contributor.
|
|
1565
|
+
givenNames.textContent = contributor.bibliographicName.given;
|
|
1454
1566
|
name.appendChild(givenNames);
|
|
1455
1567
|
}
|
|
1456
1568
|
return name;
|
|
1457
1569
|
};
|
|
1458
1570
|
}
|
|
1459
|
-
generateCitations() {
|
|
1571
|
+
generateCitations(fragment) {
|
|
1460
1572
|
const nodes = [];
|
|
1461
|
-
|
|
1573
|
+
fragment.descendants((node) => {
|
|
1462
1574
|
if ((0, schema_1.isCitationNode)(node)) {
|
|
1463
1575
|
nodes.push(node);
|
|
1464
1576
|
}
|
|
1465
1577
|
});
|
|
1466
1578
|
return (0, exports.buildCitations)(nodes);
|
|
1467
1579
|
}
|
|
1468
|
-
generateCitationTexts(
|
|
1580
|
+
generateCitationTexts(fragment, csl) {
|
|
1469
1581
|
this.citationTexts = new Map();
|
|
1470
1582
|
this.citationProvider = new library_1.CitationProvider({
|
|
1471
|
-
getLibraryItem: this.
|
|
1583
|
+
getLibraryItem: (id) => this.modelMap.get(id),
|
|
1472
1584
|
locale: csl.locale,
|
|
1473
1585
|
citationStyle: csl.style,
|
|
1474
1586
|
});
|
|
1475
|
-
const citations = this.generateCitations();
|
|
1587
|
+
const citations = this.generateCitations(fragment);
|
|
1476
1588
|
this.citationProvider.rebuildState(citations).forEach(([id, , output]) => {
|
|
1477
1589
|
this.citationTexts.set(id, output);
|
|
1478
1590
|
});
|
|
@@ -1499,50 +1611,72 @@ class JATSExporter {
|
|
|
1499
1611
|
return mathml;
|
|
1500
1612
|
}
|
|
1501
1613
|
}
|
|
1502
|
-
appendModelsToAuthorNotes(authorNotesEl,
|
|
1503
|
-
const
|
|
1504
|
-
const usedCorrespondings = this.getUsedCorrespondings(
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1614
|
+
appendModelsToAuthorNotes(authorNotesEl, containedObjectIDs) {
|
|
1615
|
+
const contributors = this.models.filter(isContributor);
|
|
1616
|
+
const usedCorrespondings = this.getUsedCorrespondings(contributors);
|
|
1617
|
+
containedObjectIDs.forEach((id) => {
|
|
1618
|
+
const model = this.modelMap.get(id);
|
|
1619
|
+
if (!model) {
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
switch (model.objectType) {
|
|
1623
|
+
case json_schema_1.ObjectTypes.ParagraphElement:
|
|
1624
|
+
this.appendParagraphToElement(model, authorNotesEl);
|
|
1509
1625
|
break;
|
|
1510
|
-
case
|
|
1511
|
-
this.appendFootnoteToElement(
|
|
1626
|
+
case json_schema_1.ObjectTypes.Footnote:
|
|
1627
|
+
this.appendFootnoteToElement(model, authorNotesEl);
|
|
1512
1628
|
break;
|
|
1513
|
-
case
|
|
1514
|
-
if (usedCorrespondings.includes(
|
|
1515
|
-
this.appendCorrespondingToElement(
|
|
1629
|
+
case json_schema_1.ObjectTypes.Corresponding:
|
|
1630
|
+
if (usedCorrespondings.includes(model)) {
|
|
1631
|
+
this.appendCorrespondingToElement(model, authorNotesEl);
|
|
1516
1632
|
}
|
|
1517
1633
|
break;
|
|
1518
1634
|
}
|
|
1519
|
-
return false;
|
|
1520
1635
|
});
|
|
1521
1636
|
}
|
|
1522
1637
|
getUsedCorrespondings(contributors) {
|
|
1523
1638
|
return contributors
|
|
1524
|
-
.flatMap((c) => { var _a; return (_a = c.
|
|
1525
|
-
.map((corresp) =>
|
|
1526
|
-
var _a;
|
|
1527
|
-
return (_a = (0, prosemirror_utils_1.findChildrenByAttr)(this.manuscriptNode, (attr) => attr.id === corresp.correspID)[0]) === null || _a === void 0 ? void 0 : _a.node;
|
|
1528
|
-
})
|
|
1639
|
+
.flatMap((c) => { var _a; return (_a = c.corresp) !== null && _a !== void 0 ? _a : []; })
|
|
1640
|
+
.map((corresp) => this.modelMap.get(corresp.correspID))
|
|
1529
1641
|
.filter((corresp) => !!corresp);
|
|
1530
1642
|
}
|
|
1531
1643
|
buildKeywords(articleMeta) {
|
|
1532
|
-
const
|
|
1533
|
-
keywordGroups
|
|
1644
|
+
const keywords = [...this.modelMap.values()].filter((model) => model.objectType === json_schema_1.ObjectTypes.Keyword);
|
|
1645
|
+
const keywordGroups = new Map();
|
|
1646
|
+
keywords.forEach((keyword) => {
|
|
1647
|
+
const containedGroup = keyword.containedGroup || '';
|
|
1648
|
+
const group = keywordGroups.get(containedGroup);
|
|
1649
|
+
if (group) {
|
|
1650
|
+
group.push(keyword);
|
|
1651
|
+
}
|
|
1652
|
+
else {
|
|
1653
|
+
keywordGroups.set(containedGroup, [keyword]);
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
for (const [groupID, keywords] of keywordGroups) {
|
|
1657
|
+
const keywordGroup = (this.modelMap.get(groupID) || {});
|
|
1534
1658
|
const kwdGroup = this.document.createElement('kwd-group');
|
|
1535
|
-
if (
|
|
1536
|
-
kwdGroup.setAttribute('kwd-group-type',
|
|
1659
|
+
if (keywordGroup.type) {
|
|
1660
|
+
kwdGroup.setAttribute('kwd-group-type', keywordGroup.type);
|
|
1661
|
+
}
|
|
1662
|
+
if (keywordGroup.label) {
|
|
1663
|
+
const label = this.document.createElement('label');
|
|
1664
|
+
label.textContent = keywordGroup.label;
|
|
1665
|
+
kwdGroup.appendChild(label);
|
|
1666
|
+
}
|
|
1667
|
+
if (keywordGroup.title) {
|
|
1668
|
+
const title = this.document.createElement('title');
|
|
1669
|
+
title.textContent = keywordGroup.title;
|
|
1670
|
+
kwdGroup.appendChild(title);
|
|
1537
1671
|
}
|
|
1538
1672
|
articleMeta.appendChild(kwdGroup);
|
|
1539
|
-
|
|
1673
|
+
for (const keyword of keywords) {
|
|
1540
1674
|
const kwd = this.document.createElement('kwd');
|
|
1541
|
-
kwd.textContent = keyword.
|
|
1675
|
+
kwd.textContent = keyword.name;
|
|
1542
1676
|
kwdGroup.appendChild(kwd);
|
|
1543
|
-
}
|
|
1677
|
+
}
|
|
1544
1678
|
articleMeta.appendChild(kwdGroup);
|
|
1545
|
-
}
|
|
1679
|
+
}
|
|
1546
1680
|
}
|
|
1547
1681
|
moveCoiStatementToAuthorNotes(back, front) {
|
|
1548
1682
|
const fnGroups = back.querySelectorAll('fn-group');
|
|
@@ -1590,7 +1724,7 @@ class JATSExporter {
|
|
|
1590
1724
|
footnotes.forEach((fn) => {
|
|
1591
1725
|
const fnType = fn.getAttribute('fn-type');
|
|
1592
1726
|
if (fnType) {
|
|
1593
|
-
fn.setAttribute('fn-type', (0,
|
|
1727
|
+
fn.setAttribute('fn-type', (0, section_category_1.chooseJatsFnType)(fnType));
|
|
1594
1728
|
}
|
|
1595
1729
|
});
|
|
1596
1730
|
}
|