@manuscripts/transform 1.5.8 → 2.0.0
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/index.js +1 -1
- package/dist/cjs/jats/importer/index.js +1 -3
- package/dist/cjs/jats/importer/jats-body-dom-parser.js +23 -227
- package/dist/cjs/jats/importer/jats-body-transformations.js +110 -201
- package/dist/cjs/jats/importer/jats-comments.js +100 -98
- package/dist/cjs/jats/importer/jats-front-parser.js +87 -81
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +51 -39
- package/dist/cjs/jats/importer/jats-parser-utils.js +17 -56
- package/dist/cjs/jats/importer/jats-reference-parser.js +24 -79
- package/dist/cjs/jats/importer/jats-references.js +34 -0
- package/dist/cjs/jats/importer/parse-jats-article.js +67 -173
- package/dist/cjs/jats/index.js +1 -3
- package/dist/cjs/jats/jats-exporter.js +34 -55
- package/dist/cjs/lib/section-group-type.js +30 -0
- package/dist/cjs/lib/utils.js +1 -25
- package/dist/cjs/schema/index.js +20 -17
- package/dist/cjs/schema/nodes/abstracts.js +27 -0
- package/dist/cjs/schema/nodes/affiliations.js +27 -0
- package/dist/cjs/schema/nodes/backmatter.js +27 -0
- package/dist/cjs/schema/nodes/body.js +27 -0
- package/dist/cjs/schema/nodes/citation.js +10 -15
- package/dist/cjs/schema/nodes/{comment_list.js → comments.js} +4 -4
- package/dist/cjs/schema/nodes/contributors.js +27 -0
- package/dist/cjs/schema/nodes/{meta_section.js → core_section.js} +6 -5
- package/dist/cjs/schema/nodes/cross_reference.js +4 -3
- package/dist/cjs/schema/nodes/inline_footnote.js +6 -5
- package/dist/cjs/schema/nodes/keyword.js +0 -1
- package/dist/cjs/schema/nodes/{keywords_group.js → keyword_group.js} +6 -6
- package/dist/cjs/schema/nodes/{keywords_section.js → keywords.js} +7 -7
- package/dist/cjs/schema/nodes/keywords_element.js +1 -1
- package/dist/cjs/schema/nodes/manuscript.js +5 -2
- package/dist/cjs/transformer/builders.js +9 -86
- package/dist/cjs/transformer/decode.js +147 -176
- package/dist/cjs/transformer/encode.js +66 -67
- package/dist/cjs/transformer/highlight-markers.js +48 -36
- package/dist/cjs/transformer/html.js +7 -23
- package/dist/cjs/transformer/labels.js +3 -17
- package/dist/cjs/transformer/node-names.js +1 -1
- package/dist/cjs/transformer/node-title.js +1 -1
- package/dist/cjs/transformer/node-types.js +7 -6
- package/dist/cjs/transformer/object-types.js +1 -2
- package/dist/cjs/transformer/section-category.js +31 -31
- package/dist/es/index.js +1 -1
- package/dist/es/jats/importer/index.js +1 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +23 -227
- package/dist/es/jats/importer/jats-body-transformations.js +111 -202
- package/dist/es/jats/importer/jats-comments.js +97 -96
- package/dist/es/jats/importer/jats-front-parser.js +88 -82
- package/dist/es/jats/importer/jats-journal-meta-parser.js +51 -39
- package/dist/es/jats/importer/jats-parser-utils.js +16 -54
- package/dist/es/jats/importer/jats-reference-parser.js +27 -82
- package/dist/es/jats/importer/jats-references.js +30 -0
- package/dist/es/jats/importer/parse-jats-article.js +70 -174
- package/dist/es/jats/index.js +1 -1
- package/dist/es/jats/jats-exporter.js +34 -55
- package/dist/es/lib/section-group-type.js +27 -0
- package/dist/es/lib/utils.js +0 -22
- package/dist/es/schema/index.js +21 -18
- package/dist/es/schema/nodes/abstracts.js +24 -0
- package/dist/es/schema/nodes/affiliations.js +24 -0
- package/dist/es/schema/nodes/backmatter.js +24 -0
- package/dist/es/schema/nodes/body.js +24 -0
- package/dist/es/schema/nodes/citation.js +10 -15
- package/dist/es/schema/nodes/{comment_list.js → comments.js} +3 -3
- package/dist/es/schema/nodes/contributors.js +24 -0
- package/dist/es/schema/nodes/{meta_section.js → core_section.js} +5 -4
- package/dist/es/schema/nodes/cross_reference.js +4 -3
- package/dist/es/schema/nodes/inline_footnote.js +6 -5
- package/dist/es/schema/nodes/keyword.js +0 -1
- package/dist/es/schema/nodes/{keywords_group.js → keyword_group.js} +4 -4
- package/dist/es/schema/nodes/{keywords_section.js → keywords.js} +5 -5
- package/dist/es/schema/nodes/keywords_element.js +1 -1
- package/dist/es/schema/nodes/manuscript.js +3 -1
- package/dist/es/transformer/builders.js +6 -73
- package/dist/es/transformer/decode.js +147 -175
- package/dist/es/transformer/encode.js +70 -71
- package/dist/es/transformer/highlight-markers.js +44 -32
- package/dist/es/transformer/html.js +7 -23
- package/dist/es/transformer/labels.js +3 -17
- package/dist/es/transformer/node-names.js +1 -1
- package/dist/es/transformer/node-title.js +1 -1
- package/dist/es/transformer/node-types.js +7 -6
- package/dist/es/transformer/object-types.js +0 -1
- package/dist/es/transformer/section-category.js +29 -29
- package/dist/types/index.d.ts +1 -1
- package/dist/types/jats/importer/index.d.ts +1 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +16 -19
- package/dist/types/jats/importer/jats-comments.d.ts +13 -9
- package/dist/types/jats/importer/jats-front-parser.d.ts +35 -12
- package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +4 -4
- package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -6
- package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -6
- package/dist/types/jats/importer/jats-references.d.ts +12 -0
- package/dist/types/jats/importer/parse-jats-article.d.ts +5 -17
- package/dist/types/jats/index.d.ts +1 -1
- package/dist/types/lib/section-group-type.d.ts +23 -0
- package/dist/types/lib/utils.d.ts +1 -4
- package/dist/types/schema/index.d.ts +4 -5
- package/dist/types/schema/nodes/{meta_section.d.ts → abstracts.d.ts} +1 -9
- package/dist/types/schema/nodes/affiliations.d.ts +17 -0
- package/dist/types/schema/nodes/backmatter.d.ts +17 -0
- package/dist/types/schema/nodes/body.d.ts +17 -0
- package/dist/types/schema/nodes/citation.d.ts +3 -5
- package/dist/types/schema/nodes/comments.d.ts +17 -0
- package/dist/types/schema/nodes/contributors.d.ts +17 -0
- package/dist/types/schema/nodes/core_section.d.ts +17 -0
- package/dist/types/schema/nodes/cross_reference.d.ts +1 -1
- package/dist/types/schema/nodes/inline_footnote.d.ts +1 -1
- package/dist/types/schema/nodes/keyword.d.ts +0 -1
- package/dist/types/schema/nodes/{contributors_element.d.ts → keyword_group.d.ts} +3 -4
- package/dist/types/schema/nodes/{comment_list.d.ts → keywords.d.ts} +3 -2
- package/dist/types/schema/nodes/manuscript.d.ts +1 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +2 -14
- package/dist/types/transformer/decode.d.ts +5 -9
- package/dist/types/transformer/encode.d.ts +4 -4
- package/dist/types/transformer/highlight-markers.d.ts +7 -2
- package/dist/types/transformer/object-types.d.ts +1 -2
- package/dist/types/transformer/section-category.d.ts +4 -3
- package/package.json +1 -6
- package/dist/cjs/lib/core-section-categories.js +0 -29
- package/dist/cjs/schema/nodes/affiliations_section.js +0 -36
- package/dist/cjs/schema/nodes/contributors_element.js +0 -49
- package/dist/cjs/schema/nodes/contributors_section.js +0 -36
- package/dist/es/lib/core-section-categories.js +0 -26
- package/dist/es/schema/nodes/affiliations_section.js +0 -32
- package/dist/es/schema/nodes/contributors_element.js +0 -46
- package/dist/es/schema/nodes/contributors_section.js +0 -32
- package/dist/types/lib/core-section-categories.d.ts +0 -8
- package/dist/types/schema/nodes/affiliations_section.d.ts +0 -11
- package/dist/types/schema/nodes/contributors_section.d.ts +0 -12
- package/dist/types/schema/nodes/keywords_group.d.ts +0 -26
- package/dist/types/schema/nodes/keywords_section.d.ts +0 -26
|
@@ -332,75 +332,6 @@ const nodes = [
|
|
|
332
332
|
};
|
|
333
333
|
},
|
|
334
334
|
},
|
|
335
|
-
{
|
|
336
|
-
tag: 'ref',
|
|
337
|
-
node: 'bibliography_item',
|
|
338
|
-
context: 'bibliography_element/',
|
|
339
|
-
getAttrs: (node) => {
|
|
340
|
-
const element = node;
|
|
341
|
-
const ref = {
|
|
342
|
-
id: element.getAttribute('id'),
|
|
343
|
-
type: element.getAttribute('type'),
|
|
344
|
-
};
|
|
345
|
-
const author = element.getAttribute('author');
|
|
346
|
-
if (author) {
|
|
347
|
-
ref.author = author;
|
|
348
|
-
}
|
|
349
|
-
const issued = element.getAttribute('issued');
|
|
350
|
-
if (issued) {
|
|
351
|
-
ref.issued = issued;
|
|
352
|
-
}
|
|
353
|
-
const containerTitle = element.getAttribute('container-title');
|
|
354
|
-
if (containerTitle) {
|
|
355
|
-
ref.containerTitle = containerTitle;
|
|
356
|
-
}
|
|
357
|
-
const doi = element.getAttribute('doi');
|
|
358
|
-
if (doi) {
|
|
359
|
-
ref.doi = doi;
|
|
360
|
-
}
|
|
361
|
-
const volume = element.getAttribute('volume');
|
|
362
|
-
if (volume) {
|
|
363
|
-
ref.volume = volume;
|
|
364
|
-
}
|
|
365
|
-
const issue = element.getAttribute('issue');
|
|
366
|
-
if (issue) {
|
|
367
|
-
ref.issue = issue;
|
|
368
|
-
}
|
|
369
|
-
const supplement = element.getAttribute('supplement');
|
|
370
|
-
if (supplement) {
|
|
371
|
-
ref.supplement = supplement;
|
|
372
|
-
}
|
|
373
|
-
const page = element.getAttribute('page');
|
|
374
|
-
if (page) {
|
|
375
|
-
ref.page = page;
|
|
376
|
-
}
|
|
377
|
-
const title = element.getAttribute('title');
|
|
378
|
-
if (title) {
|
|
379
|
-
ref.title = title;
|
|
380
|
-
}
|
|
381
|
-
const literal = element.getAttribute('literal');
|
|
382
|
-
if (literal) {
|
|
383
|
-
ref.literal = literal;
|
|
384
|
-
}
|
|
385
|
-
return ref;
|
|
386
|
-
},
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
tag: 'ref-list',
|
|
390
|
-
node: 'bibliography_element',
|
|
391
|
-
context: 'bibliography_section/',
|
|
392
|
-
getAttrs: (node) => {
|
|
393
|
-
const element = node;
|
|
394
|
-
const titleNode = element.querySelector('title');
|
|
395
|
-
if (titleNode) {
|
|
396
|
-
element.removeChild(titleNode);
|
|
397
|
-
}
|
|
398
|
-
return {
|
|
399
|
-
id: element.getAttribute('id'),
|
|
400
|
-
contents: '',
|
|
401
|
-
};
|
|
402
|
-
},
|
|
403
|
-
},
|
|
404
335
|
{
|
|
405
336
|
tag: 'fn-group',
|
|
406
337
|
node: 'footnotes_element',
|
|
@@ -490,144 +421,24 @@ const nodes = [
|
|
|
490
421
|
},
|
|
491
422
|
},
|
|
492
423
|
{
|
|
493
|
-
tag: 'sec[sec-type="
|
|
494
|
-
node: '
|
|
495
|
-
getAttrs: (node) => {
|
|
496
|
-
const element = node;
|
|
497
|
-
return {
|
|
498
|
-
id: element.getAttribute('id'),
|
|
499
|
-
};
|
|
500
|
-
},
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
tag: 'sec[sec-type="affiliations"]',
|
|
504
|
-
node: 'affiliations_section',
|
|
505
|
-
getAttrs: (node) => {
|
|
506
|
-
const element = node;
|
|
507
|
-
return {
|
|
508
|
-
id: element.getAttribute('id'),
|
|
509
|
-
category: 'MPSectionCategory:affiliations',
|
|
510
|
-
};
|
|
511
|
-
},
|
|
424
|
+
tag: 'sec[sec-type="keywords"]',
|
|
425
|
+
node: 'keywords',
|
|
512
426
|
},
|
|
513
427
|
{
|
|
514
|
-
tag: '
|
|
515
|
-
node: '
|
|
516
|
-
context: 'affiliations_section/',
|
|
517
|
-
getAttrs: (node) => {
|
|
518
|
-
const element = node;
|
|
519
|
-
const aff = {
|
|
520
|
-
id: element.getAttribute('id'),
|
|
521
|
-
};
|
|
522
|
-
const institution = element.getAttribute('institution');
|
|
523
|
-
if (institution) {
|
|
524
|
-
aff.institution = institution;
|
|
525
|
-
}
|
|
526
|
-
const email = element.getAttribute('email');
|
|
527
|
-
if (email) {
|
|
528
|
-
aff.bibliographicName = JSON.parse(email);
|
|
529
|
-
}
|
|
530
|
-
const department = element.getAttribute('department');
|
|
531
|
-
if (department) {
|
|
532
|
-
aff.department = department;
|
|
533
|
-
}
|
|
534
|
-
const addressLine1 = element.getAttribute('addressLine1');
|
|
535
|
-
if (addressLine1) {
|
|
536
|
-
aff.addressLine1 = addressLine1;
|
|
537
|
-
}
|
|
538
|
-
const addressLine2 = element.getAttribute('addressLine2');
|
|
539
|
-
if (addressLine2) {
|
|
540
|
-
aff.addressLine2 = addressLine2;
|
|
541
|
-
}
|
|
542
|
-
const addressLine3 = element.getAttribute('addressLine3');
|
|
543
|
-
if (addressLine3) {
|
|
544
|
-
aff.addressLine3 = addressLine3;
|
|
545
|
-
}
|
|
546
|
-
const postCode = element.getAttribute('postCode');
|
|
547
|
-
if (postCode) {
|
|
548
|
-
aff.postCode = postCode;
|
|
549
|
-
}
|
|
550
|
-
const country = element.getAttribute('country');
|
|
551
|
-
if (country) {
|
|
552
|
-
aff.country = country;
|
|
553
|
-
}
|
|
554
|
-
const priority = element.getAttribute('priority');
|
|
555
|
-
if (priority) {
|
|
556
|
-
aff.priority = parseInt(priority);
|
|
557
|
-
}
|
|
558
|
-
return aff;
|
|
559
|
-
},
|
|
428
|
+
tag: 'sec[sec-type="abstracts"]',
|
|
429
|
+
node: 'abstracts',
|
|
560
430
|
},
|
|
561
431
|
{
|
|
562
|
-
tag: 'sec[sec-type="
|
|
563
|
-
node: '
|
|
564
|
-
getAttrs: (node) => {
|
|
565
|
-
const element = node;
|
|
566
|
-
return {
|
|
567
|
-
id: element.getAttribute('id'),
|
|
568
|
-
category: 'MPSectionCategory:contributors',
|
|
569
|
-
};
|
|
570
|
-
},
|
|
432
|
+
tag: 'sec[sec-type="body"]',
|
|
433
|
+
node: 'body',
|
|
571
434
|
},
|
|
572
435
|
{
|
|
573
|
-
tag: '
|
|
574
|
-
node: '
|
|
575
|
-
context: 'contributors_section/',
|
|
576
|
-
getAttrs: (node) => {
|
|
577
|
-
const element = node;
|
|
578
|
-
const contrib = {
|
|
579
|
-
id: element.getAttribute('id'),
|
|
580
|
-
};
|
|
581
|
-
const role = element.getAttribute('role');
|
|
582
|
-
if (role) {
|
|
583
|
-
contrib.role = role;
|
|
584
|
-
}
|
|
585
|
-
const affiliations = element.getAttribute('affiliations');
|
|
586
|
-
if (affiliations) {
|
|
587
|
-
contrib.affiliations = JSON.parse(affiliations);
|
|
588
|
-
}
|
|
589
|
-
const footnote = element.getAttribute('footnote');
|
|
590
|
-
if (footnote) {
|
|
591
|
-
contrib.footnote = JSON.parse(footnote);
|
|
592
|
-
}
|
|
593
|
-
const corresp = element.getAttribute('corresp');
|
|
594
|
-
if (corresp) {
|
|
595
|
-
contrib.corresp = JSON.parse(corresp);
|
|
596
|
-
}
|
|
597
|
-
const bibliographicName = element.getAttribute('bibliographicName');
|
|
598
|
-
if (bibliographicName) {
|
|
599
|
-
contrib.bibliographicName = JSON.parse(bibliographicName);
|
|
600
|
-
}
|
|
601
|
-
const userID = element.getAttribute('userID');
|
|
602
|
-
if (userID) {
|
|
603
|
-
contrib.userID = userID;
|
|
604
|
-
}
|
|
605
|
-
const priority = element.getAttribute('priority');
|
|
606
|
-
if (priority) {
|
|
607
|
-
contrib.priority = parseInt(priority);
|
|
608
|
-
}
|
|
609
|
-
const invitationID = element.getAttribute('invitationID');
|
|
610
|
-
if (invitationID) {
|
|
611
|
-
contrib.invitationID = invitationID;
|
|
612
|
-
}
|
|
613
|
-
const objectType = element.getAttribute('objectType');
|
|
614
|
-
if (objectType) {
|
|
615
|
-
contrib.objectType = objectType;
|
|
616
|
-
}
|
|
617
|
-
const isCorresponding = element.getAttribute('isCorresponding');
|
|
618
|
-
if (isCorresponding) {
|
|
619
|
-
contrib.isCorresponding = JSON.parse(isCorresponding);
|
|
620
|
-
}
|
|
621
|
-
const ORCIDIdentifier = element.getAttribute('ORCIDIdentifier');
|
|
622
|
-
if (ORCIDIdentifier) {
|
|
623
|
-
contrib.ORCIDIdentifier = ORCIDIdentifier;
|
|
624
|
-
}
|
|
625
|
-
return contrib;
|
|
626
|
-
},
|
|
436
|
+
tag: 'sec[sec-type="backmatter"]',
|
|
437
|
+
node: 'backmatter',
|
|
627
438
|
},
|
|
628
439
|
{
|
|
629
|
-
tag: 'sec
|
|
630
|
-
node: '
|
|
440
|
+
tag: 'sec',
|
|
441
|
+
node: 'section',
|
|
631
442
|
getAttrs: (node) => {
|
|
632
443
|
const element = node;
|
|
633
444
|
return {
|
|
@@ -638,24 +449,13 @@ const nodes = [
|
|
|
638
449
|
},
|
|
639
450
|
{
|
|
640
451
|
tag: 'kwd-group-list',
|
|
641
|
-
context: '
|
|
452
|
+
context: 'keywords/',
|
|
642
453
|
node: 'keywords_element',
|
|
643
454
|
},
|
|
644
|
-
{
|
|
645
|
-
tag: 'sec',
|
|
646
|
-
node: 'section',
|
|
647
|
-
getAttrs: (node) => {
|
|
648
|
-
const element = node;
|
|
649
|
-
return {
|
|
650
|
-
id: element.getAttribute('id'),
|
|
651
|
-
category: chooseSectionCategory(element),
|
|
652
|
-
};
|
|
653
|
-
},
|
|
654
|
-
},
|
|
655
455
|
{
|
|
656
456
|
tag: 'kwd-group',
|
|
657
457
|
context: 'keywords_element/',
|
|
658
|
-
node: '
|
|
458
|
+
node: 'keyword_group',
|
|
659
459
|
getAttrs: (node) => {
|
|
660
460
|
const element = node;
|
|
661
461
|
return {
|
|
@@ -665,7 +465,7 @@ const nodes = [
|
|
|
665
465
|
},
|
|
666
466
|
{
|
|
667
467
|
tag: 'kwd',
|
|
668
|
-
context: '
|
|
468
|
+
context: 'keyword_group//',
|
|
669
469
|
node: 'keyword',
|
|
670
470
|
},
|
|
671
471
|
{
|
|
@@ -720,7 +520,7 @@ const nodes = [
|
|
|
720
520
|
{
|
|
721
521
|
tag: 'title',
|
|
722
522
|
node: 'section_title',
|
|
723
|
-
context: 'section/|footnotes_section/|bibliography_section/|
|
|
523
|
+
context: 'section/|footnotes_section/|bibliography_section/|keywords/',
|
|
724
524
|
},
|
|
725
525
|
{
|
|
726
526
|
tag: 'title',
|
|
@@ -769,15 +569,11 @@ const nodes = [
|
|
|
769
569
|
tag: 'xref[ref-type="bibr"]',
|
|
770
570
|
node: 'citation',
|
|
771
571
|
getAttrs: (node) => {
|
|
772
|
-
var _a;
|
|
572
|
+
var _a, _b;
|
|
773
573
|
const element = node;
|
|
774
|
-
const embeddedCitationAttr = element.getAttribute('data-reference-embedded-citation');
|
|
775
574
|
return {
|
|
776
|
-
|
|
777
|
-
contents: (
|
|
778
|
-
embeddedCitationItems: embeddedCitationAttr
|
|
779
|
-
? JSON.parse(embeddedCitationAttr)
|
|
780
|
-
: null,
|
|
575
|
+
rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
|
|
576
|
+
contents: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
|
|
781
577
|
};
|
|
782
578
|
},
|
|
783
579
|
},
|
|
@@ -785,11 +581,11 @@ const nodes = [
|
|
|
785
581
|
tag: 'xref[ref-type="fn"]',
|
|
786
582
|
node: 'inline_footnote',
|
|
787
583
|
getAttrs: (node) => {
|
|
788
|
-
var _a;
|
|
584
|
+
var _a, _b;
|
|
789
585
|
const element = node;
|
|
790
586
|
return {
|
|
791
|
-
|
|
792
|
-
contents: (
|
|
587
|
+
rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
|
|
588
|
+
contents: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
|
|
793
589
|
};
|
|
794
590
|
},
|
|
795
591
|
},
|
|
@@ -797,11 +593,11 @@ const nodes = [
|
|
|
797
593
|
tag: 'xref',
|
|
798
594
|
node: 'cross_reference',
|
|
799
595
|
getAttrs: (node) => {
|
|
800
|
-
var _a;
|
|
596
|
+
var _a, _b;
|
|
801
597
|
const element = node;
|
|
802
598
|
return {
|
|
803
|
-
|
|
804
|
-
label: (
|
|
599
|
+
rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
|
|
600
|
+
label: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
|
|
805
601
|
};
|
|
806
602
|
},
|
|
807
603
|
},
|