@manuscripts/transform 1.5.7-LEAN-3030 → 1.5.7-LEAN-3030-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.
Files changed (72) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/jats/importer/index.js +1 -3
  3. package/dist/cjs/jats/importer/jats-body-dom-parser.js +9 -218
  4. package/dist/cjs/jats/importer/jats-body-transformations.js +107 -198
  5. package/dist/cjs/jats/importer/jats-comments.js +100 -98
  6. package/dist/cjs/jats/importer/jats-front-parser.js +87 -81
  7. package/dist/cjs/jats/importer/jats-journal-meta-parser.js +51 -39
  8. package/dist/cjs/jats/importer/jats-parser-utils.js +17 -56
  9. package/dist/cjs/jats/importer/jats-reference-parser.js +24 -79
  10. package/dist/cjs/jats/importer/jats-references.js +34 -0
  11. package/dist/cjs/jats/importer/parse-jats-article.js +67 -173
  12. package/dist/cjs/jats/index.js +1 -3
  13. package/dist/cjs/jats/jats-exporter.js +21 -46
  14. package/dist/cjs/lib/section-group-type.js +30 -0
  15. package/dist/cjs/schema/nodes/citation.js +10 -15
  16. package/dist/cjs/schema/nodes/cross_reference.js +4 -3
  17. package/dist/cjs/schema/nodes/inline_footnote.js +6 -5
  18. package/dist/cjs/transformer/builders.js +9 -86
  19. package/dist/cjs/transformer/encode.js +33 -3
  20. package/dist/cjs/transformer/highlight-markers.js +4 -4
  21. package/dist/cjs/transformer/html.js +4 -19
  22. package/dist/cjs/transformer/node-types.js +0 -1
  23. package/dist/cjs/transformer/object-types.js +1 -2
  24. package/dist/cjs/transformer/section-category.js +1 -10
  25. package/dist/es/index.js +1 -1
  26. package/dist/es/jats/importer/index.js +1 -1
  27. package/dist/es/jats/importer/jats-body-dom-parser.js +9 -218
  28. package/dist/es/jats/importer/jats-body-transformations.js +108 -199
  29. package/dist/es/jats/importer/jats-comments.js +97 -96
  30. package/dist/es/jats/importer/jats-front-parser.js +88 -82
  31. package/dist/es/jats/importer/jats-journal-meta-parser.js +51 -39
  32. package/dist/es/jats/importer/jats-parser-utils.js +16 -54
  33. package/dist/es/jats/importer/jats-reference-parser.js +27 -82
  34. package/dist/es/jats/importer/jats-references.js +30 -0
  35. package/dist/es/jats/importer/parse-jats-article.js +70 -174
  36. package/dist/es/jats/index.js +1 -1
  37. package/dist/es/jats/jats-exporter.js +21 -46
  38. package/dist/es/lib/section-group-type.js +27 -0
  39. package/dist/es/schema/nodes/citation.js +10 -15
  40. package/dist/es/schema/nodes/cross_reference.js +4 -3
  41. package/dist/es/schema/nodes/inline_footnote.js +6 -5
  42. package/dist/es/transformer/builders.js +6 -73
  43. package/dist/es/transformer/encode.js +34 -4
  44. package/dist/es/transformer/highlight-markers.js +1 -1
  45. package/dist/es/transformer/html.js +4 -19
  46. package/dist/es/transformer/node-types.js +0 -1
  47. package/dist/es/transformer/object-types.js +0 -1
  48. package/dist/es/transformer/section-category.js +0 -8
  49. package/dist/types/index.d.ts +1 -1
  50. package/dist/types/jats/importer/index.d.ts +1 -1
  51. package/dist/types/jats/importer/jats-body-transformations.d.ts +16 -19
  52. package/dist/types/jats/importer/jats-comments.d.ts +13 -9
  53. package/dist/types/jats/importer/jats-front-parser.d.ts +35 -12
  54. package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +4 -4
  55. package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -6
  56. package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -6
  57. package/dist/types/jats/importer/jats-references.d.ts +12 -0
  58. package/dist/types/jats/importer/parse-jats-article.d.ts +5 -17
  59. package/dist/types/jats/index.d.ts +1 -1
  60. package/dist/types/lib/section-group-type.d.ts +31 -0
  61. package/dist/types/lib/utils.d.ts +1 -1
  62. package/dist/types/schema/nodes/citation.d.ts +3 -5
  63. package/dist/types/schema/nodes/cross_reference.d.ts +1 -1
  64. package/dist/types/schema/nodes/inline_footnote.d.ts +1 -1
  65. package/dist/types/transformer/builders.d.ts +2 -14
  66. package/dist/types/transformer/highlight-markers.d.ts +1 -0
  67. package/dist/types/transformer/object-types.d.ts +1 -2
  68. package/dist/types/transformer/section-category.d.ts +0 -1
  69. package/package.json +1 -1
  70. package/dist/cjs/lib/core-section-categories.js +0 -29
  71. package/dist/es/lib/core-section-categories.js +0 -26
  72. package/dist/types/lib/core-section-categories.d.ts +0 -8
