@manuscripts/transform 2.2.0 → 2.2.2-LEAN-3514.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 +1 -0
- package/dist/cjs/jats/jats-exporter.js +34 -24
- package/dist/cjs/schema/index.js +2 -0
- package/dist/cjs/schema/nodes/author_notes.js +1 -1
- package/dist/cjs/schema/nodes/bibliography_item.js +0 -63
- package/dist/cjs/schema/nodes/corresp.js +13 -0
- package/dist/cjs/schema/nodes/table_element_footer.js +1 -1
- package/dist/cjs/transformer/decode.js +9 -0
- package/dist/cjs/transformer/encode.js +4 -0
- package/dist/cjs/transformer/node-types.js +1 -0
- package/dist/es/jats/importer/jats-front-parser.js +1 -0
- package/dist/es/jats/jats-exporter.js +34 -24
- package/dist/es/schema/index.js +2 -0
- package/dist/es/schema/nodes/author_notes.js +1 -1
- package/dist/es/schema/nodes/bibliography_item.js +0 -63
- package/dist/es/schema/nodes/corresp.js +10 -0
- package/dist/es/schema/nodes/table_element_footer.js +1 -1
- package/dist/es/transformer/decode.js +9 -0
- package/dist/es/transformer/encode.js +4 -0
- package/dist/es/transformer/node-types.js +1 -0
- package/dist/types/jats/jats-exporter.d.ts +2 -0
- package/dist/types/schema/nodes/bibliography_item.d.ts +3 -2
- package/dist/types/schema/nodes/corresp.d.ts +11 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -617,6 +617,7 @@ class JATSExporter {
|
|
|
617
617
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
618
618
|
const nodes = {
|
|
619
619
|
author_notes: () => ['author-notes', 0],
|
|
620
|
+
corresp: () => '',
|
|
620
621
|
title: () => '',
|
|
621
622
|
affiliations: () => '',
|
|
622
623
|
contributors: () => '',
|
|
@@ -1047,7 +1048,6 @@ class JATSExporter {
|
|
|
1047
1048
|
}
|
|
1048
1049
|
};
|
|
1049
1050
|
this.buildContributors = (articleMeta) => {
|
|
1050
|
-
var _a;
|
|
1051
1051
|
const contributors = this.models.filter(isContributor);
|
|
1052
1052
|
const authorContributors = contributors
|
|
1053
1053
|
.filter((contributor) => contributor.role === 'author')
|
|
@@ -1266,34 +1266,21 @@ class JATSExporter {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
});
|
|
1268
1268
|
}
|
|
1269
|
-
const authorNotesEl = this.
|
|
1270
|
-
const usedCorrespodings = this.getUsedCorrespondings([
|
|
1271
|
-
...authorContributors,
|
|
1272
|
-
...otherContributors,
|
|
1273
|
-
]);
|
|
1274
|
-
usedCorrespodings.forEach((corresp) => {
|
|
1275
|
-
this.appendCorrespondingToElement(corresp, authorNotesEl);
|
|
1276
|
-
});
|
|
1277
|
-
const authorNotes = (_a = (0, json_schema_1.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1278
|
-
if (authorNotes) {
|
|
1279
|
-
authorNotes.containedObjectIDs.forEach((id) => {
|
|
1280
|
-
const model = this.modelMap.get(id);
|
|
1281
|
-
if (!model) {
|
|
1282
|
-
return;
|
|
1283
|
-
}
|
|
1284
|
-
if (id.startsWith('MPParagraphElement')) {
|
|
1285
|
-
this.appendParagraphToElement(model, authorNotesEl);
|
|
1286
|
-
}
|
|
1287
|
-
else if (id.startsWith('MPFootnote')) {
|
|
1288
|
-
this.appendFootnoteToElement(model, authorNotesEl);
|
|
1289
|
-
}
|
|
1290
|
-
});
|
|
1291
|
-
}
|
|
1269
|
+
const authorNotesEl = this.createAuthorNotesElement();
|
|
1292
1270
|
if (authorNotesEl.childNodes.length > 0) {
|
|
1293
1271
|
articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
|
|
1294
1272
|
}
|
|
1295
1273
|
}
|
|
1296
1274
|
};
|
|
1275
|
+
this.createAuthorNotesElement = () => {
|
|
1276
|
+
var _a;
|
|
1277
|
+
const authorNotesEl = this.document.createElement('author-notes');
|
|
1278
|
+
const authorNotes = (_a = (0, json_schema_1.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1279
|
+
if (authorNotes) {
|
|
1280
|
+
this.appendModelsToAuthorNotes(authorNotesEl, authorNotes.containedObjectIDs);
|
|
1281
|
+
}
|
|
1282
|
+
return authorNotesEl;
|
|
1283
|
+
};
|
|
1297
1284
|
this.appendCorrespondingToElement = (corresponding, element) => {
|
|
1298
1285
|
const correspondingEl = this.document.createElement('corresp');
|
|
1299
1286
|
correspondingEl.setAttribute('id', normalizeID(corresponding._id));
|
|
@@ -1623,6 +1610,29 @@ class JATSExporter {
|
|
|
1623
1610
|
return mathml;
|
|
1624
1611
|
}
|
|
1625
1612
|
}
|
|
1613
|
+
appendModelsToAuthorNotes(authorNotesEl, containedObjectIDs) {
|
|
1614
|
+
const contributors = this.models.filter(isContributor);
|
|
1615
|
+
const usedCorrespondings = this.getUsedCorrespondings(contributors);
|
|
1616
|
+
containedObjectIDs.forEach((id) => {
|
|
1617
|
+
const model = this.modelMap.get(id);
|
|
1618
|
+
if (!model) {
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1621
|
+
switch (model.objectType) {
|
|
1622
|
+
case json_schema_1.ObjectTypes.ParagraphElement:
|
|
1623
|
+
this.appendParagraphToElement(model, authorNotesEl);
|
|
1624
|
+
break;
|
|
1625
|
+
case json_schema_1.ObjectTypes.Footnote:
|
|
1626
|
+
this.appendFootnoteToElement(model, authorNotesEl);
|
|
1627
|
+
break;
|
|
1628
|
+
case json_schema_1.ObjectTypes.Corresponding:
|
|
1629
|
+
if (usedCorrespondings.includes(model)) {
|
|
1630
|
+
this.appendCorrespondingToElement(model, authorNotesEl);
|
|
1631
|
+
}
|
|
1632
|
+
break;
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1626
1636
|
getUsedCorrespondings(contributors) {
|
|
1627
1637
|
return contributors
|
|
1628
1638
|
.flatMap((c) => { var _a; return (_a = c.corresp) !== null && _a !== void 0 ? _a : []; })
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -50,6 +50,7 @@ const comment_1 = require("./nodes/comment");
|
|
|
50
50
|
const comments_1 = require("./nodes/comments");
|
|
51
51
|
const contributor_1 = require("./nodes/contributor");
|
|
52
52
|
const contributors_1 = require("./nodes/contributors");
|
|
53
|
+
const corresp_1 = require("./nodes/corresp");
|
|
53
54
|
const cross_reference_1 = require("./nodes/cross_reference");
|
|
54
55
|
const doc_1 = require("./nodes/doc");
|
|
55
56
|
const equation_1 = require("./nodes/equation");
|
|
@@ -229,5 +230,6 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
229
230
|
supplements: supplements_1.supplements,
|
|
230
231
|
supplement: supplement_1.supplement,
|
|
231
232
|
author_notes: author_notes_1.authorNotes,
|
|
233
|
+
corresp: corresp_1.corresp,
|
|
232
234
|
},
|
|
233
235
|
});
|
|
@@ -36,67 +36,4 @@ exports.bibliographyItem = {
|
|
|
36
36
|
},
|
|
37
37
|
selectable: false,
|
|
38
38
|
group: 'block',
|
|
39
|
-
parseDOM: [
|
|
40
|
-
{
|
|
41
|
-
tag: 'div.csl-entry',
|
|
42
|
-
getAttrs: (p) => {
|
|
43
|
-
const dom = p;
|
|
44
|
-
return {
|
|
45
|
-
id: dom.getAttribute('id'),
|
|
46
|
-
type: dom.getAttribute('data-type'),
|
|
47
|
-
author: dom.getAttribute('data-author') || undefined,
|
|
48
|
-
issued: dom.getAttribute('data-issued') || undefined,
|
|
49
|
-
containerTitle: dom.getAttribute('data-container-title') || undefined,
|
|
50
|
-
doi: dom.getAttribute('data-doi') || undefined,
|
|
51
|
-
volume: dom.getAttribute('data-volume') || undefined,
|
|
52
|
-
issue: dom.getAttribute('data-issue') || undefined,
|
|
53
|
-
supplement: dom.getAttribute('data-supplement') || undefined,
|
|
54
|
-
page: dom.getAttribute('data-page') || undefined,
|
|
55
|
-
title: dom.getAttribute('data-title') || undefined,
|
|
56
|
-
literal: dom.getAttribute('data-literal') || undefined,
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
toDOM: (node) => {
|
|
62
|
-
const bibliographyItemNode = node;
|
|
63
|
-
const attrs = {};
|
|
64
|
-
attrs.class = 'csl-entry';
|
|
65
|
-
const { id, type, author, issued, containerTitle, doi, volume, issue, supplement, page, title, literal, } = bibliographyItemNode.attrs;
|
|
66
|
-
attrs.id = id;
|
|
67
|
-
if (type) {
|
|
68
|
-
attrs['data-type'] = type;
|
|
69
|
-
}
|
|
70
|
-
if (author) {
|
|
71
|
-
attrs['data-author'] = author.join(',');
|
|
72
|
-
}
|
|
73
|
-
if (issued) {
|
|
74
|
-
attrs['data-issued'] = issued;
|
|
75
|
-
}
|
|
76
|
-
if (containerTitle) {
|
|
77
|
-
attrs['data-container-title'] = containerTitle;
|
|
78
|
-
}
|
|
79
|
-
if (doi) {
|
|
80
|
-
attrs['data-doi'] = doi;
|
|
81
|
-
}
|
|
82
|
-
if (volume) {
|
|
83
|
-
attrs['data-volume'] = volume;
|
|
84
|
-
}
|
|
85
|
-
if (issue) {
|
|
86
|
-
attrs['data-issue'] = issue;
|
|
87
|
-
}
|
|
88
|
-
if (supplement) {
|
|
89
|
-
attrs['data-supplement'] = supplement;
|
|
90
|
-
}
|
|
91
|
-
if (page) {
|
|
92
|
-
attrs['data-page'] = page;
|
|
93
|
-
}
|
|
94
|
-
if (title) {
|
|
95
|
-
attrs['data-title'] = title;
|
|
96
|
-
}
|
|
97
|
-
if (literal) {
|
|
98
|
-
attrs['data-literal'] = literal;
|
|
99
|
-
}
|
|
100
|
-
return ['div', attrs, 0];
|
|
101
|
-
},
|
|
102
39
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.corresp = void 0;
|
|
4
|
+
exports.corresp = {
|
|
5
|
+
content: 'inline*',
|
|
6
|
+
attrs: {
|
|
7
|
+
id: { default: '' },
|
|
8
|
+
label: { default: undefined },
|
|
9
|
+
dataTracked: { default: null },
|
|
10
|
+
},
|
|
11
|
+
group: 'block',
|
|
12
|
+
toDOM: () => ['corresp', 0],
|
|
13
|
+
};
|
|
@@ -502,6 +502,15 @@ class Decoder {
|
|
|
502
502
|
id: model._id,
|
|
503
503
|
}, content);
|
|
504
504
|
},
|
|
505
|
+
[json_schema_1.ObjectTypes.Corresponding]: (data) => {
|
|
506
|
+
const model = data;
|
|
507
|
+
return this.parseContents(model.contents, 'corresp', [], {
|
|
508
|
+
topNode: schema_1.schema.nodes.corresp.create({
|
|
509
|
+
id: model._id,
|
|
510
|
+
label: model.label,
|
|
511
|
+
}),
|
|
512
|
+
});
|
|
513
|
+
},
|
|
505
514
|
[json_schema_1.ObjectTypes.Section]: (data) => {
|
|
506
515
|
const model = data;
|
|
507
516
|
const elements = [];
|
|
@@ -522,6 +522,10 @@ const encoders = {
|
|
|
522
522
|
? [node.attrs.mimeType, node.attrs.mimeSubType].join('/')
|
|
523
523
|
: '',
|
|
524
524
|
}),
|
|
525
|
+
corresp: (node) => ({
|
|
526
|
+
contents: (0, exports.inlineContents)(node),
|
|
527
|
+
label: node.attrs.label,
|
|
528
|
+
}),
|
|
525
529
|
};
|
|
526
530
|
const modelData = (node, parent, path, priority) => {
|
|
527
531
|
const encoder = encoders[node.type.name];
|
|
@@ -62,6 +62,7 @@ exports.nodeTypesMap = new Map([
|
|
|
62
62
|
[schema_1.schema.nodes.title, json_schema_1.ObjectTypes.Titles],
|
|
63
63
|
[schema_1.schema.nodes.supplement, json_schema_1.ObjectTypes.Supplement],
|
|
64
64
|
[schema_1.schema.nodes.author_notes, json_schema_1.ObjectTypes.AuthorNotes],
|
|
65
|
+
[schema_1.schema.nodes.corresp, json_schema_1.ObjectTypes.Corresponding],
|
|
65
66
|
]);
|
|
66
67
|
const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
|
|
67
68
|
exports.isExecutableNodeType = isExecutableNodeType;
|
|
@@ -609,6 +609,7 @@ export class JATSExporter {
|
|
|
609
609
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
610
610
|
const nodes = {
|
|
611
611
|
author_notes: () => ['author-notes', 0],
|
|
612
|
+
corresp: () => '',
|
|
612
613
|
title: () => '',
|
|
613
614
|
affiliations: () => '',
|
|
614
615
|
contributors: () => '',
|
|
@@ -1039,7 +1040,6 @@ export class JATSExporter {
|
|
|
1039
1040
|
}
|
|
1040
1041
|
};
|
|
1041
1042
|
this.buildContributors = (articleMeta) => {
|
|
1042
|
-
var _a;
|
|
1043
1043
|
const contributors = this.models.filter(isContributor);
|
|
1044
1044
|
const authorContributors = contributors
|
|
1045
1045
|
.filter((contributor) => contributor.role === 'author')
|
|
@@ -1258,34 +1258,21 @@ export class JATSExporter {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
});
|
|
1260
1260
|
}
|
|
1261
|
-
const authorNotesEl = this.
|
|
1262
|
-
const usedCorrespodings = this.getUsedCorrespondings([
|
|
1263
|
-
...authorContributors,
|
|
1264
|
-
...otherContributors,
|
|
1265
|
-
]);
|
|
1266
|
-
usedCorrespodings.forEach((corresp) => {
|
|
1267
|
-
this.appendCorrespondingToElement(corresp, authorNotesEl);
|
|
1268
|
-
});
|
|
1269
|
-
const authorNotes = (_a = getModelsByType(this.modelMap, ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1270
|
-
if (authorNotes) {
|
|
1271
|
-
authorNotes.containedObjectIDs.forEach((id) => {
|
|
1272
|
-
const model = this.modelMap.get(id);
|
|
1273
|
-
if (!model) {
|
|
1274
|
-
return;
|
|
1275
|
-
}
|
|
1276
|
-
if (id.startsWith('MPParagraphElement')) {
|
|
1277
|
-
this.appendParagraphToElement(model, authorNotesEl);
|
|
1278
|
-
}
|
|
1279
|
-
else if (id.startsWith('MPFootnote')) {
|
|
1280
|
-
this.appendFootnoteToElement(model, authorNotesEl);
|
|
1281
|
-
}
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1261
|
+
const authorNotesEl = this.createAuthorNotesElement();
|
|
1284
1262
|
if (authorNotesEl.childNodes.length > 0) {
|
|
1285
1263
|
articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
|
|
1286
1264
|
}
|
|
1287
1265
|
}
|
|
1288
1266
|
};
|
|
1267
|
+
this.createAuthorNotesElement = () => {
|
|
1268
|
+
var _a;
|
|
1269
|
+
const authorNotesEl = this.document.createElement('author-notes');
|
|
1270
|
+
const authorNotes = (_a = getModelsByType(this.modelMap, ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1271
|
+
if (authorNotes) {
|
|
1272
|
+
this.appendModelsToAuthorNotes(authorNotesEl, authorNotes.containedObjectIDs);
|
|
1273
|
+
}
|
|
1274
|
+
return authorNotesEl;
|
|
1275
|
+
};
|
|
1289
1276
|
this.appendCorrespondingToElement = (corresponding, element) => {
|
|
1290
1277
|
const correspondingEl = this.document.createElement('corresp');
|
|
1291
1278
|
correspondingEl.setAttribute('id', normalizeID(corresponding._id));
|
|
@@ -1615,6 +1602,29 @@ export class JATSExporter {
|
|
|
1615
1602
|
return mathml;
|
|
1616
1603
|
}
|
|
1617
1604
|
}
|
|
1605
|
+
appendModelsToAuthorNotes(authorNotesEl, containedObjectIDs) {
|
|
1606
|
+
const contributors = this.models.filter(isContributor);
|
|
1607
|
+
const usedCorrespondings = this.getUsedCorrespondings(contributors);
|
|
1608
|
+
containedObjectIDs.forEach((id) => {
|
|
1609
|
+
const model = this.modelMap.get(id);
|
|
1610
|
+
if (!model) {
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
switch (model.objectType) {
|
|
1614
|
+
case ObjectTypes.ParagraphElement:
|
|
1615
|
+
this.appendParagraphToElement(model, authorNotesEl);
|
|
1616
|
+
break;
|
|
1617
|
+
case ObjectTypes.Footnote:
|
|
1618
|
+
this.appendFootnoteToElement(model, authorNotesEl);
|
|
1619
|
+
break;
|
|
1620
|
+
case ObjectTypes.Corresponding:
|
|
1621
|
+
if (usedCorrespondings.includes(model)) {
|
|
1622
|
+
this.appendCorrespondingToElement(model, authorNotesEl);
|
|
1623
|
+
}
|
|
1624
|
+
break;
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1618
1628
|
getUsedCorrespondings(contributors) {
|
|
1619
1629
|
return contributors
|
|
1620
1630
|
.flatMap((c) => { var _a; return (_a = c.corresp) !== null && _a !== void 0 ? _a : []; })
|
package/dist/es/schema/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import { comment } from './nodes/comment';
|
|
|
33
33
|
import { comments } from './nodes/comments';
|
|
34
34
|
import { contributor } from './nodes/contributor';
|
|
35
35
|
import { contributors } from './nodes/contributors';
|
|
36
|
+
import { corresp } from './nodes/corresp';
|
|
36
37
|
import { crossReference } from './nodes/cross_reference';
|
|
37
38
|
import { doc } from './nodes/doc';
|
|
38
39
|
import { equation } from './nodes/equation';
|
|
@@ -212,5 +213,6 @@ export const schema = new Schema({
|
|
|
212
213
|
supplements,
|
|
213
214
|
supplement,
|
|
214
215
|
author_notes: authorNotes,
|
|
216
|
+
corresp,
|
|
215
217
|
},
|
|
216
218
|
});
|
|
@@ -33,67 +33,4 @@ export const bibliographyItem = {
|
|
|
33
33
|
},
|
|
34
34
|
selectable: false,
|
|
35
35
|
group: 'block',
|
|
36
|
-
parseDOM: [
|
|
37
|
-
{
|
|
38
|
-
tag: 'div.csl-entry',
|
|
39
|
-
getAttrs: (p) => {
|
|
40
|
-
const dom = p;
|
|
41
|
-
return {
|
|
42
|
-
id: dom.getAttribute('id'),
|
|
43
|
-
type: dom.getAttribute('data-type'),
|
|
44
|
-
author: dom.getAttribute('data-author') || undefined,
|
|
45
|
-
issued: dom.getAttribute('data-issued') || undefined,
|
|
46
|
-
containerTitle: dom.getAttribute('data-container-title') || undefined,
|
|
47
|
-
doi: dom.getAttribute('data-doi') || undefined,
|
|
48
|
-
volume: dom.getAttribute('data-volume') || undefined,
|
|
49
|
-
issue: dom.getAttribute('data-issue') || undefined,
|
|
50
|
-
supplement: dom.getAttribute('data-supplement') || undefined,
|
|
51
|
-
page: dom.getAttribute('data-page') || undefined,
|
|
52
|
-
title: dom.getAttribute('data-title') || undefined,
|
|
53
|
-
literal: dom.getAttribute('data-literal') || undefined,
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
toDOM: (node) => {
|
|
59
|
-
const bibliographyItemNode = node;
|
|
60
|
-
const attrs = {};
|
|
61
|
-
attrs.class = 'csl-entry';
|
|
62
|
-
const { id, type, author, issued, containerTitle, doi, volume, issue, supplement, page, title, literal, } = bibliographyItemNode.attrs;
|
|
63
|
-
attrs.id = id;
|
|
64
|
-
if (type) {
|
|
65
|
-
attrs['data-type'] = type;
|
|
66
|
-
}
|
|
67
|
-
if (author) {
|
|
68
|
-
attrs['data-author'] = author.join(',');
|
|
69
|
-
}
|
|
70
|
-
if (issued) {
|
|
71
|
-
attrs['data-issued'] = issued;
|
|
72
|
-
}
|
|
73
|
-
if (containerTitle) {
|
|
74
|
-
attrs['data-container-title'] = containerTitle;
|
|
75
|
-
}
|
|
76
|
-
if (doi) {
|
|
77
|
-
attrs['data-doi'] = doi;
|
|
78
|
-
}
|
|
79
|
-
if (volume) {
|
|
80
|
-
attrs['data-volume'] = volume;
|
|
81
|
-
}
|
|
82
|
-
if (issue) {
|
|
83
|
-
attrs['data-issue'] = issue;
|
|
84
|
-
}
|
|
85
|
-
if (supplement) {
|
|
86
|
-
attrs['data-supplement'] = supplement;
|
|
87
|
-
}
|
|
88
|
-
if (page) {
|
|
89
|
-
attrs['data-page'] = page;
|
|
90
|
-
}
|
|
91
|
-
if (title) {
|
|
92
|
-
attrs['data-title'] = title;
|
|
93
|
-
}
|
|
94
|
-
if (literal) {
|
|
95
|
-
attrs['data-literal'] = literal;
|
|
96
|
-
}
|
|
97
|
-
return ['div', attrs, 0];
|
|
98
|
-
},
|
|
99
36
|
};
|
|
@@ -493,6 +493,15 @@ export class Decoder {
|
|
|
493
493
|
id: model._id,
|
|
494
494
|
}, content);
|
|
495
495
|
},
|
|
496
|
+
[ObjectTypes.Corresponding]: (data) => {
|
|
497
|
+
const model = data;
|
|
498
|
+
return this.parseContents(model.contents, 'corresp', [], {
|
|
499
|
+
topNode: schema.nodes.corresp.create({
|
|
500
|
+
id: model._id,
|
|
501
|
+
label: model.label,
|
|
502
|
+
}),
|
|
503
|
+
});
|
|
504
|
+
},
|
|
496
505
|
[ObjectTypes.Section]: (data) => {
|
|
497
506
|
const model = data;
|
|
498
507
|
const elements = [];
|
|
@@ -514,6 +514,10 @@ const encoders = {
|
|
|
514
514
|
? [node.attrs.mimeType, node.attrs.mimeSubType].join('/')
|
|
515
515
|
: '',
|
|
516
516
|
}),
|
|
517
|
+
corresp: (node) => ({
|
|
518
|
+
contents: inlineContents(node),
|
|
519
|
+
label: node.attrs.label,
|
|
520
|
+
}),
|
|
517
521
|
};
|
|
518
522
|
const modelData = (node, parent, path, priority) => {
|
|
519
523
|
const encoder = encoders[node.type.name];
|
|
@@ -59,6 +59,7 @@ export const nodeTypesMap = new Map([
|
|
|
59
59
|
[schema.nodes.title, ObjectTypes.Titles],
|
|
60
60
|
[schema.nodes.supplement, ObjectTypes.Supplement],
|
|
61
61
|
[schema.nodes.author_notes, ObjectTypes.AuthorNotes],
|
|
62
|
+
[schema.nodes.corresp, ObjectTypes.Corresponding],
|
|
62
63
|
]);
|
|
63
64
|
export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
|
|
64
65
|
export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
|
|
@@ -87,6 +87,8 @@ export declare class JATSExporter {
|
|
|
87
87
|
protected serializeNode: (node: ManuscriptNode) => Node;
|
|
88
88
|
private validateContributor;
|
|
89
89
|
private buildContributors;
|
|
90
|
+
private createAuthorNotesElement;
|
|
91
|
+
private appendModelsToAuthorNotes;
|
|
90
92
|
private appendCorrespondingToElement;
|
|
91
93
|
private getUsedCorrespondings;
|
|
92
94
|
private appendParagraphToElement;
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { BibliographicDate, BibliographicName } from '@manuscripts/json-schema';
|
|
16
17
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
18
|
import { ManuscriptNode } from '../types';
|
|
18
19
|
interface Attrs {
|
|
19
20
|
id: string;
|
|
20
21
|
type: string;
|
|
21
|
-
author?:
|
|
22
|
-
issued?:
|
|
22
|
+
author?: BibliographicName[];
|
|
23
|
+
issued?: BibliographicDate;
|
|
23
24
|
containerTitle?: string;
|
|
24
25
|
doi?: string;
|
|
25
26
|
volume?: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
+
import { ManuscriptNode } from '../types';
|
|
3
|
+
interface Attrs {
|
|
4
|
+
id: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CorrespNode extends ManuscriptNode {
|
|
8
|
+
attrs: Attrs;
|
|
9
|
+
}
|
|
10
|
+
export declare const corresp: NodeSpec;
|
|
11
|
+
export {};
|
|
@@ -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_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes';
|
|
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_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
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.2.
|
|
4
|
+
"version": "2.2.2-LEAN-3514.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|