@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
@@ -424,9 +424,11 @@ export class JATSExporter {
424
424
  }
425
425
  };
426
426
  this.buildBody = (fragment) => {
427
- const content = this.serializeFragment(fragment);
428
427
  const body = this.document.createElement('body');
429
- body.appendChild(content);
428
+ fragment.forEach((cFragment) => {
429
+ const serializedNode = this.serializeNode(cFragment);
430
+ body.append(...serializedNode.childNodes);
431
+ });
430
432
  this.fixBody(body, fragment);
431
433
  return body;
432
434
  };
@@ -593,8 +595,8 @@ export class JATSExporter {
593
595
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
594
596
  const nodes = {
595
597
  title: () => '',
596
- affiliations_section: () => '',
597
- contributors_section: () => '',
598
+ affiliations: () => '',
599
+ contributors: () => '',
598
600
  table_element_footer: () => ['table-wrap-foot', 0],
599
601
  contributor: () => '',
600
602
  affiliation: () => '',
@@ -603,7 +605,10 @@ export class JATSExporter {
603
605
  bibliography_element: () => '',
604
606
  bibliography_item: () => '',
605
607
  comment_list: () => '',
606
- keywords_group: () => '',
608
+ keyword_group: () => '',
609
+ body: () => ['body', 0],
610
+ abstracts: () => ['abstract', 0],
611
+ backmatter: () => ['backmatter', 0],
607
612
  bibliography_section: (node) => [
608
613
  'ref-list',
609
614
  { id: normalizeID(node.attrs.id) },
@@ -619,26 +624,15 @@ export class JATSExporter {
619
624
  return ['title', 0];
620
625
  },
621
626
  citation: (node) => {
622
- if (!node.attrs.rid) {
623
- warn(`${node.attrs.id} has no rid`);
624
- return node.attrs.label;
625
- }
626
- const rids = node.attrs
627
- .embeddedCitationItems.filter((item) => {
628
- if (!this.modelMap.has(item.bibliographyItem)) {
629
- warn(`Missing ${item.bibliographyItem} referenced by ${node.attrs.rid}`);
630
- return false;
631
- }
632
- return true;
633
- });
627
+ const citation = node;
628
+ const rids = citation.attrs.rids;
634
629
  if (!rids.length) {
635
- warn(`${node.attrs.rid} has no confirmed rids`);
636
630
  return '';
637
631
  }
638
632
  const xref = this.document.createElement('xref');
639
633
  xref.setAttribute('ref-type', 'bibr');
640
- xref.setAttribute('rid', rids.map((item) => normalizeID(item.bibliographyItem)).join(' '));
641
- if (node.attrs.contents) {
634
+ xref.setAttribute('rid', normalizeID(rids.join(' ')));
635
+ if (citation.attrs.contents) {
642
636
  const text = textFromHTML(node.attrs.contents);
643
637
  if (text !== null && text.length) {
644
638
  xref.textContent = text;
@@ -647,41 +641,27 @@ export class JATSExporter {
647
641
  return xref;
648
642
  },
649
643
  cross_reference: (node) => {
650
- var _a;
651
- if (!node.attrs.rid) {
652
- warn(`${node.attrs.id} has no rid`);
653
- return node.attrs.label;
644
+ const cross = node;
645
+ const rids = cross.attrs.rids;
646
+ if (!rids.length) {
647
+ return cross.attrs.label;
654
648
  }
655
- const auxiliaryObjectReference = getModel(node.attrs.rid);
656
- if (!auxiliaryObjectReference) {
657
- warn(`Missing model ${node.attrs.rid}`);
658
- return node.attrs.label;
649
+ const text = cross.attrs.customLabel || cross.attrs.label;
650
+ const model = getModel(rids[0]);
651
+ if (!model) {
652
+ warn('');
653
+ return text;
659
654
  }
660
655
  const xref = this.document.createElement('xref');
661
- const referencedObject = getModel(auxiliaryObjectReference.referencedObject ||
662
- ((auxiliaryObjectReference === null || auxiliaryObjectReference === void 0 ? void 0 : auxiliaryObjectReference.referencedObjects) &&
663
- auxiliaryObjectReference.referencedObjects[0]));
664
- if (referencedObject) {
665
- const refType = chooseRefType(referencedObject.objectType);
666
- if (refType) {
667
- xref.setAttribute('ref-type', refType);
668
- }
669
- else {
670
- warn(`Unset ref-type for objectType ${referencedObject.objectType}`);
671
- }
656
+ const type = chooseRefType(model.objectType);
657
+ if (type) {
658
+ xref.setAttribute('ref-type', type);
672
659
  }
673
- const getReferencedObjectId = (referencedObject) => {
674
- return normalizeID(referencedObject);
675
- };
676
- if (auxiliaryObjectReference.referencedObjects) {
677
- const rid = (_a = auxiliaryObjectReference.referencedObjects) === null || _a === void 0 ? void 0 : _a.map((referencedObject) => getReferencedObjectId(referencedObject)).join(' ');
678
- xref.setAttribute('rid', rid);
679
- }
680
- if (auxiliaryObjectReference.referencedObject) {
681
- const rid = getReferencedObjectId(auxiliaryObjectReference.referencedObject);
682
- xref.setAttribute('rid', rid);
660
+ else {
661
+ warn(`Unset ref-type for objectType ${model.objectType}`);
683
662
  }
684
- xref.textContent = node.attrs.customLabel || node.attrs.label;
663
+ xref.setAttribute('rid', normalizeID(rids.join(' ')));
664
+ xref.textContent = text;
685
665
  return xref;
686
666
  },
687
667
  doc: () => '',
@@ -776,13 +756,13 @@ export class JATSExporter {
776
756
  inline_footnote: (node) => {
777
757
  const xref = this.document.createElement('xref');
778
758
  xref.setAttribute('ref-type', 'fn');
779
- xref.setAttribute('rid', normalizeID(node.attrs.rid));
759
+ xref.setAttribute('rid', normalizeID(node.attrs.rids.join(' ')));
780
760
  xref.textContent = node.attrs.contents;
781
761
  return xref;
782
762
  },
783
763
  keyword: () => '',
784
764
  keywords_element: () => '',
785
- keywords_section: () => '',
765
+ keywords: () => '',
786
766
  link: (node) => {
787
767
  const text = node.textContent;
788
768
  if (!text) {
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * © 2023 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const abstractsType = {
17
+ _id: 'abstracts',
18
+ title: 'Abstracts',
19
+ };
20
+ export const bodyType = {
21
+ _id: 'body',
22
+ title: 'Body',
23
+ };
24
+ export const backmatterType = {
25
+ _id: 'backmatter',
26
+ title: 'Backmatter',
27
+ };
@@ -84,3 +84,11 @@ export const getTrimmedTextContent = (node, querySelector) => {
84
84
  }
85
85
  return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
86
86
  };
87
+ export const groupBy = (list, getKey) => list.reduce((previous, currentItem) => {
88
+ const group = getKey(currentItem);
89
+ if (!previous[group]) {
90
+ previous[group] = [];
91
+ }
92
+ previous[group].push(currentItem);
93
+ return previous;
94
+ }, {});
@@ -16,7 +16,7 @@
16
16
  import { Schema } from 'prosemirror-model';
17
17
  import { bold, code, italic, smallcaps, strikethrough, styled, subscript, superscript, tracked_delete, tracked_insert, underline, } from './marks';
18
18
  import { affiliation } from './nodes/affiliation';
19
- import { affiliationsSection } from './nodes/affiliations_section';
19
+ import { affiliations } from './nodes/affiliations';
20
20
  import { attribution } from './nodes/attribution';
21
21
  import { bibliographyElement } from './nodes/bibliography_element';
22
22
  import { bibliographyItem } from './nodes/bibliography_item';
@@ -28,7 +28,8 @@ import { citation } from './nodes/citation';
28
28
  import { comment } from './nodes/comment';
29
29
  import { commentList } from './nodes/comment_list';
30
30
  import { contributor } from './nodes/contributor';
31
- import { contributorsSection } from './nodes/contributors_section';
31
+ import { contributors } from './nodes/contributors';
32
+ import { coreSection } from './nodes/core_section';
32
33
  import { crossReference } from './nodes/cross_reference';
33
34
  import { doc } from './nodes/doc';
34
35
  import { equation } from './nodes/equation';
@@ -45,9 +46,9 @@ import { highlightMarker } from './nodes/highlight_marker';
45
46
  import { inlineEquation } from './nodes/inline_equation';
46
47
  import { inlineFootnote } from './nodes/inline_footnote';
47
48
  import { keyword } from './nodes/keyword';
49
+ import { keywordGroup } from './nodes/keyword_group';
50
+ import { keywords } from './nodes/keywords';
48
51
  import { keywordsElement } from './nodes/keywords_element';
49
- import { keywordsGroup } from './nodes/keywords_group';
50
- import { keywordsSection } from './nodes/keywords_section';
51
52
  import { link } from './nodes/link';
52
53
  import { bulletList, listItem, orderedList } from './nodes/list';
53
54
  import { listing } from './nodes/listing';
@@ -100,7 +101,7 @@ export * from './nodes/inline_equation';
100
101
  export * from './nodes/inline_footnote';
101
102
  export * from './nodes/keyword';
102
103
  export * from './nodes/keywords_element';
103
- export * from './nodes/keywords_section';
104
+ export * from './nodes/keywords';
104
105
  export * from './nodes/link';
105
106
  export * from './nodes/list';
106
107
  export * from './nodes/listing';
@@ -125,8 +126,8 @@ export * from './nodes/meta_section';
125
126
  export * from './nodes/contributor';
126
127
  export * from './nodes/table_element_footer';
127
128
  export * from './nodes/title';
128
- export * from './nodes/affiliations_section';
129
- export * from './nodes/contributors_section';
129
+ export * from './nodes/affiliations';
130
+ export * from './nodes/contributors';
130
131
  export const schema = new Schema({
131
132
  marks: {
132
133
  bold,
@@ -153,6 +154,9 @@ export const schema = new Schema({
153
154
  caption,
154
155
  caption_title: captionTitle,
155
156
  citation,
157
+ abstracts: coreSection,
158
+ body: coreSection,
159
+ backmatter: coreSection,
156
160
  cross_reference: crossReference,
157
161
  doc,
158
162
  equation,
@@ -170,8 +174,8 @@ export const schema = new Schema({
170
174
  inline_footnote: inlineFootnote,
171
175
  keyword,
172
176
  keywords_element: keywordsElement,
173
- keywords_section: keywordsSection,
174
- keywords_group: keywordsGroup,
177
+ keywords: keywords,
178
+ keyword_group: keywordGroup,
175
179
  link,
176
180
  list_item: listItem,
177
181
  listing,
@@ -202,7 +206,7 @@ export const schema = new Schema({
202
206
  contributor: contributor,
203
207
  table_element_footer: tableElementFooter,
204
208
  title: title,
205
- affiliations_section: affiliationsSection,
206
- contributors_section: contributorsSection,
209
+ affiliations: affiliations,
210
+ contributors: contributors,
207
211
  },
208
212
  });
@@ -1,10 +1,11 @@
1
- export const affiliationsSection = {
1
+ import { schema } from '../index';
2
+ export const affiliations = {
2
3
  content: 'section_title? affiliation*',
3
4
  attrs: {
4
5
  id: { default: 'META_SECTION_AFFILLIATIONS' },
5
6
  dataTracked: { default: null },
6
7
  },
7
- group: 'block sections',
8
+ group: 'block',
8
9
  selectable: false,
9
10
  parseDOM: [
10
11
  {
@@ -18,15 +19,15 @@ export const affiliationsSection = {
18
19
  },
19
20
  ],
20
21
  toDOM: (node) => {
21
- const affiliationsSectionNode = node;
22
+ const affiliations = node;
22
23
  return [
23
24
  'section',
24
25
  {
25
26
  class: 'affiliations',
26
- id: affiliationsSectionNode.attrs.id,
27
+ id: affiliations.attrs.id,
27
28
  },
28
- 0
29
+ 0,
29
30
  ];
30
31
  },
31
32
  };
32
- export const isAffiliationsSectionNode = (node) => node.type === node.type.schema.nodes.affiliations_section;
33
+ export const isAffiliationsNode = (node) => node.type === schema.nodes.affiliations;
@@ -19,38 +19,33 @@ export const citation = {
19
19
  draggable: true,
20
20
  atom: true,
21
21
  attrs: {
22
- rid: { default: '' },
22
+ id: { default: '' },
23
+ rids: { default: [] },
23
24
  contents: { default: '' },
24
25
  selectedText: { default: '' },
25
26
  dataTracked: { default: null },
26
- embeddedCitationItems: { default: [] },
27
27
  },
28
28
  parseDOM: [
29
29
  {
30
30
  tag: 'span.citation[data-reference-id]',
31
31
  getAttrs: (p) => {
32
+ var _a;
32
33
  const dom = p;
33
- const attr = {
34
- rid: dom.getAttribute('data-reference-id'),
34
+ return {
35
+ id: dom.getAttribute('data-id'),
36
+ rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
35
37
  contents: dom.innerHTML,
36
38
  };
37
- const embeddedCitationAttr = dom.getAttribute('data-reference-embedded-citation');
38
- if (embeddedCitationAttr) {
39
- attr['embeddedCitationItems'] = JSON.parse(embeddedCitationAttr);
40
- }
41
- return attr;
42
39
  },
43
40
  },
44
41
  ],
45
42
  toDOM: (node) => {
46
- const citationNode = node;
43
+ const citation = node;
47
44
  const dom = document.createElement('span');
48
45
  dom.className = 'citation';
49
- dom.setAttribute('data-reference-id', citationNode.attrs.rid);
50
- if (citationNode.attrs.embeddedCitationItems) {
51
- dom.setAttribute('data-reference-embedded-citation', JSON.stringify(citationNode.attrs.embeddedCitationItems));
52
- }
53
- dom.innerHTML = citationNode.attrs.contents;
46
+ dom.setAttribute('data-id', citation.attrs.id);
47
+ dom.setAttribute('data-reference-id', citation.attrs.rids.join(' '));
48
+ dom.innerHTML = node.attrs.contents;
54
49
  return dom;
55
50
  },
56
51
  };
@@ -1,11 +1,12 @@
1
- export const contributorsSection = {
1
+ import { schema } from '../index';
2
+ export const contributors = {
2
3
  content: 'section_title? contributor*',
3
4
  attrs: {
4
5
  id: { default: 'META_SECTION_CONTRIBUTORS' },
5
6
  dataTracked: { default: null },
6
7
  contents: { default: '' },
7
8
  },
8
- group: 'block sections',
9
+ group: 'block',
9
10
  selectable: false,
10
11
  parseDOM: [
11
12
  {
@@ -18,15 +19,15 @@ export const contributorsSection = {
18
19
  },
19
20
  ],
20
21
  toDOM: (node) => {
21
- const contributorsSectionNode = node;
22
+ const contributors = node;
22
23
  return [
23
24
  'section',
24
25
  {
25
26
  class: 'contributors',
26
- id: contributorsSectionNode.attrs.id,
27
+ id: contributors.attrs.id,
27
28
  },
28
29
  0,
29
30
  ];
30
31
  },
31
32
  };
32
- export const isContributorsSectionNode = (node) => node.type === node.type.schema.nodes.contributors_section;
33
+ export const isContributorsNode = (node) => node.type === schema.nodes.contributors;
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const coreSection = {
17
+ content: 'sections*',
18
+ atom: true,
19
+ attrs: {
20
+ id: { default: '' },
21
+ },
22
+ group: 'block',
23
+ toDOM: () => ['section', 0],
24
+ };
@@ -19,7 +19,7 @@ export const crossReference = {
19
19
  draggable: true,
20
20
  atom: true,
21
21
  attrs: {
22
- rid: { default: '' },
22
+ rids: { default: [] },
23
23
  label: { default: '' },
24
24
  customLabel: { default: '' },
25
25
  dataTracked: { default: null },
@@ -28,9 +28,10 @@ export const crossReference = {
28
28
  {
29
29
  tag: 'span.cross-reference',
30
30
  getAttrs: (p) => {
31
+ var _a;
31
32
  const dom = p;
32
33
  return {
33
- rid: dom.getAttribute('data-reference-id'),
34
+ rid: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
34
35
  label: dom.textContent,
35
36
  };
36
37
  },
@@ -42,7 +43,7 @@ export const crossReference = {
42
43
  'span',
43
44
  {
44
45
  class: 'cross-reference',
45
- 'data-reference-id': crossReferenceNode.attrs.rid,
46
+ 'data-reference-id': crossReferenceNode.attrs.rids.join(' '),
46
47
  },
47
48
  [
48
49
  'span',
@@ -18,6 +18,7 @@ export const graphicalAbstractSection = {
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  category: { default: '' },
21
+ dataTracked: { default: null },
21
22
  },
22
23
  group: 'block sections',
23
24
  selectable: false,
@@ -15,7 +15,7 @@
15
15
  */
16
16
  export const inlineFootnote = {
17
17
  attrs: {
18
- rid: { default: '' },
18
+ rids: { default: [] },
19
19
  contents: { default: '' },
20
20
  dataTracked: { default: null },
21
21
  },
@@ -27,20 +27,21 @@ export const inlineFootnote = {
27
27
  {
28
28
  tag: 'span.footnote',
29
29
  getAttrs: (p) => {
30
+ var _a;
30
31
  const dom = p;
31
32
  return {
32
- rid: dom.getAttribute('data-reference-id'),
33
+ rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
33
34
  contents: dom.textContent,
34
35
  };
35
36
  },
36
37
  },
37
38
  ],
38
39
  toDOM: (node) => {
39
- const inlineFootnoteNode = node;
40
+ const footnoteNode = node;
40
41
  const dom = document.createElement('span');
41
42
  dom.className = 'footnote';
42
- dom.setAttribute('data-reference-id', inlineFootnoteNode.attrs.rid);
43
- dom.textContent = inlineFootnoteNode.attrs.contents;
43
+ dom.setAttribute('data-reference-id', footnoteNode.attrs.rids.join(''));
44
+ dom.textContent = footnoteNode.attrs.contents;
44
45
  return dom;
45
46
  },
46
47
  };
@@ -18,7 +18,6 @@ export const keyword = {
18
18
  content: 'inline*',
19
19
  attrs: {
20
20
  id: { default: '' },
21
- contents: { default: '' },
22
21
  dataTracked: { default: null },
23
22
  comments: { default: null },
24
23
  },
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export const keywordsGroup = {
16
+ export const keywordGroup = {
17
17
  content: 'keyword*',
18
18
  attrs: {
19
19
  id: { default: '' },
@@ -28,11 +28,11 @@ export const keywordsGroup = {
28
28
  },
29
29
  ],
30
30
  toDOM: (node) => {
31
- const keywordsGroupNode = node;
31
+ const keywordGroupNode = node;
32
32
  return [
33
33
  'div',
34
34
  {
35
- id: keywordsGroupNode.attrs.id,
35
+ id: keywordGroupNode.attrs.id,
36
36
  class: 'keywords',
37
37
  spellcheck: 'false',
38
38
  contenteditable: false,
@@ -41,4 +41,4 @@ export const keywordsGroup = {
41
41
  ];
42
42
  },
43
43
  };
44
- export const isKeywordsGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
44
+ export const isKeywordGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
@@ -13,13 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export const keywordsSection = {
16
+ export const keywords = {
17
17
  content: 'section_title (keywords_element | placeholder_element)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  dataTracked: { default: null },
21
21
  },
22
- group: 'block sections',
22
+ group: 'block',
23
23
  selectable: false,
24
24
  parseDOM: [
25
25
  {
@@ -27,11 +27,11 @@ export const keywordsSection = {
27
27
  },
28
28
  ],
29
29
  toDOM: (node) => {
30
- const keywordsSectionNode = node;
30
+ const keywords = node;
31
31
  return [
32
32
  'div',
33
33
  {
34
- id: keywordsSectionNode.attrs.id,
34
+ id: keywords.attrs.id,
35
35
  class: 'keywords',
36
36
  spellcheck: 'false',
37
37
  contenteditable: false,
@@ -40,4 +40,4 @@ export const keywordsSection = {
40
40
  ];
41
41
  },
42
42
  };
43
- export const isKeywordsSectionNode = (node) => node.type === node.type.schema.nodes.keywords_section;
43
+ export const isKeywordsNode = (node) => node.type === node.type.schema.nodes.keywords;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  export const keywordsElement = {
17
17
  atom: true,
18
- content: 'keywords_group*',
18
+ content: 'keyword_group*',
19
19
  attrs: {
20
20
  id: { default: '' },
21
21
  contents: { default: '' },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const manuscript = {
17
- content: 'title* (section | sections)+ meta_section',
17
+ content: 'title? contributors? affiliations? keywords? abstracts body backmatter meta_section',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  },