package/dist/cjs/index.js CHANGED
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.isSectionLabelNode = void 0;
18
- __exportStar(require("./lib/core-section-categories"), exports);
18
+ __exportStar(require("./lib/section-group-type"), exports);
19
19
  __exportStar(require("./lib/table-cell-styles"), exports);
20
20
  __exportStar(require("./lib/utils"), exports);
21
21
  __exportStar(require("./mathjax"), exports);
@@ -15,10 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getElementsOrder = exports.parseJATSArticle = exports.parseJATSReferences = exports.parseJATSBody = exports.parseJATSFront = void 0;
18
+ exports.parseJATSArticle = exports.parseJATSBody = exports.parseJATSFront = void 0;
19
19
  var parse_jats_article_1 = require("./parse-jats-article");
20
20
  Object.defineProperty(exports, "parseJATSFront", { enumerable: true, get: function () { return parse_jats_article_1.parseJATSFront; } });
21
21
  Object.defineProperty(exports, "parseJATSBody", { enumerable: true, get: function () { return parse_jats_article_1.parseJATSBody; } });
22
- Object.defineProperty(exports, "parseJATSReferences", { enumerable: true, get: function () { return parse_jats_article_1.parseJATSReferences; } });
23
22
  Object.defineProperty(exports, "parseJATSArticle", { enumerable: true, get: function () { return parse_jats_article_1.parseJATSArticle; } });
24
- Object.defineProperty(exports, "getElementsOrder", { enumerable: true, get: function () { return parse_jats_article_1.getElementsOrder; } });
@@ -338,75 +338,6 @@ const nodes = [
338
338
  };
339
339
  },
340
340
  },
341
- {
342
- tag: 'ref',
343
- node: 'bibliography_item',
344
- context: 'bibliography_element/',
345
- getAttrs: (node) => {
346
- const element = node;
347
- const ref = {
348
- id: element.getAttribute('id'),
349
- type: element.getAttribute('type'),
350
- };
351
- const author = element.getAttribute('author');
352
- if (author) {
353
- ref.author = author;
354
- }
355
- const issued = element.getAttribute('issued');
356
- if (issued) {
357
- ref.issued = issued;
358
- }
359
- const containerTitle = element.getAttribute('container-title');
360
- if (containerTitle) {
361
- ref.containerTitle = containerTitle;
362
- }
363
- const doi = element.getAttribute('doi');
364
- if (doi) {
365
- ref.doi = doi;
366
- }
367
- const volume = element.getAttribute('volume');
368
- if (volume) {
369
- ref.volume = volume;
370
- }
371
- const issue = element.getAttribute('issue');
372
- if (issue) {
373
- ref.issue = issue;
374
- }
375
- const supplement = element.getAttribute('supplement');
376
- if (supplement) {
377
- ref.supplement = supplement;
378
- }
379
- const page = element.getAttribute('page');
380
- if (page) {
381
- ref.page = page;
382
- }
383
- const title = element.getAttribute('title');
384
- if (title) {
385
- ref.title = title;
386
- }
387
- const literal = element.getAttribute('literal');
388
- if (literal) {
389
- ref.literal = literal;
390
- }
391
- return ref;
392
- },
393
- },
394
- {
395
- tag: 'ref-list',
396
- node: 'bibliography_element',
397
- context: 'bibliography_section/',
398
- getAttrs: (node) => {
399
- const element = node;
400
- const titleNode = element.querySelector('title');
401
- if (titleNode) {
402
- element.removeChild(titleNode);
403
- }
404
- return {
405
- id: element.getAttribute('id'),
406
- contents: '',
407
- };
408
- },
409
- },
410
341
  {
411
342
  tag: 'fn-group',
412
343
  node: 'footnotes_element',
@@ -495,142 +426,6 @@ const nodes = [
495
426
  };
496
427
  },
497
428
  },
