@manuscripts/transform 1.5.7 → 1.5.8-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 (133) 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 +33 -54
  14. package/dist/cjs/lib/section-group-type.js +30 -0
  15. package/dist/cjs/lib/utils.js +14 -12
  16. package/dist/cjs/schema/index.js +20 -17
  17. package/dist/cjs/schema/nodes/abstracts.js +27 -0
  18. package/dist/cjs/schema/nodes/affiliations.js +27 -0
  19. package/dist/cjs/schema/nodes/backmatter.js +27 -0
  20. package/dist/cjs/schema/nodes/body.js +27 -0
  21. package/dist/cjs/schema/nodes/citation.js +10 -15
  22. package/dist/cjs/schema/nodes/{comment_list.js → comments.js} +4 -4
  23. package/dist/cjs/schema/nodes/contributors.js +27 -0
  24. package/dist/cjs/schema/nodes/{meta_section.js → core_section.js} +6 -5
  25. package/dist/cjs/schema/nodes/cross_reference.js +4 -3
  26. package/dist/cjs/schema/nodes/inline_footnote.js +6 -5
  27. package/dist/cjs/schema/nodes/keyword.js +0 -1
  28. package/dist/cjs/schema/nodes/{keywords_group.js → keyword_group.js} +6 -6
  29. package/dist/cjs/schema/nodes/{keywords_section.js → keywords.js} +7 -7
  30. package/dist/cjs/schema/nodes/keywords_element.js +1 -1
  31. package/dist/cjs/schema/nodes/manuscript.js +5 -2
  32. package/dist/cjs/transformer/builders.js +9 -86
  33. package/dist/cjs/transformer/decode.js +129 -165
  34. package/dist/cjs/transformer/encode.js +54 -45
  35. package/dist/cjs/transformer/highlight-markers.js +4 -4
  36. package/dist/cjs/transformer/html.js +5 -20
  37. package/dist/cjs/transformer/labels.js +3 -17
  38. package/dist/cjs/transformer/node-names.js +1 -1
  39. package/dist/cjs/transformer/node-title.js +1 -1
  40. package/dist/cjs/transformer/node-types.js +7 -6
  41. package/dist/cjs/transformer/object-types.js +1 -2
  42. package/dist/cjs/transformer/section-category.js +31 -31
  43. package/dist/es/index.js +1 -1
  44. package/dist/es/jats/importer/index.js +1 -1
  45. package/dist/es/jats/importer/jats-body-dom-parser.js +23 -227
  46. package/dist/es/jats/importer/jats-body-transformations.js +111 -202
  47. package/dist/es/jats/importer/jats-comments.js +97 -96
  48. package/dist/es/jats/importer/jats-front-parser.js +88 -82
  49. package/dist/es/jats/importer/jats-journal-meta-parser.js +51 -39
  50. package/dist/es/jats/importer/jats-parser-utils.js +16 -54
  51. package/dist/es/jats/importer/jats-reference-parser.js +27 -82
  52. package/dist/es/jats/importer/jats-references.js +30 -0
  53. package/dist/es/jats/importer/parse-jats-article.js +70 -174
  54. package/dist/es/jats/index.js +1 -1
  55. package/dist/es/jats/jats-exporter.js +33 -54
  56. package/dist/es/lib/section-group-type.js +27 -0
  57. package/dist/es/lib/utils.js +12 -10
  58. package/dist/es/schema/index.js +21 -18
  59. package/dist/es/schema/nodes/abstracts.js +24 -0
  60. package/dist/es/schema/nodes/affiliations.js +24 -0
  61. package/dist/es/schema/nodes/backmatter.js +24 -0
  62. package/dist/es/schema/nodes/body.js +24 -0
  63. package/dist/es/schema/nodes/citation.js +10 -15
  64. package/dist/es/schema/nodes/{comment_list.js → comments.js} +3 -3
  65. package/dist/es/schema/nodes/contributors.js +24 -0
  66. package/dist/es/schema/nodes/{meta_section.js → core_section.js} +5 -4
  67. package/dist/es/schema/nodes/cross_reference.js +4 -3
  68. package/dist/es/schema/nodes/inline_footnote.js +6 -5
  69. package/dist/es/schema/nodes/keyword.js +0 -1
  70. package/dist/es/schema/nodes/{keywords_group.js → keyword_group.js} +4 -4
  71. package/dist/es/schema/nodes/{keywords_section.js → keywords.js} +5 -5
  72. package/dist/es/schema/nodes/keywords_element.js +1 -1
  73. package/dist/es/schema/nodes/manuscript.js +3 -1
  74. package/dist/es/transformer/builders.js +6 -73
  75. package/dist/es/transformer/decode.js +129 -164
  76. package/dist/es/transformer/encode.js +57 -48
  77. package/dist/es/transformer/highlight-markers.js +1 -1
  78. package/dist/es/transformer/html.js +5 -20
  79. package/dist/es/transformer/labels.js +3 -17
  80. package/dist/es/transformer/node-names.js +1 -1
  81. package/dist/es/transformer/node-title.js +1 -1
  82. package/dist/es/transformer/node-types.js +7 -6
  83. package/dist/es/transformer/object-types.js +0 -1
  84. package/dist/es/transformer/section-category.js +29 -29
  85. package/dist/types/index.d.ts +1 -1
  86. package/dist/types/jats/importer/index.d.ts +1 -1
  87. package/dist/types/jats/importer/jats-body-transformations.d.ts +16 -19
  88. package/dist/types/jats/importer/jats-comments.d.ts +13 -9
  89. package/dist/types/jats/importer/jats-front-parser.d.ts +35 -12
  90. package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +4 -4
  91. package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -6
  92. package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -6
  93. package/dist/types/jats/importer/jats-references.d.ts +12 -0
  94. package/dist/types/jats/importer/parse-jats-article.d.ts +5 -17
  95. package/dist/types/jats/index.d.ts +1 -1
  96. package/dist/types/lib/section-group-type.d.ts +23 -0
  97. package/dist/types/lib/utils.d.ts +3 -2
  98. package/dist/types/schema/index.d.ts +4 -5
  99. package/dist/types/schema/nodes/{meta_section.d.ts → abstracts.d.ts} +1 -9
  100. package/dist/types/schema/nodes/affiliations.d.ts +17 -0
  101. package/dist/types/schema/nodes/backmatter.d.ts +17 -0
  102. package/dist/types/schema/nodes/body.d.ts +17 -0
  103. package/dist/types/schema/nodes/citation.d.ts +3 -5
  104. package/dist/types/schema/nodes/comments.d.ts +17 -0
  105. package/dist/types/schema/nodes/contributors.d.ts +17 -0
  106. package/dist/types/schema/nodes/core_section.d.ts +17 -0
  107. package/dist/types/schema/nodes/cross_reference.d.ts +1 -1
  108. package/dist/types/schema/nodes/inline_footnote.d.ts +1 -1
  109. package/dist/types/schema/nodes/keyword.d.ts +0 -1
  110. package/dist/types/schema/nodes/{contributors_element.d.ts → keyword_group.d.ts} +3 -4
  111. package/dist/types/schema/nodes/{comment_list.d.ts → keywords.d.ts} +3 -2
  112. package/dist/types/schema/nodes/manuscript.d.ts +1 -0
  113. package/dist/types/schema/types.d.ts +1 -1
  114. package/dist/types/transformer/builders.d.ts +2 -14
  115. package/dist/types/transformer/decode.d.ts +5 -9
  116. package/dist/types/transformer/encode.d.ts +1 -1
  117. package/dist/types/transformer/highlight-markers.d.ts +1 -0
  118. package/dist/types/transformer/object-types.d.ts +1 -2
  119. package/dist/types/transformer/section-category.d.ts +4 -3
  120. package/package.json +1 -1
  121. package/dist/cjs/lib/core-section-categories.js +0 -29
  122. package/dist/cjs/schema/nodes/affiliations_section.js +0 -36
  123. package/dist/cjs/schema/nodes/contributors_element.js +0 -49
  124. package/dist/cjs/schema/nodes/contributors_section.js +0 -36
  125. package/dist/es/lib/core-section-categories.js +0 -26
  126. package/dist/es/schema/nodes/affiliations_section.js +0 -32
  127. package/dist/es/schema/nodes/contributors_element.js +0 -46
  128. package/dist/es/schema/nodes/contributors_section.js +0 -32
  129. package/dist/types/lib/core-section-categories.d.ts +0 -8
  130. package/dist/types/schema/nodes/affiliations_section.d.ts +0 -11
  131. package/dist/types/schema/nodes/contributors_section.d.ts +0 -12
  132. package/dist/types/schema/nodes/keywords_group.d.ts +0 -26
  133. package/dist/types/schema/nodes/keywords_section.d.ts +0 -26
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { buildComment } from './builders';
17
- const highlightableFields = [
17
+ export const highlightableFields = [
18
18
  'caption',
19
19
  'contents',
20
20
  'title',
@@ -194,11 +194,9 @@ export class HTMLTransformer {
194
194
  const citationNode = node;
195
195
  const element = this.document.createElement('span');
196
196
  element.setAttribute('class', 'citation');
197
- const citation = getModel(citationNode.attrs.rid);
198
- if (citation) {
199
- element.setAttribute('data-reference-ids', citation.embeddedCitationItems
200
- .map((item) => item.bibliographyItem)
201
- .join(' '));
197
+ const rids = citationNode.attrs.rids;
198
+ if (rids.length) {
199
+ element.setAttribute('data-reference-ids', rids.join(' '));
202
200
  }
203
201
  if (citationNode.attrs.contents) {
204
202
  element.innerHTML = citationNode.attrs.contents;
@@ -209,20 +207,7 @@ export class HTMLTransformer {
209
207
  const crossReferenceNode = node;
210
208
  const element = this.document.createElement('a');
211
209
  element.classList.add('cross-reference');
212
- const auxiliaryObjectReference = getModel(crossReferenceNode.attrs.rid);
213
- if (auxiliaryObjectReference &&
214
- auxiliaryObjectReference.referencedObject) {
215
- if (auxiliaryObjectReference.referencedObject.startsWith('MPFigureElement')) {
216
- const model = getModel(auxiliaryObjectReference.referencedObject);
217
- if (model && model.containedObjectIDs.length > 0) {
218
- element.setAttribute('href', `#${model.containedObjectIDs[0]}`);
219
- }
220
- }
221
- else {
222
- element.setAttribute('href', `#${auxiliaryObjectReference.referencedObject}`);
223
- }
224
- element.setAttribute('data-reference-ids', crossReferenceNode.attrs.rid);
225
- }
210
+ element.setAttribute('data-reference-ids', crossReferenceNode.attrs.rids.join(' '));
226
211
  element.textContent =
227
212
  crossReferenceNode.attrs.customLabel || crossReferenceNode.attrs.label;
228
213
  return element;
@@ -256,7 +241,7 @@ export class HTMLTransformer {
256
241
  };
257
242
  return ['span', attrs];
258
243
  };
259
- nodes.meta_section = () => '';
244
+ nodes.comments = () => '';
260
245
  const serializer = new DOMSerializer(nodes, marks);
261
246
  return serializer.serializeFragment(fragment, { document });
262
247
  };
@@ -27,6 +27,7 @@ const labelProperties = new Map([
27
27
  [schema.nodes.equation_element, 'equationElementLabel'],
28
28
  [schema.nodes.listing_element, 'listingElementLabel'],
29
29
  ]);
30
+ const excludedTypes = [schema.nodes.graphical_abstract_section];
30
31
  const chooseLabel = (nodeType, manuscript) => {
31
32
  const labelProperty = labelProperties.get(nodeType);
32
33
  if (labelProperty) {
@@ -51,25 +52,10 @@ export const buildTargets = (fragment, manuscript) => {
51
52
  return `${counter.label} ${counter.index}`;
52
53
  };
53
54
  const targets = new Map();
54
- const figures = [];
55
- fragment.forEach((node) => {
56
- if (node.attrs.category === 'MPSectionCategory:abstracts') {
57
- node.forEach((child) => {
58
- if (child.type === node.type.schema.nodes.graphical_abstract_section) {
59
- child.forEach((item) => {
60
- if (item.type === node.type.schema.nodes.figure_element) {
61
- figures.push(item.attrs.id);
62
- }
63
- });
64
- }
65
- });
66
- }
67
- });
68
- fragment.descendants((node) => {
55
+ fragment.descendants((node, pos, parent) => {
69
56
  var _a;
70
57
  if (node.type.name in counters) {
71
- const isInGraphicalAbstract = figures.indexOf(node.attrs.id) > -1;
72
- if (isInGraphicalAbstract) {
58
+ if (parent && excludedTypes.includes(parent.type)) {
73
59
  return;
74
60
  }
75
61
  const label = buildLabel(node.type);
@@ -35,6 +35,6 @@ export const nodeNames = new Map([
35
35
  [schema.nodes.table_element, 'Table'],
36
36
  [schema.nodes.blockquote_element, 'Block Quote'],
37
37
  [schema.nodes.pullquote_element, 'Pull Quote'],
38
- [schema.nodes.keywords_section, 'Section'],
38
+ [schema.nodes.keywords, 'Section'],
39
39
  [schema.nodes.toc_section, 'Section'],
40
40
  ]);
@@ -47,7 +47,7 @@ export const nodeTitle = (node) => {
47
47
  case nodes.section:
48
48
  case nodes.bibliography_section:
49
49
  case nodes.footnotes_section:
50
- case nodes.keywords_section:
50
+ case nodes.keywords:
51
51
  case nodes.toc_section:
52
52
  case nodes.graphical_abstract_section:
53
53
  return snippetOfNodeType(node, nodes.section_title);
@@ -16,6 +16,9 @@
16
16
  import { ObjectTypes } from '@manuscripts/json-schema';
17
17
  import { GROUP_ELEMENT, GROUP_EXECUTABLE, GROUP_SECTION, hasGroup, schema, } from '../schema';
18
18
  export const nodeTypesMap = new Map([
19
+ [schema.nodes.abstracts, ObjectTypes.Section],
20
+ [schema.nodes.body, ObjectTypes.Section],
21
+ [schema.nodes.backmatter, ObjectTypes.Section],
19
22
  [schema.nodes.comment, ObjectTypes.CommentAnnotation],
20
23
  [schema.nodes.bibliography_item, ObjectTypes.BibliographyItem],
21
24
  [schema.nodes.bibliography_element, ObjectTypes.BibliographyElement],
@@ -23,7 +26,6 @@ export const nodeTypesMap = new Map([
23
26
  [schema.nodes.blockquote_element, ObjectTypes.QuoteElement],
24
27
  [schema.nodes.bullet_list, ObjectTypes.ListElement],
25
28
  [schema.nodes.citation, ObjectTypes.Citation],
26
- [schema.nodes.cross_reference, ObjectTypes.AuxiliaryObjectReference],
27
29
  [schema.nodes.equation, ObjectTypes.Equation],
28
30
  [schema.nodes.equation_element, ObjectTypes.EquationElement],
29
31
  [schema.nodes.figure, ObjectTypes.Figure],
@@ -37,8 +39,8 @@ export const nodeTypesMap = new Map([
37
39
  [schema.nodes.inline_equation, ObjectTypes.InlineMathFragment],
38
40
  [schema.nodes.keyword, ObjectTypes.Keyword],
39
41
  [schema.nodes.keywords_element, ObjectTypes.KeywordsElement],
40
- [schema.nodes.keywords_section, ObjectTypes.Section],
41
- [schema.nodes.keywords_group, ObjectTypes.KeywordGroup],
42
+ [schema.nodes.keywords, ObjectTypes.Section],
43
+ [schema.nodes.keyword_group, ObjectTypes.KeywordGroup],
42
44
  [schema.nodes.listing, ObjectTypes.Listing],
43
45
  [schema.nodes.listing_element, ObjectTypes.ListingElement],
44
46
  [schema.nodes.manuscript, ObjectTypes.Manuscript],
@@ -50,13 +52,12 @@ export const nodeTypesMap = new Map([
50
52
  [schema.nodes.table_element, ObjectTypes.TableElement],
51
53
  [schema.nodes.toc_element, ObjectTypes.TOCElement],
52
54
  [schema.nodes.toc_section, ObjectTypes.Section],
53
- [schema.nodes.meta_section, ObjectTypes.MetaSection],
54
55
  [schema.nodes.affiliation, ObjectTypes.Affiliation],
55
56
  [schema.nodes.contributor, ObjectTypes.Contributor],
56
57
  [schema.nodes.table_element_footer, ObjectTypes.TableElementFooter],
58
+ [schema.nodes.contributors, ObjectTypes.Section],
59
+ [schema.nodes.affiliations, ObjectTypes.Section],
57
60
  [schema.nodes.title, ObjectTypes.Titles],
58
- [schema.nodes.contributors_section, ObjectTypes.Section],
59
- [schema.nodes.affiliations_section, ObjectTypes.Section],
60
61
  ]);
61
62
  export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
62
63
  export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
@@ -48,6 +48,5 @@ export const hasObjectType = (objectType) => (model) => model.objectType === obj
48
48
  export const isFigure = hasObjectType(ObjectTypes.Figure);
49
49
  export const isManuscript = hasObjectType(ObjectTypes.Manuscript);
50
50
  export const isTable = hasObjectType(ObjectTypes.Table);
51
- export const isUserProfile = hasObjectType(ObjectTypes.UserProfile);
52
51
  export const isCommentAnnotation = hasObjectType(ObjectTypes.CommentAnnotation);
53
52
  export const isKeyword = hasObjectType(ObjectTypes.Keyword);
@@ -14,22 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ObjectTypes } from '@manuscripts/json-schema';
17
- import { coreSectionCategories } from '../lib/core-section-categories';
17
+ import { abstractsType, backmatterType, bodyType, } from '../lib/section-group-type';
18
18
  import { schema } from '../schema';
19
19
  const sectionNodeTypes = [
20
20
  schema.nodes.bibliography_section,
21
21
  schema.nodes.footnotes_section,
22
- schema.nodes.keywords_section,
22
+ schema.nodes.keywords,
23
23
  schema.nodes.section,
24
24
  schema.nodes.toc_section,
25
25
  ];
26
- export const getCoreSectionTitles = (sectionCategory) => {
27
- const category = coreSectionCategories.find((section) => section._id === sectionCategory);
28
- if (category) {
29
- return category.titles.length ? category.titles : [' '];
30
- }
31
- throw new Error(`${sectionCategory} not found in core sections`);
32
- };
33
26
  export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
34
27
  export const chooseSectionNodeType = (category) => {
35
28
  switch (category) {
@@ -40,11 +33,7 @@ export const chooseSectionNodeType = (category) => {
40
33
  case 'MPSectionCategory:endnotes':
41
34
  return schema.nodes.footnotes_section;
42
35
  case 'MPSectionCategory:keywords':
43
- return schema.nodes.keywords_section;
44
- case 'MPSectionCategory:affiliations':
45
- return schema.nodes.affiliations_section;
46
- case 'MPSectionCategory:contributors':
47
- return schema.nodes.contributors_section;
36
+ return schema.nodes.keywords;
48
37
  case 'MPSectionCategory:toc':
49
38
  return schema.nodes.toc_section;
50
39
  default:
@@ -82,16 +71,12 @@ export const buildSectionCategory = (node) => {
82
71
  return 'MPSectionCategory:bibliography';
83
72
  case schema.nodes.footnotes_section:
84
73
  return 'MPSectionCategory:endnotes';
85
- case schema.nodes.keywords_section:
74
+ case schema.nodes.keywords:
86
75
  return 'MPSectionCategory:keywords';
87
76
  case schema.nodes.toc_section:
88
77
  return 'MPSectionCategory:toc';
89
78
  case schema.nodes.graphical_abstract_section:
90
79
  return 'MPSectionCategory:abstract-graphical';
91
- case schema.nodes.affiliations_section:
92
- return 'MPSectionCategory:affiliations';
93
- case schema.nodes.contributors_section:
94
- return 'MPSectionCategory:contributors';
95
80
  default:
96
81
  return node.attrs.category || undefined;
97
82
  }
@@ -117,6 +102,31 @@ export const chooseSecType = (sectionCategory) => {
117
102
  return suffix;
118
103
  }
119
104
  };
105
+ export const getSectionGroupType = (category) => {
106
+ switch (category) {
107
+ case 'MPSectionCategory:abstract':
108
+ case 'MPSectionCategory:abstract-graphical':
109
+ return abstractsType;
110
+ case 'MPSectionCategory:competing-interests':
111
+ case 'MPSectionCategory:con':
112
+ case 'MPSectionCategory:ethics-statement':
113
+ case 'MPSectionCategory:financial-disclosure':
114
+ case 'MPSectionCategory:supplementary-material':
115
+ case 'MPSectionCategory:supported-by':
116
+ case 'MPSectionCategory:availability':
117
+ case 'MPSectionCategory:acknowledgement':
118
+ case 'MPSectionCategory:endnotes':
119
+ case 'MPSectionCategory:bibliography':
120
+ case 'MPSectionCategory:appendices':
121
+ case 'MPSectionCategory:deceased':
122
+ case 'MPSectionCategory:equal':
123
+ case 'MPSectionCategory:present-address':
124
+ case 'MPSectionCategory:presented-at':
125
+ case 'MPSectionCategory:previously-at':
126
+ return backmatterType;
127
+ }
128
+ return bodyType;
129
+ };
120
130
  export const chooseSectionCategoryByType = (secType) => {
121
131
  switch (secType) {
122
132
  case 'abstract':
@@ -176,16 +186,6 @@ export const chooseSectionCategoryByType = (secType) => {
176
186
  return 'MPSectionCategory:supported-by';
177
187
  case 'ethics-statement':
178
188
  return 'MPSectionCategory:ethics-statement';
179
- case 'body':
180
- return 'MPSectionCategory:body';
181
- case 'backmatter':
182
- return 'MPSectionCategory:backmatter';
183
- case 'abstracts':
184
- return 'MPSectionCategory:abstracts';
185
- case 'affiliations':
186
- return 'MPSectionCategory:affiliations';
187
- case 'contributors':
188
- return 'MPSectionCategory:contributors';
189
189
  default:
190
190
  return undefined;
191
191
  }
@@ -1,4 +1,4 @@
1
- export * from './lib/core-section-categories';
1
+ export * from './lib/section-group-type';
2
2
  export * from './lib/table-cell-styles';
3
3
  export * from './lib/utils';
4
4
  export * from './mathjax';
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { parseJATSFront, parseJATSBody, parseJATSReferences, parseJATSArticle, getElementsOrder, } from './parse-jats-article';
16
+ export { parseJATSFront, parseJATSBody, parseJATSArticle, } from './parse-jats-article';
@@ -13,29 +13,26 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Affiliation, BibliographyItem, Contributor } from '@manuscripts/json-schema';
17
- import { Build } from '../../transformer';
18
16
  export declare const jatsBodyTransformations: {
19
17
  ensureSection(body: Element, createElement: (tagName: string) => HTMLElement): void;
20
- createAbstract(abstractNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
21
- createAcknowledgments(ackNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
22
- createBibliography(doc: Document, references: BibliographyItem[], createElement: (tagName: string) => HTMLElement): HTMLElement;
23
- createFootnotes(footnoteGroups: Element[], createElement: (tagName: string) => HTMLElement): HTMLElement;
18
+ createAbstractSection(abstractNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
19
+ createAcknowledgmentsSection(ackNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
20
+ createFootnotesSection(footnoteGroups: Element[], createElement: (tagName: string) => HTMLElement): HTMLElement;
24
21
  createAppendixSection(app: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
25
- createFloatsGroupSection(floatsGroup: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
26
- moveAbstractsIntoContainer(doc: Document, abstractsContainer: Element, createElement: (tagName: string) => HTMLElement): void;
27
- wrapBodySections(doc: Document, bodyContainer: Element): void;
28
- moveBackSectionsIntoContainer(doc: Document, backmatterContainer: Element): void;
29
- moveAcknowledgmentsIntoContainer(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
30
- moveAppendicesIntoContainer(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
31
- moveBibliographyIntoContainer(doc: Document, backmatterContainer: Element, references: BibliographyItem[] | null, createElement: (tagName: string) => HTMLElement): void;
32
- moveSectionsToBody(doc: Document, body: Element, references: BibliographyItem[] | null, createElement: (tagName: string) => HTMLElement): void;
33
- mapFootnotesToSections(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
22
+ createFloatsGroupSection(group: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
23
+ moveAbstracts(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
24
+ wrapBodySections(doc: Document, group: Element): void;
25
+ moveBackSections(doc: Document, group: Element): void;
26
+ moveAcknowledgments(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
27
+ moveAppendices(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
28
+ createBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
29
+ createAbstracts(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
30
+ createBackmatter(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
31
+ moveSpecialFootnotes(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
32
+ moveFootnotes(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
34
33
  moveCaptionsToEnd(body: Element): void;
34
+ fixTables(body: Element, createElement: (tagName: string) => HTMLElement): void;
35
35
  moveTableFooterToEnd(body: Element): void;
36
- moveAffiliationsToBody(doc: Document, affiliations: Build<Affiliation>[] | undefined, body: Element, createElement: (tagName: string) => HTMLElement): void;
37
- moveAuthorsToBody(doc: Document, authors: Build<Contributor>[] | undefined, body: Element, createElement: (tagName: string) => HTMLElement): void;
38
36
  moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
39
- moveBlockNodesFromParagraph(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
40
- moveKeywordsToBody(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
37
+ createKeywords(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
41
38
  };
@@ -13,14 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { BibliographyItem, CommentAnnotation, Model } from '@manuscripts/json-schema';
17
- import { Build } from '../../transformer';
18
- type ProcessingInstruction = {
16
+ import { CommentAnnotation, Model } from '@manuscripts/json-schema';
17
+ import { References } from './jats-references';
18
+ export type JATSComment = {
19
19
  id: string;
20
- queryText: string;
20
+ text: string;
21
21
  };
22
- export declare const parseProcessingInstruction: (node: Node) => ProcessingInstruction | undefined;
23
- export declare const markProcessingInstructions: (doc: Document) => Map<string, string>;
24
- export declare const createComments: (authorQueriesMap: Map<string, string>, manuscriptModels: Array<Model>) => Build<CommentAnnotation>[];
25
- export declare const createReferenceComments: (referenceQueriesMap: Map<string, string[]>, references: Array<BibliographyItem>) => Build<CommentAnnotation>[];
26
- export {};
22
+ export type JATSCommentMark = {
23
+ token: string;
24
+ comment: JATSComment;
25
+ };
26
+ export declare const isJATSComment: (node: Node) => boolean;
27
+ export declare const parseJATSComment: (node: Node) => JATSComment | undefined;
28
+ export declare const markComments: (doc: Document) => JATSCommentMark[];
29
+ export declare const createComments: (models: Model[], marks: JATSCommentMark[]) => CommentAnnotation[];
30
+ export declare const createReferenceComments: (references: References) => CommentAnnotation[];
@@ -13,20 +13,43 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Journal } from '@manuscripts/json-schema';
17
16
  export declare const jatsFrontParser: {
18
- parseCounts(counts: Element | null | undefined): {
17
+ parseTitles(element: Element | null, createElement: (tagName: string) => HTMLElement): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Titles>;
18
+ parseCounts(counts: Element | null): {
19
19
  wordCount: number | undefined;
20
20
  figureCount: number | undefined;
21
21
  tableCount: number | undefined;
22
22
  equationCount: number | undefined;
23
23
  referencesCount: number | undefined;
24
24
  genericCounts: {
25
- count: number;
25
+ count: number | undefined;
26
26
  countType: string;
27
27
  }[] | undefined;
28
28
  } | undefined;
29
- parseJournal(journalMeta: Element | null): Partial<Journal>;
29
+ parseJournal(element: Element | null): {
30
+ title: string | undefined;
31
+ templateID?: string | undefined;
32
+ ISSNs: {
33
+ [k: string]: any;
34
+ ISSN: string;
35
+ publicationType?: string | undefined;
36
+ }[];
37
+ abbreviatedTitles: {
38
+ [k: string]: any;
39
+ abbreviatedTitle: string;
40
+ abbrevType?: string | undefined;
41
+ }[];
42
+ journalIdentifiers: {
43
+ [k: string]: any;
44
+ journalID: string;
45
+ journalIDType?: string | undefined;
46
+ }[];
47
+ submittable?: boolean | undefined;
48
+ publisherName: string | undefined;
49
+ _id: string;
50
+ objectType: string;
51
+ contributions?: import("@manuscripts/json-schema/dist/types").Contribution[] | undefined;
52
+ };
30
53
  parseDates(historyNode: Element | null): {
31
54
  acceptanceDate?: number | undefined;
32
55
  correctionDate?: number | undefined;
@@ -35,18 +58,18 @@ export declare const jatsFrontParser: {
35
58
  revisionReceiveDate?: number | undefined;
36
59
  receiveDate?: number | undefined;
37
60
  } | undefined;
38
- parseSupplements(supplementNodes: Element[] | null): import("../../transformer").Build<import("@manuscripts/json-schema").Supplement>[];
39
- parseAffiliationNodes(affiliationNodes: Element[]): {
40
- affiliations: import("../../transformer").Build<import("@manuscripts/json-schema").Affiliation>[];
61
+ parseSupplements(elements: Element[] | null): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Supplement>[];
62
+ parseAffiliations(elements: Element[]): {
63
+ affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
41
64
  affiliationIDs: Map<string, string>;
42
65
  };
43
- parseFootnoteNodes(footnoteNodes: Element[]): {
44
- footnotes: import("../../transformer").Build<import("@manuscripts/json-schema").Footnote>[];
66
+ parseAuthorNotes(elements: Element[]): {
67
+ footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
45
68
  footnoteIDs: Map<string, string>;
46
69
  };
47
- parseCorrespNodes(correspNodes: Element[]): {
48
- correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema").Corresponding>[];
70
+ parseCorresp(elements: Element[]): {
71
+ correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Corresponding>[];
49
72
  correspondingIDs: Map<string, string>;
50
73
  };
51
- parseAuthorNodes(authorNodes: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): import("../../transformer").Build<import("@manuscripts/json-schema").Contributor>[];
74
+ parseContributors(elements: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Contributor>[];
52
75
  };
@@ -25,10 +25,10 @@ export type JournalIdentifier = {
25
25
  journalID: string;
26
26
  journalIDType?: string;
27
27
  };
28
- export declare const parseJournalIdentifiers: (journalMeta: Element) => Array<JournalIdentifier>;
29
- export declare const parseJournalAbbreviatedTitles: (journalMeta: Element) => Array<AbbreviatedTitle>;
30
- export declare const parseJournalISSNs: (journalMeta: Element) => Array<ISSN>;
31
- export declare const parseJournalMeta: (journalMeta: Element) => {
28
+ export declare const parseJournalIdentifiers: (element: Element | null) => JournalIdentifier[];
29
+ export declare const parseJournalAbbreviatedTitles: (element: Element | null) => AbbreviatedTitle[];
30
+ export declare const parseJournalISSNs: (element: Element | null) => ISSN[];
31
+ export declare const parseJournalMeta: (element: Element | null) => {
32
32
  abbreviatedTitles: AbbreviatedTitle[];
33
33
  journalIdentifiers: JournalIdentifier[];
34
34
  ISSNs: ISSN[];
@@ -13,11 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Model } from '@manuscripts/json-schema';
17
16
  import { ManuscriptNode } from '../../schema';
18
- export declare function flatten<T>(arrays: T[][]): T[];
19
- export declare const fixBodyPMNode: (output: ManuscriptNode, models: Model[], referenceIdsMap?: Map<string, string>) => {
20
- warnings: string[];
21
- replacements: Map<string, string>;
22
- };
17
+ export declare const updateDocumentIDs: (node: ManuscriptNode, replacements: Map<string, string>) => string[];
23
18
  export declare const htmlFromJatsNode: (element: Element | undefined | null, createElement: (tagName: string) => HTMLElement) => string | undefined;
@@ -13,11 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { References } from './jats-references';
16
17
  export declare const jatsReferenceParser: {
17
- parseReferences(referenceNodes: Element[], createElement: (tagName: string) => HTMLElement): {
18
- references: import("../../transformer/builders").Build<import("@manuscripts/json-schema").BibliographyItem>[];
19
- referenceIDs: Map<string, string>;
20
- referenceQueries: Map<string, string[]>;
21
- };
22
- parseCrossReferences(crossReferenceNodes: Element[], referenceIDs: Map<string, string>): (import("../../transformer/builders").Build<import("@manuscripts/json-schema").AuxiliaryObjectReference> | import("../../transformer/builders").Build<import("@manuscripts/json-schema").Citation>)[];
18
+ parseReferences(elements: Element[], createElement: (tagName: string) => HTMLElement): References;
23
19
  };
@@ -0,0 +1,12 @@
1
+ import { BibliographyItem } from '@manuscripts/json-schema';
2
+ import { JATSComment } from './jats-comments';
3
+ export declare class References {
4
+ items: Map<string, BibliographyItem>;
5
+ IDs: Map<string, string>;
6
+ comments: Map<string, JATSComment[]>;
7
+ constructor();
8
+ add(item: BibliographyItem, id: string | null, comments: JATSComment[]): void;
9
+ getBibliographyItems(): BibliographyItem[];
10
+ getComments(id: string): JATSComment[];
11
+ private getValue;
12
+ }
@@ -13,20 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Affiliation, BibliographyItem, Contributor, ElementsOrder, FootnotesOrder, Model } from '@manuscripts/json-schema';
17
- import { ManuscriptNode } from '../../schema';
18
- import { Build } from '../../transformer/builders';
19
- export declare const parseJATSFront: (front: Element) => Promise<{
20
- models: Model[];
21
- authors: Build<Contributor>[];
22
- affiliations: Build<Affiliation>[];
23
- }>;
24
- export declare const parseJATSReferences: (back: Element | null, body: Element | null, createElement: (tagName: string) => HTMLElement) => {
25
- references: Model[];
26
- crossReferences: Model[];
27
- referenceQueriesMap: Map<string, string[]> | undefined;
28
- referenceIdsMap: Map<string, string> | undefined;
29
- };
30
- export declare const parseJATSBody: (document: Document, body: Element, bibliographyItems: BibliographyItem[] | null, authors: Build<Contributor>[], affiliations: Build<Affiliation>[], refModels: Model[], referenceIdsMap: Map<string, string> | undefined, footnotesOrder?: FootnotesOrder) => ManuscriptNode;
31
- export declare const parseJATSArticle: (doc: Document) => Promise<Model[]>;
32
- export declare const getElementsOrder: (node: ManuscriptNode) => ElementsOrder[];
16
+ import { Model } from '@manuscripts/json-schema';
17
+ import { References } from './jats-references';
18
+ export declare const parseJATSFront: (doc: Document, front: Element) => Model[];
19
+ export declare const parseJATSBody: (doc: Document, body: Element, references?: References) => IterableIterator<Model>;
20
+ export declare const parseJATSArticle: (doc: Document) => Model[];
@@ -13,6 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { parseJATSFront, parseJATSReferences, parseJATSBody, parseJATSArticle, getElementsOrder, } from './importer';
16
+ export { parseJATSFront, parseJATSBody, parseJATSArticle, } from './importer';
17
17
  export * from './jats-exporter';
18
18
  export * from './jats-versions';
@@ -0,0 +1,23 @@
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 type SectionGroupTypeID = 'abstracts' | 'body' | 'backmatter';
17
+ export type SectionGroupType = {
18
+ _id: SectionGroupTypeID;
19
+ title: string;
20
+ };
21
+ export declare const abstractsType: SectionGroupType;
22
+ export declare const bodyType: SectionGroupType;
23
+ export declare const backmatterType: SectionGroupType;
@@ -13,17 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { Model } from '@manuscripts/json-schema';
16
17
  import { Node as ProsemirrorNode, ResolvedPos } from 'prosemirror-model';
17
18
  import { ManuscriptEditorState, ManuscriptNode } from '../schema';
18
19
  export declare function iterateChildren(node: ManuscriptNode, recurse?: boolean): Iterable<ManuscriptNode>;
19
20
  export declare const findNodePositions: (state: ManuscriptEditorState, predicate: (node: ManuscriptNode) => boolean) => number[];
20
21
  export declare const isInGraphicalAbstractSection: ($pos: ResolvedPos) => boolean;
21
22
  export declare const isInBibliographySection: ($pos: ResolvedPos) => boolean;
22
- export declare const isInAbstractsSection: ($pos: ResolvedPos) => boolean;
23
23
  export declare const findParentNodeClosestToPos: ($pos: ResolvedPos, predicate: (node: ProsemirrorNode) => boolean) => {
24
24
  pos: number;
25
25
  start: number;
26
26
  depth: number;
27
27
  node: ProsemirrorNode;
28
28
  } | undefined;
29
- export declare const getTrimmedTextContent: (node: Element | Document, querySelector: string) => string | null | undefined;
29
+ export declare const getTrimmedTextContent: (node: Element | Document | null, querySelector: string) => string | null | undefined;
30
+ export declare function modelsEqual(model: Model, model2: Model): boolean;
@@ -18,7 +18,7 @@ import { Marks, Nodes } from './types';
18
18
  export * from './groups';
19
19
  export * from './types';
20
20
  export * from './nodes/comment';
21
- export * from './nodes/comment_list';
21
+ export * from './nodes/comments';
22
22
  export * from './nodes/attribution';
23
23
  export * from './nodes/bibliography_item';
24
24
  export * from './nodes/bibliography_element';
@@ -44,7 +44,7 @@ export * from './nodes/inline_equation';
44
44
  export * from './nodes/inline_footnote';
45
45
  export * from './nodes/keyword';
46
46
  export * from './nodes/keywords_element';
47
- export * from './nodes/keywords_section';
47
+ export * from './nodes/keywords';
48
48
  export * from './nodes/link';
49
49
  export * from './nodes/list';
50
50
  export * from './nodes/listing';
@@ -65,10 +65,9 @@ export * from './nodes/text';
65
65
  export * from './nodes/toc_element';
66
66
  export * from './nodes/toc_section';
67
67
  export * from './nodes/affiliation';
68
- export * from './nodes/meta_section';
69
68
  export * from './nodes/contributor';
70
69
  export * from './nodes/table_element_footer';
71
70
  export * from './nodes/title';
72
- export * from './nodes/affiliations_section';
73
- export * from './nodes/contributors_section';
71
+ export * from './nodes/affiliations';
72
+ export * from './nodes/contributors';
74
73
  export declare const schema: Schema<Nodes, Marks>;
@@ -14,12 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
- import { ManuscriptNode } from '../types';
18
- interface Attrs {
19
- id: string;
20
- }
21
- export interface MetaSectionNode extends ManuscriptNode {
22
- attrs: Attrs;
23
- }
24
- export declare const metaSection: NodeSpec;
25
- export {};
17
+ export declare const abstracts: NodeSpec;