@manuscripts/transform 1.5.6 → 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 (111) 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 +23 -227
  4. package/dist/cjs/jats/importer/jats-body-transformations.js +110 -201
  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 +32 -52
  14. package/dist/cjs/lib/section-group-type.js +30 -0
  15. package/dist/cjs/lib/utils.js +10 -1
  16. package/dist/cjs/schema/index.js +15 -11
  17. package/dist/cjs/schema/nodes/{affiliations_section.js → affiliations.js} +9 -8
  18. package/dist/cjs/schema/nodes/citation.js +10 -15
  19. package/dist/cjs/schema/nodes/{contributors_section.js → contributors.js} +8 -7
  20. package/dist/cjs/schema/nodes/core_section.js +27 -0
  21. package/dist/cjs/schema/nodes/cross_reference.js +4 -3
  22. package/dist/cjs/schema/nodes/graphical_abstract_section.js +1 -0
  23. package/dist/cjs/schema/nodes/inline_footnote.js +6 -5
  24. package/dist/cjs/schema/nodes/keyword.js +0 -1
  25. package/dist/cjs/schema/nodes/{keywords_group.js → keyword_group.js} +6 -6
  26. package/dist/cjs/schema/nodes/{keywords_section.js → keywords.js} +7 -7
  27. package/dist/cjs/schema/nodes/keywords_element.js +1 -1
  28. package/dist/cjs/schema/nodes/manuscript.js +1 -1
  29. package/dist/cjs/transformer/builders.js +9 -86
  30. package/dist/cjs/transformer/decode.js +110 -113
  31. package/dist/cjs/transformer/encode.js +46 -29
  32. package/dist/cjs/transformer/highlight-markers.js +4 -4
  33. package/dist/cjs/transformer/html.js +4 -19
  34. package/dist/cjs/transformer/node-names.js +1 -1
  35. package/dist/cjs/transformer/node-title.js +1 -1
  36. package/dist/cjs/transformer/node-types.js +7 -5
  37. package/dist/cjs/transformer/object-types.js +1 -2
  38. package/dist/cjs/transformer/section-category.js +35 -17
  39. package/dist/es/index.js +1 -1
  40. package/dist/es/jats/importer/index.js +1 -1
  41. package/dist/es/jats/importer/jats-body-dom-parser.js +23 -227
  42. package/dist/es/jats/importer/jats-body-transformations.js +111 -202
  43. package/dist/es/jats/importer/jats-comments.js +97 -96
  44. package/dist/es/jats/importer/jats-front-parser.js +88 -82
  45. package/dist/es/jats/importer/jats-journal-meta-parser.js +51 -39
  46. package/dist/es/jats/importer/jats-parser-utils.js +16 -54
  47. package/dist/es/jats/importer/jats-reference-parser.js +27 -82
  48. package/dist/es/jats/importer/jats-references.js +30 -0
  49. package/dist/es/jats/importer/parse-jats-article.js +70 -174
  50. package/dist/es/jats/index.js +1 -1
  51. package/dist/es/jats/jats-exporter.js +32 -52
  52. package/dist/es/lib/section-group-type.js +27 -0
  53. package/dist/es/lib/utils.js +8 -0
  54. package/dist/es/schema/index.js +15 -11
  55. package/dist/es/schema/nodes/{affiliations_section.js → affiliations.js} +7 -6
  56. package/dist/es/schema/nodes/citation.js +10 -15
  57. package/dist/es/schema/nodes/{contributors_section.js → contributors.js} +6 -5
  58. package/dist/es/schema/nodes/core_section.js +24 -0
  59. package/dist/es/schema/nodes/cross_reference.js +4 -3
  60. package/dist/es/schema/nodes/graphical_abstract_section.js +1 -0
  61. package/dist/es/schema/nodes/inline_footnote.js +6 -5
  62. package/dist/es/schema/nodes/keyword.js +0 -1
  63. package/dist/es/schema/nodes/{keywords_group.js → keyword_group.js} +4 -4
  64. package/dist/es/schema/nodes/{keywords_section.js → keywords.js} +5 -5
  65. package/dist/es/schema/nodes/keywords_element.js +1 -1
  66. package/dist/es/schema/nodes/manuscript.js +1 -1
  67. package/dist/es/transformer/builders.js +6 -73
  68. package/dist/es/transformer/decode.js +111 -114
  69. package/dist/es/transformer/encode.js +47 -30
  70. package/dist/es/transformer/highlight-markers.js +1 -1
  71. package/dist/es/transformer/html.js +4 -19
  72. package/dist/es/transformer/node-names.js +1 -1
  73. package/dist/es/transformer/node-title.js +1 -1
  74. package/dist/es/transformer/node-types.js +7 -5
  75. package/dist/es/transformer/object-types.js +0 -1
  76. package/dist/es/transformer/section-category.js +33 -15
  77. package/dist/types/index.d.ts +1 -1
  78. package/dist/types/jats/importer/index.d.ts +1 -1
  79. package/dist/types/jats/importer/jats-body-transformations.d.ts +16 -19
  80. package/dist/types/jats/importer/jats-comments.d.ts +13 -9
  81. package/dist/types/jats/importer/jats-front-parser.d.ts +35 -12
  82. package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +4 -4
  83. package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -6
  84. package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -6
  85. package/dist/types/jats/importer/jats-references.d.ts +12 -0
  86. package/dist/types/jats/importer/parse-jats-article.d.ts +5 -17
  87. package/dist/types/jats/index.d.ts +1 -1
  88. package/dist/types/lib/section-group-type.d.ts +31 -0
  89. package/dist/types/lib/utils.d.ts +2 -1
  90. package/dist/types/schema/index.d.ts +3 -3
  91. package/dist/types/schema/nodes/affiliations.d.ts +11 -0
  92. package/dist/types/schema/nodes/citation.d.ts +3 -5
  93. package/dist/types/schema/nodes/contributors.d.ts +12 -0
  94. package/dist/types/schema/nodes/core_section.d.ts +17 -0
  95. package/dist/types/schema/nodes/cross_reference.d.ts +1 -1
  96. package/dist/types/schema/nodes/inline_footnote.d.ts +1 -1
  97. package/dist/types/schema/nodes/keyword.d.ts +0 -1
  98. package/dist/types/schema/nodes/{keywords_group.d.ts → keyword_group.d.ts} +3 -3
  99. package/dist/types/schema/nodes/{keywords_section.d.ts → keywords.d.ts} +3 -3
  100. package/dist/types/schema/types.d.ts +1 -1
  101. package/dist/types/transformer/builders.d.ts +2 -14
  102. package/dist/types/transformer/decode.d.ts +6 -6
  103. package/dist/types/transformer/highlight-markers.d.ts +1 -0
  104. package/dist/types/transformer/object-types.d.ts +1 -2
  105. package/dist/types/transformer/section-category.d.ts +1 -1
  106. package/package.json +1 -1
  107. package/dist/cjs/lib/core-section-categories.js +0 -29
  108. package/dist/es/lib/core-section-categories.js +0 -26
  109. package/dist/types/lib/core-section-categories.d.ts +0 -8
  110. package/dist/types/schema/nodes/affiliations_section.d.ts +0 -11
  111. package/dist/types/schema/nodes/contributors_section.d.ts +0 -12
