@manuscripts/transform 1.5.3 → 1.5.4-LEAN-3030

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 (67) hide show
  1. package/dist/cjs/jats/importer/jats-body-dom-parser.js +23 -18
  2. package/dist/cjs/jats/importer/jats-body-transformations.js +3 -3
  3. package/dist/cjs/jats/importer/parse-jats-article.js +11 -2
  4. package/dist/cjs/jats/jats-exporter.js +19 -12
  5. package/dist/cjs/lib/utils.js +10 -1
  6. package/dist/cjs/schema/index.js +19 -12
  7. package/dist/cjs/schema/nodes/affiliations.js +15 -0
  8. package/dist/cjs/schema/nodes/contributors.js +15 -0
  9. package/dist/cjs/schema/nodes/core_section.js +27 -0
  10. package/dist/cjs/schema/nodes/keyword.js +0 -1
  11. package/dist/cjs/schema/nodes/{keywords_group.js → keyword_group.js} +6 -6
  12. package/dist/cjs/schema/nodes/{keywords_section.js → keywords.js} +7 -7
  13. package/dist/cjs/schema/nodes/keywords_element.js +1 -1
  14. package/dist/cjs/schema/nodes/manuscript.js +1 -1
  15. package/dist/cjs/schema/nodes/title.js +29 -0
  16. package/dist/cjs/transformer/builders.js +8 -3
  17. package/dist/cjs/transformer/decode.js +119 -105
  18. package/dist/cjs/transformer/encode.js +19 -26
  19. package/dist/cjs/transformer/html.js +6 -5
  20. package/dist/cjs/transformer/node-names.js +1 -1
  21. package/dist/cjs/transformer/node-title.js +7 -5
  22. package/dist/cjs/transformer/node-types.js +8 -4
  23. package/dist/cjs/transformer/project-bundle.js +22 -1
  24. package/dist/cjs/transformer/section-category.js +35 -8
  25. package/dist/es/jats/importer/jats-body-dom-parser.js +23 -18
  26. package/dist/es/jats/importer/jats-body-transformations.js +3 -3
  27. package/dist/es/jats/importer/parse-jats-article.js +11 -2
  28. package/dist/es/jats/jats-exporter.js +20 -13
  29. package/dist/es/lib/utils.js +8 -0
  30. package/dist/es/schema/index.js +19 -12
  31. package/dist/es/schema/nodes/{affiliations_section.js → affiliations.js} +3 -3
  32. package/dist/es/schema/nodes/{contributors_section.js → contributors.js} +3 -3
  33. package/dist/es/schema/nodes/core_section.js +24 -0
  34. package/dist/es/schema/nodes/keyword.js +0 -1
  35. package/dist/es/schema/nodes/{keywords_group.js → keyword_group.js} +4 -4
  36. package/dist/es/schema/nodes/{keywords_section.js → keywords.js} +5 -5
  37. package/dist/es/schema/nodes/keywords_element.js +1 -1
  38. package/dist/es/schema/nodes/manuscript.js +1 -1
  39. package/dist/es/schema/nodes/title.js +26 -0
  40. package/dist/es/transformer/builders.js +6 -2
  41. package/dist/es/transformer/decode.js +120 -106
  42. package/dist/es/transformer/encode.js +19 -26
  43. package/dist/es/transformer/html.js +7 -6
  44. package/dist/es/transformer/node-names.js +1 -1
  45. package/dist/es/transformer/node-title.js +8 -6
  46. package/dist/es/transformer/node-types.js +8 -4
  47. package/dist/es/transformer/project-bundle.js +20 -0
  48. package/dist/es/transformer/section-category.js +33 -7
  49. package/dist/types/lib/utils.d.ts +1 -0
  50. package/dist/types/schema/index.d.ts +4 -3
  51. package/dist/types/schema/nodes/affiliations.d.ts +11 -0
  52. package/dist/types/schema/nodes/contributors.d.ts +11 -0
  53. package/dist/types/schema/nodes/core_section.d.ts +17 -0
  54. package/dist/types/schema/nodes/keyword.d.ts +0 -1
  55. package/dist/types/schema/nodes/{keywords_group.d.ts → keyword_group.d.ts} +3 -3
  56. package/dist/types/schema/nodes/{keywords_section.d.ts → keywords.d.ts} +3 -3
  57. package/dist/types/schema/nodes/title.d.ts +28 -0
  58. package/dist/types/schema/types.d.ts +1 -1
  59. package/dist/types/transformer/builders.d.ts +3 -2
  60. package/dist/types/transformer/decode.d.ts +6 -5
  61. package/dist/types/transformer/project-bundle.d.ts +2 -1
  62. package/dist/types/transformer/section-category.d.ts +1 -0
  63. package/package.json +2 -2
  64. package/dist/cjs/schema/nodes/affiliations_section.js +0 -15
  65. package/dist/cjs/schema/nodes/contributors_section.js +0 -15
  66. package/dist/types/schema/nodes/affiliations_section.d.ts +0 -11
  67. package/dist/types/schema/nodes/contributors_section.d.ts +0 -11
