@manuscripts/transform 2.1.1-LEAN-3376-0 → 2.1.1-LEAN-3352-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-front-parser.js +5 -7
- package/dist/cjs/jats/importer/parse-jats-article.js +2 -7
- package/dist/cjs/jats/jats-exporter.js +48 -46
- package/dist/cjs/schema/index.js +0 -2
- package/dist/cjs/schema/nodes/contributors.js +1 -1
- package/dist/cjs/transformer/builders.js +1 -7
- package/dist/cjs/transformer/decode.js +1 -13
- package/dist/cjs/transformer/encode.js +0 -3
- package/dist/cjs/transformer/node-types.js +0 -2
- package/dist/es/jats/importer/jats-front-parser.js +6 -8
- package/dist/es/jats/importer/parse-jats-article.js +3 -8
- package/dist/es/jats/jats-exporter.js +48 -46
- package/dist/es/schema/index.js +0 -2
- package/dist/es/schema/nodes/contributors.js +1 -1
- package/dist/es/transformer/builders.js +0 -5
- package/dist/es/transformer/decode.js +1 -13
- package/dist/es/transformer/encode.js +0 -3
- package/dist/es/transformer/node-types.js +0 -2
- package/dist/types/jats/importer/jats-front-parser.d.ts +7 -9
- package/dist/types/jats/jats-exporter.d.ts +0 -3
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +1 -2
- package/package.json +4 -4
- package/dist/cjs/schema/nodes/author_notes.js +0 -27
- package/dist/es/schema/nodes/author_notes.js +0 -24
- package/dist/types/schema/nodes/author_notes.d.ts +0 -25
|
@@ -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) {
|
|
@@ -189,13 +194,6 @@ exports.jatsFrontParser = {
|
|
|
189
194
|
footnoteIDs,
|
|
190
195
|
};
|
|
191
196
|
},
|
|
192
|
-
parseAuthorNotesParagraphs(elements) {
|
|
193
|
-
const paragraphs = [];
|
|
194
|
-
elements.forEach((p) => {
|
|
195
|
-
paragraphs.push((0, transformer_1.buildParagraph)(p.innerHTML));
|
|
196
|
-
});
|
|
197
|
-
return paragraphs;
|
|
198
|
-
},
|
|
199
197
|
parseCorresp(elements) {
|
|
200
198
|
const correspondingIDs = new Map();
|
|
201
199
|
const correspondingList = elements.map((element) => {
|
|
@@ -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
|
]);
|
|
@@ -40,22 +41,16 @@ const parseJATSFront = (doc, front) => {
|
|
|
40
41
|
const { correspondingList, correspondingIDs } = jats_front_parser_1.jatsFrontParser.parseCorresp([
|
|
41
42
|
...front.querySelectorAll('article-meta > author-notes > corresp'),
|
|
42
43
|
]);
|
|
43
|
-
const authorNotesParagraphs = jats_front_parser_1.jatsFrontParser.parseAuthorNotesParagraphs([
|
|
44
|
-
...front.querySelectorAll('article-meta > author-notes > p'),
|
|
45
|
-
]);
|
|
46
|
-
const authorNotes = (0, transformer_1.buildAuthorNotes)(Array.from(footnoteIDs.values()).concat(authorNotesParagraphs.map((p) => p._id)));
|
|
47
44
|
const authors = jats_front_parser_1.jatsFrontParser.parseContributors([
|
|
48
45
|
...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
|
|
49
46
|
], affiliationIDs, footnoteIDs, correspondingIDs);
|
|
50
47
|
const history = jats_front_parser_1.jatsFrontParser.parseDates(front.querySelector('article-meta > history'));
|
|
51
48
|
const counts = jats_front_parser_1.jatsFrontParser.parseCounts(front.querySelector('article-meta counts'));
|
|
52
|
-
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 });
|
|
53
50
|
return generateIDs([
|
|
54
51
|
manuscript,
|
|
55
52
|
titles,
|
|
56
53
|
journal,
|
|
57
|
-
...authorNotesParagraphs,
|
|
58
|
-
authorNotes,
|
|
59
54
|
...footnotes,
|
|
60
55
|
...authors,
|
|
61
56
|
...affiliations,
|
|
@@ -248,7 +248,7 @@ class JATSExporter {
|
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
this.buildFront = (doi, id, links) => {
|
|
251
|
-
var _a, _b, _c, _d;
|
|
251
|
+
var _a, _b, _c, _d, _e;
|
|
252
252
|
const manuscript = (0, project_bundle_1.findManuscript)(this.modelMap);
|
|
253
253
|
const titles = (0, project_bundle_1.findTitles)(this.modelMap);
|
|
254
254
|
const front = this.document.createElement('front');
|
|
@@ -311,10 +311,10 @@ class JATSExporter {
|
|
|
311
311
|
articleID.textContent = id;
|
|
312
312
|
articleMeta.appendChild(articleID);
|
|
313
313
|
}
|
|
314
|
-
if (doi) {
|
|
314
|
+
if (doi || manuscript.DOI) {
|
|
315
315
|
const articleID = this.document.createElement('article-id');
|
|
316
316
|
articleID.setAttribute('pub-id-type', 'doi');
|
|
317
|
-
articleID.textContent = doi;
|
|
317
|
+
articleID.textContent = (_a = manuscript.DOI) !== null && _a !== void 0 ? _a : doi;
|
|
318
318
|
articleMeta.appendChild(articleID);
|
|
319
319
|
}
|
|
320
320
|
const titleGroup = this.document.createElement('title-group');
|
|
@@ -349,14 +349,14 @@ class JATSExporter {
|
|
|
349
349
|
for (const supplement of supplements) {
|
|
350
350
|
const supplementaryMaterial = this.document.createElement('supplementary-material');
|
|
351
351
|
supplementaryMaterial.setAttribute('id', normalizeID(supplement._id));
|
|
352
|
-
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (
|
|
353
|
-
const mimeType = (
|
|
354
|
-
const mimeSubType = (
|
|
352
|
+
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (_b = supplement.href) !== null && _b !== void 0 ? _b : '');
|
|
353
|
+
const mimeType = (_c = supplement.MIME) === null || _c === void 0 ? void 0 : _c.split('/')[0];
|
|
354
|
+
const mimeSubType = (_d = supplement.MIME) === null || _d === void 0 ? void 0 : _d.split('/')[1];
|
|
355
355
|
supplementaryMaterial.setAttribute('mimetype', mimeType !== null && mimeType !== void 0 ? mimeType : '');
|
|
356
356
|
supplementaryMaterial.setAttribute('mime-subtype', mimeSubType !== null && mimeSubType !== void 0 ? mimeSubType : '');
|
|
357
357
|
const caption = this.document.createElement('caption');
|
|
358
358
|
const title = this.document.createElement('title');
|
|
359
|
-
title.textContent = (
|
|
359
|
+
title.textContent = (_e = supplement.title) !== null && _e !== void 0 ? _e : '';
|
|
360
360
|
caption.append(title);
|
|
361
361
|
supplementaryMaterial.append(caption);
|
|
362
362
|
articleMeta.append(supplementaryMaterial);
|
|
@@ -614,7 +614,6 @@ class JATSExporter {
|
|
|
614
614
|
this.createSerializer = () => {
|
|
615
615
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
616
616
|
const nodes = {
|
|
617
|
-
author_notes: () => ['author-notes', 0],
|
|
618
617
|
title: () => '',
|
|
619
618
|
affiliations: () => '',
|
|
620
619
|
contributors: () => '',
|
|
@@ -1253,23 +1252,49 @@ class JATSExporter {
|
|
|
1253
1252
|
}
|
|
1254
1253
|
});
|
|
1255
1254
|
}
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1255
|
+
const noteIDs = [];
|
|
1256
|
+
for (const contributor of [...authorContributors, ...otherContributors]) {
|
|
1257
|
+
if (contributor.footnote) {
|
|
1258
|
+
const ids = contributor.footnote.map((note) => {
|
|
1259
|
+
return note.noteID;
|
|
1260
|
+
});
|
|
1261
|
+
noteIDs.push(...ids);
|
|
1262
|
+
}
|
|
1263
|
+
if (contributor.corresp) {
|
|
1264
|
+
const ids = contributor.corresp.map((corresp) => {
|
|
1265
|
+
return corresp.correspID;
|
|
1266
|
+
});
|
|
1267
|
+
noteIDs.push(...ids);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
const footnotes = [];
|
|
1271
|
+
footnotes.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote)));
|
|
1272
|
+
const correspodings = [];
|
|
1273
|
+
correspodings.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Corresponding)));
|
|
1274
|
+
if (footnotes || correspodings) {
|
|
1258
1275
|
const authorNotesEl = this.document.createElement('author-notes');
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1276
|
+
const usedFootnotes = footnotes.filter((footnote) => {
|
|
1277
|
+
return noteIDs.includes(footnote._id);
|
|
1278
|
+
});
|
|
1279
|
+
const usedCorrespodings = correspodings.filter((corresp) => {
|
|
1280
|
+
return noteIDs.includes(corresp._id);
|
|
1281
|
+
});
|
|
1282
|
+
usedFootnotes.forEach((footnote) => {
|
|
1283
|
+
const authorFootNote = this.document.createElement('fn');
|
|
1284
|
+
authorFootNote.setAttribute('id', normalizeID(footnote._id));
|
|
1285
|
+
authorFootNote.innerHTML = footnote.contents;
|
|
1286
|
+
authorNotesEl.appendChild(authorFootNote);
|
|
1287
|
+
});
|
|
1288
|
+
usedCorrespodings.forEach((corresponding) => {
|
|
1289
|
+
const correspondingEl = this.document.createElement('corresp');
|
|
1290
|
+
correspondingEl.setAttribute('id', normalizeID(corresponding._id));
|
|
1291
|
+
if (corresponding.label) {
|
|
1292
|
+
const labelEl = this.document.createElement('label');
|
|
1293
|
+
labelEl.textContent = corresponding.label;
|
|
1294
|
+
correspondingEl.appendChild(labelEl);
|
|
1272
1295
|
}
|
|
1296
|
+
correspondingEl.append(corresponding.contents);
|
|
1297
|
+
authorNotesEl.appendChild(correspondingEl);
|
|
1273
1298
|
});
|
|
1274
1299
|
if (authorNotesEl.childNodes.length > 0) {
|
|
1275
1300
|
articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
|
|
@@ -1277,29 +1302,6 @@ class JATSExporter {
|
|
|
1277
1302
|
}
|
|
1278
1303
|
}
|
|
1279
1304
|
};
|
|
1280
|
-
this.appendParagraphToElement = (paragraph, element) => {
|
|
1281
|
-
const paragraphEl = this.document.createElement('p');
|
|
1282
|
-
paragraphEl.setAttribute('id', normalizeID(paragraph._id));
|
|
1283
|
-
paragraphEl.innerHTML = paragraph.contents;
|
|
1284
|
-
element.appendChild(paragraphEl);
|
|
1285
|
-
};
|
|
1286
|
-
this.appendCorrespondingToElement = (corresponding, element) => {
|
|
1287
|
-
const correspondingEl = this.document.createElement('corresp');
|
|
1288
|
-
correspondingEl.setAttribute('id', normalizeID(corresponding._id));
|
|
1289
|
-
if (corresponding.label) {
|
|
1290
|
-
const labelEl = this.document.createElement('label');
|
|
1291
|
-
labelEl.textContent = corresponding.label;
|
|
1292
|
-
correspondingEl.appendChild(labelEl);
|
|
1293
|
-
}
|
|
1294
|
-
correspondingEl.append(corresponding.contents);
|
|
1295
|
-
element.appendChild(correspondingEl);
|
|
1296
|
-
};
|
|
1297
|
-
this.appendFootnoteToElement = (footnote, element) => {
|
|
1298
|
-
const footnoteEl = this.document.createElement('fn');
|
|
1299
|
-
footnoteEl.setAttribute('id', normalizeID(footnote._id));
|
|
1300
|
-
footnoteEl.innerHTML = footnote.contents;
|
|
1301
|
-
element.appendChild(footnoteEl);
|
|
1302
|
-
};
|
|
1303
1305
|
this.fixBody = (body, fragment) => {
|
|
1304
1306
|
fragment.descendants((node) => {
|
|
1305
1307
|
if (node.attrs.id) {
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -36,7 +36,6 @@ const abstracts_1 = require("./nodes/abstracts");
|
|
|
36
36
|
const affiliation_1 = require("./nodes/affiliation");
|
|
37
37
|
const affiliations_1 = require("./nodes/affiliations");
|
|
38
38
|
const attribution_1 = require("./nodes/attribution");
|
|
39
|
-
const author_notes_1 = require("./nodes/author_notes");
|
|
40
39
|
const backmatter_1 = require("./nodes/backmatter");
|
|
41
40
|
const bibliography_element_1 = require("./nodes/bibliography_element");
|
|
42
41
|
const bibliography_item_1 = require("./nodes/bibliography_item");
|
|
@@ -231,6 +230,5 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
231
230
|
contributors: contributors_1.contributors,
|
|
232
231
|
supplements: supplements_1.supplements,
|
|
233
232
|
supplement: supplement_1.supplement,
|
|
234
|
-
author_notes: author_notes_1.authorNotes,
|
|
235
233
|
},
|
|
236
234
|
});
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.buildTitles = exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildJournal = exports.buildAttribution = exports.buildContributorRole = exports.buildContribution = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.
|
|
21
|
+
exports.buildTitles = exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildJournal = exports.buildAttribution = exports.buildContributorRole = exports.buildContribution = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildFootnote = exports.buildInlineMathFragment = exports.buildNote = exports.buildComment = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildKeywordGroup = exports.buildKeyword = exports.buildBibliographyElement = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = void 0;
|
|
22
22
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
23
23
|
const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
|
|
24
24
|
const schema_1 = require("../schema");
|
|
@@ -130,12 +130,6 @@ const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
|
|
|
130
130
|
kind,
|
|
131
131
|
});
|
|
132
132
|
exports.buildFootnote = buildFootnote;
|
|
133
|
-
const buildAuthorNotes = (containedObjectIDs) => ({
|
|
134
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.AuthorNotes),
|
|
135
|
-
objectType: json_schema_1.ObjectTypes.AuthorNotes,
|
|
136
|
-
containedObjectIDs: containedObjectIDs,
|
|
137
|
-
});
|
|
138
|
-
exports.buildAuthorNotes = buildAuthorNotes;
|
|
139
133
|
const buildFootnotesOrder = (footnotesList) => ({
|
|
140
134
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.FootnotesOrder),
|
|
141
135
|
objectType: json_schema_1.ObjectTypes.FootnotesOrder,
|
|
@@ -62,7 +62,6 @@ const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(
|
|
|
62
62
|
exports.sortSectionsByPriority = sortSectionsByPriority;
|
|
63
63
|
const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Section).sort(exports.sortSectionsByPriority);
|
|
64
64
|
const getAffiliations = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Affiliation);
|
|
65
|
-
const getAuthorNotes = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.AuthorNotes);
|
|
66
65
|
const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
|
|
67
66
|
const getKeywordElements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordsElement);
|
|
68
67
|
const getSupplements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Supplement);
|
|
@@ -93,11 +92,7 @@ class Decoder {
|
|
|
93
92
|
const contributors = getContributors(this.modelMap)
|
|
94
93
|
.map((c) => this.decode(c))
|
|
95
94
|
.filter(Boolean);
|
|
96
|
-
|
|
97
|
-
.map((authorNote) => this.decode(authorNote))
|
|
98
|
-
.filter(Boolean);
|
|
99
|
-
const content = [...contributors, ...authorNotes];
|
|
100
|
-
return schema_1.schema.nodes.contributors.createAndFill({}, content);
|
|
95
|
+
return schema_1.schema.nodes.contributors.createAndFill({}, contributors);
|
|
101
96
|
}
|
|
102
97
|
createKeywordsNode() {
|
|
103
98
|
const elements = getKeywordElements(this.modelMap)
|
|
@@ -496,13 +491,6 @@ class Decoder {
|
|
|
496
491
|
id: model._id,
|
|
497
492
|
}, content);
|
|
498
493
|
},
|
|
499
|
-
[json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
|
|
500
|
-
const model = data;
|
|
501
|
-
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
502
|
-
return schema_1.schema.nodes.author_notes.create({
|
|
503
|
-
id: model._id,
|
|
504
|
-
}, content);
|
|
505
|
-
},
|
|
506
494
|
[json_schema_1.ObjectTypes.Section]: (data) => {
|
|
507
495
|
const model = data;
|
|
508
496
|
const elements = [];
|
|
@@ -395,9 +395,6 @@ const encoders = {
|
|
|
395
395
|
table_element_footer: (node) => ({
|
|
396
396
|
containedObjectIDs: containedObjectIDs(node),
|
|
397
397
|
}),
|
|
398
|
-
author_notes: (node) => ({
|
|
399
|
-
containedObjectIDs: containedObjectIDs(node),
|
|
400
|
-
}),
|
|
401
398
|
footnotes_section: (node, parent, path, priority) => ({
|
|
402
399
|
category: (0, section_category_1.buildSectionCategory)(node),
|
|
403
400
|
priority: priority.value++,
|
|
@@ -62,8 +62,6 @@ exports.nodeTypesMap = new Map([
|
|
|
62
62
|
[schema_1.schema.nodes.affiliations, json_schema_1.ObjectTypes.Section],
|
|
63
63
|
[schema_1.schema.nodes.title, json_schema_1.ObjectTypes.Titles],
|
|
64
64
|
[schema_1.schema.nodes.supplement, json_schema_1.ObjectTypes.Supplement],
|
|
65
|
-
[schema_1.schema.nodes.author_notes, json_schema_1.ObjectTypes.AuthorNotes],
|
|
66
|
-
[schema_1.schema.nodes.corresp, json_schema_1.ObjectTypes.Corresponding],
|
|
67
65
|
]);
|
|
68
66
|
const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
|
|
69
67
|
exports.isExecutableNodeType = isExecutableNodeType;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import debug from 'debug';
|
|
17
17
|
import { getTrimmedTextContent } from '../../lib/utils';
|
|
18
|
-
import { buildAffiliation, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildJournal,
|
|
18
|
+
import { buildAffiliation, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildJournal, buildTitles, } from '../../transformer';
|
|
19
19
|
import { parseJournalMeta } from './jats-journal-meta-parser';
|
|
20
20
|
import { htmlFromJatsNode } from './jats-parser-utils';
|
|
21
21
|
const warn = debug('manuscripts-transform');
|
|
@@ -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) {
|
|
@@ -183,13 +188,6 @@ export const jatsFrontParser = {
|
|
|
183
188
|
footnoteIDs,
|
|
184
189
|
};
|
|
185
190
|
},
|
|
186
|
-
parseAuthorNotesParagraphs(elements) {
|
|
187
|
-
const paragraphs = [];
|
|
188
|
-
elements.forEach((p) => {
|
|
189
|
-
paragraphs.push(buildParagraph(p.innerHTML));
|
|
190
|
-
});
|
|
191
|
-
return paragraphs;
|
|
192
|
-
},
|
|
193
191
|
parseCorresp(elements) {
|
|
194
192
|
const correspondingIDs = new Map();
|
|
195
193
|
const correspondingList = elements.map((element) => {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { InvalidInput } from '../../errors';
|
|
17
|
-
import {
|
|
17
|
+
import { buildBibliographyElement, buildSection, encode, } from '../../transformer';
|
|
18
18
|
import { buildManuscript } from '../../transformer/builders';
|
|
19
19
|
import { generateID } from '../../transformer/id';
|
|
20
20
|
import { findManuscript } from '../../transformer/project-bundle';
|
|
@@ -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
|
]);
|
|
@@ -37,22 +38,16 @@ export const parseJATSFront = (doc, front) => {
|
|
|
37
38
|
const { correspondingList, correspondingIDs } = jatsFrontParser.parseCorresp([
|
|
38
39
|
...front.querySelectorAll('article-meta > author-notes > corresp'),
|
|
39
40
|
]);
|
|
40
|
-
const authorNotesParagraphs = jatsFrontParser.parseAuthorNotesParagraphs([
|
|
41
|
-
...front.querySelectorAll('article-meta > author-notes > p'),
|
|
42
|
-
]);
|
|
43
|
-
const authorNotes = buildAuthorNotes(Array.from(footnoteIDs.values()).concat(authorNotesParagraphs.map((p) => p._id)));
|
|
44
41
|
const authors = jatsFrontParser.parseContributors([
|
|
45
42
|
...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
|
|
46
43
|
], affiliationIDs, footnoteIDs, correspondingIDs);
|
|
47
44
|
const history = jatsFrontParser.parseDates(front.querySelector('article-meta > history'));
|
|
48
45
|
const counts = jatsFrontParser.parseCounts(front.querySelector('article-meta counts'));
|
|
49
|
-
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 });
|
|
50
47
|
return generateIDs([
|
|
51
48
|
manuscript,
|
|
52
49
|
titles,
|
|
53
50
|
journal,
|
|
54
|
-
...authorNotesParagraphs,
|
|
55
|
-
authorNotes,
|
|
56
51
|
...footnotes,
|
|
57
52
|
...authors,
|
|
58
53
|
...affiliations,
|
|
@@ -240,7 +240,7 @@ export class JATSExporter {
|
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
242
|
this.buildFront = (doi, id, links) => {
|
|
243
|
-
var _a, _b, _c, _d;
|
|
243
|
+
var _a, _b, _c, _d, _e;
|
|
244
244
|
const manuscript = findManuscript(this.modelMap);
|
|
245
245
|
const titles = findTitles(this.modelMap);
|
|
246
246
|
const front = this.document.createElement('front');
|
|
@@ -303,10 +303,10 @@ export class JATSExporter {
|
|
|
303
303
|
articleID.textContent = id;
|
|
304
304
|
articleMeta.appendChild(articleID);
|
|
305
305
|
}
|
|
306
|
-
if (doi) {
|
|
306
|
+
if (doi || manuscript.DOI) {
|
|
307
307
|
const articleID = this.document.createElement('article-id');
|
|
308
308
|
articleID.setAttribute('pub-id-type', 'doi');
|
|
309
|
-
articleID.textContent = doi;
|
|
309
|
+
articleID.textContent = (_a = manuscript.DOI) !== null && _a !== void 0 ? _a : doi;
|
|
310
310
|
articleMeta.appendChild(articleID);
|
|
311
311
|
}
|
|
312
312
|
const titleGroup = this.document.createElement('title-group');
|
|
@@ -341,14 +341,14 @@ export class JATSExporter {
|
|
|
341
341
|
for (const supplement of supplements) {
|
|
342
342
|
const supplementaryMaterial = this.document.createElement('supplementary-material');
|
|
343
343
|
supplementaryMaterial.setAttribute('id', normalizeID(supplement._id));
|
|
344
|
-
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (
|
|
345
|
-
const mimeType = (
|
|
346
|
-
const mimeSubType = (
|
|
344
|
+
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', (_b = supplement.href) !== null && _b !== void 0 ? _b : '');
|
|
345
|
+
const mimeType = (_c = supplement.MIME) === null || _c === void 0 ? void 0 : _c.split('/')[0];
|
|
346
|
+
const mimeSubType = (_d = supplement.MIME) === null || _d === void 0 ? void 0 : _d.split('/')[1];
|
|
347
347
|
supplementaryMaterial.setAttribute('mimetype', mimeType !== null && mimeType !== void 0 ? mimeType : '');
|
|
348
348
|
supplementaryMaterial.setAttribute('mime-subtype', mimeSubType !== null && mimeSubType !== void 0 ? mimeSubType : '');
|
|
349
349
|
const caption = this.document.createElement('caption');
|
|
350
350
|
const title = this.document.createElement('title');
|
|
351
|
-
title.textContent = (
|
|
351
|
+
title.textContent = (_e = supplement.title) !== null && _e !== void 0 ? _e : '';
|
|
352
352
|
caption.append(title);
|
|
353
353
|
supplementaryMaterial.append(caption);
|
|
354
354
|
articleMeta.append(supplementaryMaterial);
|
|
@@ -606,7 +606,6 @@ export class JATSExporter {
|
|
|
606
606
|
this.createSerializer = () => {
|
|
607
607
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
608
608
|
const nodes = {
|
|
609
|
-
author_notes: () => ['author-notes', 0],
|
|
610
609
|
title: () => '',
|
|
611
610
|
affiliations: () => '',
|
|
612
611
|
contributors: () => '',
|
|
@@ -1245,23 +1244,49 @@ export class JATSExporter {
|
|
|
1245
1244
|
}
|
|
1246
1245
|
});
|
|
1247
1246
|
}
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1247
|
+
const noteIDs = [];
|
|
1248
|
+
for (const contributor of [...authorContributors, ...otherContributors]) {
|
|
1249
|
+
if (contributor.footnote) {
|
|
1250
|
+
const ids = contributor.footnote.map((note) => {
|
|
1251
|
+
return note.noteID;
|
|
1252
|
+
});
|
|
1253
|
+
noteIDs.push(...ids);
|
|
1254
|
+
}
|
|
1255
|
+
if (contributor.corresp) {
|
|
1256
|
+
const ids = contributor.corresp.map((corresp) => {
|
|
1257
|
+
return corresp.correspID;
|
|
1258
|
+
});
|
|
1259
|
+
noteIDs.push(...ids);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
const footnotes = [];
|
|
1263
|
+
footnotes.push(...this.models.filter(hasObjectType(ObjectTypes.Footnote)));
|
|
1264
|
+
const correspodings = [];
|
|
1265
|
+
correspodings.push(...this.models.filter(hasObjectType(ObjectTypes.Corresponding)));
|
|
1266
|
+
if (footnotes || correspodings) {
|
|
1250
1267
|
const authorNotesEl = this.document.createElement('author-notes');
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1268
|
+
const usedFootnotes = footnotes.filter((footnote) => {
|
|
1269
|
+
return noteIDs.includes(footnote._id);
|
|
1270
|
+
});
|
|
1271
|
+
const usedCorrespodings = correspodings.filter((corresp) => {
|
|
1272
|
+
return noteIDs.includes(corresp._id);
|
|
1273
|
+
});
|
|
1274
|
+
usedFootnotes.forEach((footnote) => {
|
|
1275
|
+
const authorFootNote = this.document.createElement('fn');
|
|
1276
|
+
authorFootNote.setAttribute('id', normalizeID(footnote._id));
|
|
1277
|
+
authorFootNote.innerHTML = footnote.contents;
|
|
1278
|
+
authorNotesEl.appendChild(authorFootNote);
|
|
1279
|
+
});
|
|
1280
|
+
usedCorrespodings.forEach((corresponding) => {
|
|
1281
|
+
const correspondingEl = this.document.createElement('corresp');
|
|
1282
|
+
correspondingEl.setAttribute('id', normalizeID(corresponding._id));
|
|
1283
|
+
if (corresponding.label) {
|
|
1284
|
+
const labelEl = this.document.createElement('label');
|
|
1285
|
+
labelEl.textContent = corresponding.label;
|
|
1286
|
+
correspondingEl.appendChild(labelEl);
|
|
1264
1287
|
}
|
|
1288
|
+
correspondingEl.append(corresponding.contents);
|
|
1289
|
+
authorNotesEl.appendChild(correspondingEl);
|
|
1265
1290
|
});
|
|
1266
1291
|
if (authorNotesEl.childNodes.length > 0) {
|
|
1267
1292
|
articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
|
|
@@ -1269,29 +1294,6 @@ export class JATSExporter {
|
|
|
1269
1294
|
}
|
|
1270
1295
|
}
|
|
1271
1296
|
};
|
|
1272
|
-
this.appendParagraphToElement = (paragraph, element) => {
|
|
1273
|
-
const paragraphEl = this.document.createElement('p');
|
|
1274
|
-
paragraphEl.setAttribute('id', normalizeID(paragraph._id));
|
|
1275
|
-
paragraphEl.innerHTML = paragraph.contents;
|
|
1276
|
-
element.appendChild(paragraphEl);
|
|
1277
|
-
};
|
|
1278
|
-
this.appendCorrespondingToElement = (corresponding, element) => {
|
|
1279
|
-
const correspondingEl = this.document.createElement('corresp');
|
|
1280
|
-
correspondingEl.setAttribute('id', normalizeID(corresponding._id));
|
|
1281
|
-
if (corresponding.label) {
|
|
1282
|
-
const labelEl = this.document.createElement('label');
|
|
1283
|
-
labelEl.textContent = corresponding.label;
|
|
1284
|
-
correspondingEl.appendChild(labelEl);
|
|
1285
|
-
}
|
|
1286
|
-
correspondingEl.append(corresponding.contents);
|
|
1287
|
-
element.appendChild(correspondingEl);
|
|
1288
|
-
};
|
|
1289
|
-
this.appendFootnoteToElement = (footnote, element) => {
|
|
1290
|
-
const footnoteEl = this.document.createElement('fn');
|
|
1291
|
-
footnoteEl.setAttribute('id', normalizeID(footnote._id));
|
|
1292
|
-
footnoteEl.innerHTML = footnote.contents;
|
|
1293
|
-
element.appendChild(footnoteEl);
|
|
1294
|
-
};
|
|
1295
1297
|
this.fixBody = (body, fragment) => {
|
|
1296
1298
|
fragment.descendants((node) => {
|
|
1297
1299
|
if (node.attrs.id) {
|
package/dist/es/schema/index.js
CHANGED
|
@@ -19,7 +19,6 @@ import { abstracts } from './nodes/abstracts';
|
|
|
19
19
|
import { affiliation } from './nodes/affiliation';
|
|
20
20
|
import { affiliations } from './nodes/affiliations';
|
|
21
21
|
import { attribution } from './nodes/attribution';
|
|
22
|
-
import { authorNotes } from './nodes/author_notes';
|
|
23
22
|
import { backmatter } from './nodes/backmatter';
|
|
24
23
|
import { bibliographyElement } from './nodes/bibliography_element';
|
|
25
24
|
import { bibliographyItem } from './nodes/bibliography_item';
|
|
@@ -214,6 +213,5 @@ export const schema = new Schema({
|
|
|
214
213
|
contributors,
|
|
215
214
|
supplements,
|
|
216
215
|
supplement,
|
|
217
|
-
author_notes: authorNotes,
|
|
218
216
|
},
|
|
219
217
|
});
|
|
@@ -108,11 +108,6 @@ export const buildFootnote = (containingObject, contents, kind = 'footnote') =>
|
|
|
108
108
|
contents,
|
|
109
109
|
kind,
|
|
110
110
|
});
|
|
111
|
-
export const buildAuthorNotes = (containedObjectIDs) => ({
|
|
112
|
-
_id: generateID(ObjectTypes.AuthorNotes),
|
|
113
|
-
objectType: ObjectTypes.AuthorNotes,
|
|
114
|
-
containedObjectIDs: containedObjectIDs,
|
|
115
|
-
});
|
|
116
111
|
export const buildFootnotesOrder = (footnotesList) => ({
|
|
117
112
|
_id: generateID(ObjectTypes.FootnotesOrder),
|
|
118
113
|
objectType: ObjectTypes.FootnotesOrder,
|
|
@@ -53,7 +53,6 @@ export const getModelsByType = (modelMap, objectType) => {
|
|
|
53
53
|
export const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(a.priority) - Number(b.priority);
|
|
54
54
|
const getSections = (modelMap) => getModelsByType(modelMap, ObjectTypes.Section).sort(sortSectionsByPriority);
|
|
55
55
|
const getAffiliations = (modelMap) => getModelsByType(modelMap, ObjectTypes.Affiliation);
|
|
56
|
-
const getAuthorNotes = (modelMap) => getModelsByType(modelMap, ObjectTypes.AuthorNotes);
|
|
57
56
|
const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
|
|
58
57
|
const getKeywordElements = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordsElement);
|
|
59
58
|
const getSupplements = (modelMap) => getModelsByType(modelMap, ObjectTypes.Supplement);
|
|
@@ -84,11 +83,7 @@ export class Decoder {
|
|
|
84
83
|
const contributors = getContributors(this.modelMap)
|
|
85
84
|
.map((c) => this.decode(c))
|
|
86
85
|
.filter(Boolean);
|
|
87
|
-
|
|
88
|
-
.map((authorNote) => this.decode(authorNote))
|
|
89
|
-
.filter(Boolean);
|
|
90
|
-
const content = [...contributors, ...authorNotes];
|
|
91
|
-
return schema.nodes.contributors.createAndFill({}, content);
|
|
86
|
+
return schema.nodes.contributors.createAndFill({}, contributors);
|
|
92
87
|
}
|
|
93
88
|
createKeywordsNode() {
|
|
94
89
|
const elements = getKeywordElements(this.modelMap)
|
|
@@ -487,13 +482,6 @@ export class Decoder {
|
|
|
487
482
|
id: model._id,
|
|
488
483
|
}, content);
|
|
489
484
|
},
|
|
490
|
-
[ObjectTypes.AuthorNotes]: (data) => {
|
|
491
|
-
const model = data;
|
|
492
|
-
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
493
|
-
return schema.nodes.author_notes.create({
|
|
494
|
-
id: model._id,
|
|
495
|
-
}, content);
|
|
496
|
-
},
|
|
497
485
|
[ObjectTypes.Section]: (data) => {
|
|
498
486
|
const model = data;
|
|
499
487
|
const elements = [];
|
|
@@ -387,9 +387,6 @@ const encoders = {
|
|
|
387
387
|
table_element_footer: (node) => ({
|
|
388
388
|
containedObjectIDs: containedObjectIDs(node),
|
|
389
389
|
}),
|
|
390
|
-
author_notes: (node) => ({
|
|
391
|
-
containedObjectIDs: containedObjectIDs(node),
|
|
392
|
-
}),
|
|
393
390
|
footnotes_section: (node, parent, path, priority) => ({
|
|
394
391
|
category: buildSectionCategory(node),
|
|
395
392
|
priority: priority.value++,
|
|
@@ -59,8 +59,6 @@ export const nodeTypesMap = new Map([
|
|
|
59
59
|
[schema.nodes.affiliations, ObjectTypes.Section],
|
|
60
60
|
[schema.nodes.title, ObjectTypes.Titles],
|
|
61
61
|
[schema.nodes.supplement, ObjectTypes.Supplement],
|
|
62
|
-
[schema.nodes.author_notes, ObjectTypes.AuthorNotes],
|
|
63
|
-
[schema.nodes.corresp, ObjectTypes.Corresponding],
|
|
64
62
|
]);
|
|
65
63
|
export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
|
|
66
64
|
export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
|
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ParagraphElement } from '@manuscripts/json-schema';
|
|
17
|
-
import { Build } from '../../transformer';
|
|
18
16
|
export declare const jatsFrontParser: {
|
|
19
|
-
parseTitles(element: Element | null, createElement: (tagName: string) => HTMLElement): Build<import("@manuscripts/json-schema").Titles>;
|
|
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;
|
|
20
19
|
parseCounts(counts: Element | null): {
|
|
21
20
|
wordCount: number | undefined;
|
|
22
21
|
figureCount: number | undefined;
|
|
@@ -50,7 +49,7 @@ export declare const jatsFrontParser: {
|
|
|
50
49
|
publisherName: string | undefined;
|
|
51
50
|
_id: string;
|
|
52
51
|
objectType: string;
|
|
53
|
-
contributions?: import("@manuscripts/json-schema").Contribution[] | undefined;
|
|
52
|
+
contributions?: import("@manuscripts/json-schema/dist/types").Contribution[] | undefined;
|
|
54
53
|
};
|
|
55
54
|
parseDates(historyNode: Element | null): {
|
|
56
55
|
acceptanceDate?: number | undefined;
|
|
@@ -61,17 +60,16 @@ export declare const jatsFrontParser: {
|
|
|
61
60
|
receiveDate?: number | undefined;
|
|
62
61
|
} | undefined;
|
|
63
62
|
parseAffiliations(elements: Element[]): {
|
|
64
|
-
affiliations: Build<import("@manuscripts/json-schema").Affiliation>[];
|
|
63
|
+
affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
|
|
65
64
|
affiliationIDs: Map<string, string>;
|
|
66
65
|
};
|
|
67
66
|
parseAuthorNotes(elements: Element[]): {
|
|
68
|
-
footnotes: Build<import("@manuscripts/json-schema").Footnote>[];
|
|
67
|
+
footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
|
|
69
68
|
footnoteIDs: Map<string, string>;
|
|
70
69
|
};
|
|
71
|
-
parseAuthorNotesParagraphs(elements: Element[]): Build<ParagraphElement>[];
|
|
72
70
|
parseCorresp(elements: Element[]): {
|
|
73
|
-
correspondingList: Build<import("@manuscripts/json-schema").Corresponding>[];
|
|
71
|
+
correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Corresponding>[];
|
|
74
72
|
correspondingIDs: Map<string, string>;
|
|
75
73
|
};
|
|
76
|
-
parseContributors(elements: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): Build<import("@manuscripts/json-schema").Contributor>[];
|
|
74
|
+
parseContributors(elements: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Contributor>[];
|
|
77
75
|
};
|
|
@@ -86,9 +86,6 @@ export declare class JATSExporter {
|
|
|
86
86
|
protected serializeNode: (node: ManuscriptNode) => Node;
|
|
87
87
|
private validateContributor;
|
|
88
88
|
private buildContributors;
|
|
89
|
-
private appendParagraphToElement;
|
|
90
|
-
private appendCorrespondingToElement;
|
|
91
|
-
private appendFootnoteToElement;
|
|
92
89
|
private buildKeywords;
|
|
93
90
|
private fixBody;
|
|
94
91
|
private changeTag;
|
|
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
|
|
|
17
17
|
import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
|
|
18
18
|
import { EditorView, NodeView } from 'prosemirror-view';
|
|
19
19
|
export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
|
|
20
|
-
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement'
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Affiliation, Attribution,
|
|
16
|
+
import { Affiliation, Attribution, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, InlineMathFragment, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
|
|
17
17
|
import { FootnotesOrderIndexList } from './footnotes-order';
|
|
18
18
|
import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
|
|
19
19
|
export type Build<T> = Pick<T, Exclude<keyof T, keyof ManuscriptModel>> & {
|
|
@@ -46,7 +46,6 @@ export declare const buildComment: (target: string, contents?: string, selector?
|
|
|
46
46
|
export declare const buildNote: (target: string, source: 'EMAIL' | 'EDITOR' | 'DASHBOARD', contents?: string) => Build<ManuscriptNote>;
|
|
47
47
|
export declare const buildInlineMathFragment: (containingObject: string, TeXRepresentation: string) => Build<InlineMathFragment>;
|
|
48
48
|
export declare const buildFootnote: (containingObject: string, contents: string, kind?: 'footnote' | 'endnote') => Build<Footnote>;
|
|
49
|
-
export declare const buildAuthorNotes: (containedObjectIDs: string[]) => Build<AuthorNotes>;
|
|
50
49
|
export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList) => Build<FootnotesOrder>;
|
|
51
50
|
export declare const buildCorresp: (contents: string) => Build<Corresponding>;
|
|
52
51
|
export declare const buildSection: (priority?: number, path?: string[]) => Build<Section>;
|
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.1-LEAN-
|
|
4
|
+
"version": "2.1.1-LEAN-3352-1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"version": "yarn build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@manuscripts/json-schema": "2.2.
|
|
33
|
-
"@manuscripts/library": "1.3.2
|
|
32
|
+
"@manuscripts/json-schema": "^2.2.2",
|
|
33
|
+
"@manuscripts/library": "1.3.2",
|
|
34
34
|
"debug": "^4.3.4",
|
|
35
35
|
"jszip": "^3.10.1",
|
|
36
36
|
"mathjax-full": "^3.2.2",
|
|
@@ -78,4 +78,4 @@
|
|
|
78
78
|
"rimraf": "^3.0.2",
|
|
79
79
|
"typescript": "^4.0.5"
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2019 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.authorNotes = void 0;
|
|
19
|
-
exports.authorNotes = {
|
|
20
|
-
attrs: {
|
|
21
|
-
id: { default: '' },
|
|
22
|
-
dataTracked: { default: null },
|
|
23
|
-
},
|
|
24
|
-
content: '(footnote | paragraph)+',
|
|
25
|
-
group: 'block element',
|
|
26
|
-
toDOM: () => ['author-notes', 0],
|
|
27
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export const authorNotes = {
|
|
17
|
-
attrs: {
|
|
18
|
-
id: { default: '' },
|
|
19
|
-
dataTracked: { default: null },
|
|
20
|
-
},
|
|
21
|
-
content: '(footnote | paragraph)+',
|
|
22
|
-
group: 'block element',
|
|
23
|
-
toDOM: () => ['author-notes', 0],
|
|
24
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
-
import { ManuscriptNode } from '../types';
|
|
18
|
-
interface Attrs {
|
|
19
|
-
id: string;
|
|
20
|
-
}
|
|
21
|
-
export interface AuthorNotesNode extends ManuscriptNode {
|
|
22
|
-
attrs: Attrs;
|
|
23
|
-
}
|
|
24
|
-
export declare const authorNotes: NodeSpec;
|
|
25
|
-
export {};
|