@manuscripts/transform 2.3.16-LEAN-3753.0 → 2.3.17

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 (54) hide show
  1. package/dist/cjs/jats/jats-exporter.js +1 -1
  2. package/dist/cjs/schema/index.js +2 -0
  3. package/dist/cjs/schema/nodes/author_notes.js +9 -2
  4. package/dist/cjs/schema/nodes/contributors.js +1 -1
  5. package/dist/cjs/schema/nodes/corresp.js +13 -2
  6. package/dist/cjs/schema/nodes/equation_element.js +1 -0
  7. package/dist/cjs/schema/nodes/figure_element.js +1 -0
  8. package/dist/cjs/schema/nodes/footnote.js +1 -0
  9. package/dist/cjs/schema/nodes/inline_equation.js +1 -0
  10. package/dist/cjs/schema/nodes/keyword.js +1 -0
  11. package/dist/cjs/schema/nodes/listing.js +1 -0
  12. package/dist/cjs/schema/nodes/listing_element.js +1 -0
  13. package/dist/cjs/schema/nodes/manuscript.js +1 -1
  14. package/dist/cjs/schema/nodes/paragraph.js +1 -0
  15. package/dist/cjs/schema/nodes/section.js +1 -0
  16. package/dist/cjs/schema/nodes/table_element.js +1 -0
  17. package/dist/cjs/transformer/decode.js +26 -7
  18. package/dist/cjs/transformer/encode.js +11 -2
  19. package/dist/cjs/version.js +1 -1
  20. package/dist/es/jats/jats-exporter.js +1 -1
  21. package/dist/es/schema/index.js +2 -0
  22. package/dist/es/schema/nodes/author_notes.js +9 -2
  23. package/dist/es/schema/nodes/contributors.js +1 -1
  24. package/dist/es/schema/nodes/corresp.js +11 -1
  25. package/dist/es/schema/nodes/equation_element.js +1 -0
  26. package/dist/es/schema/nodes/figure_element.js +1 -0
  27. package/dist/es/schema/nodes/footnote.js +1 -0
  28. package/dist/es/schema/nodes/inline_equation.js +1 -0
  29. package/dist/es/schema/nodes/keyword.js +1 -0
  30. package/dist/es/schema/nodes/listing.js +1 -0
  31. package/dist/es/schema/nodes/listing_element.js +1 -0
  32. package/dist/es/schema/nodes/manuscript.js +1 -1
  33. package/dist/es/schema/nodes/paragraph.js +1 -0
  34. package/dist/es/schema/nodes/section.js +1 -0
  35. package/dist/es/schema/nodes/table_element.js +1 -0
  36. package/dist/es/transformer/decode.js +26 -7
  37. package/dist/es/transformer/encode.js +11 -2
  38. package/dist/es/version.js +1 -1
  39. package/dist/types/lib/table-cell-styles.d.ts +1 -1
  40. package/dist/types/schema/index.d.ts +2 -0
  41. package/dist/types/schema/nodes/corresp.d.ts +1 -0
  42. package/dist/types/schema/nodes/equation_element.d.ts +2 -0
  43. package/dist/types/schema/nodes/figure_element.d.ts +2 -0
  44. package/dist/types/schema/nodes/footnote.d.ts +2 -0
  45. package/dist/types/schema/nodes/inline_equation.d.ts +2 -0
  46. package/dist/types/schema/nodes/keyword.d.ts +2 -0
  47. package/dist/types/schema/nodes/listing.d.ts +2 -0
  48. package/dist/types/schema/nodes/listing_element.d.ts +2 -0
  49. package/dist/types/schema/nodes/paragraph.d.ts +2 -0
  50. package/dist/types/schema/nodes/section.d.ts +2 -0
  51. package/dist/types/schema/nodes/table_element.d.ts +2 -0
  52. package/dist/types/transformer/decode.d.ts +1 -0
  53. package/dist/types/version.d.ts +1 -1
  54. package/package.json +1 -1
