@manuscripts/transform 1.0.0 → 1.0.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-parser-utils.js +2 -2
- package/dist/cjs/jats/jats-exporter.js +16 -16
- package/dist/cjs/schema/nodes/blockquote_element.js +2 -2
- package/dist/cjs/schema/nodes/equation.js +3 -3
- package/dist/cjs/schema/nodes/inline_equation.js +3 -3
- package/dist/cjs/schema/nodes/list.js +3 -3
- package/dist/cjs/schema/nodes/listing.js +3 -3
- package/dist/cjs/schema/nodes/paragraph.js +2 -2
- package/dist/cjs/schema/nodes/pullquote_element.js +2 -2
- package/dist/cjs/transformer/builders.js +73 -73
- package/dist/cjs/transformer/decode.js +25 -25
- package/dist/cjs/transformer/document-object-types.js +11 -11
- package/dist/cjs/transformer/html.js +2 -2
- package/dist/cjs/transformer/index.js +0 -1
- package/dist/cjs/transformer/labels.js +1 -2
- package/dist/cjs/transformer/manuscript-dependencies.js +3 -3
- package/dist/cjs/transformer/node-types.js +33 -33
- package/dist/cjs/transformer/object-types.js +23 -23
- package/dist/cjs/transformer/project-bundle.js +4 -4
- package/dist/cjs/transformer/section-category.js +5 -5
- package/dist/es/jats/importer/jats-parser-utils.js +1 -1
- package/dist/es/jats/jats-exporter.js +1 -1
- package/dist/es/schema/nodes/blockquote_element.js +1 -1
- package/dist/es/schema/nodes/equation.js +1 -1
- package/dist/es/schema/nodes/inline_equation.js +1 -1
- package/dist/es/schema/nodes/list.js +1 -1
- package/dist/es/schema/nodes/listing.js +1 -1
- package/dist/es/schema/nodes/paragraph.js +1 -1
- package/dist/es/schema/nodes/pullquote_element.js +1 -1
- package/dist/es/transformer/builders.js +1 -1
- package/dist/es/transformer/decode.js +1 -1
- package/dist/es/transformer/document-object-types.js +1 -1
- package/dist/es/transformer/html.js +1 -1
- package/dist/es/transformer/index.js +0 -1
- package/dist/es/transformer/labels.js +1 -2
- package/dist/es/transformer/manuscript-dependencies.js +1 -1
- package/dist/es/transformer/node-types.js +1 -1
- package/dist/es/transformer/object-types.js +1 -1
- package/dist/es/transformer/project-bundle.js +1 -1
- package/dist/es/transformer/section-category.js +1 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +1 -1
- package/dist/types/jats/importer/jats-comments.d.ts +1 -1
- package/dist/types/jats/importer/jats-front-parser.d.ts +6 -6
- package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -1
- package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -2
- package/dist/types/jats/importer/parse-jats-article.d.ts +2 -2
- package/dist/types/jats/jats-exporter.d.ts +1 -1
- package/dist/types/lib/styled-content.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +1 -1
- package/dist/types/transformer/bundles-data.d.ts +1 -1
- package/dist/types/transformer/bundles.d.ts +1 -1
- package/dist/types/transformer/decode.d.ts +1 -1
- package/dist/types/transformer/document-object-types.d.ts +1 -1
- package/dist/types/transformer/encode.d.ts +1 -1
- package/dist/types/transformer/footnotes-order.d.ts +1 -1
- package/dist/types/transformer/highlight-markers.d.ts +1 -1
- package/dist/types/transformer/html.d.ts +1 -1
- package/dist/types/transformer/id.d.ts +1 -1
- package/dist/types/transformer/index.d.ts +0 -1
- package/dist/types/transformer/labels.d.ts +1 -1
- package/dist/types/transformer/manuscript-dependencies.d.ts +1 -1
- package/dist/types/transformer/model-map.d.ts +1 -1
- package/dist/types/transformer/models.d.ts +1 -1
- package/dist/types/transformer/node-types.d.ts +1 -1
- package/dist/types/transformer/object-types.d.ts +1 -1
- package/dist/types/transformer/project-bundle.d.ts +1 -1
- package/dist/types/transformer/section-category.d.ts +1 -1
- package/dist/types/transformer/shared-data.d.ts +1 -1
- package/dist/types/transformer/update-identifiers.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/transformer/tei-grobid-importer.js +0 -121
- package/dist/es/transformer/tei-grobid-importer.js +0 -115
- package/dist/types/transformer/tei-grobid-importer.d.ts +0 -20
|
@@ -30,7 +30,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.Decoder = exports.isManuscriptNode = exports.sortSectionsByPriority = exports.getModelsByType = exports.getModelData = void 0;
|
|
33
|
-
const
|
|
33
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
34
34
|
const debug_1 = __importDefault(require("debug"));
|
|
35
35
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
36
36
|
const errors_1 = require("../errors");
|
|
@@ -59,11 +59,11 @@ const getModelsByType = (modelMap, objectType) => {
|
|
|
59
59
|
exports.getModelsByType = getModelsByType;
|
|
60
60
|
const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(a.priority) - Number(b.priority);
|
|
61
61
|
exports.sortSectionsByPriority = sortSectionsByPriority;
|
|
62
|
-
const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap,
|
|
62
|
+
const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Section).sort(exports.sortSectionsByPriority);
|
|
63
63
|
const isManuscriptNode = (model) => model !== null;
|
|
64
64
|
exports.isManuscriptNode = isManuscriptNode;
|
|
65
|
-
const isParagraphElement = (0, object_types_1.hasObjectType)(
|
|
66
|
-
const isFootnote = (0, object_types_1.hasObjectType)(
|
|
65
|
+
const isParagraphElement = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.ParagraphElement);
|
|
66
|
+
const isFootnote = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote);
|
|
67
67
|
const hasParentSection = (id) => (section) => section.path &&
|
|
68
68
|
section.path.length > 1 &&
|
|
69
69
|
section.path[section.path.length - 2] === id;
|
|
@@ -99,7 +99,7 @@ class Decoder {
|
|
|
99
99
|
}
|
|
100
100
|
constructor(modelMap, allowMissingElements = false) {
|
|
101
101
|
this.creators = {
|
|
102
|
-
[
|
|
102
|
+
[json_schema_1.ObjectTypes.BibliographyElement]: (data) => {
|
|
103
103
|
var _a;
|
|
104
104
|
const model = data;
|
|
105
105
|
const referenceIDs = (_a = model.containedObjectIDs) === null || _a === void 0 ? void 0 : _a.filter((i) => i.startsWith('MPBibliographyItem'));
|
|
@@ -119,7 +119,7 @@ class Decoder {
|
|
|
119
119
|
paragraphStyle: model.paragraphStyle,
|
|
120
120
|
}, references);
|
|
121
121
|
},
|
|
122
|
-
[
|
|
122
|
+
[json_schema_1.ObjectTypes.BibliographyItem]: (data) => {
|
|
123
123
|
const model = data;
|
|
124
124
|
return schema_1.schema.nodes.bibliography_item.create({
|
|
125
125
|
id: model._id,
|
|
@@ -142,7 +142,7 @@ class Decoder {
|
|
|
142
142
|
id: model._id,
|
|
143
143
|
});
|
|
144
144
|
},
|
|
145
|
-
[
|
|
145
|
+
[json_schema_1.ObjectTypes.Figure]: (data) => {
|
|
146
146
|
const model = data;
|
|
147
147
|
return schema_1.schema.nodes.figure.create({
|
|
148
148
|
id: model._id,
|
|
@@ -152,7 +152,7 @@ class Decoder {
|
|
|
152
152
|
comments: this.createCommentsNode(model),
|
|
153
153
|
});
|
|
154
154
|
},
|
|
155
|
-
[
|
|
155
|
+
[json_schema_1.ObjectTypes.FigureElement]: (data) => {
|
|
156
156
|
const model = data;
|
|
157
157
|
const paragraphIDs = model.containedObjectIDs.filter((i) => i.startsWith('MPParagraphElement'));
|
|
158
158
|
const figureIDs = model.containedObjectIDs.filter((i) => i.startsWith('MPFigure') || i.startsWith('MPMissingFigure'));
|
|
@@ -201,7 +201,7 @@ class Decoder {
|
|
|
201
201
|
comments: this.createCommentsNode(model),
|
|
202
202
|
}, content);
|
|
203
203
|
},
|
|
204
|
-
[
|
|
204
|
+
[json_schema_1.ObjectTypes.Equation]: (data) => {
|
|
205
205
|
const model = data;
|
|
206
206
|
return schema_1.schema.nodes.equation.createChecked({
|
|
207
207
|
id: model._id,
|
|
@@ -210,7 +210,7 @@ class Decoder {
|
|
|
210
210
|
TeXRepresentation: model.TeXRepresentation,
|
|
211
211
|
});
|
|
212
212
|
},
|
|
213
|
-
[
|
|
213
|
+
[json_schema_1.ObjectTypes.EquationElement]: (data) => {
|
|
214
214
|
const model = data;
|
|
215
215
|
const equationModel = this.getModel(model.containedObjectID);
|
|
216
216
|
let equation;
|
|
@@ -233,7 +233,7 @@ class Decoder {
|
|
|
233
233
|
suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
|
|
234
234
|
}, [equation, figcaption]);
|
|
235
235
|
},
|
|
236
|
-
[
|
|
236
|
+
[json_schema_1.ObjectTypes.FootnotesElement]: (data) => {
|
|
237
237
|
const model = data;
|
|
238
238
|
const collateByKind = model.collateByKind || 'footnote';
|
|
239
239
|
const footnotesOfKind = [];
|
|
@@ -255,7 +255,7 @@ class Decoder {
|
|
|
255
255
|
paragraphStyle: model.paragraphStyle,
|
|
256
256
|
}, footnotesOfKind);
|
|
257
257
|
},
|
|
258
|
-
[
|
|
258
|
+
[json_schema_1.ObjectTypes.Footnote]: (data) => {
|
|
259
259
|
const model = data;
|
|
260
260
|
return schema_1.schema.nodes.footnote.create({
|
|
261
261
|
id: model._id,
|
|
@@ -263,7 +263,7 @@ class Decoder {
|
|
|
263
263
|
comments: this.createCommentsNode(model),
|
|
264
264
|
});
|
|
265
265
|
},
|
|
266
|
-
[
|
|
266
|
+
[json_schema_1.ObjectTypes.KeywordsElement]: (data) => {
|
|
267
267
|
const model = data;
|
|
268
268
|
return schema_1.schema.nodes.keywords_element.create({
|
|
269
269
|
id: model._id,
|
|
@@ -273,7 +273,7 @@ class Decoder {
|
|
|
273
273
|
paragraphStyle: model.paragraphStyle,
|
|
274
274
|
});
|
|
275
275
|
},
|
|
276
|
-
[
|
|
276
|
+
[json_schema_1.ObjectTypes.ListElement]: (data) => {
|
|
277
277
|
const model = data;
|
|
278
278
|
switch (model.elementType) {
|
|
279
279
|
case 'ol':
|
|
@@ -295,7 +295,7 @@ class Decoder {
|
|
|
295
295
|
throw new Error('Unknown list element type');
|
|
296
296
|
}
|
|
297
297
|
},
|
|
298
|
-
[
|
|
298
|
+
[json_schema_1.ObjectTypes.Listing]: (data) => {
|
|
299
299
|
const model = data;
|
|
300
300
|
return schema_1.schema.nodes.listing.createChecked({
|
|
301
301
|
id: model._id,
|
|
@@ -305,7 +305,7 @@ class Decoder {
|
|
|
305
305
|
comments: this.createCommentsNode(model),
|
|
306
306
|
});
|
|
307
307
|
},
|
|
308
|
-
[
|
|
308
|
+
[json_schema_1.ObjectTypes.ListingElement]: (data) => {
|
|
309
309
|
const model = data;
|
|
310
310
|
const listingModel = this.getModel(model.containedObjectID);
|
|
311
311
|
let listing;
|
|
@@ -329,14 +329,14 @@ class Decoder {
|
|
|
329
329
|
comments: this.createCommentsNode(model),
|
|
330
330
|
}, [listing, figcaption]);
|
|
331
331
|
},
|
|
332
|
-
[
|
|
332
|
+
[json_schema_1.ObjectTypes.MissingFigure]: (data) => {
|
|
333
333
|
const model = data;
|
|
334
334
|
return schema_1.schema.nodes.missing_figure.create({
|
|
335
335
|
id: model._id,
|
|
336
336
|
position: model.position,
|
|
337
337
|
});
|
|
338
338
|
},
|
|
339
|
-
[
|
|
339
|
+
[json_schema_1.ObjectTypes.ParagraphElement]: (data) => {
|
|
340
340
|
const model = data;
|
|
341
341
|
return this.parseContents(model.contents || '<p></p>', undefined, this.getComments(model), {
|
|
342
342
|
topNode: schema_1.schema.nodes.paragraph.create({
|
|
@@ -347,7 +347,7 @@ class Decoder {
|
|
|
347
347
|
}),
|
|
348
348
|
});
|
|
349
349
|
},
|
|
350
|
-
[
|
|
350
|
+
[json_schema_1.ObjectTypes.QuoteElement]: (data) => {
|
|
351
351
|
const model = data;
|
|
352
352
|
switch (model.quoteType) {
|
|
353
353
|
case 'block':
|
|
@@ -370,7 +370,7 @@ class Decoder {
|
|
|
370
370
|
throw new Error('Unknown block type');
|
|
371
371
|
}
|
|
372
372
|
},
|
|
373
|
-
[
|
|
373
|
+
[json_schema_1.ObjectTypes.Section]: (data) => {
|
|
374
374
|
const model = data;
|
|
375
375
|
const isKeywordsSection = model.category === 'MPSectionCategory:keywords';
|
|
376
376
|
const elements = [];
|
|
@@ -415,7 +415,7 @@ class Decoder {
|
|
|
415
415
|
}
|
|
416
416
|
const nestedSections = getSections(this.modelMap)
|
|
417
417
|
.filter(hasParentSection(model._id))
|
|
418
|
-
.map(this.creators[
|
|
418
|
+
.map(this.creators[json_schema_1.ObjectTypes.Section]);
|
|
419
419
|
const sectionCategory = model.category || (0, section_category_1.guessSectionCategory)(elements);
|
|
420
420
|
const sectionNodeType = (0, section_category_1.chooseSectionNodeType)(sectionCategory);
|
|
421
421
|
const content = (sectionLabelNode
|
|
@@ -437,7 +437,7 @@ class Decoder {
|
|
|
437
437
|
}
|
|
438
438
|
return sectionNode;
|
|
439
439
|
},
|
|
440
|
-
[
|
|
440
|
+
[json_schema_1.ObjectTypes.Table]: (data) => {
|
|
441
441
|
const model = data;
|
|
442
442
|
return this.parseContents(model.contents, undefined, this.getComments(model), {
|
|
443
443
|
topNode: schema_1.schema.nodes.table.create({
|
|
@@ -446,7 +446,7 @@ class Decoder {
|
|
|
446
446
|
}),
|
|
447
447
|
});
|
|
448
448
|
},
|
|
449
|
-
[
|
|
449
|
+
[json_schema_1.ObjectTypes.TableElement]: (data) => {
|
|
450
450
|
const model = data;
|
|
451
451
|
const tableModel = this.getModel(model.containedObjectID);
|
|
452
452
|
let table;
|
|
@@ -497,7 +497,7 @@ class Decoder {
|
|
|
497
497
|
comments: this.createCommentsNode(model),
|
|
498
498
|
}, content);
|
|
499
499
|
},
|
|
500
|
-
[
|
|
500
|
+
[json_schema_1.ObjectTypes.TOCElement]: (data) => {
|
|
501
501
|
const model = data;
|
|
502
502
|
return schema_1.schema.nodes.toc_element.create({
|
|
503
503
|
id: model._id,
|
|
@@ -507,7 +507,7 @@ class Decoder {
|
|
|
507
507
|
paragraphStyle: model.paragraphStyle,
|
|
508
508
|
});
|
|
509
509
|
},
|
|
510
|
-
[
|
|
510
|
+
[json_schema_1.ObjectTypes.CommentAnnotation]: (data) => {
|
|
511
511
|
const model = data;
|
|
512
512
|
return schema_1.schema.nodes.comment.create({
|
|
513
513
|
id: model._id,
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.documentObjectTypes = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
exports.documentObjectTypes = [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
json_schema_1.ObjectTypes.BibliographyElement,
|
|
22
|
+
json_schema_1.ObjectTypes.EquationElement,
|
|
23
|
+
json_schema_1.ObjectTypes.FigureElement,
|
|
24
|
+
json_schema_1.ObjectTypes.ListElement,
|
|
25
|
+
json_schema_1.ObjectTypes.ListingElement,
|
|
26
|
+
json_schema_1.ObjectTypes.Manuscript,
|
|
27
|
+
json_schema_1.ObjectTypes.ParagraphElement,
|
|
28
|
+
json_schema_1.ObjectTypes.Section,
|
|
29
|
+
json_schema_1.ObjectTypes.TableElement,
|
|
30
|
+
json_schema_1.ObjectTypes.TOCElement,
|
|
31
31
|
];
|
|
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.HTMLTransformer = void 0;
|
|
22
|
-
const
|
|
22
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
23
23
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
24
24
|
const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
|
|
25
25
|
const jats_exporter_1 = require("../jats/jats-exporter");
|
|
@@ -334,7 +334,7 @@ class HTMLTransformer {
|
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
336
|
buildContributors(articleMeta) {
|
|
337
|
-
const contributors = Array.from(this.modelMap.values()).filter((0, object_types_1.hasObjectType)(
|
|
337
|
+
const contributors = Array.from(this.modelMap.values()).filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Contributor));
|
|
338
338
|
const affiliationIDs = [];
|
|
339
339
|
if (contributors && contributors.length) {
|
|
340
340
|
const contribGroup = this.document.createElement('div');
|
|
@@ -49,6 +49,5 @@ __exportStar(require("./project-bundle"), exports);
|
|
|
49
49
|
__exportStar(require("./section-category"), exports);
|
|
50
50
|
__exportStar(require("./serializer"), exports);
|
|
51
51
|
__exportStar(require("./shared-data"), exports);
|
|
52
|
-
__exportStar(require("./tei-grobid-importer"), exports);
|
|
53
52
|
__exportStar(require("./timestamp"), exports);
|
|
54
53
|
__exportStar(require("./update-identifiers"), exports);
|
|
@@ -49,8 +49,7 @@ const buildTargets = (fragment, manuscript) => {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
const buildLabel = (type) => {
|
|
52
|
-
const
|
|
53
|
-
const counter = counters[viewLabel.name];
|
|
52
|
+
const counter = counters[type.name];
|
|
54
53
|
counter.index++;
|
|
55
54
|
return `${counter.label} ${counter.index}`;
|
|
56
55
|
};
|
|
@@ -12,11 +12,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.updatedPageLayout = exports.getByPrototype = exports.fromPrototype = exports.loadBundledDependencies = exports.loadContributorRoles = exports.loadKeywords = exports.loadStyles = void 0;
|
|
15
|
-
const
|
|
15
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
16
16
|
const id_1 = require("./id");
|
|
17
17
|
const object_types_1 = require("./object-types");
|
|
18
18
|
const shared_data_1 = require("./shared-data");
|
|
19
|
-
const isStatusLabel = (0, object_types_1.hasObjectType)(
|
|
19
|
+
const isStatusLabel = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.StatusLabel);
|
|
20
20
|
const isBundledModel = (model) => model.bundled === true;
|
|
21
21
|
const loadBundledData = async (file) => {
|
|
22
22
|
const models = await (0, shared_data_1.loadSharedData)(file);
|
|
@@ -49,7 +49,7 @@ const getByPrototype = (modelMap, prototype) => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
exports.getByPrototype = getByPrototype;
|
|
52
|
-
const isParagraphStyle = (0, object_types_1.hasObjectType)(
|
|
52
|
+
const isParagraphStyle = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.ParagraphStyle);
|
|
53
53
|
const chooseNewDefaultParagraphStyle = (styles) => {
|
|
54
54
|
for (const style of styles.values()) {
|
|
55
55
|
if (isParagraphStyle(style)) {
|
|
@@ -16,41 +16,41 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isNodeType = exports.isSectionNodeType = exports.isElementNodeType = exports.isExecutableNodeType = exports.nodeTypesMap = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const schema_1 = require("../schema");
|
|
21
21
|
exports.nodeTypesMap = new Map([
|
|
22
|
-
[schema_1.schema.nodes.comment,
|
|
23
|
-
[schema_1.schema.nodes.bibliography_item,
|
|
24
|
-
[schema_1.schema.nodes.bibliography_element,
|
|
25
|
-
[schema_1.schema.nodes.bibliography_section,
|
|
26
|
-
[schema_1.schema.nodes.blockquote_element,
|
|
27
|
-
[schema_1.schema.nodes.bullet_list,
|
|
28
|
-
[schema_1.schema.nodes.citation,
|
|
29
|
-
[schema_1.schema.nodes.cross_reference,
|
|
30
|
-
[schema_1.schema.nodes.equation,
|
|
31
|
-
[schema_1.schema.nodes.equation_element,
|
|
32
|
-
[schema_1.schema.nodes.figure,
|
|
33
|
-
[schema_1.schema.nodes.missing_figure,
|
|
34
|
-
[schema_1.schema.nodes.figure_element,
|
|
35
|
-
[schema_1.schema.nodes.footnote,
|
|
36
|
-
[schema_1.schema.nodes.footnotes_element,
|
|
37
|
-
[schema_1.schema.nodes.footnotes_section,
|
|
38
|
-
[schema_1.schema.nodes.graphical_abstract_section,
|
|
39
|
-
[schema_1.schema.nodes.highlight_marker,
|
|
40
|
-
[schema_1.schema.nodes.inline_equation,
|
|
41
|
-
[schema_1.schema.nodes.keywords_element,
|
|
42
|
-
[schema_1.schema.nodes.keywords_section,
|
|
43
|
-
[schema_1.schema.nodes.listing,
|
|
44
|
-
[schema_1.schema.nodes.listing_element,
|
|
45
|
-
[schema_1.schema.nodes.manuscript,
|
|
46
|
-
[schema_1.schema.nodes.ordered_list,
|
|
47
|
-
[schema_1.schema.nodes.paragraph,
|
|
48
|
-
[schema_1.schema.nodes.pullquote_element,
|
|
49
|
-
[schema_1.schema.nodes.section,
|
|
50
|
-
[schema_1.schema.nodes.table,
|
|
51
|
-
[schema_1.schema.nodes.table_element,
|
|
52
|
-
[schema_1.schema.nodes.toc_element,
|
|
53
|
-
[schema_1.schema.nodes.toc_section,
|
|
22
|
+
[schema_1.schema.nodes.comment, json_schema_1.ObjectTypes.CommentAnnotation],
|
|
23
|
+
[schema_1.schema.nodes.bibliography_item, json_schema_1.ObjectTypes.BibliographyItem],
|
|
24
|
+
[schema_1.schema.nodes.bibliography_element, json_schema_1.ObjectTypes.BibliographyElement],
|
|
25
|
+
[schema_1.schema.nodes.bibliography_section, json_schema_1.ObjectTypes.Section],
|
|
26
|
+
[schema_1.schema.nodes.blockquote_element, json_schema_1.ObjectTypes.QuoteElement],
|
|
27
|
+
[schema_1.schema.nodes.bullet_list, json_schema_1.ObjectTypes.ListElement],
|
|
28
|
+
[schema_1.schema.nodes.citation, json_schema_1.ObjectTypes.Citation],
|
|
29
|
+
[schema_1.schema.nodes.cross_reference, json_schema_1.ObjectTypes.AuxiliaryObjectReference],
|
|
30
|
+
[schema_1.schema.nodes.equation, json_schema_1.ObjectTypes.Equation],
|
|
31
|
+
[schema_1.schema.nodes.equation_element, json_schema_1.ObjectTypes.EquationElement],
|
|
32
|
+
[schema_1.schema.nodes.figure, json_schema_1.ObjectTypes.Figure],
|
|
33
|
+
[schema_1.schema.nodes.missing_figure, json_schema_1.ObjectTypes.MissingFigure],
|
|
34
|
+
[schema_1.schema.nodes.figure_element, json_schema_1.ObjectTypes.FigureElement],
|
|
35
|
+
[schema_1.schema.nodes.footnote, json_schema_1.ObjectTypes.Footnote],
|
|
36
|
+
[schema_1.schema.nodes.footnotes_element, json_schema_1.ObjectTypes.FootnotesElement],
|
|
37
|
+
[schema_1.schema.nodes.footnotes_section, json_schema_1.ObjectTypes.Section],
|
|
38
|
+
[schema_1.schema.nodes.graphical_abstract_section, json_schema_1.ObjectTypes.Section],
|
|
39
|
+
[schema_1.schema.nodes.highlight_marker, json_schema_1.ObjectTypes.HighlightMarker],
|
|
40
|
+
[schema_1.schema.nodes.inline_equation, json_schema_1.ObjectTypes.InlineMathFragment],
|
|
41
|
+
[schema_1.schema.nodes.keywords_element, json_schema_1.ObjectTypes.KeywordsElement],
|
|
42
|
+
[schema_1.schema.nodes.keywords_section, json_schema_1.ObjectTypes.Section],
|
|
43
|
+
[schema_1.schema.nodes.listing, json_schema_1.ObjectTypes.Listing],
|
|
44
|
+
[schema_1.schema.nodes.listing_element, json_schema_1.ObjectTypes.ListingElement],
|
|
45
|
+
[schema_1.schema.nodes.manuscript, json_schema_1.ObjectTypes.Manuscript],
|
|
46
|
+
[schema_1.schema.nodes.ordered_list, json_schema_1.ObjectTypes.ListElement],
|
|
47
|
+
[schema_1.schema.nodes.paragraph, json_schema_1.ObjectTypes.ParagraphElement],
|
|
48
|
+
[schema_1.schema.nodes.pullquote_element, json_schema_1.ObjectTypes.QuoteElement],
|
|
49
|
+
[schema_1.schema.nodes.section, json_schema_1.ObjectTypes.Section],
|
|
50
|
+
[schema_1.schema.nodes.table, json_schema_1.ObjectTypes.Table],
|
|
51
|
+
[schema_1.schema.nodes.table_element, json_schema_1.ObjectTypes.TableElement],
|
|
52
|
+
[schema_1.schema.nodes.toc_element, json_schema_1.ObjectTypes.TOCElement],
|
|
53
|
+
[schema_1.schema.nodes.toc_section, json_schema_1.ObjectTypes.Section],
|
|
54
54
|
]);
|
|
55
55
|
const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
|
|
56
56
|
exports.isExecutableNodeType = isExecutableNodeType;
|
|
@@ -16,42 +16,42 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isCommentAnnotation = exports.isUserProfile = exports.isTable = exports.isManuscript = exports.isFigure = exports.hasObjectType = exports.isManuscriptModel = exports.manuscriptObjects = exports.elementObjects = exports.ExtraObjectTypes = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
var ExtraObjectTypes;
|
|
21
21
|
(function (ExtraObjectTypes) {
|
|
22
22
|
ExtraObjectTypes["PlaceholderElement"] = "MPPlaceholderElement";
|
|
23
23
|
})(ExtraObjectTypes = exports.ExtraObjectTypes || (exports.ExtraObjectTypes = {}));
|
|
24
24
|
exports.elementObjects = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
json_schema_1.ObjectTypes.BibliographyElement,
|
|
26
|
+
json_schema_1.ObjectTypes.EquationElement,
|
|
27
|
+
json_schema_1.ObjectTypes.FigureElement,
|
|
28
|
+
json_schema_1.ObjectTypes.FootnotesElement,
|
|
29
|
+
json_schema_1.ObjectTypes.ListElement,
|
|
30
|
+
json_schema_1.ObjectTypes.ListingElement,
|
|
31
|
+
json_schema_1.ObjectTypes.ParagraphElement,
|
|
32
|
+
json_schema_1.ObjectTypes.TableElement,
|
|
33
|
+
json_schema_1.ObjectTypes.TOCElement,
|
|
34
34
|
];
|
|
35
35
|
exports.manuscriptObjects = [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
json_schema_1.ObjectTypes.Affiliation,
|
|
37
|
+
json_schema_1.ObjectTypes.Citation,
|
|
38
|
+
json_schema_1.ObjectTypes.CommentAnnotation,
|
|
39
|
+
json_schema_1.ObjectTypes.Contributor,
|
|
40
|
+
json_schema_1.ObjectTypes.Footnote,
|
|
41
|
+
json_schema_1.ObjectTypes.InlineMathFragment,
|
|
42
|
+
json_schema_1.ObjectTypes.Section,
|
|
43
43
|
].concat(exports.elementObjects);
|
|
44
44
|
const isManuscriptModel = (model) => {
|
|
45
45
|
if (!model.objectType) {
|
|
46
46
|
throw new Error('Model must have objectType');
|
|
47
47
|
}
|
|
48
|
-
return
|
|
48
|
+
return json_schema_1.manuscriptIDTypes.has(model.objectType);
|
|
49
49
|
};
|
|
50
50
|
exports.isManuscriptModel = isManuscriptModel;
|
|
51
51
|
const hasObjectType = (objectType) => (model) => model.objectType === objectType;
|
|
52
52
|
exports.hasObjectType = hasObjectType;
|
|
53
|
-
exports.isFigure = (0, exports.hasObjectType)(
|
|
54
|
-
exports.isManuscript = (0, exports.hasObjectType)(
|
|
55
|
-
exports.isTable = (0, exports.hasObjectType)(
|
|
56
|
-
exports.isUserProfile = (0, exports.hasObjectType)(
|
|
57
|
-
exports.isCommentAnnotation = (0, exports.hasObjectType)(
|
|
53
|
+
exports.isFigure = (0, exports.hasObjectType)(json_schema_1.ObjectTypes.Figure);
|
|
54
|
+
exports.isManuscript = (0, exports.hasObjectType)(json_schema_1.ObjectTypes.Manuscript);
|
|
55
|
+
exports.isTable = (0, exports.hasObjectType)(json_schema_1.ObjectTypes.Table);
|
|
56
|
+
exports.isUserProfile = (0, exports.hasObjectType)(json_schema_1.ObjectTypes.UserProfile);
|
|
57
|
+
exports.isCommentAnnotation = (0, exports.hasObjectType)(json_schema_1.ObjectTypes.CommentAnnotation);
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.findManuscriptById = exports.findLatestManuscriptSubmission = exports.findManuscriptModelByType = exports.findJournal = exports.findManuscript = exports.parseProjectBundle = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const decode_1 = require("./decode");
|
|
21
21
|
const object_types_1 = require("./object-types");
|
|
22
22
|
const parseProjectBundle = (projectBundle, manuscriptID) => {
|
|
@@ -32,7 +32,7 @@ const parseProjectBundle = (projectBundle, manuscriptID) => {
|
|
|
32
32
|
return { doc, modelMap };
|
|
33
33
|
};
|
|
34
34
|
exports.parseProjectBundle = parseProjectBundle;
|
|
35
|
-
const isManuscript = (0, object_types_1.hasObjectType)(
|
|
35
|
+
const isManuscript = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Manuscript);
|
|
36
36
|
const findManuscript = (modelMap) => {
|
|
37
37
|
for (const model of modelMap.values()) {
|
|
38
38
|
if (isManuscript(model)) {
|
|
@@ -42,7 +42,7 @@ const findManuscript = (modelMap) => {
|
|
|
42
42
|
throw new Error('No manuscript found');
|
|
43
43
|
};
|
|
44
44
|
exports.findManuscript = findManuscript;
|
|
45
|
-
const isJournal = (0, object_types_1.hasObjectType)(
|
|
45
|
+
const isJournal = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Journal);
|
|
46
46
|
const findJournal = (modelMap) => {
|
|
47
47
|
for (const model of modelMap.values()) {
|
|
48
48
|
if (isJournal(model)) {
|
|
@@ -63,7 +63,7 @@ const findManuscriptModelByType = (modelMap, manuscript, objectType) => {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
exports.findManuscriptModelByType = findManuscriptModelByType;
|
|
66
|
-
const isSubmission = (0, object_types_1.hasObjectType)(
|
|
66
|
+
const isSubmission = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Submission);
|
|
67
67
|
const newestFirst = (a, b) => b.createdAt - a.createdAt;
|
|
68
68
|
const findLatestManuscriptSubmission = (modelMap, manuscript) => {
|
|
69
69
|
const submissions = [];
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.chooseSectionCategoryFromTitle = exports.chooseSectionCategory = exports.chooseSectionCategoryByType = exports.chooseSecType = exports.buildSectionCategory = exports.guessSectionCategory = exports.chooseSectionLableName = exports.chooseSectionNodeType = exports.isAnySectionNode = void 0;
|
|
19
|
-
const
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const schema_1 = require("../schema");
|
|
21
21
|
const sectionNodeTypes = [
|
|
22
22
|
schema_1.schema.nodes.bibliography_section,
|
|
@@ -58,13 +58,13 @@ const guessSectionCategory = (elements) => {
|
|
|
58
58
|
return undefined;
|
|
59
59
|
}
|
|
60
60
|
switch (elements[0].objectType) {
|
|
61
|
-
case
|
|
61
|
+
case json_schema_1.ObjectTypes.BibliographyElement:
|
|
62
62
|
return 'MPSectionCategory:bibliography';
|
|
63
|
-
case
|
|
63
|
+
case json_schema_1.ObjectTypes.FootnotesElement:
|
|
64
64
|
return 'MPSectionCategory:endnotes';
|
|
65
|
-
case
|
|
65
|
+
case json_schema_1.ObjectTypes.KeywordsElement:
|
|
66
66
|
return 'MPSectionCategory:keywords';
|
|
67
|
-
case
|
|
67
|
+
case json_schema_1.ObjectTypes.TOCElement:
|
|
68
68
|
return 'MPSectionCategory:toc';
|
|
69
69
|
default:
|
|
70
70
|
return undefined;
|
|
@@ -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 { ObjectTypes, } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
import { generateID, hasObjectType, nodeTypesMap } from '../../transformer';
|
|
18
18
|
const isAuxiliaryObjectReference = hasObjectType(ObjectTypes.AuxiliaryObjectReference);
|
|
19
19
|
export function flatten(arrays) {
|
|
@@ -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 { ObjectTypes, } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
import debug from 'debug';
|
|
18
18
|
import { DOMParser, DOMSerializer } from 'prosemirror-model';
|
|
19
19
|
import serializeToXML from 'w3c-xmlserializer';
|
|
@@ -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 { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { buildElementClass } from '../../lib/attributes';
|
|
18
18
|
export const blockquoteElement = {
|
|
19
19
|
content: 'paragraph+ attribution',
|
|
@@ -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 { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
export const equation = {
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
@@ -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 { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
export const inlineEquation = {
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
@@ -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 { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { buildElementClass } from '../../lib/attributes';
|
|
18
18
|
export const bulletList = {
|
|
19
19
|
content: 'list_item+',
|
|
@@ -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 { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
export const listing = {
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
@@ -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 { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { buildElementClass } from '../../lib/attributes';
|
|
18
18
|
export const paragraph = {
|
|
19
19
|
content: 'inline*',
|
|
@@ -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 { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { buildElementClass } from '../../lib/attributes';
|
|
18
18
|
export const pullquoteElement = {
|
|
19
19
|
content: 'paragraph+ attribution',
|
|
@@ -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 { ObjectTypes, } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
import serializeToXML from 'w3c-xmlserializer';
|
|
18
18
|
import { schema } from '../schema';
|
|
19
19
|
import { generateID } from './id';
|
|
@@ -24,7 +24,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
}
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
|
-
import { ObjectTypes, } from '@manuscripts/
|
|
27
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
28
28
|
import debug from 'debug';
|
|
29
29
|
import { DOMParser } from 'prosemirror-model';
|
|
30
30
|
import { MissingElement } from '../errors';
|
|
@@ -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 { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
export const documentObjectTypes = [
|
|
18
18
|
ObjectTypes.BibliographyElement,
|
|
19
19
|
ObjectTypes.EquationElement,
|