@manuscripts/transform 1.5.7-LEAN-3030-1 → 1.5.7-LEAN-3030-2

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 (40) hide show
  1. package/dist/cjs/jats/jats-exporter.js +1 -2
  2. package/dist/cjs/schema/index.js +9 -10
  3. package/dist/cjs/schema/nodes/abstracts.js +27 -0
  4. package/dist/cjs/schema/nodes/affiliations.js +19 -29
  5. package/dist/cjs/schema/nodes/backmatter.js +27 -0
  6. package/dist/cjs/schema/nodes/{meta_section.js → body.js} +7 -6
  7. package/dist/cjs/schema/nodes/{comment_list.js → comments.js} +4 -4
  8. package/dist/cjs/schema/nodes/contributors.js +19 -29
  9. package/dist/cjs/schema/nodes/manuscript.js +5 -2
  10. package/dist/cjs/transformer/decode.js +48 -64
  11. package/dist/cjs/transformer/encode.js +16 -31
  12. package/dist/cjs/transformer/html.js +1 -1
  13. package/dist/cjs/transformer/node-types.js +0 -1
  14. package/dist/es/jats/jats-exporter.js +1 -2
  15. package/dist/es/schema/index.js +12 -13
  16. package/dist/es/schema/nodes/abstracts.js +24 -0
  17. package/dist/es/schema/nodes/affiliations.js +18 -27
  18. package/dist/es/schema/nodes/backmatter.js +24 -0
  19. package/dist/es/schema/nodes/{meta_section.js → body.js} +6 -5
  20. package/dist/es/schema/nodes/{comment_list.js → comments.js} +3 -3
  21. package/dist/es/schema/nodes/contributors.js +18 -27
  22. package/dist/es/schema/nodes/manuscript.js +3 -1
  23. package/dist/es/transformer/decode.js +47 -62
  24. package/dist/es/transformer/encode.js +17 -32
  25. package/dist/es/transformer/html.js +1 -1
  26. package/dist/es/transformer/node-types.js +0 -1
  27. package/dist/types/schema/index.d.ts +1 -2
  28. package/dist/types/schema/nodes/{meta_section.d.ts → abstracts.d.ts} +1 -9
  29. package/dist/types/schema/nodes/affiliations.d.ts +15 -9
  30. package/dist/types/schema/nodes/{comment_list.d.ts → backmatter.d.ts} +1 -9
  31. package/dist/types/schema/nodes/body.d.ts +17 -0
  32. package/dist/types/schema/nodes/comments.d.ts +17 -0
  33. package/dist/types/schema/nodes/contributors.d.ts +15 -10
  34. package/dist/types/schema/nodes/manuscript.d.ts +1 -0
  35. package/dist/types/schema/types.d.ts +1 -1
  36. package/dist/types/transformer/decode.d.ts +2 -4
  37. package/package.json +1 -1
  38. package/dist/cjs/schema/nodes/contributors_element.js +0 -49
  39. package/dist/es/schema/nodes/contributors_element.js +0 -46
  40. package/dist/types/schema/nodes/contributors_element.d.ts +0 -27