@@ -594,7 +594,7 @@ class JATSExporter {
594
594
  this.createSerializer = () => {
595
595
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
596
596
  const nodes = {
597
- author_notes: () => ['author-notes', 0],
597
+ author_notes: () => '',
598
598
  corresp: () => '',
599
599
  title: () => '',
600
600
  affiliations: () => '',
@@ -150,6 +150,8 @@ __exportStar(require("./nodes/affiliations"), exports);
150
150
  __exportStar(require("./nodes/contributors"), exports);
151
151
  __exportStar(require("./nodes/supplement"), exports);
152
152
  __exportStar(require("./nodes/supplements"), exports);
153
+ __exportStar(require("./nodes/corresp"), exports);
154
+ __exportStar(require("./nodes/author_notes"), exports);
153
155
  exports.schema = new prosemirror_model_1.Schema({
154
156
  marks: {
155
157
  bold: marks_1.bold,
@@ -21,7 +21,14 @@ exports.authorNotes = {
21
21
  id: { default: '' },
22
22
  dataTracked: { default: null },
23
23
  },
24
- content: '(corresp | footnote | paragraph)+',
24
+ content: 'section_title (corresp | footnote | paragraph)+',
25
25
  group: 'block element',
26
- toDOM: () => ['author-notes', 0],
26
+ toDOM: (node) => [
27
+ 'div',
28
+ {
29
+ class: 'author-notes',
30
+ id: node.attrs.id,
31
+ },
32
+ 0,
33
+ ],
27
34
  };
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.contributors = void 0;
19
19
  exports.contributors = {
20
- content: 'contributor* author_notes?',
20
+ content: 'contributor*',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  },
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.corresp = void 0;
3
+ exports.isCorrespNode = exports.corresp = void 0;
4
4
  exports.corresp = {
5
5
  content: 'inline*',
6
6
  attrs: {
@@ -9,5 +9,16 @@ exports.corresp = {
9
9
  dataTracked: { default: null },
10
10
  },
11
11
  group: 'block',
12
- toDOM: () => ['corresp', 0],
12
+ toDOM: (node) => {
13
+ return [
14
+ 'div',
15
+ {
16
+ class: 'corresp',
17
+ id: node.attrs.id,
18
+ },
19
+ 0,
20
+ ];
21
+ },
13
22
  };
23
+ const isCorrespNode = (node) => node.type === node.type.schema.nodes.corresp;
24
+ exports.isCorrespNode = isCorrespNode;
@@ -22,6 +22,7 @@ exports.equationElement = {
22
22
  id: { default: '' },
23
23
  label: { default: '' },
24
24
  dataTracked: { default: null },
25
+ comments: { default: null },
25
26
  },
26
27
  selectable: false,
27
28
  group: 'block element',
@@ -30,6 +30,7 @@ exports.figureElement = {
30
30
  attribution: { default: undefined },
31
31
  alternatives: { default: undefined },
32
32
  dataTracked: { default: null },
33
+ comments: { default: null },
33
34
  },
34
35
  selectable: false,
35
36
  group: 'block element executable',
@@ -25,6 +25,7 @@ exports.footnote = {
25
25
  paragraphStyle: { default: '' },
26
26
  placeholder: { default: '' },
27
27
  dataTracked: { default: null },
28
+ comments: { default: null },
28
29
  },
29
30
  parseDOM: [
30
31
  {
@@ -19,6 +19,7 @@ exports.inlineEquation = void 0;
19
19
  exports.inlineEquation = {
20
20
  attrs: {
21
21
  dataTracked: { default: null },
22
+ comments: { default: null },
22
23
  id: { default: '' },
23
24
  contents: { default: '' },
24
25
  format: { default: '' },
@@ -22,6 +22,7 @@ exports.keyword = {
22
22
  attrs: {
23
23
  id: { default: '' },
24
24
  dataTracked: { default: null },
25
+ comments: { default: null },
25
26
  },
26
27
  group: 'block',
27
28
  selectable: false,
@@ -26,6 +26,7 @@ exports.listing = {
26
26
  isExpanded: { default: false },
27
27
  isExecuting: { default: false },
28
28
  dataTracked: { default: null },
29
+ comments: { default: null },
29
30
  },
30
31
  draggable: false,
31
32
  selectable: false,
@@ -23,6 +23,7 @@ exports.listingElement = {
23
23
  suppressCaption: { default: true },
24
24
  suppressTitle: { default: undefined },
25
25
  dataTracked: { default: null },
26
+ comments: { default: null },
26
27
  },
27
28
  group: 'block element',
28
29
  selectable: false,
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isManuscriptNode = exports.manuscript = void 0;
19
19
  exports.manuscript = {
20
- content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
20
+ content: 'title? contributors? affiliations? author_notes? keywords? supplements? abstracts body backmatter comments',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  doi: { default: '' },
@@ -25,6 +25,7 @@ exports.paragraph = {
25
25
  paragraphStyle: { default: '' },
26
26
  placeholder: { default: '' },
27
27
  dataTracked: { default: null },
28
+ comments: { default: null },
28
29
  },
29
30
  group: 'block element',
30
31
  selectable: false,
@@ -43,6 +43,7 @@ exports.section = {
43
43
  generatedLabel: { default: undefined },
44
44
  pageBreakStyle: { default: undefined },
45
45
  dataTracked: { default: null },
46
+ comments: { default: null },
46
47
  },
47
48
  group: 'block sections',
48
49
  selectable: false,
@@ -29,6 +29,7 @@ exports.tableElement = {
29
29
  suppressHeader: { default: false },
30
30
  expandListing: { default: false },
31
31
  dataTracked: { default: null },
32
+ comments: { default: null },
32
33
  },
33
34
  selectable: false,
34
35
  group: 'block element executable',
@@ -63,8 +63,8 @@ const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(
63
63
  exports.sortSectionsByPriority = sortSectionsByPriority;
64
64
  const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Section).sort(exports.sortSectionsByPriority);
65
65
  const getAffiliations = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Affiliation);
66
- const getAuthorNotes = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.AuthorNotes);
67
66
  const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
67
+ const getAuthorNotes = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.AuthorNotes);
68
68
  const getKeywordElements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordsElement);
69
69
  const getSupplements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Supplement);
70
70
  const getKeywordGroups = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordGroup);
@@ -96,15 +96,17 @@ class Decoder {
96
96
  const contributors = getContributors(this.modelMap)
97
97
  .map((c) => this.decode(c))
98
98
  .filter(Boolean);
99
- const authorNotes = getAuthorNotes(this.modelMap)
100
- .map((authorNote) => this.decode(authorNote))
101
- .filter(Boolean);
102
- const content = [...contributors, ...authorNotes];
99
+ const content = [...contributors];
103
100
  if (!content.length) {
104
101
  return false;
105
102
  }
106
103
  return schema_1.schema.nodes.contributors.createAndFill({}, content);
107
104
  }
105
+ createAuthorNotesNode() {
106
+ return getAuthorNotes(this.modelMap)
107
+ .map((authorNote) => this.decode(authorNote))
108
+ .filter(Boolean);
109
+ }
108
110
  createKeywordsNode() {
109
111
  const elements = getKeywordElements(this.modelMap)
110
112
  .map((e) => this.decode(e))
@@ -220,6 +222,7 @@ class Decoder {
220
222
  page: model.page,
221
223
  title: model.title,
222
224
  literal: model.literal,
225
+ comments: comments.map((c) => c.attrs.id),
223
226
  });
224
227
  },
225
228
  [object_types_1.ExtraObjectTypes.PlaceholderElement]: (data) => {
@@ -237,6 +240,7 @@ class Decoder {
237
240
  contentType: model.contentType,
238
241
  src: model.src,
239
242
  position: model.position,
243
+ comments: comments.map((c) => c.attrs.id),
240
244
  });
241
245
  },
242
246
  [json_schema_1.ObjectTypes.FigureElement]: (data) => {
@@ -287,6 +291,7 @@ class Decoder {
287
291
  suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
288
292
  attribution: model.attribution,
289
293
  alternatives: model.alternatives,
294
+ comments: comments.map((c) => c.attrs.id),
290
295
  }, content);
291
296
  },
292
297
  [json_schema_1.ObjectTypes.Equation]: (data) => {
@@ -333,6 +338,7 @@ class Decoder {
333
338
  topNode: schema_1.schema.nodes.footnote.create({
334
339
  id: model._id,
335
340
  kind: model.kind,
341
+ comments: comments.map((c) => c.attrs.id),
336
342
  }),
337
343
  });
338
344
  footnotesOfKind.push(footnote);
@@ -353,6 +359,7 @@ class Decoder {
353
359
  topNode: schema_1.schema.nodes.footnote.create({
354
360
  id: footnoteModel._id,
355
361
  kind: footnoteModel.kind,
362
+ comments: comments.map((c) => c.attrs.id),
356
363
  }),
357
364
  });
358
365
  },
@@ -374,6 +381,7 @@ class Decoder {
374
381
  return schema_1.schema.nodes.keyword_group.create({
375
382
  id: keywordGroup._id,
376
383
  type: keywordGroup.type,
384
+ comments: comments.map((c) => c.attrs.id),
377
385
  }, keywords);
378
386
  },
379
387
  [json_schema_1.ObjectTypes.Keyword]: (data) => {
@@ -383,6 +391,7 @@ class Decoder {
383
391
  return schema_1.schema.nodes.keyword.create({
384
392
  id: keyword._id,
385
393
  contents: keyword.name,
394
+ comments: comments.map((c) => c.attrs.id),
386
395
  }, schema_1.schema.text(keyword.name));
387
396
  },
388
397
  [json_schema_1.ObjectTypes.ListElement]: (data) => {
@@ -396,6 +405,7 @@ class Decoder {
396
405
  id: model._id,
397
406
  listStyleType: model.listStyleType || 'order',
398
407
  paragraphStyle: model.paragraphStyle,
408
+ comments: comments.map((c) => c.attrs.id),
399
409
  }),
400
410
  });
