@manuscripts/transform 4.2.14 → 4.2.15
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/__tests__/jats-importer.test.js +1 -1
- package/dist/cjs/jats/exporter/jats-exporter.js +21 -25
- package/dist/cjs/jats/importer/jats-dom-parser.js +1 -2
- package/dist/cjs/jats/importer/jats-transformations.js +2 -2
- package/dist/cjs/schema/migration/migration-scripts/3.0.56.js +1 -1
- package/dist/cjs/schema/migration/migration-scripts/4.2.15.js +22 -0
- package/dist/cjs/schema/migration/migration-scripts/index.js +2 -0
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/schema/nodes/supplement.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/__tests__/jats-importer.test.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +21 -25
- package/dist/es/jats/importer/jats-dom-parser.js +1 -2
- package/dist/es/jats/importer/jats-transformations.js +2 -2
- package/dist/es/schema/migration/migration-scripts/3.0.56.js +1 -1
- package/dist/es/schema/migration/migration-scripts/4.2.15.js +20 -0
- package/dist/es/schema/migration/migration-scripts/index.js +2 -0
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/schema/nodes/supplement.js +1 -1
- package/dist/es/version.js +1 -1
- package/dist/types/jats/exporter/jats-exporter.d.ts +1 -0
- package/dist/types/schema/migration/migration-scripts/4.2.15.d.ts +8 -0
- package/dist/types/schema/migration/migration-scripts/index.d.ts +2 -1
- package/dist/types/schema/nodes/supplement.d.ts +0 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -174,7 +174,7 @@ describe('JATS importer', () => {
|
|
|
174
174
|
const jats = await (0, files_1.readAndParseFixture)('jats-import.xml');
|
|
175
175
|
const { node } = (0, parse_jats_article_1.parseJATSArticle)(jats, section_categories_1.sectionCategories);
|
|
176
176
|
const supplementsNode = (0, utils_1.findNodeByType)(node, schema_1.schema.nodes.supplement);
|
|
177
|
-
(0, utils_1.
|
|
177
|
+
(0, utils_1.changeIDs)(supplementsNode);
|
|
178
178
|
expect(supplementsNode).toMatchSnapshot();
|
|
179
179
|
});
|
|
180
180
|
it('should not have supplements node if supplementary-material elements do not exist', async () => {
|
|
@@ -160,6 +160,12 @@ class JATSExporter {
|
|
|
160
160
|
await this.rewriteIDs();
|
|
161
161
|
return (0, w3c_xmlserializer_1.default)(this.document);
|
|
162
162
|
};
|
|
163
|
+
this.appendChildNodeOfType = (element, node, type) => {
|
|
164
|
+
const childNode = this.getFirstChildOfType(type, node);
|
|
165
|
+
if (childNode) {
|
|
166
|
+
element.appendChild(this.serializeNode(childNode));
|
|
167
|
+
}
|
|
168
|
+
};
|
|
163
169
|
this.initCiteprocEngine = (csl) => {
|
|
164
170
|
const bibitems = new Map();
|
|
165
171
|
const citations = new Map();
|
|
@@ -328,11 +334,7 @@ class JATSExporter {
|
|
|
328
334
|
supplementaryMaterial.setAttributeNS(xml_1.XLINK_NAMESPACE, 'href', node.attrs.href ?? '');
|
|
329
335
|
supplementaryMaterial.setAttribute('mimetype', node.attrs.mimeType ?? '');
|
|
330
336
|
supplementaryMaterial.setAttribute('mime-subtype', node.attrs.mimeSubType ?? '');
|
|
331
|
-
|
|
332
|
-
const title = this.createElement('title');
|
|
333
|
-
title.textContent = node.attrs.title ?? '';
|
|
334
|
-
caption.append(title);
|
|
335
|
-
supplementaryMaterial.append(caption);
|
|
337
|
+
this.appendChildNodeOfType(supplementaryMaterial, node, schema_1.schema.nodes.figcaption);
|
|
336
338
|
articleMeta.append(supplementaryMaterial);
|
|
337
339
|
});
|
|
338
340
|
const history = articleMeta.querySelector('history') || this.createElement('history');
|
|
@@ -526,9 +528,9 @@ class JATSExporter {
|
|
|
526
528
|
mediaElement.setAttribute('mime-subtype', node.attrs.mimeSubtype);
|
|
527
529
|
}
|
|
528
530
|
appendLabels(mediaElement, node);
|
|
529
|
-
appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.alt_text);
|
|
530
|
-
appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.long_desc);
|
|
531
|
-
appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.figcaption);
|
|
531
|
+
this.appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.alt_text);
|
|
532
|
+
this.appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.long_desc);
|
|
533
|
+
this.appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.figcaption);
|
|
532
534
|
return mediaElement;
|
|
533
535
|
},
|
|
534
536
|
awards: () => ['funding-group', 0],
|
|
@@ -868,12 +870,6 @@ class JATSExporter {
|
|
|
868
870
|
element.appendChild(attribution);
|
|
869
871
|
}
|
|
870
872
|
};
|
|
871
|
-
const appendChildNodeOfType = (element, node, type) => {
|
|
872
|
-
const childNode = this.getFirstChildOfType(type, node);
|
|
873
|
-
if (childNode) {
|
|
874
|
-
element.appendChild(this.serializeNode(childNode));
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
873
|
const appendTable = (element, node) => {
|
|
878
874
|
const tableNode = this.getFirstChildOfType(schema_1.schema.nodes.table, node);
|
|
879
875
|
const colGroupNode = this.getFirstChildOfType(schema_1.schema.nodes.table_colgroup, node);
|
|
@@ -899,7 +895,7 @@ class JATSExporter {
|
|
|
899
895
|
appendLabels(element, node);
|
|
900
896
|
const child = node.firstChild;
|
|
901
897
|
if (child?.type === schema_1.schema.nodes.figcaption) {
|
|
902
|
-
appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
898
|
+
this.appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
903
899
|
}
|
|
904
900
|
processChildNodes(element, node, node.type.schema.nodes.section);
|
|
905
901
|
return element;
|
|
@@ -921,8 +917,8 @@ class JATSExporter {
|
|
|
921
917
|
const extLink = this.appendElement(graphicElement, 'ext-link');
|
|
922
918
|
extLink.setAttributeNS(xml_1.XLINK_NAMESPACE, 'href', node.attrs.extLink);
|
|
923
919
|
}
|
|
924
|
-
appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.alt_text);
|
|
925
|
-
appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.long_desc);
|
|
920
|
+
this.appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.alt_text);
|
|
921
|
+
this.appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.long_desc);
|
|
926
922
|
return graphicElement;
|
|
927
923
|
};
|
|
928
924
|
const createGraphic = (node) => {
|
|
@@ -945,10 +941,10 @@ class JATSExporter {
|
|
|
945
941
|
element.setAttribute('fig-type', figType);
|
|
946
942
|
}
|
|
947
943
|
appendLabels(element, node);
|
|
948
|
-
appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
949
|
-
appendChildNodeOfType(element, node, schema_1.schema.nodes.alt_text);
|
|
950
|
-
appendChildNodeOfType(element, node, schema_1.schema.nodes.long_desc);
|
|
951
|
-
appendChildNodeOfType(element, node, node.type.schema.nodes.footnotes_element);
|
|
944
|
+
this.appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
945
|
+
this.appendChildNodeOfType(element, node, schema_1.schema.nodes.alt_text);
|
|
946
|
+
this.appendChildNodeOfType(element, node, schema_1.schema.nodes.long_desc);
|
|
947
|
+
this.appendChildNodeOfType(element, node, node.type.schema.nodes.footnotes_element);
|
|
952
948
|
processChildNodes(element, node, contentNodeType);
|
|
953
949
|
appendAttributions(element, node);
|
|
954
950
|
if ((0, transformer_1.isExecutableNodeType)(node.type)) {
|
|
@@ -960,11 +956,11 @@ class JATSExporter {
|
|
|
960
956
|
const nodeName = 'table-wrap';
|
|
961
957
|
const element = createElement(node, nodeName);
|
|
962
958
|
appendLabels(element, node);
|
|
963
|
-
appendChildNodeOfType(element, node, schema_1.schema.nodes.figcaption);
|
|
964
|
-
appendChildNodeOfType(element, node, schema_1.schema.nodes.alt_text);
|
|
965
|
-
appendChildNodeOfType(element, node, schema_1.schema.nodes.long_desc);
|
|
959
|
+
this.appendChildNodeOfType(element, node, schema_1.schema.nodes.figcaption);
|
|
960
|
+
this.appendChildNodeOfType(element, node, schema_1.schema.nodes.alt_text);
|
|
961
|
+
this.appendChildNodeOfType(element, node, schema_1.schema.nodes.long_desc);
|
|
966
962
|
appendTable(element, node);
|
|
967
|
-
appendChildNodeOfType(element, node, node.type.schema.nodes.table_element_footer);
|
|
963
|
+
this.appendChildNodeOfType(element, node, node.type.schema.nodes.table_element_footer);
|
|
968
964
|
if ((0, transformer_1.isExecutableNodeType)(node.type)) {
|
|
969
965
|
processExecutableNode(node, element);
|
|
970
966
|
}
|
|
@@ -476,7 +476,7 @@ class JATSDOMParser {
|
|
|
476
476
|
{
|
|
477
477
|
tag: 'caption',
|
|
478
478
|
node: 'figcaption',
|
|
479
|
-
context: 'figure_element/|table_element/|embed/',
|
|
479
|
+
context: 'figure_element/|table_element/|embed/|supplement/',
|
|
480
480
|
getContent: (node, schema) => {
|
|
481
481
|
const element = node;
|
|
482
482
|
const content = [];
|
|
@@ -776,7 +776,6 @@ class JATSDOMParser {
|
|
|
776
776
|
href: element.getAttributeNS(xml_1.XLINK_NAMESPACE, 'href'),
|
|
777
777
|
mimeType: element.getAttribute('mimetype'),
|
|
778
778
|
mimeSubType: element.getAttribute('mime-subtype'),
|
|
779
|
-
title: (0, utils_1.getTrimmedTextContent)(element, 'title'),
|
|
780
779
|
};
|
|
781
780
|
},
|
|
782
781
|
},
|
|
@@ -27,7 +27,7 @@ const createSectionGroup = (type, createElement) => {
|
|
|
27
27
|
return sec;
|
|
28
28
|
};
|
|
29
29
|
const addMissingCaptions = (doc, createElement) => {
|
|
30
|
-
const elements = doc.querySelectorAll('fig, table-wrap, media');
|
|
30
|
+
const elements = doc.querySelectorAll('fig, table-wrap, media, supplementary-material');
|
|
31
31
|
for (const element of elements) {
|
|
32
32
|
let caption = element.querySelector('caption');
|
|
33
33
|
if (!caption) {
|
|
@@ -339,7 +339,7 @@ const createSupplementaryMaterialsSection = (document, body, createElement) => {
|
|
|
339
339
|
title.textContent = 'Supplementary Material';
|
|
340
340
|
section.append(title);
|
|
341
341
|
section.append(...suppls);
|
|
342
|
-
body.
|
|
342
|
+
body.append(section);
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
345
|
exports.createSupplementaryMaterialsSection = createSupplementaryMaterialsSection;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const __1 = require("../..");
|
|
4
|
+
class Migration4215 {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.fromVersion = '4.2.14';
|
|
7
|
+
this.toVersion = '4.2.15';
|
|
8
|
+
}
|
|
9
|
+
migrateNode(node) {
|
|
10
|
+
if (node.type !== __1.schema.nodes.manuscript.name || !node.content) {
|
|
11
|
+
return node;
|
|
12
|
+
}
|
|
13
|
+
const supplementsNode = node.content.find((child) => child.type === __1.schema.nodes.supplements.name);
|
|
14
|
+
if (supplementsNode) {
|
|
15
|
+
node.content = node.content.filter((child) => child.type !== __1.schema.nodes.supplements.name);
|
|
16
|
+
const backmatterIndex = node.content.findIndex((child) => child.type === __1.schema.nodes.backmatter.name);
|
|
17
|
+
node.content.splice(backmatterIndex + 1, 0, supplementsNode);
|
|
18
|
+
}
|
|
19
|
+
return node;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = Migration4215;
|
|
@@ -28,6 +28,7 @@ const _3_0_41_1 = __importDefault(require("./3.0.41"));
|
|
|
28
28
|
const _3_0_55_1 = __importDefault(require("./3.0.55"));
|
|
29
29
|
const _3_0_56_1 = __importDefault(require("./3.0.56"));
|
|
30
30
|
const _4_2_13_1 = __importDefault(require("./4.2.13"));
|
|
31
|
+
const _4_2_15_1 = __importDefault(require("./4.2.15"));
|
|
31
32
|
const migrations = [
|
|
32
33
|
new _1_2_5_1.default(),
|
|
33
34
|
new _2_3_22_1.default(),
|
|
@@ -39,5 +40,6 @@ const migrations = [
|
|
|
39
40
|
new _3_0_55_1.default(),
|
|
40
41
|
new _3_0_56_1.default(),
|
|
41
42
|
new _4_2_13_1.default(),
|
|
43
|
+
new _4_2_15_1.default(),
|
|
42
44
|
];
|
|
43
45
|
exports.default = migrations;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isManuscriptNode = exports.manuscript = void 0;
|
|
19
19
|
exports.manuscript = {
|
|
20
|
-
content: 'title subtitles? alt_titles? contributors? affiliations? author_notes? awards? keywords?
|
|
20
|
+
content: 'title subtitles? alt_titles? contributors? affiliations? author_notes? awards? keywords? abstracts body backmatter supplements? hero_image? comments attachments?',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
doi: { default: '' },
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.supplement = void 0;
|
|
19
19
|
exports.supplement = {
|
|
20
|
+
content: 'figcaption?',
|
|
20
21
|
attrs: {
|
|
21
22
|
id: { default: '' },
|
|
22
23
|
href: { default: '' },
|
|
23
24
|
mimeType: { default: '' },
|
|
24
25
|
mimeSubType: { default: '' },
|
|
25
|
-
title: { default: '' },
|
|
26
26
|
dataTracked: { default: null },
|
|
27
27
|
},
|
|
28
28
|
group: 'block',
|
package/dist/cjs/version.js
CHANGED
|
@@ -172,7 +172,7 @@ describe('JATS importer', () => {
|
|
|
172
172
|
const jats = await readAndParseFixture('jats-import.xml');
|
|
173
173
|
const { node } = parseJATSArticle(jats, sectionCategories);
|
|
174
174
|
const supplementsNode = findNodeByType(node, schema.nodes.supplement);
|
|
175
|
-
|
|
175
|
+
changeIDs(supplementsNode);
|
|
176
176
|
expect(supplementsNode).toMatchSnapshot();
|
|
177
177
|
});
|
|
178
178
|
it('should not have supplements node if supplementary-material elements do not exist', async () => {
|
|
@@ -120,6 +120,12 @@ export class JATSExporter {
|
|
|
120
120
|
await this.rewriteIDs();
|
|
121
121
|
return serializeToXML(this.document);
|
|
122
122
|
};
|
|
123
|
+
this.appendChildNodeOfType = (element, node, type) => {
|
|
124
|
+
const childNode = this.getFirstChildOfType(type, node);
|
|
125
|
+
if (childNode) {
|
|
126
|
+
element.appendChild(this.serializeNode(childNode));
|
|
127
|
+
}
|
|
128
|
+
};
|
|
123
129
|
this.initCiteprocEngine = (csl) => {
|
|
124
130
|
const bibitems = new Map();
|
|
125
131
|
const citations = new Map();
|
|
@@ -288,11 +294,7 @@ export class JATSExporter {
|
|
|
288
294
|
supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', node.attrs.href ?? '');
|
|
289
295
|
supplementaryMaterial.setAttribute('mimetype', node.attrs.mimeType ?? '');
|
|
290
296
|
supplementaryMaterial.setAttribute('mime-subtype', node.attrs.mimeSubType ?? '');
|
|
291
|
-
|
|
292
|
-
const title = this.createElement('title');
|
|
293
|
-
title.textContent = node.attrs.title ?? '';
|
|
294
|
-
caption.append(title);
|
|
295
|
-
supplementaryMaterial.append(caption);
|
|
297
|
+
this.appendChildNodeOfType(supplementaryMaterial, node, schema.nodes.figcaption);
|
|
296
298
|
articleMeta.append(supplementaryMaterial);
|
|
297
299
|
});
|
|
298
300
|
const history = articleMeta.querySelector('history') || this.createElement('history');
|
|
@@ -486,9 +488,9 @@ export class JATSExporter {
|
|
|
486
488
|
mediaElement.setAttribute('mime-subtype', node.attrs.mimeSubtype);
|
|
487
489
|
}
|
|
488
490
|
appendLabels(mediaElement, node);
|
|
489
|
-
appendChildNodeOfType(mediaElement, node, schema.nodes.alt_text);
|
|
490
|
-
appendChildNodeOfType(mediaElement, node, schema.nodes.long_desc);
|
|
491
|
-
appendChildNodeOfType(mediaElement, node, schema.nodes.figcaption);
|
|
491
|
+
this.appendChildNodeOfType(mediaElement, node, schema.nodes.alt_text);
|
|
492
|
+
this.appendChildNodeOfType(mediaElement, node, schema.nodes.long_desc);
|
|
493
|
+
this.appendChildNodeOfType(mediaElement, node, schema.nodes.figcaption);
|
|
492
494
|
return mediaElement;
|
|
493
495
|
},
|
|
494
496
|
awards: () => ['funding-group', 0],
|
|
@@ -828,12 +830,6 @@ export class JATSExporter {
|
|
|
828
830
|
element.appendChild(attribution);
|
|
829
831
|
}
|
|
830
832
|
};
|
|
831
|
-
const appendChildNodeOfType = (element, node, type) => {
|
|
832
|
-
const childNode = this.getFirstChildOfType(type, node);
|
|
833
|
-
if (childNode) {
|
|
834
|
-
element.appendChild(this.serializeNode(childNode));
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
833
|
const appendTable = (element, node) => {
|
|
838
834
|
const tableNode = this.getFirstChildOfType(schema.nodes.table, node);
|
|
839
835
|
const colGroupNode = this.getFirstChildOfType(schema.nodes.table_colgroup, node);
|
|
@@ -859,7 +855,7 @@ export class JATSExporter {
|
|
|
859
855
|
appendLabels(element, node);
|
|
860
856
|
const child = node.firstChild;
|
|
861
857
|
if (child?.type === schema.nodes.figcaption) {
|
|
862
|
-
appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
858
|
+
this.appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
863
859
|
}
|
|
864
860
|
processChildNodes(element, node, node.type.schema.nodes.section);
|
|
865
861
|
return element;
|
|
@@ -881,8 +877,8 @@ export class JATSExporter {
|
|
|
881
877
|
const extLink = this.appendElement(graphicElement, 'ext-link');
|
|
882
878
|
extLink.setAttributeNS(XLINK_NAMESPACE, 'href', node.attrs.extLink);
|
|
883
879
|
}
|
|
884
|
-
appendChildNodeOfType(graphicElement, node, schema.nodes.alt_text);
|
|
885
|
-
appendChildNodeOfType(graphicElement, node, schema.nodes.long_desc);
|
|
880
|
+
this.appendChildNodeOfType(graphicElement, node, schema.nodes.alt_text);
|
|
881
|
+
this.appendChildNodeOfType(graphicElement, node, schema.nodes.long_desc);
|
|
886
882
|
return graphicElement;
|
|
887
883
|
};
|
|
888
884
|
const createGraphic = (node) => {
|
|
@@ -905,10 +901,10 @@ export class JATSExporter {
|
|
|
905
901
|
element.setAttribute('fig-type', figType);
|
|
906
902
|
}
|
|
907
903
|
appendLabels(element, node);
|
|
908
|
-
appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
909
|
-
appendChildNodeOfType(element, node, schema.nodes.alt_text);
|
|
910
|
-
appendChildNodeOfType(element, node, schema.nodes.long_desc);
|
|
911
|
-
appendChildNodeOfType(element, node, node.type.schema.nodes.footnotes_element);
|
|
904
|
+
this.appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
|
|
905
|
+
this.appendChildNodeOfType(element, node, schema.nodes.alt_text);
|
|
906
|
+
this.appendChildNodeOfType(element, node, schema.nodes.long_desc);
|
|
907
|
+
this.appendChildNodeOfType(element, node, node.type.schema.nodes.footnotes_element);
|
|
912
908
|
processChildNodes(element, node, contentNodeType);
|
|
913
909
|
appendAttributions(element, node);
|
|
914
910
|
if (isExecutableNodeType(node.type)) {
|
|
@@ -920,11 +916,11 @@ export class JATSExporter {
|
|
|
920
916
|
const nodeName = 'table-wrap';
|
|
921
917
|
const element = createElement(node, nodeName);
|
|
922
918
|
appendLabels(element, node);
|
|
923
|
-
appendChildNodeOfType(element, node, schema.nodes.figcaption);
|
|
924
|
-
appendChildNodeOfType(element, node, schema.nodes.alt_text);
|
|
925
|
-
appendChildNodeOfType(element, node, schema.nodes.long_desc);
|
|
919
|
+
this.appendChildNodeOfType(element, node, schema.nodes.figcaption);
|
|
920
|
+
this.appendChildNodeOfType(element, node, schema.nodes.alt_text);
|
|
921
|
+
this.appendChildNodeOfType(element, node, schema.nodes.long_desc);
|
|
926
922
|
appendTable(element, node);
|
|
927
|
-
appendChildNodeOfType(element, node, node.type.schema.nodes.table_element_footer);
|
|
923
|
+
this.appendChildNodeOfType(element, node, node.type.schema.nodes.table_element_footer);
|
|
928
924
|
if (isExecutableNodeType(node.type)) {
|
|
929
925
|
processExecutableNode(node, element);
|
|
930
926
|
}
|
|
@@ -473,7 +473,7 @@ export class JATSDOMParser {
|
|
|
473
473
|
{
|
|
474
474
|
tag: 'caption',
|
|
475
475
|
node: 'figcaption',
|
|
476
|
-
context: 'figure_element/|table_element/|embed/',
|
|
476
|
+
context: 'figure_element/|table_element/|embed/|supplement/',
|
|
477
477
|
getContent: (node, schema) => {
|
|
478
478
|
const element = node;
|
|
479
479
|
const content = [];
|
|
@@ -773,7 +773,6 @@ export class JATSDOMParser {
|
|
|
773
773
|
href: element.getAttributeNS(XLINK_NAMESPACE, 'href'),
|
|
774
774
|
mimeType: element.getAttribute('mimetype'),
|
|
775
775
|
mimeSubType: element.getAttribute('mime-subtype'),
|
|
776
|
-
title: getTrimmedTextContent(element, 'title'),
|
|
777
776
|
};
|
|
778
777
|
},
|
|
779
778
|
},
|
|
@@ -24,7 +24,7 @@ const createSectionGroup = (type, createElement) => {
|
|
|
24
24
|
return sec;
|
|
25
25
|
};
|
|
26
26
|
export const addMissingCaptions = (doc, createElement) => {
|
|
27
|
-
const elements = doc.querySelectorAll('fig, table-wrap, media');
|
|
27
|
+
const elements = doc.querySelectorAll('fig, table-wrap, media, supplementary-material');
|
|
28
28
|
for (const element of elements) {
|
|
29
29
|
let caption = element.querySelector('caption');
|
|
30
30
|
if (!caption) {
|
|
@@ -322,7 +322,7 @@ export const createSupplementaryMaterialsSection = (document, body, createElemen
|
|
|
322
322
|
title.textContent = 'Supplementary Material';
|
|
323
323
|
section.append(title);
|
|
324
324
|
section.append(...suppls);
|
|
325
|
-
body.
|
|
325
|
+
body.append(section);
|
|
326
326
|
}
|
|
327
327
|
};
|
|
328
328
|
export const createAccessibilityItems = (doc, createElement) => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { schema } from '../..';
|
|
2
|
+
class Migration4215 {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.fromVersion = '4.2.14';
|
|
5
|
+
this.toVersion = '4.2.15';
|
|
6
|
+
}
|
|
7
|
+
migrateNode(node) {
|
|
8
|
+
if (node.type !== schema.nodes.manuscript.name || !node.content) {
|
|
9
|
+
return node;
|
|
10
|
+
}
|
|
11
|
+
const supplementsNode = node.content.find((child) => child.type === schema.nodes.supplements.name);
|
|
12
|
+
if (supplementsNode) {
|
|
13
|
+
node.content = node.content.filter((child) => child.type !== schema.nodes.supplements.name);
|
|
14
|
+
const backmatterIndex = node.content.findIndex((child) => child.type === schema.nodes.backmatter.name);
|
|
15
|
+
node.content.splice(backmatterIndex + 1, 0, supplementsNode);
|
|
16
|
+
}
|
|
17
|
+
return node;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export default Migration4215;
|
|
@@ -23,6 +23,7 @@ import Migration3041 from './3.0.41';
|
|
|
23
23
|
import Migration3055 from './3.0.55';
|
|
24
24
|
import Migration3056 from './3.0.56';
|
|
25
25
|
import Migration4213 from './4.2.13';
|
|
26
|
+
import Migration4215 from './4.2.15';
|
|
26
27
|
const migrations = [
|
|
27
28
|
new Migration125(),
|
|
28
29
|
new Migration2322(),
|
|
@@ -34,5 +35,6 @@ const migrations = [
|
|
|
34
35
|
new Migration3055(),
|
|
35
36
|
new Migration3056(),
|
|
36
37
|
new Migration4213(),
|
|
38
|
+
new Migration4215(),
|
|
37
39
|
];
|
|
38
40
|
export default migrations;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const manuscript = {
|
|
17
|
-
content: 'title subtitles? alt_titles? contributors? affiliations? author_notes? awards? keywords?
|
|
17
|
+
content: 'title subtitles? alt_titles? contributors? affiliations? author_notes? awards? keywords? abstracts body backmatter supplements? hero_image? comments attachments?',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
doi: { default: '' },
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const supplement = {
|
|
17
|
+
content: 'figcaption?',
|
|
17
18
|
attrs: {
|
|
18
19
|
id: { default: '' },
|
|
19
20
|
href: { default: '' },
|
|
20
21
|
mimeType: { default: '' },
|
|
21
22
|
mimeSubType: { default: '' },
|
|
22
|
-
title: { default: '' },
|
|
23
23
|
dataTracked: { default: null },
|
|
24
24
|
},
|
|
25
25
|
group: 'block',
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "4.2.
|
|
1
|
+
export const VERSION = "4.2.15";
|
|
@@ -44,6 +44,7 @@ export declare class JATSExporter {
|
|
|
44
44
|
protected getFirstChildOfType<T extends ManuscriptNode>(type: NodeType, node?: ManuscriptNode): T | undefined;
|
|
45
45
|
protected getChildrenOfType<T extends ManuscriptNode>(type: NodeType, node?: ManuscriptNode): T[];
|
|
46
46
|
serializeToJATS: (manuscriptNode: ManuscriptNode, options: ExportOptions) => Promise<string>;
|
|
47
|
+
private appendChildNodeOfType;
|
|
47
48
|
private initCiteprocEngine;
|
|
48
49
|
private nodeFromJATS;
|
|
49
50
|
protected rewriteIDs: (generator?: IDGenerator) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONProsemirrorNode } from '../../../types';
|
|
2
|
+
import { MigrationScript } from '../migration-script';
|
|
3
|
+
declare class Migration4215 implements MigrationScript {
|
|
4
|
+
fromVersion: string;
|
|
5
|
+
toVersion: string;
|
|
6
|
+
migrateNode(node: JSONProsemirrorNode): JSONProsemirrorNode;
|
|
7
|
+
}
|
|
8
|
+
export default Migration4215;
|
|
@@ -23,5 +23,6 @@ import Migration3041 from './3.0.41';
|
|
|
23
23
|
import Migration3055 from './3.0.55';
|
|
24
24
|
import Migration3056 from './3.0.56';
|
|
25
25
|
import Migration4213 from './4.2.13';
|
|
26
|
-
|
|
26
|
+
import Migration4215 from './4.2.15';
|
|
27
|
+
declare const migrations: (Migration125 | Migration2322 | Migration3012 | Migration3021 | Migration3030 | Migration3031 | Migration3041 | Migration3055 | Migration3056 | Migration4213 | Migration4215)[];
|
|
27
28
|
export default migrations;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.2.
|
|
1
|
+
export declare const VERSION = "4.2.15";
|
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": "4.2.
|
|
4
|
+
"version": "4.2.15",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|