@@ -507,7 +507,7 @@ const nodes = [
507
507
  },
508
508
  {
509
509
  tag: 'sec[sec-type="affiliations"]',
510
- node: 'affiliations_section',
510
+ node: 'affiliations',
511
511
  getAttrs: (node) => {
512
512
  const element = node;
513
513
  return {
@@ -519,7 +519,7 @@ const nodes = [
519
519
  {
520
520
  tag: 'aff',
521
521
  node: 'affiliation',
522
- context: 'affiliations_section/',
522
+ context: 'affiliations/',
523
523
  getAttrs: (node) => {
524
524
  const element = node;
525
525
  const aff = {
@@ -566,7 +566,7 @@ const nodes = [
566
566
  },
567
567
  {
568
568
  tag: 'sec[sec-type="contributors"]',
569
- node: 'contributors_section',
569
+ node: 'contributors',
570
570
  getAttrs: (node) => {
571
571
  const element = node;
572
572
  return {
@@ -578,7 +578,7 @@ const nodes = [
578
578
  {
579
579
  tag: 'contrib',
580
580
  node: 'contributor',
581
- context: 'contributors_section/',
581
+ context: 'contributors/',
582
582
  getAttrs: (node) => {
583
583
  const element = node;
584
584
  const contrib = {
@@ -633,19 +633,19 @@ const nodes = [
633
633
  },
634
634
  {
635
635
  tag: 'sec[sec-type="keywords"]',
636
- node: 'keywords_section',
637
- getAttrs: (node) => {
638
- const element = node;
639
- return {
640
- id: element.getAttribute('id'),
641
- category: (0, transformer_1.chooseSectionCategory)(element),
642
- };
643
- },
636
+ node: 'keywords',
644
637
  },
645
638
  {
646
- tag: 'kwd-group-list',
647
- context: 'keywords_section/',
648
- node: 'keywords_element',
639
+ tag: 'sec[sec-type="abstracts"]',
640
+ node: 'abstracts',
641
+ },
642
+ {
643
+ tag: 'sec[sec-type="body"]',
644
+ node: 'body',
645
+ },
646
+ {
647
+ tag: 'sec[sec-type="backmatter"]',
648
+ node: 'backmatter',
649
649
  },
650
650
  {
651
651
  tag: 'sec',
@@ -658,10 +658,15 @@ const nodes = [
658
658
  };
659
659
  },
660
660
  },
661
+ {
662
+ tag: 'kwd-group-list',
663
+ context: 'keywords/',
664
+ node: 'keywords_element',
665
+ },
661
666
  {
662
667
  tag: 'kwd-group',
663
668
  context: 'keywords_element/',
664
- node: 'keywords_group',
669
+ node: 'keyword_group',
665
670
  getAttrs: (node) => {
666
671
  const element = node;
667
672
  return {
@@ -671,7 +676,7 @@ const nodes = [
671
676
  },
672
677
  {
673
678
  tag: 'kwd',
674
- context: 'keywords_group//',
679
+ context: 'keyword_group//',
675
680
  node: 'keyword',
676
681
  },
677
682
  {
@@ -726,7 +731,7 @@ const nodes = [
726
731
  {
727
732
  tag: 'title',
728
733
  node: 'section_title',
729
- context: 'section/|footnotes_section/|bibliography_section/|keywords_section/',
734
+ context: 'section/|footnotes_section/|bibliography_section/|keywords/',
730
735
  },
731
736
  {
732
737
  tag: 'title',
@@ -380,9 +380,9 @@ exports.jatsBodyTransformations = {
380
380
  const title = createElement('title');
381
381
  title.textContent = 'Keywords';
382
382
  section.append(title);
383
- const kwdGroupsEl = createElement('kwd-group-list');
384
- kwdGroupsEl.append(keywordGroups[0]);
385
- section.append(kwdGroupsEl);
383
+ const keywordsElement = createElement('kwd-group-list');
384
+ keywordsElement.append(keywordGroups[0]);
385
+ section.append(keywordsElement);
386
386
  body.prepend(section);
387
387
  }
388
388
  },
@@ -16,6 +16,7 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.getElementsOrder = exports.parseJATSArticle = exports.parseJATSBody = exports.parseJATSReferences = exports.parseJATSFront = void 0;
19
+ const json_schema_1 = require("@manuscripts/json-schema");
19
20
  const prosemirror_model_1 = require("prosemirror-model");
20
21
  const errors_1 = require("../../errors");
21
22
  const html_1 = require("../../lib/html");
@@ -51,9 +52,16 @@ const parseJATSFront = async (front) => {
51
52
  const title = (_a = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > article-title')) === null || _a === void 0 ? void 0 : _a.innerHTML;
52
53
  const subtitle = (_b = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > subtitle')) === null || _b === void 0 ? void 0 : _b.innerHTML;
53
54
  const runningTitle = (_c = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > alt-title[alt-title-type="right-running"]')) === null || _c === void 0 ? void 0 : _c.innerHTML;
54
- const manuscriptMeta = Object.assign({ title: title ? inlineContentsFromJATSTitle(title) : undefined, subtitle: subtitle ? inlineContentsFromJATSTitle(subtitle) : undefined, runningTitle: runningTitle
55
+ const manuscriptMeta = Object.assign({}, jats_front_parser_1.jatsFrontParser.parseCounts(articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('counts')));
56
+ const titles = {
57
+ objectType: json_schema_1.ObjectTypes.Titles,
58
+ _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Titles),
59
+ title: title ? inlineContentsFromJATSTitle(title) : undefined,
60
+ subtitle: subtitle ? inlineContentsFromJATSTitle(subtitle) : undefined,
61
+ runningTitle: runningTitle
55
62
  ? inlineContentsFromJATSTitle(runningTitle)
56
- : undefined }, jats_front_parser_1.jatsFrontParser.parseCounts(articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('counts')));
63
+ : undefined,
64
+ };
57
65
  const { affiliations, affiliationIDs } = jats_front_parser_1.jatsFrontParser.parseAffiliationNodes([
58
66
  ...front.querySelectorAll('article-meta > contrib-group > aff'),
59
67
  ]);
@@ -73,6 +81,7 @@ const parseJATSFront = async (front) => {
73
81
  const manuscript = Object.assign(Object.assign(Object.assign({}, (0, builders_1.buildManuscript)()), manuscriptMeta), history);
74
82
  return {
75
83
  models: generateModelIDs([
84
+ titles,
76
85
  manuscript,
77
86
  ...footnotes,
78
87
  ...correspondingList,
@@ -238,6 +238,7 @@ class JATSExporter {
238
238
  this.buildFront = (doi, id, links) => {
239
239
  var _a, _b, _c, _d;
240
240
  const manuscript = (0, project_bundle_1.findManuscript)(this.modelMap);
241
+ const titles = (0, project_bundle_1.findTitles)(this.modelMap);
241
242
  const front = this.document.createElement('front');
242
243
  const journalMeta = this.document.createElement('journal-meta');
243
244
  front.appendChild(journalMeta);
@@ -315,20 +316,20 @@ class JATSExporter {
315
316
  articleMeta.appendChild(link);
316
317
  }
317
318
  }
318
- if (manuscript.title) {
319
+ if (titles.title) {
319
320
  const element = this.document.createElement('article-title');
320
- this.setTitleContent(element, manuscript.title);
321
+ this.setTitleContent(element, titles.title);
321
322
  titleGroup.appendChild(element);
322
323
  }
323
- if (manuscript.subtitle) {
324
+ if (titles.subtitle) {
324
325
  const element = this.document.createElement('subtitle');
325
- this.setTitleContent(element, manuscript.subtitle);
326
+ this.setTitleContent(element, titles.subtitle);
326
327
  titleGroup.appendChild(element);
327
328
  }
328
- if (manuscript.runningTitle) {
329
+ if (titles.runningTitle) {
329
330
  const element = this.document.createElement('alt-title');
330
331
  element.setAttribute('alt-title-type', 'right-running');
331
- this.setTitleContent(element, manuscript.runningTitle);
332
+ this.setTitleContent(element, titles.runningTitle);
332
333
  titleGroup.appendChild(element);
333
334
  }
334
335
  const supplements = [...this.modelMap.values()].filter((model) => model.objectType === json_schema_1.ObjectTypes.Supplement);
@@ -430,9 +431,11 @@ class JATSExporter {
430
431
  }
431
432
  };
432
433
  this.buildBody = (fragment) => {
433
- const content = this.serializeFragment(fragment);
434
434
  const body = this.document.createElement('body');
435
- body.appendChild(content);
435
+ fragment.forEach((cFragment) => {
436
+ const serializedNode = this.serializeNode(cFragment);
437
+ body.append(...serializedNode.childNodes);
438
+ });
436
439
  this.fixBody(body, fragment);
437
440
  return body;
438
441
  };
@@ -598,8 +601,9 @@ class JATSExporter {
598
601
  this.createSerializer = () => {
599
602
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
600
603
  const nodes = {
601
- affiliations_section: () => '',
602
- contributors_section: () => '',
604
+ title: () => '',
605
+ affiliations: () => '',
606
+ contributors: () => '',
603
607
  table_element_footer: () => ['table-wrap-foot', 0],
604
608
  contributor: () => '',
605
609
  affiliation: () => '',
@@ -608,7 +612,10 @@ class JATSExporter {
608
612
  bibliography_element: () => '',
609
613
  bibliography_item: () => '',
610
614
  comment_list: () => '',
611
- keywords_group: () => '',
615
+ keyword_group: () => '',
616
+ body: () => ['body', 0],
617
+ abstracts: () => ['abstract', 0],
618
+ backmatter: () => ['backmatter', 0],
612
619
  bibliography_section: (node) => [
613
620
  'ref-list',
614
621
  { id: normalizeID(node.attrs.id) },
@@ -787,7 +794,7 @@ class JATSExporter {
787
794
  },
788
795
  keyword: () => '',
789
796
  keywords_element: () => '',
790
- keywords_section: () => '',
797
+ keywords: () => '',
791
798
  link: (node) => {
792
799
  const text = node.textContent;
793
800
  if (!text) {
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getTrimmedTextContent = exports.findParentNodeClosestToPos = exports.isInAbstractsSection = exports.isInBibliographySection = exports.isInGraphicalAbstractSection = exports.findNodePositions = exports.iterateChildren = void 0;
18
+ exports.groupBy = exports.getTrimmedTextContent = exports.findParentNodeClosestToPos = exports.isInAbstractsSection = exports.isInBibliographySection = exports.isInGraphicalAbstractSection = exports.findNodePositions = exports.iterateChildren = void 0;
19
19
  const bibliography_section_1 = require("../schema/nodes/bibliography_section");
20
20
  const graphical_abstract_section_1 = require("../schema/nodes/graphical_abstract_section");
21
21
  function* iterateChildren(node, recurse = false) {
@@ -94,3 +94,12 @@ const getTrimmedTextContent = (node, querySelector) => {
94
94
  return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
95
95
  };
96
96
  exports.getTrimmedTextContent = getTrimmedTextContent;
97
+ const groupBy = (list, getKey) => list.reduce((previous, currentItem) => {
98
+ const group = getKey(currentItem);
99
+ if (!previous[group]) {
100
+ previous[group] = [];
101
+ }
102
+ previous[group].push(currentItem);
103
+ return previous;
104
+ }, {});
105
+ exports.groupBy = groupBy;
@@ -33,7 +33,7 @@ exports.schema = void 0;
33
33
  const prosemirror_model_1 = require("prosemirror-model");
34
34
  const marks_1 = require("./marks");
35
35
  const affiliation_1 = require("./nodes/affiliation");
36
- const affiliations_section_1 = require("./nodes/affiliations_section");
36
+ const affiliations_1 = require("./nodes/affiliations");
37
37
  const attribution_1 = require("./nodes/attribution");
38
38
  const bibliography_element_1 = require("./nodes/bibliography_element");
39
39
  const bibliography_item_1 = require("./nodes/bibliography_item");
@@ -45,7 +45,8 @@ const citation_1 = require("./nodes/citation");
45
45
  const comment_1 = require("./nodes/comment");
46
46
  const comment_list_1 = require("./nodes/comment_list");
47
47
  const contributor_1 = require("./nodes/contributor");
48
- const contributors_section_1 = require("./nodes/contributors_section");
48
+ const contributors_1 = require("./nodes/contributors");
49
+ const core_section_1 = require("./nodes/core_section");
49
50
  const cross_reference_1 = require("./nodes/cross_reference");
50
51
  const doc_1 = require("./nodes/doc");
51
52
  const equation_1 = require("./nodes/equation");
@@ -62,9 +63,8 @@ const highlight_marker_1 = require("./nodes/highlight_marker");
62
63
  const inline_equation_1 = require("./nodes/inline_equation");
63
64
  const inline_footnote_1 = require("./nodes/inline_footnote");
64
65
  const keyword_1 = require("./nodes/keyword");
65
- const keywords_element_1 = require("./nodes/keywords_element");
66
- const keywords_group_1 = require("./nodes/keywords_group");
67
- const keywords_section_1 = require("./nodes/keywords_section");
66
+ const keyword_group_1 = require("./nodes/keyword_group");
67
+ const keywords_1 = require("./nodes/keywords");
68
68
  const link_1 = require("./nodes/link");
69
69
  const list_1 = require("./nodes/list");
70
70
  const listing_1 = require("./nodes/listing");
@@ -85,8 +85,10 @@ const table_element_1 = require("./nodes/table_element");
85
85
  const table_element_footer_1 = require("./nodes/table_element_footer");
86
86
  const table_row_1 = require("./nodes/table_row");
87
87
  const text_1 = require("./nodes/text");
88
+ const title_1 = require("./nodes/title");
88
89
  const toc_element_1 = require("./nodes/toc_element");
89
90
  const toc_section_1 = require("./nodes/toc_section");
91
+ const keywords_element_1 = require("./nodes/keywords_element");
90
92
  __exportStar(require("./groups"), exports);
91
93
  __exportStar(require("./types"), exports);
92
94
  __exportStar(require("./nodes/comment"), exports);
@@ -116,7 +118,7 @@ __exportStar(require("./nodes/inline_equation"), exports);
116
118
  __exportStar(require("./nodes/inline_footnote"), exports);
117
119
  __exportStar(require("./nodes/keyword"), exports);
118
120
  __exportStar(require("./nodes/keywords_element"), exports);
119
- __exportStar(require("./nodes/keywords_section"), exports);
121
+ __exportStar(require("./nodes/keywords"), exports);
120
122
  __exportStar(require("./nodes/link"), exports);
121
123
  __exportStar(require("./nodes/list"), exports);
122
124
  __exportStar(require("./nodes/listing"), exports);
@@ -140,8 +142,9 @@ __exportStar(require("./nodes/affiliation"), exports);
140
142
  __exportStar(require("./nodes/meta_section"), exports);
141
143
  __exportStar(require("./nodes/contributor"), exports);
142
144
  __exportStar(require("./nodes/table_element_footer"), exports);
143
- __exportStar(require("./nodes/affiliations_section"), exports);
144
- __exportStar(require("./nodes/contributors_section"), exports);
145
+ __exportStar(require("./nodes/title"), exports);
146
+ __exportStar(require("./nodes/affiliations"), exports);
147
+ __exportStar(require("./nodes/contributors"), exports);
145
148
  exports.schema = new prosemirror_model_1.Schema({
146
149
  marks: {
147
150
  bold: marks_1.bold,
@@ -168,6 +171,9 @@ exports.schema = new prosemirror_model_1.Schema({
168
171
  caption: caption_1.caption,
169
172
  caption_title: caption_title_1.captionTitle,
170
173
  citation: citation_1.citation,
174
+ abstracts: core_section_1.coreSection,
175
+ body: core_section_1.coreSection,
176
+ backmatter: core_section_1.coreSection,
171
177
  cross_reference: cross_reference_1.crossReference,
172
178
  doc: doc_1.doc,
173
179
  equation: equation_1.equation,
@@ -185,8 +191,8 @@ exports.schema = new prosemirror_model_1.Schema({
185
191
  inline_footnote: inline_footnote_1.inlineFootnote,
186
192
  keyword: keyword_1.keyword,
187
193
  keywords_element: keywords_element_1.keywordsElement,
188
- keywords_section: keywords_section_1.keywordsSection,
189
- keywords_group: keywords_group_1.keywordsGroup,
194
+ keywords: keywords_1.keywords,
195
+ keyword_group: keyword_group_1.keywordGroup,
190
196
  link: link_1.link,
191
197
  list_item: list_1.listItem,
192
198
  listing: listing_1.listing,
@@ -216,7 +222,8 @@ exports.schema = new prosemirror_model_1.Schema({
216
222
  meta_section: meta_section_1.metaSection,
217
223
  contributor: contributor_1.contributor,
218
224
  table_element_footer: table_element_footer_1.tableElementFooter,
219
- affiliations_section: affiliations_section_1.affiliationsSection,
220
- contributors_section: contributors_section_1.contributorsSection,
225
+ title: title_1.title,
226
+ affiliations: affiliations_1.affiliations,
227
+ contributors: contributors_1.contributors,
221
228
  },
222
229
  });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAffiliationsNode = exports.affiliations = void 0;
4
+ exports.affiliations = {
5
+ content: 'section_title? affiliation*',
6
+ attrs: {
7
+ id: { default: '' },
8
+ dataTracked: { default: null },
9
+ },
10
+ group: 'block',
11
+ selectable: false,
12
+ toDOM: () => ['section', 0],
13
+ };
14
+ const isAffiliationsNode = (node) => node.type === node.type.schema.nodes.affiliations;
15
+ exports.isAffiliationsNode = isAffiliationsNode;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isContributorsNode = exports.contributors = void 0;
4
+ exports.contributors = {
5
+ content: 'section_title? contributor*',
6
+ attrs: {
7
+ id: { default: '' },
8
+ dataTracked: { default: null },
9
+ },
10
+ group: 'block',
11
+ selectable: false,
12
+ toDOM: () => ['section', 0],
13
+ };
14
+ const isContributorsNode = (node) => node.type === node.type.schema.nodes.contributors;
15
+ exports.isContributorsNode = isContributorsNode;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.coreSection = void 0;
19
+ exports.coreSection = {
20
+ content: 'sections*',
21
+ atom: true,
22
+ attrs: {
23
+ id: { default: '' },
24
+ },
25
+ group: 'block',
26
+ toDOM: () => ['section', 0],
27
+ };
@@ -21,7 +21,6 @@ exports.keyword = {
21
21
  content: 'inline*',
22
22
  attrs: {
23
23
  id: { default: '' },
24
- contents: { default: '' },
25
24
  dataTracked: { default: null },
26
25
  comments: { default: null },
27
26
  },
@@ -15,8 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isKeywordsGroupNode = exports.keywordsGroup = void 0;
19
- exports.keywordsGroup = {
18
+ exports.isKeywordGroupNode = exports.keywordGroup = void 0;
19
+ exports.keywordGroup = {
20
20
  content: 'keyword*',
21
21
  attrs: {
22
22
  id: { default: '' },
@@ -31,11 +31,11 @@ exports.keywordsGroup = {
31
31
  },
32
32
  ],
33
33
  toDOM: (node) => {
34
- const keywordsGroupNode = node;
34
+ const keywordGroupNode = node;
35
35
  return [
36
36
  'div',
37
37
  {
38
- id: keywordsGroupNode.attrs.id,
38
+ id: keywordGroupNode.attrs.id,
39
39
  class: 'keywords',
40
40
  spellcheck: 'false',
41
41
  contenteditable: false,
@@ -44,5 +44,5 @@ exports.keywordsGroup = {
44
44
  ];
45
45
  },
46
46
  };
47
- const isKeywordsGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
48
- exports.isKeywordsGroupNode = isKeywordsGroupNode;
47
+ const isKeywordGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
48
+ exports.isKeywordGroupNode = isKeywordGroupNode;
@@ -15,14 +15,14 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isKeywordsSectionNode = exports.keywordsSection = void 0;
19
- exports.keywordsSection = {
18
+ exports.isKeywordsNode = exports.keywords = void 0;
19
+ exports.keywords = {
20
20
  content: 'section_title (keywords_element | placeholder_element)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  dataTracked: { default: null },
24
24
  },
25
- group: 'block sections',
25
+ group: 'block',
26
26
  selectable: false,
27
27
  parseDOM: [
28
28
  {
@@ -30,11 +30,11 @@ exports.keywordsSection = {
30
30
  },
31
31
  ],
32
32
  toDOM: (node) => {
33
- const keywordsSectionNode = node;
33
+ const keywords = node;
34
34
  return [
35
35
  'div',
36
36
  {
37
- id: keywordsSectionNode.attrs.id,
37
+ id: keywords.attrs.id,
38
38
  class: 'keywords',
39
39
  spellcheck: 'false',
40
40
  contenteditable: false,
@@ -43,5 +43,5 @@ exports.keywordsSection = {
43
43
  ];
44
44
  },
45
45
  };
46
- const isKeywordsSectionNode = (node) => node.type === node.type.schema.nodes.keywords_section;
47
- exports.isKeywordsSectionNode = isKeywordsSectionNode;
46
+ const isKeywordsNode = (node) => node.type === node.type.schema.nodes.keywords;
47
+ exports.isKeywordsNode = isKeywordsNode;
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.keywordsElement = void 0;
19
19
  exports.keywordsElement = {
20
20
  atom: true,
21
- content: 'keywords_group*',
21
+ content: 'keyword_group*',
22
22
  attrs: {
23
23
  id: { default: '' },
24
24
  contents: { default: '' },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.manuscript = void 0;
19
19
  exports.manuscript = {
20
- content: '(section | sections)+ meta_section',
20
+ content: 'title? contributors? affiliations? keywords? abstracts body backmatter meta_section',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  },
@@ -0,0 +1,29 @@
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.title = void 0;
19
+ exports.title = {
20
+ content: 'text*',
21
+ marks: 'italic smallcaps subscript superscript tracked_insert tracked_delete',
22
+ attrs: {
23
+ id: { default: '' },
24
+ dataTracked: { default: null },
25
+ },
26
+ group: 'block element',
27
+ parseDOM: [{ tag: 'div' }],
28
+ toDOM: () => ['div', 0],
29
+ };
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildStatusLabel = exports.buildJournal = exports.buildAttribution = exports.buildInlineStyle = exports.buildContributorRole = exports.buildContribution = exports.buildHighlightMarker = exports.buildHighlight = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildFootnote = exports.buildInlineMathFragment = exports.buildValidation = exports.buildNote = exports.buildComment = exports.buildUserProfileAffiliation = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildLibraryCollection = exports.buildManuscriptKeyword = exports.buildKeywordGroup = exports.buildKeyword = exports.buildCitation = exports.buildEmbeddedCitationItem = exports.buildAuxiliaryObjectReference = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = exports.DEFAULT_PAGE_LAYOUT = exports.DEFAULT_BUNDLE = void 0;
21
+ exports.buildTitles = exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildStatusLabel = exports.buildJournal = exports.buildAttribution = exports.buildInlineStyle = exports.buildContributorRole = exports.buildContribution = exports.buildHighlightMarker = exports.buildHighlight = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildFootnote = exports.buildInlineMathFragment = exports.buildValidation = exports.buildNote = exports.buildComment = exports.buildUserProfileAffiliation = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildLibraryCollection = exports.buildManuscriptKeyword = exports.buildKeywordGroup = exports.buildKeyword = exports.buildCitation = exports.buildEmbeddedCitationItem = exports.buildAuxiliaryObjectReference = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = exports.DEFAULT_PAGE_LAYOUT = exports.DEFAULT_BUNDLE = void 0;
22
22
  const json_schema_1 = require("@manuscripts/json-schema");
23
23
  const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
24
24
  const schema_1 = require("../schema");
@@ -35,10 +35,9 @@ const buildProject = (owner) => ({
35
35
  title: '',
36
36
  });
37
37
  exports.buildProject = buildProject;
38
- const buildManuscript = (title = '') => ({
38
+ const buildManuscript = () => ({
39
39
  _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Manuscript),
40
40
  objectType: json_schema_1.ObjectTypes.Manuscript,
41
- title,
42
41
  });
43
42
  exports.buildManuscript = buildManuscript;
44
43
  const buildContributor = (bibliographicName, role = 'author', priority = 0, userID, invitationID) => ({
@@ -291,3 +290,9 @@ const buildElementsOrder = (elementType) => ({
291
290
  elements: [],
292
291
  });
293
292
  exports.buildElementsOrder = buildElementsOrder;
293
+ const buildTitles = (title) => ({
294
+ _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Titles),
295
+ objectType: json_schema_1.ObjectTypes.Titles,
296
+ title: title || '',
297
+ });
298
+ exports.buildTitles = buildTitles;