498
- {
499
- tag: 'sec[sec-type="bibliography"]',
500
- node: 'bibliography_section',
501
- getAttrs: (node) => {
502
- const element = node;
503
- return {
504
- id: element.getAttribute('id'),
505
- };
506
- },
507
- },
508
- {
509
- tag: 'sec[sec-type="affiliations"]',
510
- node: 'affiliations',
511
- getAttrs: (node) => {
512
- const element = node;
513
- return {
514
- id: element.getAttribute('id'),
515
- category: 'MPSectionCategory:affiliations',
516
- };
517
- },
518
- },
519
- {
520
- tag: 'aff',
521
- node: 'affiliation',
522
- context: 'affiliations/',
523
- getAttrs: (node) => {
524
- const element = node;
525
- const aff = {
526
- id: element.getAttribute('id'),
527
- };
528
- const institution = element.getAttribute('institution');
529
- if (institution) {
530
- aff.institution = institution;
531
- }
532
- const email = element.getAttribute('email');
533
- if (email) {
534
- aff.bibliographicName = JSON.parse(email);
535
- }
536
- const department = element.getAttribute('department');
537
- if (department) {
538
- aff.department = department;
539
- }
540
- const addressLine1 = element.getAttribute('addressLine1');
541
- if (addressLine1) {
542
- aff.addressLine1 = addressLine1;
543
- }
544
- const addressLine2 = element.getAttribute('addressLine2');
545
- if (addressLine2) {
546
- aff.addressLine2 = addressLine2;
547
- }
548
- const addressLine3 = element.getAttribute('addressLine3');
549
- if (addressLine3) {
550
- aff.addressLine3 = addressLine3;
551
- }
552
- const postCode = element.getAttribute('postCode');
553
- if (postCode) {
554
- aff.postCode = postCode;
555
- }
556
- const country = element.getAttribute('country');
557
- if (country) {
558
- aff.country = country;
559
- }
560
- const priority = element.getAttribute('priority');
561
- if (priority) {
562
- aff.priority = parseInt(priority);
563
- }
564
- return aff;
565
- },
566
- },
567
- {
568
- tag: 'sec[sec-type="contributors"]',
569
- node: 'contributors',
570
- getAttrs: (node) => {
571
- const element = node;
572
- return {
573
- id: element.getAttribute('id'),
574
- category: 'MPSectionCategory:contributors',
575
- };
576
- },
577
- },
578
- {
579
- tag: 'contrib',
580
- node: 'contributor',
581
- context: 'contributors/',
582
- getAttrs: (node) => {
583
- const element = node;
584
- const contrib = {
585
- id: element.getAttribute('id'),
586
- };
587
- const role = element.getAttribute('role');
588
- if (role) {
589
- contrib.role = role;
590
- }
591
- const affiliations = element.getAttribute('affiliations');
592
- if (affiliations) {
593
- contrib.affiliations = JSON.parse(affiliations);
594
- }
595
- const footnote = element.getAttribute('footnote');
596
- if (footnote) {
597
- contrib.footnote = JSON.parse(footnote);
598
- }
599
- const corresp = element.getAttribute('corresp');
600
- if (corresp) {
601
- contrib.corresp = JSON.parse(corresp);
602
- }
603
- const bibliographicName = element.getAttribute('bibliographicName');
604
- if (bibliographicName) {
605
- contrib.bibliographicName = JSON.parse(bibliographicName);
606
- }
607
- const userID = element.getAttribute('userID');
608
- if (userID) {
609
- contrib.userID = userID;
610
- }
611
- const priority = element.getAttribute('priority');
612
- if (priority) {
613
- contrib.priority = parseInt(priority);
614
- }
615
- const invitationID = element.getAttribute('invitationID');
616
- if (invitationID) {
617
- contrib.invitationID = invitationID;
618
- }
619
- const objectType = element.getAttribute('objectType');
620
- if (objectType) {
621
- contrib.objectType = objectType;
622
- }
623
- const isCorresponding = element.getAttribute('isCorresponding');
624
- if (isCorresponding) {
625
- contrib.isCorresponding = JSON.parse(isCorresponding);
626
- }
627
- const ORCIDIdentifier = element.getAttribute('ORCIDIdentifier');
628
- if (ORCIDIdentifier) {
629
- contrib.ORCIDIdentifier = ORCIDIdentifier;
630
- }
631
- return contrib;
632
- },
633
- },
634
429
  {
635
430
  tag: 'sec[sec-type="keywords"]',
636
431
  node: 'keywords',
@@ -780,15 +575,11 @@ const nodes = [
780
575
  tag: 'xref[ref-type="bibr"]',
781
576
  node: 'citation',
782
577
  getAttrs: (node) => {
783
- var _a;
578
+ var _a, _b;
784
579
  const element = node;
785
- const embeddedCitationAttr = element.getAttribute('data-reference-embedded-citation');
786
580
  return {
787
- rid: element.getAttribute('rid'),
788
- contents: (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
789
- embeddedCitationItems: embeddedCitationAttr
790
- ? JSON.parse(embeddedCitationAttr)
791
- : null,
581
+ rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
582
+ contents: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
792
583
  };
793
584
  },
794
585
  },
@@ -796,11 +587,11 @@ const nodes = [
796
587
  tag: 'xref[ref-type="fn"]',
797
588
  node: 'inline_footnote',
798
589
  getAttrs: (node) => {
799
- var _a;
590
+ var _a, _b;
800
591
  const element = node;
801
592
  return {
802
- rid: element.getAttribute('rid'),
803
- contents: (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
593
+ rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
594
+ contents: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
804
595
  };
805
596
  },
806
597
  },
@@ -808,11 +599,11 @@ const nodes = [
808
599
  tag: 'xref',
809
600
  node: 'cross_reference',
810
601
  getAttrs: (node) => {
811
- var _a;
602
+ var _a, _b;
812
603
  const element = node;
813
604
  return {
814
- rid: element.getAttribute('rid'),
815
- label: (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
605
+ rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
606
+ label: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
816
607
  };
817
608
  },
818
609
  },