@manuscripts/transform 3.0.2-LEAN-4021.0 → 3.0.2
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/exporter/jats-exporter.js +38 -2
- package/dist/cjs/jats/importer/jats-dom-parser.js +24 -4
- package/dist/cjs/jats/importer/jats-parser-utils.js +0 -14
- package/dist/cjs/jats/importer/jats-transformations.js +9 -1
- package/dist/cjs/jats/importer/parse-jats-article.js +1 -0
- package/dist/cjs/transformer/id.js +9 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +38 -2
- package/dist/es/jats/importer/jats-dom-parser.js +24 -4
- package/dist/es/jats/importer/jats-parser-utils.js +1 -15
- package/dist/es/jats/importer/jats-transformations.js +7 -0
- package/dist/es/jats/importer/parse-jats-article.js +2 -1
- package/dist/es/transformer/id.js +9 -1
- package/dist/es/version.js +1 -1
- package/dist/types/jats/exporter/jats-exporter.d.ts +1 -0
- package/dist/types/jats/importer/jats-transformations.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -151,6 +151,7 @@ class JATSExporter {
|
|
|
151
151
|
this.updateFootnoteTypes(front, back);
|
|
152
152
|
this.fillEmptyTableFooters(article);
|
|
153
153
|
this.fillEmptyFootnotes(article);
|
|
154
|
+
this.moveAwards(front, body);
|
|
154
155
|
await this.rewriteIDs();
|
|
155
156
|
return (0, w3c_xmlserializer_1.default)(this.document);
|
|
156
157
|
};
|
|
@@ -511,8 +512,18 @@ class JATSExporter {
|
|
|
511
512
|
};
|
|
512
513
|
this.createSerializer = () => {
|
|
513
514
|
const nodes = {
|
|
514
|
-
|
|
515
|
-
|
|
515
|
+
awards: () => ['funding-group', 0],
|
|
516
|
+
award: (node) => {
|
|
517
|
+
const awardGroup = node;
|
|
518
|
+
const awardGroupElement = this.document.createElement('award-group');
|
|
519
|
+
awardGroupElement.setAttribute('id', normalizeID(awardGroup.attrs.id));
|
|
520
|
+
appendChildIfPresent(awardGroupElement, 'funding-source', awardGroup.attrs.source);
|
|
521
|
+
awardGroup.attrs.code
|
|
522
|
+
.split(';')
|
|
523
|
+
.forEach((code) => appendChildIfPresent(awardGroupElement, 'award-id', code));
|
|
524
|
+
appendChildIfPresent(awardGroupElement, 'principal-award-recipient', awardGroup.attrs.recipient);
|
|
525
|
+
return awardGroupElement;
|
|
526
|
+
},
|
|
516
527
|
box_element: (node) => createBoxElement(node),
|
|
517
528
|
author_notes: () => '',
|
|
518
529
|
corresp: () => '',
|
|
@@ -790,6 +801,14 @@ class JATSExporter {
|
|
|
790
801
|
tracked_delete: () => ['del'],
|
|
791
802
|
};
|
|
792
803
|
this.serializer = new prosemirror_model_1.DOMSerializer(nodes, marks);
|
|
804
|
+
const appendChildIfPresent = (parent, tagName, textContent) => {
|
|
805
|
+
if (!textContent) {
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
const element = this.document.createElement(tagName);
|
|
809
|
+
element.textContent = textContent;
|
|
810
|
+
parent.appendChild(element);
|
|
811
|
+
};
|
|
793
812
|
const processChildNodes = (element, node, contentNodeType) => {
|
|
794
813
|
node.forEach((childNode) => {
|
|
795
814
|
if (childNode.type === contentNodeType) {
|
|
@@ -1297,6 +1316,23 @@ class JATSExporter {
|
|
|
1297
1316
|
}
|
|
1298
1317
|
body.removeChild(container);
|
|
1299
1318
|
};
|
|
1319
|
+
this.moveAwards = (front, body) => {
|
|
1320
|
+
const awardGroups = body.querySelectorAll(':scope > award-group');
|
|
1321
|
+
if (!awardGroups.length) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
const fundingGroup = this.document.createElement('funding-group');
|
|
1325
|
+
awardGroups.forEach((award) => {
|
|
1326
|
+
fundingGroup.appendChild(award);
|
|
1327
|
+
});
|
|
1328
|
+
const articleMeta = front.querySelector(':scope > article-meta');
|
|
1329
|
+
if (articleMeta) {
|
|
1330
|
+
const insertBeforeElement = articleMeta.querySelector(':scope > support-group, :scope > conference, :scope > counts, :scope > custom-meta-group');
|
|
1331
|
+
insertBeforeElement
|
|
1332
|
+
? articleMeta.insertBefore(fundingGroup, insertBeforeElement)
|
|
1333
|
+
: articleMeta.appendChild(fundingGroup);
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1300
1336
|
this.moveAbstracts = (front, body) => {
|
|
1301
1337
|
const container = body.querySelector(':scope > sec[sec-type="abstracts"]');
|
|
1302
1338
|
let abstractSections;
|
|
@@ -292,6 +292,26 @@ const nodes = [
|
|
|
292
292
|
};
|
|
293
293
|
},
|
|
294
294
|
},
|
|
295
|
+
{
|
|
296
|
+
tag: 'funding-group',
|
|
297
|
+
node: 'awards',
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
tag: 'award-group',
|
|
301
|
+
node: 'award',
|
|
302
|
+
getAttrs: (node) => {
|
|
303
|
+
var _a, _b;
|
|
304
|
+
const element = node;
|
|
305
|
+
return {
|
|
306
|
+
id: element.getAttribute('id'),
|
|
307
|
+
recipient: (_a = element.querySelector('principal-award-recipient')) === null || _a === void 0 ? void 0 : _a.textContent,
|
|
308
|
+
code: Array.from(element.querySelectorAll('award-id'))
|
|
309
|
+
.map((awardID) => awardID.textContent)
|
|
310
|
+
.reduce((acc, text) => (acc ? `${acc};${text}` : text), ''),
|
|
311
|
+
source: (_b = element.querySelector('funding-source')) === null || _b === void 0 ? void 0 : _b.textContent,
|
|
312
|
+
};
|
|
313
|
+
},
|
|
314
|
+
},
|
|
295
315
|
{
|
|
296
316
|
tag: 'fn:not([fn-type])',
|
|
297
317
|
node: 'footnote',
|
|
@@ -867,8 +887,8 @@ const nodes = [
|
|
|
867
887
|
node: 'table_cell',
|
|
868
888
|
getAttrs: (node) => {
|
|
869
889
|
const element = node;
|
|
870
|
-
const colspan =
|
|
871
|
-
const rowspan =
|
|
890
|
+
const colspan = element.getAttribute('colspan');
|
|
891
|
+
const rowspan = element.getAttribute('rowspan');
|
|
872
892
|
return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
|
|
873
893
|
},
|
|
874
894
|
},
|
|
@@ -877,8 +897,8 @@ const nodes = [
|
|
|
877
897
|
node: 'table_header',
|
|
878
898
|
getAttrs: (node) => {
|
|
879
899
|
const element = node;
|
|
880
|
-
const colspan =
|
|
881
|
-
const rowspan =
|
|
900
|
+
const colspan = element.getAttribute('colspan');
|
|
901
|
+
const rowspan = element.getAttribute('rowspan');
|
|
882
902
|
return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
|
|
883
903
|
},
|
|
884
904
|
},
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.htmlFromJatsNode = exports.updateDocumentIDs = void 0;
|
|
19
|
-
const uuid_1 = require("uuid");
|
|
20
19
|
const schema_1 = require("../../schema");
|
|
21
20
|
const transformer_1 = require("../../transformer");
|
|
22
21
|
const updateDocumentIDs = (node) => {
|
|
@@ -35,14 +34,6 @@ const recurseDoc = (node, fn) => {
|
|
|
35
34
|
node.descendants((n) => fn(n));
|
|
36
35
|
};
|
|
37
36
|
const updateNodeID = (node, replacements, warnings) => {
|
|
38
|
-
if (node.type === schema_1.schema.nodes.inline_equation) {
|
|
39
|
-
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `InlineMathFragment:${(0, uuid_1.v4)()}` });
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (node.type === schema_1.schema.nodes.general_table_footnote) {
|
|
43
|
-
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `GeneralTableFootnote:${(0, uuid_1.v4)()}` });
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
37
|
if (node.type === schema_1.schema.nodes.comment ||
|
|
47
38
|
node.type === schema_1.schema.nodes.highlight_marker) {
|
|
48
39
|
return;
|
|
@@ -50,11 +41,6 @@ const updateNodeID = (node, replacements, warnings) => {
|
|
|
50
41
|
if (!('id' in node.attrs)) {
|
|
51
42
|
return;
|
|
52
43
|
}
|
|
53
|
-
const objectType = transformer_1.nodeTypesMap.get(node.type);
|
|
54
|
-
if (!objectType) {
|
|
55
|
-
warnings.push(`Unknown object type for node type ${node.type.name}`);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
44
|
const previousID = node.attrs.id;
|
|
59
45
|
const nextID = (0, transformer_1.generateNodeID)(node.type);
|
|
60
46
|
if (previousID) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.fixTables = exports.orderTableFootnote = exports.moveReferencesToBackmatter = exports.createSupplementaryMaterialsSection = exports.createKeywordsSection = exports.moveCaptionsToEnd = exports.createBackmatter = exports.createAbstracts = exports.createBody = exports.createBoxedElementSection = exports.moveAbstracts = exports.moveAffiliations = exports.moveContributors = exports.moveAuthorNotes = exports.moveTitle = exports.ensureSection = void 0;
|
|
18
|
+
exports.fixTables = exports.orderTableFootnote = exports.moveReferencesToBackmatter = exports.createSupplementaryMaterialsSection = exports.createKeywordsSection = exports.moveCaptionsToEnd = exports.createBackmatter = exports.createAbstracts = exports.createBody = exports.createBoxedElementSection = exports.moveAbstracts = exports.moveAffiliations = exports.moveContributors = exports.moveAwards = exports.moveAuthorNotes = exports.moveTitle = exports.ensureSection = void 0;
|
|
19
19
|
const deafults_1 = require("../../lib/deafults");
|
|
20
20
|
const section_group_type_1 = require("../../lib/section-group-type");
|
|
21
21
|
const transformer_1 = require("../../transformer");
|
|
@@ -76,6 +76,14 @@ const moveAuthorNotes = (front, createElement) => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
exports.moveAuthorNotes = moveAuthorNotes;
|
|
79
|
+
const moveAwards = (front) => {
|
|
80
|
+
var _a;
|
|
81
|
+
const awards = front.querySelector('article-meta > funding-group');
|
|
82
|
+
if (awards) {
|
|
83
|
+
(_a = front.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(awards, front);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.moveAwards = moveAwards;
|
|
79
87
|
const moveContributors = (front, createElement) => {
|
|
80
88
|
var _a;
|
|
81
89
|
const contribs = front.querySelectorAll('contrib-group > contrib[contrib-type="author"]');
|
|
@@ -32,6 +32,7 @@ const processJATS = (doc) => {
|
|
|
32
32
|
(0, jats_transformations_1.moveContributors)(front, createElement);
|
|
33
33
|
(0, jats_transformations_1.moveAffiliations)(front, createElement);
|
|
34
34
|
(0, jats_transformations_1.moveAuthorNotes)(front, createElement);
|
|
35
|
+
(0, jats_transformations_1.moveAwards)(front);
|
|
35
36
|
const body = doc.querySelector('body');
|
|
36
37
|
if (!body) {
|
|
37
38
|
return;
|
|
@@ -19,6 +19,14 @@ exports.generateNodeID = void 0;
|
|
|
19
19
|
const uuid_1 = require("uuid");
|
|
20
20
|
const node_types_1 = require("./node-types");
|
|
21
21
|
const generateNodeID = (type) => {
|
|
22
|
-
|
|
22
|
+
const uniqueID = ':' + (0, uuid_1.v4)().toUpperCase();
|
|
23
|
+
let name = node_types_1.nodeTypesMap.get(type);
|
|
24
|
+
if (name === undefined) {
|
|
25
|
+
name = type.name
|
|
26
|
+
.split('_')
|
|
27
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
28
|
+
.join('');
|
|
29
|
+
}
|
|
30
|
+
return name + uniqueID;
|
|
23
31
|
};
|
|
24
32
|
exports.generateNodeID = generateNodeID;
|
package/dist/cjs/version.js
CHANGED
|
@@ -143,6 +143,7 @@ export class JATSExporter {
|
|
|
143
143
|
this.updateFootnoteTypes(front, back);
|
|
144
144
|
this.fillEmptyTableFooters(article);
|
|
145
145
|
this.fillEmptyFootnotes(article);
|
|
146
|
+
this.moveAwards(front, body);
|
|
146
147
|
await this.rewriteIDs();
|
|
147
148
|
return serializeToXML(this.document);
|
|
148
149
|
};
|
|
@@ -503,8 +504,18 @@ export class JATSExporter {
|
|
|
503
504
|
};
|
|
504
505
|
this.createSerializer = () => {
|
|
505
506
|
const nodes = {
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
awards: () => ['funding-group', 0],
|
|
508
|
+
award: (node) => {
|
|
509
|
+
const awardGroup = node;
|
|
510
|
+
const awardGroupElement = this.document.createElement('award-group');
|
|
511
|
+
awardGroupElement.setAttribute('id', normalizeID(awardGroup.attrs.id));
|
|
512
|
+
appendChildIfPresent(awardGroupElement, 'funding-source', awardGroup.attrs.source);
|
|
513
|
+
awardGroup.attrs.code
|
|
514
|
+
.split(';')
|
|
515
|
+
.forEach((code) => appendChildIfPresent(awardGroupElement, 'award-id', code));
|
|
516
|
+
appendChildIfPresent(awardGroupElement, 'principal-award-recipient', awardGroup.attrs.recipient);
|
|
517
|
+
return awardGroupElement;
|
|
518
|
+
},
|
|
508
519
|
box_element: (node) => createBoxElement(node),
|
|
509
520
|
author_notes: () => '',
|
|
510
521
|
corresp: () => '',
|
|
@@ -782,6 +793,14 @@ export class JATSExporter {
|
|
|
782
793
|
tracked_delete: () => ['del'],
|
|
783
794
|
};
|
|
784
795
|
this.serializer = new DOMSerializer(nodes, marks);
|
|
796
|
+
const appendChildIfPresent = (parent, tagName, textContent) => {
|
|
797
|
+
if (!textContent) {
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
const element = this.document.createElement(tagName);
|
|
801
|
+
element.textContent = textContent;
|
|
802
|
+
parent.appendChild(element);
|
|
803
|
+
};
|
|
785
804
|
const processChildNodes = (element, node, contentNodeType) => {
|
|
786
805
|
node.forEach((childNode) => {
|
|
787
806
|
if (childNode.type === contentNodeType) {
|
|
@@ -1289,6 +1308,23 @@ export class JATSExporter {
|
|
|
1289
1308
|
}
|
|
1290
1309
|
body.removeChild(container);
|
|
1291
1310
|
};
|
|
1311
|
+
this.moveAwards = (front, body) => {
|
|
1312
|
+
const awardGroups = body.querySelectorAll(':scope > award-group');
|
|
1313
|
+
if (!awardGroups.length) {
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
const fundingGroup = this.document.createElement('funding-group');
|
|
1317
|
+
awardGroups.forEach((award) => {
|
|
1318
|
+
fundingGroup.appendChild(award);
|
|
1319
|
+
});
|
|
1320
|
+
const articleMeta = front.querySelector(':scope > article-meta');
|
|
1321
|
+
if (articleMeta) {
|
|
1322
|
+
const insertBeforeElement = articleMeta.querySelector(':scope > support-group, :scope > conference, :scope > counts, :scope > custom-meta-group');
|
|
1323
|
+
insertBeforeElement
|
|
1324
|
+
? articleMeta.insertBefore(fundingGroup, insertBeforeElement)
|
|
1325
|
+
: articleMeta.appendChild(fundingGroup);
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1292
1328
|
this.moveAbstracts = (front, body) => {
|
|
1293
1329
|
const container = body.querySelector(':scope > sec[sec-type="abstracts"]');
|
|
1294
1330
|
let abstractSections;
|
|
@@ -286,6 +286,26 @@ const nodes = [
|
|
|
286
286
|
};
|
|
287
287
|
},
|
|
288
288
|
},
|
|
289
|
+
{
|
|
290
|
+
tag: 'funding-group',
|
|
291
|
+
node: 'awards',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
tag: 'award-group',
|
|
295
|
+
node: 'award',
|
|
296
|
+
getAttrs: (node) => {
|
|
297
|
+
var _a, _b;
|
|
298
|
+
const element = node;
|
|
299
|
+
return {
|
|
300
|
+
id: element.getAttribute('id'),
|
|
301
|
+
recipient: (_a = element.querySelector('principal-award-recipient')) === null || _a === void 0 ? void 0 : _a.textContent,
|
|
302
|
+
code: Array.from(element.querySelectorAll('award-id'))
|
|
303
|
+
.map((awardID) => awardID.textContent)
|
|
304
|
+
.reduce((acc, text) => (acc ? `${acc};${text}` : text), ''),
|
|
305
|
+
source: (_b = element.querySelector('funding-source')) === null || _b === void 0 ? void 0 : _b.textContent,
|
|
306
|
+
};
|
|
307
|
+
},
|
|
308
|
+
},
|
|
289
309
|
{
|
|
290
310
|
tag: 'fn:not([fn-type])',
|
|
291
311
|
node: 'footnote',
|
|
@@ -861,8 +881,8 @@ const nodes = [
|
|
|
861
881
|
node: 'table_cell',
|
|
862
882
|
getAttrs: (node) => {
|
|
863
883
|
const element = node;
|
|
864
|
-
const colspan =
|
|
865
|
-
const rowspan =
|
|
884
|
+
const colspan = element.getAttribute('colspan');
|
|
885
|
+
const rowspan = element.getAttribute('rowspan');
|
|
866
886
|
return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
|
|
867
887
|
},
|
|
868
888
|
},
|
|
@@ -871,8 +891,8 @@ const nodes = [
|
|
|
871
891
|
node: 'table_header',
|
|
872
892
|
getAttrs: (node) => {
|
|
873
893
|
const element = node;
|
|
874
|
-
const colspan =
|
|
875
|
-
const rowspan =
|
|
894
|
+
const colspan = element.getAttribute('colspan');
|
|
895
|
+
const rowspan = element.getAttribute('rowspan');
|
|
876
896
|
return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
|
|
877
897
|
},
|
|
878
898
|
},
|
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
17
16
|
import { schema, } from '../../schema';
|
|
18
|
-
import { generateNodeID
|
|
17
|
+
import { generateNodeID } from '../../transformer';
|
|
19
18
|
export const updateDocumentIDs = (node) => {
|
|
20
19
|
const replacements = new Map();
|
|
21
20
|
const warnings = [];
|
|
@@ -31,14 +30,6 @@ const recurseDoc = (node, fn) => {
|
|
|
31
30
|
node.descendants((n) => fn(n));
|
|
32
31
|
};
|
|
33
32
|
const updateNodeID = (node, replacements, warnings) => {
|
|
34
|
-
if (node.type === schema.nodes.inline_equation) {
|
|
35
|
-
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `InlineMathFragment:${uuidv4()}` });
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (node.type === schema.nodes.general_table_footnote) {
|
|
39
|
-
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `GeneralTableFootnote:${uuidv4()}` });
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
33
|
if (node.type === schema.nodes.comment ||
|
|
43
34
|
node.type === schema.nodes.highlight_marker) {
|
|
44
35
|
return;
|
|
@@ -46,11 +37,6 @@ const updateNodeID = (node, replacements, warnings) => {
|
|
|
46
37
|
if (!('id' in node.attrs)) {
|
|
47
38
|
return;
|
|
48
39
|
}
|
|
49
|
-
const objectType = nodeTypesMap.get(node.type);
|
|
50
|
-
if (!objectType) {
|
|
51
|
-
warnings.push(`Unknown object type for node type ${node.type.name}`);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
40
|
const previousID = node.attrs.id;
|
|
55
41
|
const nextID = generateNodeID(node.type);
|
|
56
42
|
if (previousID) {
|
|
@@ -70,6 +70,13 @@ export const moveAuthorNotes = (front, createElement) => {
|
|
|
70
70
|
(_a = front.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(authorNotes, front);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
+
export const moveAwards = (front) => {
|
|
74
|
+
var _a;
|
|
75
|
+
const awards = front.querySelector('article-meta > funding-group');
|
|
76
|
+
if (awards) {
|
|
77
|
+
(_a = front.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(awards, front);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
73
80
|
export const moveContributors = (front, createElement) => {
|
|
74
81
|
var _a;
|
|
75
82
|
const contribs = front.querySelectorAll('contrib-group > contrib[contrib-type="author"]');
|
|
@@ -17,7 +17,7 @@ import { markComments } from './jats-comments';
|
|
|
17
17
|
import { jatsDOMParser } from './jats-dom-parser';
|
|
18
18
|
import { parseJournal } from './jats-journal-meta-parser';
|
|
19
19
|
import { updateDocumentIDs } from './jats-parser-utils';
|
|
20
|
-
import { createAbstracts, createBackmatter, createBody, createBoxedElementSection, createKeywordsSection, createSupplementaryMaterialsSection, ensureSection, fixTables, moveAffiliations, moveAuthorNotes, moveCaptionsToEnd, moveContributors, moveReferencesToBackmatter, moveTitle, orderTableFootnote, } from './jats-transformations';
|
|
20
|
+
import { createAbstracts, createBackmatter, createBody, createBoxedElementSection, createKeywordsSection, createSupplementaryMaterialsSection, ensureSection, fixTables, moveAffiliations, moveAuthorNotes, moveAwards, moveCaptionsToEnd, moveContributors, moveReferencesToBackmatter, moveTitle, orderTableFootnote, } from './jats-transformations';
|
|
21
21
|
const processJATS = (doc) => {
|
|
22
22
|
const createElement = createElementFn(doc);
|
|
23
23
|
markComments(doc);
|
|
@@ -29,6 +29,7 @@ const processJATS = (doc) => {
|
|
|
29
29
|
moveContributors(front, createElement);
|
|
30
30
|
moveAffiliations(front, createElement);
|
|
31
31
|
moveAuthorNotes(front, createElement);
|
|
32
|
+
moveAwards(front);
|
|
32
33
|
const body = doc.querySelector('body');
|
|
33
34
|
if (!body) {
|
|
34
35
|
return;
|
|
@@ -16,5 +16,13 @@
|
|
|
16
16
|
import { v4 as uuid } from 'uuid';
|
|
17
17
|
import { nodeTypesMap } from './node-types';
|
|
18
18
|
export const generateNodeID = (type) => {
|
|
19
|
-
|
|
19
|
+
const uniqueID = ':' + uuid().toUpperCase();
|
|
20
|
+
let name = nodeTypesMap.get(type);
|
|
21
|
+
if (name === undefined) {
|
|
22
|
+
name = type.name
|
|
23
|
+
.split('_')
|
|
24
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
25
|
+
.join('');
|
|
26
|
+
}
|
|
27
|
+
return name + uniqueID;
|
|
20
28
|
};
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.2
|
|
1
|
+
export const VERSION = "3.0.2";
|
|
@@ -85,6 +85,7 @@ export declare class JATSExporter {
|
|
|
85
85
|
private fixTable;
|
|
86
86
|
private unwrapBody;
|
|
87
87
|
private removeBackContainer;
|
|
88
|
+
private moveAwards;
|
|
88
89
|
private moveAbstracts;
|
|
89
90
|
private moveSectionsToBack;
|
|
90
91
|
sectionToFootnote: (section: Element, fnType: string) => HTMLElement;
|
|
@@ -17,6 +17,7 @@ export type CreateElement = (tagName: string) => HTMLElement;
|
|
|
17
17
|
export declare const ensureSection: (body: Element, createElement: CreateElement) => void;
|
|
18
18
|
export declare const moveTitle: (front: Element, createElement: CreateElement) => void;
|
|
19
19
|
export declare const moveAuthorNotes: (front: Element, createElement: CreateElement) => void;
|
|
20
|
+
export declare const moveAwards: (front: Element) => void;
|
|
20
21
|
export declare const moveContributors: (front: Element, createElement: CreateElement) => void;
|
|
21
22
|
export declare const moveAffiliations: (front: Element, createElement: CreateElement) => void;
|
|
22
23
|
export declare const moveAbstracts: (doc: Document, group: Element, createElement: CreateElement) => void;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.2
|
|
1
|
+
export declare const VERSION = "3.0.2";
|
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": "3.0.2
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|