401
411
  case 'ul':
@@ -419,6 +429,7 @@ class Decoder {
419
429
  contents: model.contents,
420
430
  language: model.language,
421
431
  languageKey: model.languageKey,
432
+ comments: comments.map((c) => c.attrs.id),
422
433
  });
423
434
  },
424
435
  [json_schema_1.ObjectTypes.ListingElement]: (data) => {
@@ -444,6 +455,7 @@ class Decoder {
444
455
  id: model._id,
445
456
  suppressCaption: model.suppressCaption,
446
457
  suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
458
+ comments: comments.map((c) => c.attrs.id),
447
459
  }, [listing, figcaption]);
448
460
  },
449
461
  [json_schema_1.ObjectTypes.MissingFigure]: (data) => {
@@ -462,6 +474,7 @@ class Decoder {
462
474
  id: model._id,
463
475
  paragraphStyle: model.paragraphStyle,
464
476
  placeholder: model.placeholderInnerHTML,
477
+ comments: comments.map((c) => c.attrs.id),
465
478
  }),
466
479
  });
467
480
  },
@@ -518,9 +531,12 @@ class Decoder {
518
531
  [json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
519
532
  const model = data;
520
533
  const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
521
- return schema_1.schema.nodes.author_notes.create({
534
+ return schema_1.schema.nodes.author_notes.createAndFill({
522
535
  id: model._id,
523
- }, content);
536
+ }, [
537
+ schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Correspondence')),
538
+ ...content,
539
+ ]);
524
540
  },
525
541
  [json_schema_1.ObjectTypes.Corresponding]: (data) => {
526
542
  const model = data;
@@ -587,6 +603,7 @@ class Decoder {
587
603
  titleSuppressed: model.titleSuppressed,
588
604
  pageBreakStyle: model.pageBreakStyle,
589
605
  generatedLabel: model.generatedLabel,
606
+ comments: comments.map((c) => c.attrs.id),
590
607
  }, content);
591
608
  if (!sectionNode) {
592
609
  console.error(model);
@@ -631,6 +648,7 @@ class Decoder {
631
648
  suppressHeader: model.suppressHeader,
632
649
  tableStyle: model.tableStyle,
633
650
  paragraphStyle: model.paragraphStyle,
651
+ comments: comments.map((c) => c.attrs.id),
634
652
  }, content);
635
653
  },