@@ -431,9 +431,11 @@ class JATSExporter {
431
431
  }
432
432
  };
433
433
  this.buildBody = (fragment) => {
434
- const content = this.serializeFragment(fragment);
435
434
  const body = this.document.createElement('body');
436
- body.appendChild(content);
435
+ fragment.forEach((cFragment) => {
436
+ const serializedNode = this.serializeNode(cFragment);
437
+ body.append(...serializedNode.childNodes);
438
+ });
437
439
  this.fixBody(body, fragment);
438
440
  return body;
439
441
  };
@@ -600,8 +602,8 @@ class JATSExporter {
600
602
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
601
603
  const nodes = {
602
604
  title: () => '',
603
- affiliations_section: () => '',
604
- contributors_section: () => '',
605
+ affiliations: () => '',
606
+ contributors: () => '',
605
607
  table_element_footer: () => ['table-wrap-foot', 0],
606
608
  contributor: () => '',
607
609
  affiliation: () => '',
@@ -610,7 +612,10 @@ class JATSExporter {
610
612
  bibliography_element: () => '',
611
613
  bibliography_item: () => '',
612
614
  comment_list: () => '',
613
- keywords_group: () => '',
615
+ keyword_group: () => '',
616
+ body: () => ['body', 0],
617
+ abstracts: () => ['abstract', 0],
618
+ backmatter: () => ['backmatter', 0],
614
619
  bibliography_section: (node) => [
615
620
  'ref-list',
616
621
  { id: normalizeID(node.attrs.id) },
@@ -626,26 +631,15 @@ class JATSExporter {
626
631
  return ['title', 0];
627
632
  },
628
633
  citation: (node) => {
629
- if (!node.attrs.rid) {
630
- warn(`${node.attrs.id} has no rid`);
631
- return node.attrs.label;
632
- }
633
- const rids = node.attrs
634
- .embeddedCitationItems.filter((item) => {
635
- if (!this.modelMap.has(item.bibliographyItem)) {
636
- warn(`Missing ${item.bibliographyItem} referenced by ${node.attrs.rid}`);
637
- return false;
638
- }
639
- return true;
640
- });
634
+ const citation = node;
635
+ const rids = citation.attrs.rids;
641
636
  if (!rids.length) {
642
- warn(`${node.attrs.rid} has no confirmed rids`);
643
637
  return '';
644
638
  }
645
639
  const xref = this.document.createElement('xref');
646
640
  xref.setAttribute('ref-type', 'bibr');
647
- xref.setAttribute('rid', rids.map((item) => normalizeID(item.bibliographyItem)).join(' '));
648
- if (node.attrs.contents) {
641
+ xref.setAttribute('rid', normalizeID(rids.join(' ')));
642
+ if (citation.attrs.contents) {
649
643
  const text = (0, html_1.textFromHTML)(node.attrs.contents);
650
644
  if (text !== null && text.length) {
651
645
  xref.textContent = text;
@@ -654,41 +648,27 @@ class JATSExporter {
654
648
  return xref;
655
649
  },
656
650
  cross_reference: (node) => {
657
- var _a;
658
- if (!node.attrs.rid) {
659
- warn(`${node.attrs.id} has no rid`);
660
- return node.attrs.label;
651
+ const cross = node;
652
+ const rids = cross.attrs.rids;
653
+ if (!rids.length) {
654
+ return cross.attrs.label;
661
655
  }
662
- const auxiliaryObjectReference = getModel(node.attrs.rid);
663
- if (!auxiliaryObjectReference) {
664
- warn(`Missing model ${node.attrs.rid}`);
665
- return node.attrs.label;
656
+ const text = cross.attrs.customLabel || cross.attrs.label;
657
+ const model = getModel(rids[0]);
658
+ if (!model) {
659
+ warn('');
660
+ return text;
666
661
  }
667
662
  const xref = this.document.createElement('xref');
668
- const referencedObject = getModel(auxiliaryObjectReference.referencedObject ||
669
- ((auxiliaryObjectReference === null || auxiliaryObjectReference === void 0 ? void 0 : auxiliaryObjectReference.referencedObjects) &&
670
- auxiliaryObjectReference.referencedObjects[0]));
671
- if (referencedObject) {
672
- const refType = chooseRefType(referencedObject.objectType);
673
- if (refType) {
674
- xref.setAttribute('ref-type', refType);
675
- }
676
- else {
677
- warn(`Unset ref-type for objectType ${referencedObject.objectType}`);
678
- }
663
+ const type = chooseRefType(model.objectType);
664
+ if (type) {
665
+ xref.setAttribute('ref-type', type);
679
666
  }
680
- const getReferencedObjectId = (referencedObject) => {
681
- return normalizeID(referencedObject);
682
- };
683
- if (auxiliaryObjectReference.referencedObjects) {
684
- const rid = (_a = auxiliaryObjectReference.referencedObjects) === null || _a === void 0 ? void 0 : _a.map((referencedObject) => getReferencedObjectId(referencedObject)).join(' ');
685
- xref.setAttribute('rid', rid);
686
- }
687
- if (auxiliaryObjectReference.referencedObject) {
688
- const rid = getReferencedObjectId(auxiliaryObjectReference.referencedObject);
689
- xref.setAttribute('rid', rid);
667
+ else {
668
+ warn(`Unset ref-type for objectType ${model.objectType}`);
690
669
  }
691
- xref.textContent = node.attrs.customLabel || node.attrs.label;
670
+ xref.setAttribute('rid', normalizeID(rids.join(' ')));
671
+ xref.textContent = text;
692
672
  return xref;
693
673
  },
694
674
  doc: () => '',
@@ -783,13 +763,13 @@ class JATSExporter {
783
763
  inline_footnote: (node) => {
784
764
  const xref = this.document.createElement('xref');
785
765
  xref.setAttribute('ref-type', 'fn');
786
- xref.setAttribute('rid', normalizeID(node.attrs.rid));
766
+ xref.setAttribute('rid', normalizeID(node.attrs.rids.join(' ')));
787
767
  xref.textContent = node.attrs.contents;
788
768
  return xref;
789
769
  },
790
770
  keyword: () => '',
791
771
  keywords_element: () => '',
792
- keywords_section: () => '',
772
+ keywords: () => '',
793
773
  link: (node) => {
794
774
  const text = node.textContent;
795
775
  if (!text) {
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2023 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.backmatterType = exports.bodyType = exports.abstractsType = void 0;
19
+ exports.abstractsType = {
20
+ _id: 'abstracts',
21
+ title: 'Abstracts',
22
+ };
23
+ exports.bodyType = {
24
+ _id: 'body',
25
+ title: 'Body',
26
+ };
27
+ exports.backmatterType = {
28
+ _id: 'backmatter',
29
+ title: 'Backmatter',
30
+ };
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getTrimmedTextContent = exports.findParentNodeClosestToPos = exports.isInAbstractsSection = exports.isInBibliographySection = exports.isInGraphicalAbstractSection = exports.findNodePositions = exports.iterateChildren = void 0;
18
+ exports.groupBy = exports.getTrimmedTextContent = exports.findParentNodeClosestToPos = exports.isInAbstractsSection = exports.isInBibliographySection = exports.isInGraphicalAbstractSection = exports.findNodePositions = exports.iterateChildren = void 0;
19
19
  const bibliography_section_1 = require("../schema/nodes/bibliography_section");
20
20
  const graphical_abstract_section_1 = require("../schema/nodes/graphical_abstract_section");
21
21
  function* iterateChildren(node, recurse = false) {
@@ -94,3 +94,12 @@ const getTrimmedTextContent = (node, querySelector) => {
94
94
  return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
95
95
  };
96
96
  exports.getTrimmedTextContent = getTrimmedTextContent;
97
+ const groupBy = (list, getKey) => list.reduce((previous, currentItem) => {
98
+ const group = getKey(currentItem);
99
+ if (!previous[group]) {
100
+ previous[group] = [];
101
+ }
102
+ previous[group].push(currentItem);
103
+ return previous;
104
+ }, {});
105
+ exports.groupBy = groupBy;
@@ -33,7 +33,7 @@ exports.schema = void 0;
33
33
  const prosemirror_model_1 = require("prosemirror-model");
34
34
  const marks_1 = require("./marks");
35
35
  const affiliation_1 = require("./nodes/affiliation");
36
- const affiliations_section_1 = require("./nodes/affiliations_section");
36
+ const affiliations_1 = require("./nodes/affiliations");
37
37
  const attribution_1 = require("./nodes/attribution");
38
38
  const bibliography_element_1 = require("./nodes/bibliography_element");
39
39
  const bibliography_item_1 = require("./nodes/bibliography_item");
@@ -45,7 +45,8 @@ const citation_1 = require("./nodes/citation");
45
45
  const comment_1 = require("./nodes/comment");
46
46
  const comment_list_1 = require("./nodes/comment_list");
47
47
  const contributor_1 = require("./nodes/contributor");
48
- const contributors_section_1 = require("./nodes/contributors_section");
48
+ const contributors_1 = require("./nodes/contributors");
49
+ const core_section_1 = require("./nodes/core_section");
49
50
  const cross_reference_1 = require("./nodes/cross_reference");
50
51
  const doc_1 = require("./nodes/doc");
51
52
  const equation_1 = require("./nodes/equation");
@@ -62,9 +63,9 @@ const highlight_marker_1 = require("./nodes/highlight_marker");
62
63
  const inline_equation_1 = require("./nodes/inline_equation");
63
64
  const inline_footnote_1 = require("./nodes/inline_footnote");
64
65
  const keyword_1 = require("./nodes/keyword");
66
+ const keyword_group_1 = require("./nodes/keyword_group");
67
+ const keywords_1 = require("./nodes/keywords");
65
68
  const keywords_element_1 = require("./nodes/keywords_element");
66
- const keywords_group_1 = require("./nodes/keywords_group");
67
- const keywords_section_1 = require("./nodes/keywords_section");
68
69
  const link_1 = require("./nodes/link");
69
70
  const list_1 = require("./nodes/list");
70
71
  const listing_1 = require("./nodes/listing");
@@ -117,7 +118,7 @@ __exportStar(require("./nodes/inline_equation"), exports);
117
118
  __exportStar(require("./nodes/inline_footnote"), exports);
118
119
  __exportStar(require("./nodes/keyword"), exports);
119
120
  __exportStar(require("./nodes/keywords_element"), exports);
120
- __exportStar(require("./nodes/keywords_section"), exports);
121
+ __exportStar(require("./nodes/keywords"), exports);
121
122
  __exportStar(require("./nodes/link"), exports);
122
123
  __exportStar(require("./nodes/list"), exports);
123
124
  __exportStar(require("./nodes/listing"), exports);
@@ -142,8 +143,8 @@ __exportStar(require("./nodes/meta_section"), exports);
142
143
  __exportStar(require("./nodes/contributor"), exports);
143
144
  __exportStar(require("./nodes/table_element_footer"), exports);
144
145
  __exportStar(require("./nodes/title"), exports);
145
- __exportStar(require("./nodes/affiliations_section"), exports);
146
- __exportStar(require("./nodes/contributors_section"), exports);
146
+ __exportStar(require("./nodes/affiliations"), exports);
147
+ __exportStar(require("./nodes/contributors"), exports);
147
148
  exports.schema = new prosemirror_model_1.Schema({
148
149
  marks: {
149
150
  bold: marks_1.bold,
@@ -170,6 +171,9 @@ exports.schema = new prosemirror_model_1.Schema({
170
171
  caption: caption_1.caption,
171
172
  caption_title: caption_title_1.captionTitle,
172
173
  citation: citation_1.citation,
174
+ abstracts: core_section_1.coreSection,
175
+ body: core_section_1.coreSection,
176
+ backmatter: core_section_1.coreSection,
173
177
  cross_reference: cross_reference_1.crossReference,
174
178
  doc: doc_1.doc,
175
179
  equation: equation_1.equation,
@@ -187,8 +191,8 @@ exports.schema = new prosemirror_model_1.Schema({
187
191
  inline_footnote: inline_footnote_1.inlineFootnote,
188
192
  keyword: keyword_1.keyword,
189
193
  keywords_element: keywords_element_1.keywordsElement,
190
- keywords_section: keywords_section_1.keywordsSection,
191
- keywords_group: keywords_group_1.keywordsGroup,
194
+ keywords: keywords_1.keywords,
195
+ keyword_group: keyword_group_1.keywordGroup,
192
196
  link: link_1.link,
193
197
  list_item: list_1.listItem,
194
198
  listing: listing_1.listing,
@@ -219,7 +223,7 @@ exports.schema = new prosemirror_model_1.Schema({
219
223
  contributor: contributor_1.contributor,
220
224
  table_element_footer: table_element_footer_1.tableElementFooter,
221
225
  title: title_1.title,
222
- affiliations_section: affiliations_section_1.affiliationsSection,
223
- contributors_section: contributors_section_1.contributorsSection,
226
+ affiliations: affiliations_1.affiliations,
227
+ contributors: contributors_1.contributors,
224
228
  },
225
229
  });
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAffiliationsSectionNode = exports.affiliationsSection = void 0;
4
- exports.affiliationsSection = {
3
+ exports.isAffiliationsNode = exports.affiliations = void 0;
4
+ const index_1 = require("../index");
5
+ exports.affiliations = {
5
6
  content: 'section_title? affiliation*',
6
7
  attrs: {
7
8
  id: { default: 'META_SECTION_AFFILLIATIONS' },
8
9
  dataTracked: { default: null },
9
10
  },
10
- group: 'block sections',
11
+ group: 'block',
11
12
  selectable: false,
12
13
  parseDOM: [
13
14
  {
@@ -21,16 +22,16 @@ exports.affiliationsSection = {
21
22
  },
22
23
  ],
23
24
  toDOM: (node) => {
24
- const affiliationsSectionNode = node;
25
+ const affiliations = node;
25
26
  return [
26
27
  'section',
27
28
  {
28
29
  class: 'affiliations',
29
- id: affiliationsSectionNode.attrs.id,
30
+ id: affiliations.attrs.id,
30
31
  },
31
- 0
32
+ 0,
32
33
  ];
33
34
  },
34
35
  };
35
- const isAffiliationsSectionNode = (node) => node.type === node.type.schema.nodes.affiliations_section;
36
- exports.isAffiliationsSectionNode = isAffiliationsSectionNode;
36
+ const isAffiliationsNode = (node) => node.type === index_1.schema.nodes.affiliations;
37
+ exports.isAffiliationsNode = isAffiliationsNode;
@@ -22,38 +22,33 @@ exports.citation = {
22
22
  draggable: true,
23
23
  atom: true,
24
24
  attrs: {
25
- rid: { default: '' },
25
+ id: { default: '' },
26
+ rids: { default: [] },
26
27
  contents: { default: '' },
27
28
  selectedText: { default: '' },
28
29
  dataTracked: { default: null },
29
- embeddedCitationItems: { default: [] },
30
30
  },
31
31
  parseDOM: [
32
32
  {
33
33
  tag: 'span.citation[data-reference-id]',
34
34
  getAttrs: (p) => {
35
+ var _a;
35
36
  const dom = p;
36
- const attr = {
37
- rid: dom.getAttribute('data-reference-id'),
37
+ return {
38
+ id: dom.getAttribute('data-id'),
39
+ rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
38
40
  contents: dom.innerHTML,
39
41
  };
40
- const embeddedCitationAttr = dom.getAttribute('data-reference-embedded-citation');
41
- if (embeddedCitationAttr) {
42
- attr['embeddedCitationItems'] = JSON.parse(embeddedCitationAttr);
43
- }
44
- return attr;
45
42
  },
46
43
  },
47
44
  ],
48
45
  toDOM: (node) => {
49
- const citationNode = node;
46
+ const citation = node;
50
47
  const dom = document.createElement('span');
51
48
  dom.className = 'citation';
52
- dom.setAttribute('data-reference-id', citationNode.attrs.rid);
53
- if (citationNode.attrs.embeddedCitationItems) {
54
- dom.setAttribute('data-reference-embedded-citation', JSON.stringify(citationNode.attrs.embeddedCitationItems));
55
- }
56
- dom.innerHTML = citationNode.attrs.contents;
49
+ dom.setAttribute('data-id', citation.attrs.id);
50
+ dom.setAttribute('data-reference-id', citation.attrs.rids.join(' '));
51
+ dom.innerHTML = node.attrs.contents;
57
52
  return dom;
58
53
  },
59
54
  };
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isContributorsSectionNode = exports.contributorsSection = void 0;
4
- exports.contributorsSection = {
3
+ exports.isContributorsNode = exports.contributors = void 0;
4
+ const index_1 = require("../index");
5
+ exports.contributors = {
5
6
  content: 'section_title? contributor*',
6
7
  attrs: {
7
8
  id: { default: 'META_SECTION_CONTRIBUTORS' },
8
9
  dataTracked: { default: null },
9
10
  contents: { default: '' },
10
11
  },
11
- group: 'block sections',
12
+ group: 'block',
12
13
  selectable: false,
13
14
  parseDOM: [
14
15
  {
@@ -21,16 +22,16 @@ exports.contributorsSection = {
21
22
  },
22
23
  ],
23
24
  toDOM: (node) => {
24
- const contributorsSectionNode = node;
25
+ const contributors = node;
25
26
  return [
26
27
  'section',
27
28
  {
28
29
  class: 'contributors',
29
- id: contributorsSectionNode.attrs.id,
30
+ id: contributors.attrs.id,
30
31
  },
31
32
  0,
32
33
  ];
33
34
  },
34
35
  };
35
- const isContributorsSectionNode = (node) => node.type === node.type.schema.nodes.contributors_section;
36
- exports.isContributorsSectionNode = isContributorsSectionNode;
36
+ const isContributorsNode = (node) => node.type === index_1.schema.nodes.contributors;
37
+ exports.isContributorsNode = isContributorsNode;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.coreSection = void 0;
19
+ exports.coreSection = {
20
+ content: 'sections*',
21
+ atom: true,
22
+ attrs: {
23
+ id: { default: '' },
24
+ },
25
+ group: 'block',
26
+ toDOM: () => ['section', 0],
27
+ };
@@ -22,7 +22,7 @@ exports.crossReference = {
22
22
  draggable: true,
23
23
  atom: true,
24
24
  attrs: {
25
- rid: { default: '' },
25
+ rids: { default: [] },
26
26
  label: { default: '' },
27
27
  customLabel: { default: '' },
28
28
  dataTracked: { default: null },
@@ -31,9 +31,10 @@ exports.crossReference = {
31
31
  {
32
32
  tag: 'span.cross-reference',
33
33
  getAttrs: (p) => {
34
+ var _a;
34
35
  const dom = p;
35
36
  return {
36
- rid: dom.getAttribute('data-reference-id'),
37
+ rid: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
37
38
  label: dom.textContent,
38
39
  };
39
40
  },
@@ -45,7 +46,7 @@ exports.crossReference = {
45
46
  'span',
46
47
  {
47
48
  class: 'cross-reference',
48
- 'data-reference-id': crossReferenceNode.attrs.rid,
49
+ 'data-reference-id': crossReferenceNode.attrs.rids.join(' '),
49
50
  },
50
51
  [
51
52
  'span',
@@ -21,6 +21,7 @@ exports.graphicalAbstractSection = {
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  category: { default: '' },
24
+ dataTracked: { default: null },
24
25
  },
25
26
  group: 'block sections',
26
27
  selectable: false,
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isInlineFootnoteNode = exports.inlineFootnote = void 0;
19
19
  exports.inlineFootnote = {
20
20
  attrs: {
21
- rid: { default: '' },
21
+ rids: { default: [] },
22
22
  contents: { default: '' },
23
23
  dataTracked: { default: null },
24
24
  },
@@ -30,20 +30,21 @@ exports.inlineFootnote = {
30
30
  {
31
31
  tag: 'span.footnote',
32
32
  getAttrs: (p) => {
33
+ var _a;
33
34
  const dom = p;
34
35
  return {
35
- rid: dom.getAttribute('data-reference-id'),
36
+ rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
36
37
  contents: dom.textContent,
37
38
  };
38
39
  },
39
40
  },
40
41
  ],
41
42
  toDOM: (node) => {
42
- const inlineFootnoteNode = node;
43
+ const footnoteNode = node;
43
44
  const dom = document.createElement('span');
44
45
  dom.className = 'footnote';
45
- dom.setAttribute('data-reference-id', inlineFootnoteNode.attrs.rid);
46
- dom.textContent = inlineFootnoteNode.attrs.contents;
46
+ dom.setAttribute('data-reference-id', footnoteNode.attrs.rids.join(''));
47
+ dom.textContent = footnoteNode.attrs.contents;
47
48
  return dom;
48
49
  },
49
50
  };
@@ -21,7 +21,6 @@ exports.keyword = {
21
21
  content: 'inline*',
22
22
  attrs: {
23
23
  id: { default: '' },
24
- contents: { default: '' },
25
24
  dataTracked: { default: null },
26
25
  comments: { default: null },
27
26
  },
@@ -15,8 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isKeywordsGroupNode = exports.keywordsGroup = void 0;
19
- exports.keywordsGroup = {
18
+ exports.isKeywordGroupNode = exports.keywordGroup = void 0;
19
+ exports.keywordGroup = {
20
20
  content: 'keyword*',
21
21
  attrs: {
22
22
  id: { default: '' },
@@ -31,11 +31,11 @@ exports.keywordsGroup = {
31
31
  },
32
32
  ],
33
33
  toDOM: (node) => {
34
- const keywordsGroupNode = node;
34
+ const keywordGroupNode = node;
35
35
  return [
36
36
  'div',
37
37
  {
38
- id: keywordsGroupNode.attrs.id,
38
+ id: keywordGroupNode.attrs.id,
39
39
  class: 'keywords',
40
40
  spellcheck: 'false',
41
41
  contenteditable: false,
@@ -44,5 +44,5 @@ exports.keywordsGroup = {
44
44
  ];
45
45
  },
46
46
  };
47
- const isKeywordsGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
48
- exports.isKeywordsGroupNode = isKeywordsGroupNode;
47
+ const isKeywordGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
48
+ exports.isKeywordGroupNode = isKeywordGroupNode;
@@ -15,14 +15,14 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isKeywordsSectionNode = exports.keywordsSection = void 0;
19
- exports.keywordsSection = {
18
+ exports.isKeywordsNode = exports.keywords = void 0;
19
+ exports.keywords = {
20
20
  content: 'section_title (keywords_element | placeholder_element)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  dataTracked: { default: null },
24
24
  },
25
- group: 'block sections',
25
+ group: 'block',
26
26
  selectable: false,
27
27
  parseDOM: [
28
28
  {
@@ -30,11 +30,11 @@ exports.keywordsSection = {
30
30
  },
31
31
  ],
32
32
  toDOM: (node) => {
33
- const keywordsSectionNode = node;
33
+ const keywords = node;
34
34
  return [
35
35
  'div',
36
36
  {
37
- id: keywordsSectionNode.attrs.id,
37
+ id: keywords.attrs.id,
38
38
  class: 'keywords',
39
39
  spellcheck: 'false',
40
40
  contenteditable: false,
@@ -43,5 +43,5 @@ exports.keywordsSection = {
43
43
  ];
44
44
  },
45
45
  };
46
- const isKeywordsSectionNode = (node) => node.type === node.type.schema.nodes.keywords_section;
47
- exports.isKeywordsSectionNode = isKeywordsSectionNode;
46
+ const isKeywordsNode = (node) => node.type === node.type.schema.nodes.keywords;
47
+ exports.isKeywordsNode = isKeywordsNode;
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.keywordsElement = void 0;
19
19
  exports.keywordsElement = {
20
20
  atom: true,
21
- content: 'keywords_group*',
21
+ content: 'keyword_group*',
22
22
  attrs: {
23
23
  id: { default: '' },
24
24
  contents: { default: '' },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.manuscript = void 0;
19
19
  exports.manuscript = {
20
- content: 'title* (section | sections)+ meta_section',
20
+ content: 'title? contributors? affiliations? keywords? abstracts body backmatter meta_section',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  },