@manuscripts/transform 2.1.3-LEAN-3376-5 → 2.1.3-LEAN-3376-7
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 +0 -1
- package/dist/cjs/jats/jats-exporter.js +21 -7
- package/dist/cjs/transformer/decode.js +1 -3
- package/dist/es/jats/importer/jats-front-parser.js +0 -1
- package/dist/es/jats/jats-exporter.js +21 -7
- package/dist/es/transformer/decode.js +1 -3
- package/dist/types/jats/jats-exporter.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1278,9 +1278,16 @@ class JATSExporter {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
});
|
|
1280
1280
|
}
|
|
1281
|
+
const authorNotesEl = this.document.createElement('author-notes');
|
|
1282
|
+
const usedCorrespodings = this.getUsedCorrespondings([
|
|
1283
|
+
...authorContributors,
|
|
1284
|
+
...otherContributors,
|
|
1285
|
+
]);
|
|
1286
|
+
usedCorrespodings.forEach((corresp) => {
|
|
1287
|
+
this.appendCorrespondingToElement(corresp, authorNotesEl);
|
|
1288
|
+
});
|
|
1281
1289
|
const authorNotes = (_a = (0, json_schema_1.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1282
1290
|
if (authorNotes) {
|
|
1283
|
-
const authorNotesEl = this.document.createElement('author-notes');
|
|
1284
1291
|
authorNotes.containedObjectIDs.forEach((id) => {
|
|
1285
1292
|
const model = this.modelMap.get(id);
|
|
1286
1293
|
if (!model) {
|
|
@@ -1292,13 +1299,10 @@ class JATSExporter {
|
|
|
1292
1299
|
else if (id.startsWith('MPFootnote')) {
|
|
1293
1300
|
this.appendFootnoteToElement(model, authorNotesEl);
|
|
1294
1301
|
}
|
|
1295
|
-
else if (id.startsWith('MPCorrepsonding')) {
|
|
1296
|
-
this.appendCorrespondingToElement(model, authorNotesEl);
|
|
1297
|
-
}
|
|
1298
1302
|
});
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1303
|
+
}
|
|
1304
|
+
if (authorNotesEl.childNodes.length > 0) {
|
|
1305
|
+
articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
|
|
1302
1306
|
}
|
|
1303
1307
|
}
|
|
1304
1308
|
};
|
|
@@ -1313,6 +1317,16 @@ class JATSExporter {
|
|
|
1313
1317
|
correspondingEl.append(corresponding.contents);
|
|
1314
1318
|
element.appendChild(correspondingEl);
|
|
1315
1319
|
};
|
|
1320
|
+
this.getUsedCorrespondings = (contributors) => {
|
|
1321
|
+
const correspodings = (0, json_schema_1.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.Corresponding);
|
|
1322
|
+
const ids = [];
|
|
1323
|
+
contributors.forEach((contributor) => {
|
|
1324
|
+
if (contributor.corresp) {
|
|
1325
|
+
ids.push(...contributor.corresp.map((corresp) => corresp.correspID));
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
return correspodings.filter((corresp) => ids.includes(corresp._id));
|
|
1329
|
+
};
|
|
1316
1330
|
this.appendParagraphToElement = (paragraph, element) => {
|
|
1317
1331
|
const paragraphEl = this.document.createElement('p');
|
|
1318
1332
|
paragraphEl.setAttribute('id', normalizeID(paragraph._id));
|
|
@@ -499,9 +499,7 @@ class Decoder {
|
|
|
499
499
|
},
|
|
500
500
|
[json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
|
|
501
501
|
const model = data;
|
|
502
|
-
const content = model.containedObjectIDs
|
|
503
|
-
.filter((id) => !id.startsWith('MPCorresponding'))
|
|
504
|
-
.map((id) => this.decode(this.modelMap.get(id)));
|
|
502
|
+
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
505
503
|
return schema_1.schema.nodes.author_notes.create({
|
|
506
504
|
id: model._id,
|
|
507
505
|
}, content);
|
|
@@ -1270,9 +1270,16 @@ export class JATSExporter {
|
|
|
1270
1270
|
}
|
|
1271
1271
|
});
|
|
1272
1272
|
}
|
|
1273
|
+
const authorNotesEl = this.document.createElement('author-notes');
|
|
1274
|
+
const usedCorrespodings = this.getUsedCorrespondings([
|
|
1275
|
+
...authorContributors,
|
|
1276
|
+
...otherContributors,
|
|
1277
|
+
]);
|
|
1278
|
+
usedCorrespodings.forEach((corresp) => {
|
|
1279
|
+
this.appendCorrespondingToElement(corresp, authorNotesEl);
|
|
1280
|
+
});
|
|
1273
1281
|
const authorNotes = (_a = getModelsByType(this.modelMap, ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1274
1282
|
if (authorNotes) {
|
|
1275
|
-
const authorNotesEl = this.document.createElement('author-notes');
|
|
1276
1283
|
authorNotes.containedObjectIDs.forEach((id) => {
|
|
1277
1284
|
const model = this.modelMap.get(id);
|
|
1278
1285
|
if (!model) {
|
|
@@ -1284,13 +1291,10 @@ export class JATSExporter {
|
|
|
1284
1291
|
else if (id.startsWith('MPFootnote')) {
|
|
1285
1292
|
this.appendFootnoteToElement(model, authorNotesEl);
|
|
1286
1293
|
}
|
|
1287
|
-
else if (id.startsWith('MPCorrepsonding')) {
|
|
1288
|
-
this.appendCorrespondingToElement(model, authorNotesEl);
|
|
1289
|
-
}
|
|
1290
1294
|
});
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1295
|
+
}
|
|
1296
|
+
if (authorNotesEl.childNodes.length > 0) {
|
|
1297
|
+
articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
|
|
1294
1298
|
}
|
|
1295
1299
|
}
|
|
1296
1300
|
};
|
|
@@ -1305,6 +1309,16 @@ export class JATSExporter {
|
|
|
1305
1309
|
correspondingEl.append(corresponding.contents);
|
|
1306
1310
|
element.appendChild(correspondingEl);
|
|
1307
1311
|
};
|
|
1312
|
+
this.getUsedCorrespondings = (contributors) => {
|
|
1313
|
+
const correspodings = getModelsByType(this.modelMap, ObjectTypes.Corresponding);
|
|
1314
|
+
const ids = [];
|
|
1315
|
+
contributors.forEach((contributor) => {
|
|
1316
|
+
if (contributor.corresp) {
|
|
1317
|
+
ids.push(...contributor.corresp.map((corresp) => corresp.correspID));
|
|
1318
|
+
}
|
|
1319
|
+
});
|
|
1320
|
+
return correspodings.filter((corresp) => ids.includes(corresp._id));
|
|
1321
|
+
};
|
|
1308
1322
|
this.appendParagraphToElement = (paragraph, element) => {
|
|
1309
1323
|
const paragraphEl = this.document.createElement('p');
|
|
1310
1324
|
paragraphEl.setAttribute('id', normalizeID(paragraph._id));
|
|
@@ -490,9 +490,7 @@ export class Decoder {
|
|
|
490
490
|
},
|
|
491
491
|
[ObjectTypes.AuthorNotes]: (data) => {
|
|
492
492
|
const model = data;
|
|
493
|
-
const content = model.containedObjectIDs
|
|
494
|
-
.filter((id) => !id.startsWith('MPCorresponding'))
|
|
495
|
-
.map((id) => this.decode(this.modelMap.get(id)));
|
|
493
|
+
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
496
494
|
return schema.nodes.author_notes.create({
|
|
497
495
|
id: model._id,
|
|
498
496
|
}, content);
|
|
@@ -87,6 +87,7 @@ export declare class JATSExporter {
|
|
|
87
87
|
private validateContributor;
|
|
88
88
|
private buildContributors;
|
|
89
89
|
private appendCorrespondingToElement;
|
|
90
|
+
private getUsedCorrespondings;
|
|
90
91
|
private appendParagraphToElement;
|
|
91
92
|
private appendFootnoteToElement;
|
|
92
93
|
private buildKeywords;
|
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.3-LEAN-3376-
|
|
4
|
+
"version": "2.1.3-LEAN-3376-7",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|