@@ -607,11 +607,10 @@ class JATSExporter {
607
607
  table_element_footer: () => ['table-wrap-foot', 0],
608
608
  contributor: () => '',
609
609
  affiliation: () => '',
610
- meta_section: () => '',
611
610
  attribution: () => ['attrib', 0],
612
611
  bibliography_element: () => '',
613
612
  bibliography_item: () => '',
614
- comment_list: () => '',
613
+ comments: () => '',
615
614
  keyword_group: () => '',
616
615
  body: () => ['body', 0],
617
616
  abstracts: () => ['abstract', 0],
@@ -43,10 +43,9 @@ const caption_1 = require("./nodes/caption");
43
43
  const caption_title_1 = require("./nodes/caption_title");
44
44
  const citation_1 = require("./nodes/citation");
45
45
  const comment_1 = require("./nodes/comment");
46
- const comment_list_1 = require("./nodes/comment_list");
46
+ const comments_1 = require("./nodes/comments");
47
47
  const contributor_1 = require("./nodes/contributor");
48
48
  const contributors_1 = require("./nodes/contributors");
49
- const core_section_1 = require("./nodes/core_section");
50
49
  const cross_reference_1 = require("./nodes/cross_reference");
51
50
  const doc_1 = require("./nodes/doc");
52
51
  const equation_1 = require("./nodes/equation");
@@ -71,7 +70,6 @@ const list_1 = require("./nodes/list");
71
70
  const listing_1 = require("./nodes/listing");
72
71
  const listing_element_1 = require("./nodes/listing_element");
73
72
  const manuscript_1 = require("./nodes/manuscript");
74
- const meta_section_1 = require("./nodes/meta_section");
75
73
  const missing_figure_1 = require("./nodes/missing_figure");
76
74
  const paragraph_1 = require("./nodes/paragraph");
77
75
  const placeholder_1 = require("./nodes/placeholder");
@@ -89,10 +87,13 @@ const text_1 = require("./nodes/text");
89
87
  const title_1 = require("./nodes/title");
90
88
  const toc_element_1 = require("./nodes/toc_element");
91
89
  const toc_section_1 = require("./nodes/toc_section");
90
+ const abstracts_1 = require("./nodes/abstracts");
91
+ const body_1 = require("./nodes/body");
92
+ const backmatter_1 = require("./nodes/backmatter");
92
93
  __exportStar(require("./groups"), exports);
93
94
  __exportStar(require("./types"), exports);
94
95
  __exportStar(require("./nodes/comment"), exports);
95
- __exportStar(require("./nodes/comment_list"), exports);
96
+ __exportStar(require("./nodes/comments"), exports);
96
97
  __exportStar(require("./nodes/attribution"), exports);
97
98
  __exportStar(require("./nodes/bibliography_item"), exports);
98
99
  __exportStar(require("./nodes/bibliography_element"), exports);
@@ -139,7 +140,6 @@ __exportStar(require("./nodes/text"), exports);
139
140
  __exportStar(require("./nodes/toc_element"), exports);
140
141
  __exportStar(require("./nodes/toc_section"), exports);
141
142
  __exportStar(require("./nodes/affiliation"), exports);
142
- __exportStar(require("./nodes/meta_section"), exports);
143
143
  __exportStar(require("./nodes/contributor"), exports);
144
144
  __exportStar(require("./nodes/table_element_footer"), exports);
145
145
  __exportStar(require("./nodes/title"), exports);
@@ -161,7 +161,7 @@ exports.schema = new prosemirror_model_1.Schema({
161
161
  },
162
162
  nodes: {
163
163
  comment: comment_1.comment,
164
- comment_list: comment_list_1.commentList,
164
+ comments: comments_1.comments,
165
165
  attribution: attribution_1.attribution,
166
166
  bibliography_item: bibliography_item_1.bibliographyItem,
167
167
  bibliography_element: bibliography_element_1.bibliographyElement,
@@ -171,9 +171,9 @@ exports.schema = new prosemirror_model_1.Schema({
171
171
  caption: caption_1.caption,
172
172
  caption_title: caption_title_1.captionTitle,
173
173
  citation: citation_1.citation,
174
- abstracts: core_section_1.coreSection,
175
- body: core_section_1.coreSection,
176
- backmatter: core_section_1.coreSection,
174
+ abstracts: abstracts_1.abstracts,
175
+ body: body_1.body,
176
+ backmatter: backmatter_1.backmatter,
177
177
  cross_reference: cross_reference_1.crossReference,
178
178
  doc: doc_1.doc,
179
179
  equation: equation_1.equation,
@@ -219,7 +219,6 @@ exports.schema = new prosemirror_model_1.Schema({
219
219
  toc_element: toc_element_1.tocElement,
220
220
  toc_section: toc_section_1.tocSection,
221
221
  affiliation: affiliation_1.affiliation,
222
- meta_section: meta_section_1.metaSection,
223
222
  contributor: contributor_1.contributor,
224
223
  table_element_footer: table_element_footer_1.tableElementFooter,
225
224
  title: title_1.title,
@@ -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.abstracts = void 0;
19
+ exports.abstracts = {
20
+ content: 'sections*',
21
+ atom: true,
22
+ attrs: {
23
+ id: { default: '' },
24
+ },
25
+ group: 'block',
26
+ toDOM: () => ['div', { class: 'abstracts' }, 0],
27
+ };
@@ -1,37 +1,27 @@
1
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
+ */
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAffiliationsNode = exports.affiliations = void 0;
4
- const index_1 = require("../index");
18
+ exports.affiliations = void 0;
5
19
  exports.affiliations = {
6
- content: 'section_title? affiliation*',
20
+ content: 'affiliation*',
7
21
  attrs: {
8
- id: { default: 'META_SECTION_AFFILLIATIONS' },
9
- dataTracked: { default: null },
22
+ id: { default: '' },
10
23
  },
11
24
  group: 'block',
12
25
  selectable: false,
13
- parseDOM: [
14
- {
15
- tag: 'section.affiliations',
16
- getAttrs: (section) => {
17
- const dom = section;
18
- return {
19
- contents: dom.innerHTML,
20
- };
21
- },
22
- },
23
- ],
24
- toDOM: (node) => {
25
- const affiliations = node;
26
- return [
27
- 'section',
28
- {
29
- class: 'affiliations',
30
- id: affiliations.attrs.id,
31
- },
32
- 0,
33
- ];
34
- },
26
+ toDOM: () => ['div', { class: 'abstracts' }, 0],
35
27
  };
36
- const isAffiliationsNode = (node) => node.type === index_1.schema.nodes.affiliations;
37
- exports.isAffiliationsNode = isAffiliationsNode;
@@ -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.backmatter = void 0;
19
+ exports.backmatter = {
20
+ content: 'sections*',
21
+ atom: true,
22
+ attrs: {
23
+ id: { default: '' },
24
+ },
25
+ group: 'block',
26
+ toDOM: () => ['div', { class: 'backmatter' }, 0],
27
+ };
@@ -15,12 +15,13 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.metaSection = void 0;
19
- exports.metaSection = {
20
- content: 'comment_list',
18
+ exports.body = void 0;
19
+ exports.body = {
20
+ content: 'sections*',
21
+ atom: true,
21
22
  attrs: {
22
- id: { default: 'META_SECTION' },
23
+ id: { default: '' },
23
24
  },
24
- group: 'block sections',
25
- toDOM: () => ['section', 0],
25
+ group: 'block',
26
+ toDOM: () => ['div', { class: 'body' }, 0],
26
27
  };
@@ -15,11 +15,11 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.commentList = void 0;
19
- exports.commentList = {
18
+ exports.comments = void 0;
19
+ exports.comments = {
20
20
  content: 'comment*',
21
21
  attrs: {
22
- id: { default: 'COMMENT_LIST' },
22
+ id: { default: '' },
23
23
  },
24
- toDOM: () => ['section', 0],
24
+ toDOM: () => ['div', { class: 'comments' }, 0],
25
25
  };
@@ -1,37 +1,27 @@
1
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
+ */
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isContributorsNode = exports.contributors = void 0;
4
- const index_1 = require("../index");
18
+ exports.contributors = void 0;
5
19
  exports.contributors = {
6
- content: 'section_title? contributor*',
20
+ content: 'contributor*',
7
21
  attrs: {
8
- id: { default: 'META_SECTION_CONTRIBUTORS' },
9
- dataTracked: { default: null },
10
- contents: { default: '' },
22
+ id: { default: '' },
11
23
  },
12
24
  group: 'block',
13
25
  selectable: false,
14
- parseDOM: [
15
- {
16
- tag: 'section.contributors',
17
- getAttrs: () => {
18
- return {
19
- contents: '',
20
- };
21
- },
22
- },
23
- ],
24
- toDOM: (node) => {
25
- const contributors = node;
26
- return [
27
- 'section',
28
- {
29
- class: 'contributors',
30
- id: contributors.attrs.id,
31
- },
32
- 0,
33
- ];
34
- },
26
+ toDOM: () => ['div', { class: 'contributors' }, 0],
35
27
  };
36
- const isContributorsNode = (node) => node.type === index_1.schema.nodes.contributors;
37
- exports.isContributorsNode = isContributorsNode;
@@ -15,9 +15,10 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.manuscript = void 0;
18
+ exports.isManuscriptNode = exports.manuscript = void 0;
19
+ const index_1 = require("../index");
19
20
  exports.manuscript = {
20
- content: 'title? contributors? affiliations? keywords? abstracts body backmatter meta_section',
21
+ content: 'title? contributors? affiliations? keywords? abstracts body backmatter comments',
21
22
  attrs: {
22
23
  id: { default: '' },
23
24
  },
@@ -44,3 +45,5 @@ exports.manuscript = {
44
45
  ];
45
46
  },
46
47
  };
48
+ const isManuscriptNode = (node) => node.type === index_1.schema.nodes.manuscript;
49
+ exports.isManuscriptNode = isManuscriptNode;
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.Decoder = exports.isManuscriptNode = exports.sortSectionsByPriority = exports.getModelsByType = exports.getModelData = void 0;
32
+ exports.Decoder = exports.sortSectionsByPriority = exports.getModelsByType = exports.getModelData = void 0;
33
33
  const json_schema_1 = require("@manuscripts/json-schema");
34
34
  const debug_1 = __importDefault(require("debug"));
35
35
  const prosemirror_model_1 = require("prosemirror-model");
@@ -68,8 +68,6 @@ const getKeywordElements = (modelMap) => (0, exports.getModelsByType)(modelMap,
68
68
  const getKeywordGroups = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordGroup);
69
69
  const getKeywords = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Keyword);
70
70
  const getTitles = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Titles)[0];
71
- const isManuscriptNode = (model) => model !== null;
72
- exports.isManuscriptNode = isManuscriptNode;
73
71
  const isFootnote = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote);
74
72
  const hasParentSection = (id) => (section) => section.path &&
75
73
  section.path.length > 1 &&
@@ -100,14 +98,8 @@ class Decoder {
100
98
  ...elements,
101
99
  ]);
102
100
  }
103
- createMetaSectionNode() {
104
- const commentListNode = this.createCommentListNode();
105
- return schema_1.schema.nodes.meta_section.createAndFill({}, [
106
- commentListNode,
107
- ]);
108
- }
109
- createCommentListNode() {
110
- return schema_1.schema.nodes.comment_list.createAndFill({}, [
101
+ createCommentsNode() {
102
+ return schema_1.schema.nodes.comments.createAndFill({}, [
111
103
  ...this.comments.values(),
112
104
  ]);
113
105
  }
@@ -123,15 +115,9 @@ class Decoder {
123
115
  return (0, section_category_1.chooseCoreSectionBySection)((_a = sec.category) !== null && _a !== void 0 ? _a : '');
124
116
  });
125
117
  this.ensureCoreSectionsExist(sectionGroups);
126
- const absSectionNode = sectionGroups['MPSectionCategory:abstracts']
127
- .map(this.decode)
128
- .filter(exports.isManuscriptNode);
129
- const bodySectionNodes = sectionGroups['MPSectionCategory:body']
130
- .map(this.decode)
131
- .filter(exports.isManuscriptNode);
132
- const backmatterSectionNodes = sectionGroups['MPSectionCategory:backmatter']
133
- .map(this.decode)
134
- .filter(exports.isManuscriptNode);
118
+ const absSectionNode = sectionGroups['MPSectionCategory:abstracts'].map((e) => this.decode(e));
119
+ const bodySectionNodes = sectionGroups['MPSectionCategory:body'].map((e) => this.decode(e));
120
+ const backmatterSectionNodes = sectionGroups['MPSectionCategory:backmatter'].map(e => this.decode(e));
135
121
  const abstractCoreSectionNodes = this.createAndFill(schema_1.schema.nodes.abstracts, absSectionNode);
136
122
  const bodyCoreSectionNodes = this.createAndFill(schema_1.schema.nodes.body, bodySectionNodes);
137
123
  const backmatterCoreSectionNodes = this.createAndFill(schema_1.schema.nodes.backmatter, backmatterSectionNodes);
@@ -157,7 +143,7 @@ class Decoder {
157
143
  id: (0, id_1.generateNodeID)(nodeType),
158
144
  }, content);
159
145
  }
160
- createCommentsNode(model) {
146
+ createCommentNodes(model) {
161
147
  const comments = [];
162
148
  for (const comment of this.getComments(model)) {
163
149
  comments.push(this.decode(comment));
@@ -202,8 +188,8 @@ class Decoder {
202
188
  },
203
189
  [json_schema_1.ObjectTypes.BibliographyItem]: (data) => {
204
190
  const model = data;
205
- const commentNodes = this.createCommentsNode(model);
206
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
191
+ const comments = this.createCommentNodes(model);
192
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
207
193
  return schema_1.schema.nodes.bibliography_item.create({
208
194
  id: model._id,
209
195
  type: model.type,
@@ -217,7 +203,7 @@ class Decoder {
217
203
  page: model.page,
218
204
  title: model.title,
219
205
  literal: model.literal,
220
- comments: commentNodes.map((c) => c.attrs.id),
206
+ comments: comments.map((c) => c.attrs.id),
221
207
  });
222
208
  },
223
209
  [object_types_1.ExtraObjectTypes.PlaceholderElement]: (data) => {
@@ -228,14 +214,14 @@ class Decoder {
228
214
  },
229
215
  [json_schema_1.ObjectTypes.Figure]: (data) => {
230
216
  const model = data;
231
- const commentNodes = this.createCommentsNode(model);
232
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
217
+ const comments = this.createCommentNodes(model);
218
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
233
219
  return schema_1.schema.nodes.figure.create({
234
220
  id: model._id,
235
221
  contentType: model.contentType,
236
222
  src: model.src,
237
223
  position: model.position,
238
- comments: commentNodes.map((c) => c.attrs.id),
224
+ comments: comments.map((c) => c.attrs.id),
239
225
  });
240
226
  },
241
227
  [json_schema_1.ObjectTypes.FigureElement]: (data) => {
@@ -264,8 +250,8 @@ class Decoder {
264
250
  figures.push(schema_1.schema.nodes.figure.createAndFill());
265
251
  }
266
252
  const figcaption = this.getFigcaption(model);
267
- const commentNodes = this.createCommentsNode(model);
268
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
253
+ const comments = this.createCommentNodes(model);
254
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
269
255
  const content = [...paragraphs, ...figures, figcaption];
270
256
  const listing = this.extractListing(model);
271
257
  if (listing) {
@@ -286,7 +272,7 @@ class Decoder {
286
272
  suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
287
273
  attribution: model.attribution,
288
274
  alternatives: model.alternatives,
289
- comments: commentNodes.map((c) => c.attrs.id),
275
+ comments: comments.map((c) => c.attrs.id),
290
276
  }, content);
291
277
  },
292
278
  [json_schema_1.ObjectTypes.Equation]: (data) => {
@@ -329,13 +315,13 @@ class Decoder {
329
315
  if (isFootnote(model) &&
330
316
  model.kind === collateByKind &&
331
317
  model.containingObject === foonotesElementModel._id) {
332
- const commentNodes = this.createCommentsNode(model);
333
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
318
+ const comments = this.createCommentNodes(model);
319
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
334
320
  const footnote = this.parseContents(model.contents || '<div></div>', undefined, this.getComments(model), {
335
321
  topNode: schema_1.schema.nodes.footnote.create({
336
322
  id: model._id,
337
323
  kind: model.kind,
338
- comments: commentNodes.map((c) => c.attrs.id),
324
+ comments: comments.map((c) => c.attrs.id),
339
325
  }),
340
326
  });
341
327
  footnotesOfKind.push(footnote);
@@ -349,13 +335,13 @@ class Decoder {
349
335
  },
350
336
  [json_schema_1.ObjectTypes.Footnote]: (data) => {
351
337
  const footnoteModel = data;
352
- const commentNodes = this.createCommentsNode(footnoteModel);
353
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
338
+ const comments = this.createCommentNodes(footnoteModel);
339
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
354
340
  return this.parseContents(footnoteModel.contents || '<div></div>', undefined, this.getComments(footnoteModel), {
355
341
  topNode: schema_1.schema.nodes.footnote.create({
356
342
  id: footnoteModel._id,
357
343
  kind: footnoteModel.kind,
358
- comments: commentNodes.map((c) => c.attrs.id),
344
+ comments: comments.map((c) => c.attrs.id),
359
345
  }),
360
346
  });
361
347
  },
@@ -372,7 +358,7 @@ class Decoder {
372
358
  const keywords = getKeywords(this.modelMap)
373
359
  .filter((k) => k.containedGroup === keywordGroup._id)
374
360
  .map((k) => this.decode(k));
375
- const comments = this.createCommentsNode(keywordGroup);
361
+ const comments = this.createCommentNodes(keywordGroup);
376
362
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
377
363
  return schema_1.schema.nodes.keyword_group.create({
378
364
  id: keywordGroup._id,
@@ -382,7 +368,7 @@ class Decoder {
382
368
  },
383
369
  [json_schema_1.ObjectTypes.Keyword]: (data) => {
384
370
  const keyword = data;
385
- const comments = this.createCommentsNode(keyword);
371
+ const comments = this.createCommentNodes(keyword);
386
372
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
387
373
  return schema_1.schema.nodes.keyword.create({
388
374
  id: keyword._id,
@@ -392,8 +378,8 @@ class Decoder {
392
378
  },
393
379
  [json_schema_1.ObjectTypes.ListElement]: (data) => {
394
380
  const model = data;
395
- const commentNodes = this.createCommentsNode(model);
396
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
381
+ const comments = this.createCommentNodes(model);
382
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
397
383
  switch (model.elementType) {
398
384
  case 'ol':
399
385
  return this.parseContents(model.contents || '<ol></ol>', undefined, this.getComments(model), {
@@ -401,7 +387,7 @@ class Decoder {
401
387
  id: model._id,
402
388
  listStyleType: model.listStyleType,
403
389
  paragraphStyle: model.paragraphStyle,
404
- comments: commentNodes.map((c) => c.attrs.id),
390
+ comments: comments.map((c) => c.attrs.id),
405
391
  }),
406
392
  });
407
393
  case 'ul':
@@ -417,14 +403,14 @@ class Decoder {
417
403
  },
418
404
  [json_schema_1.ObjectTypes.Listing]: (data) => {
419
405
  const model = data;
420
- const commentNodes = this.createCommentsNode(model);
421
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
406
+ const comments = this.createCommentNodes(model);
407
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
422
408
  return schema_1.schema.nodes.listing.createChecked({
423
409
  id: model._id,
424
410
  contents: model.contents,
425
411
  language: model.language,
426
412
  languageKey: model.languageKey,
427
- comments: commentNodes.map((c) => c.attrs.id),
413
+ comments: comments.map((c) => c.attrs.id),
428
414
  });
429
415
  },
430
416
  [json_schema_1.ObjectTypes.ListingElement]: (data) => {
@@ -444,13 +430,13 @@ class Decoder {
444
430
  throw new errors_1.MissingElement(model.containedObjectID);
445
431
  }
446
432
  const figcaption = this.getFigcaption(model);
447
- const commentNodes = this.createCommentsNode(model);
448
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
433
+ const comments = this.createCommentNodes(model);
434
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
449
435
  return schema_1.schema.nodes.listing_element.createChecked({
450
436
  id: model._id,
451
437
  suppressCaption: model.suppressCaption,
452
438
  suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
453
- comments: commentNodes.map((c) => c.attrs.id),
439
+ comments: comments.map((c) => c.attrs.id),
454
440
  }, [listing, figcaption]);
455
441
  },
456
442
  [json_schema_1.ObjectTypes.MissingFigure]: (data) => {
@@ -462,14 +448,14 @@ class Decoder {
462
448
  },
463
449
  [json_schema_1.ObjectTypes.ParagraphElement]: (data) => {
464
450
  const model = data;
465
- const commentNodes = this.createCommentsNode(model);
466
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
451
+ const comments = this.createCommentNodes(model);
452
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
467
453
  return this.parseContents(model.contents || '<p></p>', undefined, this.getComments(model), {
468
454
  topNode: schema_1.schema.nodes.paragraph.create({
469
455
  id: model._id,
470
456
  paragraphStyle: model.paragraphStyle,
471
457
  placeholder: model.placeholderInnerHTML,
472
- comments: commentNodes.map((c) => c.attrs.id),
458
+ comments: comments.map((c) => c.attrs.id),
473
459
  }),
474
460
  });
475
461
  },
@@ -528,9 +514,7 @@ class Decoder {
528
514
  }
529
515
  }
530
516
  }
531
- const elementNodes = elements
532
- .map(this.decode)
533
- .filter(exports.isManuscriptNode);
517
+ const elementNodes = elements.map(e => this.decode(e));
534
518
  const sectionTitle = 'section_title';
535
519
  const sectionTitleNode = model.title
536
520
  ? this.parseContents(model.title, 'h1', this.getComments(model), {
@@ -548,8 +532,8 @@ class Decoder {
548
532
  .map(this.creators[json_schema_1.ObjectTypes.Section]);
549
533
  const sectionCategory = model.category || (0, section_category_1.guessSectionCategory)(elements);
550
534
  const sectionNodeType = (0, section_category_1.chooseSectionNodeType)(sectionCategory);
551
- const commentNodes = this.createCommentsNode(model);
552
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
535
+ const comments = this.createCommentNodes(model);
536
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
553
537
  const content = (sectionLabelNode
554
538
  ? [sectionLabelNode, sectionTitleNode]
555
539
  : [sectionTitleNode])
@@ -561,7 +545,7 @@ class Decoder {
561
545
  titleSuppressed: model.titleSuppressed,
562
546
  pageBreakStyle: model.pageBreakStyle,
563
547
  generatedLabel: model.generatedLabel,
564
- comments: commentNodes.map((c) => c.attrs.id),
548
+ comments: comments.map((c) => c.attrs.id),
565
549
  }, content);
566
550
  if (!sectionNode) {
567
551
  console.error(model);
@@ -571,12 +555,12 @@ class Decoder {
571
555
  },
572
556
  [json_schema_1.ObjectTypes.Table]: (data) => {
573
557
  const model = data;
574
- const commentNodes = this.createCommentsNode(model);
575
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
558
+ const comments = this.createCommentNodes(model);
559
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
576
560
  return this.parseContents(model.contents, undefined, this.getComments(model), {
577
561
  topNode: schema_1.schema.nodes.table.create({
578
562
  id: model._id,
579
- comments: commentNodes.map((c) => c.attrs.id),
563
+ comments: comments.map((c) => c.attrs.id),
580
564
  }),
581
565
  });
582
566
  },
@@ -585,8 +569,8 @@ class Decoder {
585
569
  const table = this.createTable(model);
586
570
  const tableElementFooter = this.createTableElementFooter(model);
587
571
  const figcaption = this.getFigcaption(model);
588
- const commentNodes = this.createCommentsNode(model);
589
- commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
572
+ const comments = this.createCommentNodes(model);
573
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
590
574
  const content = tableElementFooter
591
575
  ? [table, figcaption, tableElementFooter]
592
576
  : [table, figcaption];
@@ -607,7 +591,7 @@ class Decoder {
607
591
  suppressHeader: model.suppressHeader,
608
592
  tableStyle: model.tableStyle,
609
593
  paragraphStyle: model.paragraphStyle,
610
- comments: commentNodes.map((c) => c.attrs.id),
594
+ comments: comments.map((c) => c.attrs.id),
611
595
  }, content);
612
596
  },
613
597
  [json_schema_1.ObjectTypes.TOCElement]: (data) => {
@@ -678,7 +662,7 @@ class Decoder {
678
662
  const affiliations = this.createAffiliationsNode();
679
663
  const keywords = this.createKeywordsNode();
680
664
  const { abstracts, body, backmatter } = this.createRootSectionNodes();
681
- const meta = this.createMetaSectionNode();
665
+ const comments = this.createCommentsNode();
682
666
  const contents = [
683
667
  title,
684
668
  contributors,
@@ -687,7 +671,7 @@ class Decoder {
687
671
  abstracts,
688
672
  body,
689
673
  backmatter,
690
- meta,
674
+ comments,
691
675
  ];
692
676
  return schema_1.schema.nodes.manuscript.create({
693
677
  id: manuscriptID || this.getManuscriptID(),