636
654
  [json_schema_1.ObjectTypes.TOCElement]: (data) => {
@@ -715,6 +733,7 @@ class Decoder {
715
733
  this.createTitleNode(),
716
734
  this.createContributorsNode(),
717
735
  this.createAffiliationsNode(),
736
+ ...this.createAuthorNotesNode(),
718
737
  this.createKeywordsNode(),
719
738
  this.createSupplementsNode(),
720
739
  ...this.createContentSections(),
@@ -206,6 +206,16 @@ const containedParagraphIDs = (node) => {
206
206
  const paragraphNodeType = node.type.schema.nodes.paragraph;
207
207
  return containedObjectIDs(node, [paragraphNodeType]);
208
208
  };
209
+ const containedAuthorNotesIDs = (node) => {
210
+ const correspNodeType = node.type.schema.nodes.corresp;
211
+ const footnoteNodetype = node.type.schema.nodes.footnote;
212
+ const paragraphNodeType = node.type.schema.nodes.paragraph;
213
+ return containedObjectIDs(node, [
214
+ correspNodeType,
215
+ footnoteNodetype,
216
+ paragraphNodeType,
217
+ ]);
218
+ };
209
219
  const containedBibliographyItemIDs = (node) => {
210
220
  const bibliographyItemNodeType = node.type.schema.nodes.bibliography_item;
211
221
  return containedObjectIDs(node, [bibliographyItemNodeType]);
@@ -398,7 +408,7 @@ const encoders = {
398
408
  containedObjectIDs: tableElementFooterContainedIDs(node),
399
409
  }),
400
410
  author_notes: (node) => ({
401
- containedObjectIDs: containedObjectIDs(node),
411
+ containedObjectIDs: containedAuthorNotesIDs(node),
402
412
  }),
403
413
  footnotes_section: (node, parent, path, priority) => ({
404
414
  category: (0, section_category_1.buildSectionCategory)(node),
@@ -559,7 +569,6 @@ exports.modelFromNode = modelFromNode;
559
569
  const containerTypes = [
560
570
  schema_1.schema.nodes.affiliations,
561
571
  schema_1.schema.nodes.contributors,
562
- schema_1.schema.nodes.affiliations,
563
572
  schema_1.schema.nodes.keywords,
564
573
  schema_1.schema.nodes.supplements,
565
574
  schema_1.schema.nodes.abstracts,
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "2.3.16-LEAN-3753.0";
4
+ exports.VERSION = "2.3.17";
@@ -586,7 +586,7 @@ export class JATSExporter {
586
586
  this.createSerializer = () => {
587
587
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
588
588
  const nodes = {
589
- author_notes: () => ['author-notes', 0],
589
+ author_notes: () => '',
590
590
  corresp: () => '',
591
591
  title: () => '',
592
592
  affiliations: () => '',
@@ -133,6 +133,8 @@ export * from './nodes/affiliations';
133
133
  export * from './nodes/contributors';
134
134
  export * from './nodes/supplement';
135
135
  export * from './nodes/supplements';
136
+ export * from './nodes/corresp';
137
+ export * from './nodes/author_notes';
136
138
  export const schema = new Schema({
137
139
  marks: {
138
140
  bold,
@@ -18,7 +18,14 @@ export const authorNotes = {
18
18
  id: { default: '' },
19
19
  dataTracked: { default: null },
20
20
  },
21
- content: '(corresp | footnote | paragraph)+',
21
+ content: 'section_title (corresp | footnote | paragraph)+',
22
22
  group: 'block element',
23
- toDOM: () => ['author-notes', 0],
23
+ toDOM: (node) => [
24
+ 'div',
25
+ {
26
+ class: 'author-notes',
27
+ id: node.attrs.id,
28
+ },
29
+ 0,
30
+ ],
24
31
  };
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const contributors = {
17
- content: 'contributor* author_notes?',
17
+ content: 'contributor*',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  },
@@ -6,5 +6,15 @@ export const corresp = {
6
6
  dataTracked: { default: null },
7
7
  },
8
8
  group: 'block',
9
- toDOM: () => ['corresp', 0],
9
+ toDOM: (node) => {
10
+ return [
11
+ 'div',
12
+ {
13
+ class: 'corresp',
14
+ id: node.attrs.id,
15
+ },
16
+ 0,
17
+ ];
18
+ },
10
19
  };
20
+ export const isCorrespNode = (node) => node.type === node.type.schema.nodes.corresp;
@@ -19,6 +19,7 @@ export const equationElement = {
19
19
  id: { default: '' },
20
20
  label: { default: '' },
21
21
  dataTracked: { default: null },
22
+ comments: { default: null },
22
23
  },
23
24
  selectable: false,
24
25
  group: 'block element',
@@ -27,6 +27,7 @@ export const figureElement = {
27
27
  attribution: { default: undefined },
28
28
  alternatives: { default: undefined },
29
29
  dataTracked: { default: null },
30
+ comments: { default: null },
30
31
  },
31
32
  selectable: false,
32
33
  group: 'block element executable',
@@ -22,6 +22,7 @@ export const footnote = {
22
22
  paragraphStyle: { default: '' },
23
23
  placeholder: { default: '' },
24
24
  dataTracked: { default: null },
25
+ comments: { default: null },
25
26
  },
26
27
  parseDOM: [
27
28
  {
@@ -16,6 +16,7 @@
16
16
  export const inlineEquation = {
17
17
  attrs: {
18
18
  dataTracked: { default: null },
19
+ comments: { default: null },
19
20
  id: { default: '' },
20
21
  contents: { default: '' },
21
22
  format: { default: '' },
@@ -19,6 +19,7 @@ export const keyword = {
19
19
  attrs: {
20
20
  id: { default: '' },
21
21
  dataTracked: { default: null },
22
+ comments: { default: null },
22
23
  },
23
24
  group: 'block',
24
25
  selectable: false,
@@ -23,6 +23,7 @@ export const listing = {
23
23
  isExpanded: { default: false },
24
24
  isExecuting: { default: false },
25
25
  dataTracked: { default: null },
26
+ comments: { default: null },
26
27
  },
27
28
  draggable: false,
28
29
  selectable: false,
@@ -20,6 +20,7 @@ export const listingElement = {
20
20
  suppressCaption: { default: true },
21
21
  suppressTitle: { default: undefined },
22
22
  dataTracked: { default: null },
23
+ comments: { default: null },
23
24
  },
24
25
  group: 'block element',
25
26
  selectable: false,
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const manuscript = {
17
- content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
17
+ content: 'title? contributors? affiliations? author_notes? keywords? supplements? abstracts body backmatter comments',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  doi: { default: '' },
@@ -22,6 +22,7 @@ export const paragraph = {
22
22
  paragraphStyle: { default: '' },
23
23
  placeholder: { default: '' },
24
24
  dataTracked: { default: null },
25
+ comments: { default: null },
25
26
  },
26
27
  group: 'block element',
27
28
  selectable: false,
@@ -40,6 +40,7 @@ export const section = {
40
40
  generatedLabel: { default: undefined },
41
41
  pageBreakStyle: { default: undefined },
42
42
  dataTracked: { default: null },
43
+ comments: { default: null },
43
44
  },
44
45
  group: 'block sections',
45
46
  selectable: false,
@@ -26,6 +26,7 @@ export const tableElement = {
26
26
  suppressHeader: { default: false },
27
27
  expandListing: { default: false },
28
28
  dataTracked: { default: null },
29
+ comments: { default: null },
29
30
  },
30
31
  selectable: false,
31
32
  group: 'block element executable',
@@ -54,8 +54,8 @@ export const getModelsByType = (modelMap, objectType) => {
54
54
  export const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(a.priority) - Number(b.priority);
55
55
  const getSections = (modelMap) => getModelsByType(modelMap, ObjectTypes.Section).sort(sortSectionsByPriority);
56
56
  const getAffiliations = (modelMap) => getModelsByType(modelMap, ObjectTypes.Affiliation);
57
- const getAuthorNotes = (modelMap) => getModelsByType(modelMap, ObjectTypes.AuthorNotes);
58
57
  const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
58
+ const getAuthorNotes = (modelMap) => getModelsByType(modelMap, ObjectTypes.AuthorNotes);
59
59
  const getKeywordElements = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordsElement);
60
60
  const getSupplements = (modelMap) => getModelsByType(modelMap, ObjectTypes.Supplement);
61
61
  const getKeywordGroups = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordGroup);
@@ -87,15 +87,17 @@ export class Decoder {
87
87
  const contributors = getContributors(this.modelMap)
88
88
  .map((c) => this.decode(c))
89
89
  .filter(Boolean);
90
- const authorNotes = getAuthorNotes(this.modelMap)
91
- .map((authorNote) => this.decode(authorNote))
92
- .filter(Boolean);
93
- const content = [...contributors, ...authorNotes];
90
+ const content = [...contributors];
94
91
  if (!content.length) {
95
92
  return false;
96
93
  }
97
94
  return schema.nodes.contributors.createAndFill({}, content);
98
95
  }
96
+ createAuthorNotesNode() {
97
+ return getAuthorNotes(this.modelMap)
98
+ .map((authorNote) => this.decode(authorNote))
99
+ .filter(Boolean);
100
+ }
99
101
  createKeywordsNode() {
100
102
  const elements = getKeywordElements(this.modelMap)
101
103
  .map((e) => this.decode(e))
@@ -211,6 +213,7 @@ export class Decoder {
211
213
  page: model.page,
212
214
  title: model.title,
213
215
  literal: model.literal,
216
+ comments: comments.map((c) => c.attrs.id),
214
217
  });
215
218
  },
216
219
  [ExtraObjectTypes.PlaceholderElement]: (data) => {
@@ -228,6 +231,7 @@ export class Decoder {
228
231
  contentType: model.contentType,
229
232
  src: model.src,
230
233
  position: model.position,
234
+ comments: comments.map((c) => c.attrs.id),
231
235
  });
232
236
  },
233
237
  [ObjectTypes.FigureElement]: (data) => {
@@ -278,6 +282,7 @@ export class Decoder {
278
282
  suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
279
283
  attribution: model.attribution,
280
284
  alternatives: model.alternatives,
285
+ comments: comments.map((c) => c.attrs.id),
281
286
  }, content);
282
287
  },
283
288
  [ObjectTypes.Equation]: (data) => {
@@ -324,6 +329,7 @@ export class Decoder {
324
329
  topNode: schema.nodes.footnote.create({
325
330
  id: model._id,
326
331
  kind: model.kind,
332
+ comments: comments.map((c) => c.attrs.id),
327
333
  }),
328
334
  });
329
335
  footnotesOfKind.push(footnote);
@@ -344,6 +350,7 @@ export class Decoder {
344
350
  topNode: schema.nodes.footnote.create({
345
351
  id: footnoteModel._id,
346
352
  kind: footnoteModel.kind,
353
+ comments: comments.map((c) => c.attrs.id),
347
354
  }),
348
355
  });
349
356
  },
@@ -365,6 +372,7 @@ export class Decoder {
365
372
  return schema.nodes.keyword_group.create({
366
373
  id: keywordGroup._id,
367
374
  type: keywordGroup.type,
375
+ comments: comments.map((c) => c.attrs.id),
368
376
  }, keywords);
369
377
  },
370
378
  [ObjectTypes.Keyword]: (data) => {
@@ -374,6 +382,7 @@ export class Decoder {
374
382
  return schema.nodes.keyword.create({
375
383
  id: keyword._id,
376
384
  contents: keyword.name,
385
+ comments: comments.map((c) => c.attrs.id),
377
386
  }, schema.text(keyword.name));
378
387
  },
379
388
  [ObjectTypes.ListElement]: (data) => {
@@ -387,6 +396,7 @@ export class Decoder {
387
396
  id: model._id,
388
397
  listStyleType: model.listStyleType || 'order',
389
398
  paragraphStyle: model.paragraphStyle,
399
+ comments: comments.map((c) => c.attrs.id),
390
400
  }),
391
401
  });
392
402
  case 'ul':
@@ -410,6 +420,7 @@ export class Decoder {
410
420
  contents: model.contents,
411
421
  language: model.language,
412
422
  languageKey: model.languageKey,
423
+ comments: comments.map((c) => c.attrs.id),
413
424
  });
414
425
  },
415
426
  [ObjectTypes.ListingElement]: (data) => {
@@ -435,6 +446,7 @@ export class Decoder {
435
446
  id: model._id,
436
447
  suppressCaption: model.suppressCaption,
437
448
  suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
449
+ comments: comments.map((c) => c.attrs.id),
438
450
  }, [listing, figcaption]);
439
451
  },
440
452
  [ObjectTypes.MissingFigure]: (data) => {
@@ -453,6 +465,7 @@ export class Decoder {
453
465
  id: model._id,
454
466
  paragraphStyle: model.paragraphStyle,
455
467
  placeholder: model.placeholderInnerHTML,
468
+ comments: comments.map((c) => c.attrs.id),
456
469
  }),
457
470
  });
458
471
  },
@@ -509,9 +522,12 @@ export class Decoder {
509
522
  [ObjectTypes.AuthorNotes]: (data) => {
510
523
  const model = data;
511
524
  const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
512
- return schema.nodes.author_notes.create({
525
+ return schema.nodes.author_notes.createAndFill({
513
526
  id: model._id,
514
- }, content);
527
+ }, [
528
+ schema.nodes.section_title.create({}, schema.text('Correspondence')),
529
+ ...content,
530
+ ]);
515
531
  },
516
532
  [ObjectTypes.Corresponding]: (data) => {
517
533
  const model = data;
@@ -578,6 +594,7 @@ export class Decoder {
578
594
  titleSuppressed: model.titleSuppressed,
579
595
  pageBreakStyle: model.pageBreakStyle,
580
596
  generatedLabel: model.generatedLabel,
597
+ comments: comments.map((c) => c.attrs.id),
581
598
  }, content);
582
599
  if (!sectionNode) {
583
600
  console.error(model);
@@ -622,6 +639,7 @@ export class Decoder {
622
639
  suppressHeader: model.suppressHeader,
623
640
  tableStyle: model.tableStyle,
624
641
  paragraphStyle: model.paragraphStyle,
642
+ comments: comments.map((c) => c.attrs.id),
625
643
  }, content);
626
644
  },
627
645
  [ObjectTypes.TOCElement]: (data) => {
@@ -706,6 +724,7 @@ export class Decoder {
706
724
  this.createTitleNode(),
707
725
  this.createContributorsNode(),
708
726
  this.createAffiliationsNode(),
727
+ ...this.createAuthorNotesNode(),
709
728
  this.createKeywordsNode(),
710
729
  this.createSupplementsNode(),
711
730
  ...this.createContentSections(),
@@ -198,6 +198,16 @@ const containedParagraphIDs = (node) => {
198
198
  const paragraphNodeType = node.type.schema.nodes.paragraph;
199
199
  return containedObjectIDs(node, [paragraphNodeType]);
200
200
  };
201
+ const containedAuthorNotesIDs = (node) => {
202
+ const correspNodeType = node.type.schema.nodes.corresp;
203
+ const footnoteNodetype = node.type.schema.nodes.footnote;
204
+ const paragraphNodeType = node.type.schema.nodes.paragraph;
205
+ return containedObjectIDs(node, [
206
+ correspNodeType,
207
+ footnoteNodetype,
208
+ paragraphNodeType,
209
+ ]);
210
+ };
201
211
  const containedBibliographyItemIDs = (node) => {
202
212
  const bibliographyItemNodeType = node.type.schema.nodes.bibliography_item;
203
213
  return containedObjectIDs(node, [bibliographyItemNodeType]);
@@ -390,7 +400,7 @@ const encoders = {
390
400
  containedObjectIDs: tableElementFooterContainedIDs(node),
391
401
  }),
392
402
  author_notes: (node) => ({
393
- containedObjectIDs: containedObjectIDs(node),
403
+ containedObjectIDs: containedAuthorNotesIDs(node),
394
404
  }),
395
405
  footnotes_section: (node, parent, path, priority) => ({
396
406
  category: buildSectionCategory(node),
@@ -550,7 +560,6 @@ export const modelFromNode = (node, parent, path, priority) => {
550
560
  const containerTypes = [
551
561
  schema.nodes.affiliations,
552
562
  schema.nodes.contributors,
553
- schema.nodes.affiliations,
554
563
  schema.nodes.keywords,
555
564
  schema.nodes.supplements,
556
565
  schema.nodes.abstracts,
@@ -1 +1 @@
1
- export const VERSION = "2.3.16-LEAN-3753.0";
1
+ export const VERSION = "2.3.17";
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare const TABLE_CELL_STYLES: readonly ["backgroundColor", "border-top", "border-right", "border-bottom", "border-left", "verticalAlign", "textAlign"];
17
- export type TableCellStyleKey = (typeof TABLE_CELL_STYLES)[number];
17
+ export type TableCellStyleKey = typeof TABLE_CELL_STYLES[number];
18
18
  export declare const serializeTableCellStyles: (styles: {
19
19
  backgroundColor?: string | null | undefined;
20
20
  "border-top"?: string | null | undefined;
@@ -71,4 +71,6 @@ export * from './nodes/affiliations';
71
71
  export * from './nodes/contributors';
72
72
  export * from './nodes/supplement';
73
73
  export * from './nodes/supplements';
74
+ export * from './nodes/corresp';
75
+ export * from './nodes/author_notes';
74
76
  export declare const schema: Schema<Nodes, Marks>;
@@ -8,4 +8,5 @@ export interface CorrespNode extends ManuscriptNode {
8
8
  attrs: Attrs;
9
9
  }
10
10
  export declare const corresp: NodeSpec;
11
+ export declare const isCorrespNode: (node: ManuscriptNode) => node is CorrespNode;
11
12
  export {};
@@ -15,9 +15,11 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  interface Attrs {
19
20
  id: string;
20
21
  label: string;
22
+ comments?: CommentNode[];
21
23
  }
22
24
  export interface EquationElementNode extends ManuscriptNode {
23
25
  attrs: Attrs;
@@ -16,6 +16,7 @@
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
18
  import { AttributionNode } from './attribution';
19
+ import { CommentNode } from './comment';
19
20
  interface Attrs {
20
21
  columns: number;
21
22
  figureLayout: string;
@@ -33,6 +34,7 @@ interface Attrs {
33
34
  src: string;
34
35
  type?: string;
35
36
  }[];
37
+ comments?: CommentNode[];
36
38
  }
37
39
  export interface FigureElementNode extends ManuscriptNode {
38
40
  attrs: Attrs;
@@ -15,12 +15,14 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  type Kind = 'footnote' | 'endnote';
19
20
  interface Attrs {
20
21
  id: string;
21
22
  kind: Kind;
22
23
  paragraphStyle?: string;
23
24
  placeholder?: string;
25
+ comments?: CommentNode[];
24
26
  }
25
27
  export interface FootnoteNode extends ManuscriptNode {
26
28
  attrs: Attrs;
@@ -15,10 +15,12 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  interface Attrs {
19
20
  id: string;
20
21
  contents: string;
21
22
  format: string;
23
+ comments?: CommentNode[];
22
24
  }
23
25
  export interface InlineEquationNode extends ManuscriptNode {
24
26
  attrs: Attrs;
@@ -15,8 +15,10 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  interface Attrs {
19
20
  id: string;
21
+ comments?: CommentNode[];
20
22
  }
21
23
  export interface KeywordNode extends ManuscriptNode {
22
24
  attrs: Attrs;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  interface Attrs {
19
20
  id: string;
20
21
  contents: string;
@@ -22,6 +23,7 @@ interface Attrs {
22
23
  languageKey: string;
23
24
  isExpanded: boolean;
24
25
  isExecuting: boolean;
26
+ comments?: CommentNode[];
25
27
  }
26
28
  export interface ListingNode extends ManuscriptNode {
27
29
  attrs: Attrs;
@@ -15,10 +15,12 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  interface Attrs {
19
20
  id: string;
20
21
  suppressCaption: boolean;
21
22
  suppressTitle?: boolean;
23
+ comments?: CommentNode[];
22
24
  }
23
25
  export interface ListingElementNode extends ManuscriptNode {
24
26
  attrs: Attrs;
@@ -15,10 +15,12 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  interface Attrs {
19
20
  id: string;
20
21
  paragraphStyle: string;
21
22
  placeholder: string;
23
+ comments?: CommentNode[];
22
24
  }
23
25
  export interface ParagraphNode extends ManuscriptNode {
24
26
  attrs: Attrs;
@@ -15,12 +15,14 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  interface Attrs {
19
20
  id: string;
20
21
  category?: string;
21
22
  titleSuppressed: boolean;
22
23
  generatedLabel: boolean;
23
24
  pageBreakStyle?: number;
25
+ comments?: CommentNode[];
24
26
  }
25
27
  export interface SectionNode extends ManuscriptNode {
26
28
  attrs: Attrs;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
+ import { CommentNode } from './comment';
18
19
  interface Attrs {
19
20
  id: string;
20
21
  paragraphStyle: string;
@@ -25,6 +26,7 @@ interface Attrs {
25
26
  suppressFooter: boolean;
26
27
  suppressHeader: boolean;
27
28
  expandListing: boolean;
29
+ comments?: CommentNode[];
28
30
  }
29
31
  export interface TableElementNode extends ManuscriptNode {
30
32
  attrs: Attrs;
@@ -27,6 +27,7 @@ export declare class Decoder {
27
27
  private createTitleNode;
28
28
  private createAffiliationsNode;
29
29
  private createContributorsNode;
30
+ private createAuthorNotesNode;
30
31
  private createKeywordsNode;
31
32
  private createSupplementsNode;
32
33
  private createCommentsNode;
@@ -1 +1 @@
1
- export declare const VERSION = "2.3.16-LEAN-3753.0";
1
+ export declare const VERSION = "2.3.17";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/transform",
3
3
  "description": "ProseMirror transformer for Manuscripts applications",
4
- "version": "2.3.16-LEAN-3753.0",
4
+ "version": "2.3.17",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",