@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
@@ -501,7 +501,7 @@ const nodes = [
501
501
  },
502
502
  {
503
503
  tag: 'sec[sec-type="affiliations"]',
504
- node: 'affiliations_section',
504
+ node: 'affiliations',
505
505
  getAttrs: (node) => {
506
506
  const element = node;
507
507
  return {
@@ -513,7 +513,7 @@ const nodes = [
513
513
  {
514
514
  tag: 'aff',
515
515
  node: 'affiliation',
516
- context: 'affiliations_section/',
516
+ context: 'affiliations/',
517
517
  getAttrs: (node) => {
518
518
  const element = node;
519
519
  const aff = {
@@ -560,7 +560,7 @@ const nodes = [
560
560
  },
561
561
  {
562
562
  tag: 'sec[sec-type="contributors"]',
563
- node: 'contributors_section',
563
+ node: 'contributors',
564
564
  getAttrs: (node) => {
565
565
  const element = node;
566
566
  return {
@@ -572,7 +572,7 @@ const nodes = [
572
572
  {
573
573
  tag: 'contrib',
574
574
  node: 'contributor',
575
- context: 'contributors_section/',
575
+ context: 'contributors/',
576
576
  getAttrs: (node) => {
577
577
  const element = node;
578
578
  const contrib = {
@@ -627,19 +627,19 @@ const nodes = [
627
627
  },
628
628
  {
629
629
  tag: 'sec[sec-type="keywords"]',
630
- node: 'keywords_section',
631
- getAttrs: (node) => {
632
- const element = node;
633
- return {
634
- id: element.getAttribute('id'),
635
- category: chooseSectionCategory(element),
636
- };
637
- },
630
+ node: 'keywords',
638
631
  },
639
632
  {
640
- tag: 'kwd-group-list',
641
- context: 'keywords_section/',
642
- node: 'keywords_element',
633
+ tag: 'sec[sec-type="abstracts"]',
634
+ node: 'abstracts',
635
+ },
636
+ {
637
+ tag: 'sec[sec-type="body"]',
638
+ node: 'body',
639
+ },
640
+ {
641
+ tag: 'sec[sec-type="backmatter"]',
642
+ node: 'backmatter',
643
643
  },
644
644
  {
645
645
  tag: 'sec',
@@ -652,10 +652,15 @@ const nodes = [
652
652
  };
653
653
  },
654
654
  },
655
+ {
656
+ tag: 'kwd-group-list',
657
+ context: 'keywords/',
658
+ node: 'keywords_element',
659
+ },
655
660
  {
656
661
  tag: 'kwd-group',
657
662
  context: 'keywords_element/',
658
- node: 'keywords_group',
663
+ node: 'keyword_group',
659
664
  getAttrs: (node) => {
660
665
  const element = node;
661
666
  return {
@@ -665,7 +670,7 @@ const nodes = [
665
670
  },
666
671
  {
667
672
  tag: 'kwd',
668
- context: 'keywords_group//',
673
+ context: 'keyword_group//',
669
674
  node: 'keyword',
670
675
  },
671
676
  {
@@ -720,7 +725,7 @@ const nodes = [
720
725
  {
721
726
  tag: 'title',
722
727
  node: 'section_title',
723
- context: 'section/|footnotes_section/|bibliography_section/|keywords_section/',
728
+ context: 'section/|footnotes_section/|bibliography_section/|keywords/',
724
729
  },
725
730
  {
726
731
  tag: 'title',
@@ -377,9 +377,9 @@ export const jatsBodyTransformations = {
377
377
  const title = createElement('title');
378
378
  title.textContent = 'Keywords';
379
379
  section.append(title);
380
- const kwdGroupsEl = createElement('kwd-group-list');
381
- kwdGroupsEl.append(keywordGroups[0]);
382
- section.append(kwdGroupsEl);
380
+ const keywordsElement = createElement('kwd-group-list');
381
+ keywordsElement.append(keywordGroups[0]);
382
+ section.append(keywordsElement);
383
383
  body.prepend(section);
384
384
  }
385
385
  },
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { ObjectTypes, } from '@manuscripts/json-schema';
16
17
  import { DOMParser } from 'prosemirror-model';
17
18
  import { InvalidInput } from '../../errors';
18
19
  import { nodeFromHTML } from '../../lib/html';
@@ -48,9 +49,16 @@ export const parseJATSFront = async (front) => {
48
49
  const title = (_a = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > article-title')) === null || _a === void 0 ? void 0 : _a.innerHTML;
49
50
  const subtitle = (_b = articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('title-group > subtitle')) === null || _b === void 0 ? void 0 : _b.innerHTML;
50
51
  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;
51
- const manuscriptMeta = Object.assign({ title: title ? inlineContentsFromJATSTitle(title) : undefined, subtitle: subtitle ? inlineContentsFromJATSTitle(subtitle) : undefined, runningTitle: runningTitle
52
+ const manuscriptMeta = Object.assign({}, jatsFrontParser.parseCounts(articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('counts')));
53
+ const titles = {
54
+ objectType: ObjectTypes.Titles,
55
+ _id: generateID(ObjectTypes.Titles),
56
+ title: title ? inlineContentsFromJATSTitle(title) : undefined,
57
+ subtitle: subtitle ? inlineContentsFromJATSTitle(subtitle) : undefined,
58
+ runningTitle: runningTitle
52
59
  ? inlineContentsFromJATSTitle(runningTitle)
53
- : undefined }, jatsFrontParser.parseCounts(articleMeta === null || articleMeta === void 0 ? void 0 : articleMeta.querySelector('counts')));
60
+ : undefined,
61
+ };
54
62
  const { affiliations, affiliationIDs } = jatsFrontParser.parseAffiliationNodes([
55
63
  ...front.querySelectorAll('article-meta > contrib-group > aff'),
56
64
  ]);
@@ -70,6 +78,7 @@ export const parseJATSFront = async (front) => {
70
78
  const manuscript = Object.assign(Object.assign(Object.assign({}, buildManuscript()), manuscriptMeta), history);
71
79
  return {
72
80
  models: generateModelIDs([
81
+ titles,
73
82
  manuscript,
74
83
  ...footnotes,
75
84
  ...correspondingList,
@@ -25,7 +25,7 @@ import { generateAttachmentFilename } from '../transformer/filename';
25
25
  import { buildTargets } from '../transformer/labels';
26
26
  import { isExecutableNodeType, isNodeType } from '../transformer/node-types';
27
27
  import { hasObjectType } from '../transformer/object-types';
28
- import { findManuscript, findManuscriptById, } from '../transformer/project-bundle';
28
+ import { findManuscript, findManuscriptById, findTitles, } from '../transformer/project-bundle';
29
29
  import { chooseJatsFnType, chooseSecType, } from '../transformer/section-category';
30
30
  import { selectVersionIds } from './jats-versions';
31
31
  const warn = debug('manuscripts-transform');
@@ -231,6 +231,7 @@ export class JATSExporter {
231
231
  this.buildFront = (doi, id, links) => {
232
232
  var _a, _b, _c, _d;
233
233
  const manuscript = findManuscript(this.modelMap);
234
+ const titles = findTitles(this.modelMap);
234
235
  const front = this.document.createElement('front');
235
236
  const journalMeta = this.document.createElement('journal-meta');
236
237
  front.appendChild(journalMeta);
@@ -308,20 +309,20 @@ export class JATSExporter {
308
309
  articleMeta.appendChild(link);
309
310
  }
310
311
  }
311
- if (manuscript.title) {
312
+ if (titles.title) {
312
313
  const element = this.document.createElement('article-title');
313
- this.setTitleContent(element, manuscript.title);
314
+ this.setTitleContent(element, titles.title);
314
315
  titleGroup.appendChild(element);
315
316
  }
316
- if (manuscript.subtitle) {
317
+ if (titles.subtitle) {
317
318
  const element = this.document.createElement('subtitle');
318
- this.setTitleContent(element, manuscript.subtitle);
319
+ this.setTitleContent(element, titles.subtitle);
319
320
  titleGroup.appendChild(element);
320
321
  }
321
- if (manuscript.runningTitle) {
322
+ if (titles.runningTitle) {
322
323
  const element = this.document.createElement('alt-title');
323
324
  element.setAttribute('alt-title-type', 'right-running');
324
- this.setTitleContent(element, manuscript.runningTitle);
325
+ this.setTitleContent(element, titles.runningTitle);
325
326
  titleGroup.appendChild(element);
326
327
  }
327
328
  const supplements = [...this.modelMap.values()].filter((model) => model.objectType === ObjectTypes.Supplement);
@@ -423,9 +424,11 @@ export class JATSExporter {
423
424
  }
424
425
  };
425
426
  this.buildBody = (fragment) => {
426
- const content = this.serializeFragment(fragment);
427
427
  const body = this.document.createElement('body');
428
- body.appendChild(content);
428
+ fragment.forEach((cFragment) => {
429
+ const serializedNode = this.serializeNode(cFragment);
430
+ body.append(...serializedNode.childNodes);
431
+ });
429
432
  this.fixBody(body, fragment);
430
433
  return body;
431
434
  };
@@ -591,8 +594,9 @@ export class JATSExporter {
591
594
  this.createSerializer = () => {
592
595
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
593
596
  const nodes = {
594
- affiliations_section: () => '',
595
- contributors_section: () => '',
597
+ title: () => '',
598
+ affiliations: () => '',
599
+ contributors: () => '',
596
600
  table_element_footer: () => ['table-wrap-foot', 0],
597
601
  contributor: () => '',
598
602
  affiliation: () => '',
@@ -601,7 +605,10 @@ export class JATSExporter {
601
605
  bibliography_element: () => '',
602
606
  bibliography_item: () => '',
603
607
  comment_list: () => '',
604
- keywords_group: () => '',
608
+ keyword_group: () => '',
609
+ body: () => ['body', 0],
610
+ abstracts: () => ['abstract', 0],
611
+ backmatter: () => ['backmatter', 0],
605
612
  bibliography_section: (node) => [
606
613
  'ref-list',
607
614
  { id: normalizeID(node.attrs.id) },
@@ -780,7 +787,7 @@ export class JATSExporter {
780
787
  },
781
788
  keyword: () => '',
782
789
  keywords_element: () => '',
783
- keywords_section: () => '',
790
+ keywords: () => '',
784
791
  link: (node) => {
785
792
  const text = node.textContent;
786
793
  if (!text) {
@@ -84,3 +84,11 @@ export const getTrimmedTextContent = (node, querySelector) => {
84
84
  }
85
85
  return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
86
86
  };
87
+ export const groupBy = (list, getKey) => list.reduce((previous, currentItem) => {
88
+ const group = getKey(currentItem);
89
+ if (!previous[group]) {
90
+ previous[group] = [];
91
+ }
92
+ previous[group].push(currentItem);
93
+ return previous;
94
+ }, {});
@@ -16,7 +16,7 @@
16
16
  import { Schema } from 'prosemirror-model';
17
17
  import { bold, code, italic, smallcaps, strikethrough, styled, subscript, superscript, tracked_delete, tracked_insert, underline, } from './marks';
18
18
  import { affiliation } from './nodes/affiliation';
19
- import { affiliationsSection } from './nodes/affiliations_section';
19
+ import { affiliations } from './nodes/affiliations';
20
20
  import { attribution } from './nodes/attribution';
21
21
  import { bibliographyElement } from './nodes/bibliography_element';
22
22
  import { bibliographyItem } from './nodes/bibliography_item';
@@ -28,7 +28,8 @@ import { citation } from './nodes/citation';
28
28
  import { comment } from './nodes/comment';
29
29
  import { commentList } from './nodes/comment_list';
30
30
  import { contributor } from './nodes/contributor';
31
- import { contributorsSection } from './nodes/contributors_section';
31
+ import { contributors } from './nodes/contributors';
32
+ import { coreSection } from './nodes/core_section';
32
33
  import { crossReference } from './nodes/cross_reference';
33
34
  import { doc } from './nodes/doc';
34
35
  import { equation } from './nodes/equation';
@@ -45,9 +46,8 @@ import { highlightMarker } from './nodes/highlight_marker';
45
46
  import { inlineEquation } from './nodes/inline_equation';
46
47
  import { inlineFootnote } from './nodes/inline_footnote';
47
48
  import { keyword } from './nodes/keyword';
48
- import { keywordsElement } from './nodes/keywords_element';
49
- import { keywordsGroup } from './nodes/keywords_group';
50
- import { keywordsSection } from './nodes/keywords_section';
49
+ import { keywordGroup } from './nodes/keyword_group';
50
+ import { keywords } from './nodes/keywords';
51
51
  import { link } from './nodes/link';
52
52
  import { bulletList, listItem, orderedList } from './nodes/list';
53
53
  import { listing } from './nodes/listing';
@@ -68,8 +68,10 @@ import { tableElement } from './nodes/table_element';
68
68
  import { tableElementFooter } from './nodes/table_element_footer';
69
69
  import { tableCell, tableRow } from './nodes/table_row';
70
70
  import { text } from './nodes/text';
71
+ import { title } from './nodes/title';
71
72
  import { tocElement } from './nodes/toc_element';
72
73
  import { tocSection } from './nodes/toc_section';
74
+ import { keywordsElement } from "./nodes/keywords_element";
73
75
  export * from './groups';
74
76
  export * from './types';
75
77
  export * from './nodes/comment';
@@ -99,7 +101,7 @@ export * from './nodes/inline_equation';
99
101
  export * from './nodes/inline_footnote';
100
102
  export * from './nodes/keyword';
101
103
  export * from './nodes/keywords_element';
102
- export * from './nodes/keywords_section';
104
+ export * from './nodes/keywords';
103
105
  export * from './nodes/link';
104
106
  export * from './nodes/list';
105
107
  export * from './nodes/listing';
@@ -123,8 +125,9 @@ export * from './nodes/affiliation';
123
125
  export * from './nodes/meta_section';
124
126
  export * from './nodes/contributor';
125
127
  export * from './nodes/table_element_footer';
126
- export * from './nodes/affiliations_section';
127
- export * from './nodes/contributors_section';
128
+ export * from './nodes/title';
129
+ export * from './nodes/affiliations';
130
+ export * from './nodes/contributors';
128
131
  export const schema = new Schema({
129
132
  marks: {
130
133
  bold,
@@ -151,6 +154,9 @@ export const schema = new Schema({
151
154
  caption,
152
155
  caption_title: captionTitle,
153
156
  citation,
157
+ abstracts: coreSection,
158
+ body: coreSection,
159
+ backmatter: coreSection,
154
160
  cross_reference: crossReference,
155
161
  doc,
156
162
  equation,
@@ -168,8 +174,8 @@ export const schema = new Schema({
168
174
  inline_footnote: inlineFootnote,
169
175
  keyword,
170
176
  keywords_element: keywordsElement,
171
- keywords_section: keywordsSection,
172
- keywords_group: keywordsGroup,
177
+ keywords: keywords,
178
+ keyword_group: keywordGroup,
173
179
  link,
174
180
  list_item: listItem,
175
181
  listing,
@@ -199,7 +205,8 @@ export const schema = new Schema({
199
205
  meta_section: metaSection,
200
206
  contributor: contributor,
201
207
  table_element_footer: tableElementFooter,
202
- affiliations_section: affiliationsSection,
203
- contributors_section: contributorsSection,
208
+ title: title,
209
+ affiliations: affiliations,
210
+ contributors: contributors,
204
211
  },
205
212
  });
@@ -1,11 +1,11 @@
1
- export const affiliationsSection = {
1
+ export const affiliations = {
2
2
  content: 'section_title? affiliation*',
3
3
  attrs: {
4
4
  id: { default: '' },
5
5
  dataTracked: { default: null },
6
6
  },
7
- group: 'block sections',
7
+ group: 'block',
8
8
  selectable: false,
9
9
  toDOM: () => ['section', 0],
10
10
  };
11
- export const isAffiliationsSectionNode = (node) => node.type === node.type.schema.nodes.affiliations_section;
11
+ export const isAffiliationsNode = (node) => node.type === node.type.schema.nodes.affiliations;
@@ -1,11 +1,11 @@
1
- export const contributorsSection = {
1
+ export const contributors = {
2
2
  content: 'section_title? contributor*',
3
3
  attrs: {
4
4
  id: { default: '' },
5
5
  dataTracked: { default: null },
6
6
  },
7
- group: 'block sections',
7
+ group: 'block',
8
8
  selectable: false,
9
9
  toDOM: () => ['section', 0],
10
10
  };
11
- export const isContributorsSectionNode = (node) => node.type === node.type.schema.nodes.contributors_section;
11
+ export const isContributorsNode = (node) => node.type === node.type.schema.nodes.contributors;
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const coreSection = {
17
+ content: 'sections*',
18
+ atom: true,
19
+ attrs: {
20
+ id: { default: '' },
21
+ },
22
+ group: 'block',
23
+ toDOM: () => ['section', 0],
24
+ };
@@ -18,7 +18,6 @@ export const keyword = {
18
18
  content: 'inline*',
19
19
  attrs: {
20
20
  id: { default: '' },
21
- contents: { default: '' },
22
21
  dataTracked: { default: null },
23
22
  comments: { default: null },
24
23
  },
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export const keywordsGroup = {
16
+ export const keywordGroup = {
17
17
  content: 'keyword*',
18
18
  attrs: {
19
19
  id: { default: '' },
@@ -28,11 +28,11 @@ export const keywordsGroup = {
28
28
  },
29
29
  ],
30
30
  toDOM: (node) => {
31
- const keywordsGroupNode = node;
31
+ const keywordGroupNode = node;
32
32
  return [
33
33
  'div',
34
34
  {
35
- id: keywordsGroupNode.attrs.id,
35
+ id: keywordGroupNode.attrs.id,
36
36
  class: 'keywords',
37
37
  spellcheck: 'false',
38
38
  contenteditable: false,
@@ -41,4 +41,4 @@ export const keywordsGroup = {
41
41
  ];
42
42
  },
43
43
  };
44
- export const isKeywordsGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
44
+ export const isKeywordGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
@@ -13,13 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export const keywordsSection = {
16
+ export const keywords = {
17
17
  content: 'section_title (keywords_element | placeholder_element)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  dataTracked: { default: null },
21
21
  },
22
- group: 'block sections',
22
+ group: 'block',
23
23
  selectable: false,
24
24
  parseDOM: [
25
25
  {
@@ -27,11 +27,11 @@ export const keywordsSection = {
27
27
  },
28
28
  ],
29
29
  toDOM: (node) => {
30
- const keywordsSectionNode = node;
30
+ const keywords = node;
31
31
  return [
32
32
  'div',
33
33
  {
34
- id: keywordsSectionNode.attrs.id,
34
+ id: keywords.attrs.id,
35
35
  class: 'keywords',
36
36
  spellcheck: 'false',
37
37
  contenteditable: false,
@@ -40,4 +40,4 @@ export const keywordsSection = {
40
40
  ];
41
41
  },
42
42
  };
43
- export const isKeywordsSectionNode = (node) => node.type === node.type.schema.nodes.keywords_section;
43
+ export const isKeywordsNode = (node) => node.type === node.type.schema.nodes.keywords;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  export const keywordsElement = {
17
17
  atom: true,
18
- content: 'keywords_group*',
18
+ content: 'keyword_group*',
19
19
  attrs: {
20
20
  id: { default: '' },
21
21
  contents: { default: '' },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const manuscript = {
17
- content: '(section | sections)+ meta_section',
17
+ content: 'title? contributors? affiliations? keywords? abstracts body backmatter meta_section',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  },
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const title = {
17
+ content: 'text*',
18
+ marks: 'italic smallcaps subscript superscript tracked_insert tracked_delete',
19
+ attrs: {
20
+ id: { default: '' },
21
+ dataTracked: { default: null },
22
+ },
23
+ group: 'block element',
24
+ parseDOM: [{ tag: 'div' }],
25
+ toDOM: () => ['div', 0],
26
+ };
@@ -28,10 +28,9 @@ export const buildProject = (owner) => ({
28
28
  viewers: [],
29
29
  title: '',
30
30
  });
31
- export const buildManuscript = (title = '') => ({
31
+ export const buildManuscript = () => ({
32
32
  _id: generateID(ObjectTypes.Manuscript),
33
33
  objectType: ObjectTypes.Manuscript,
34
- title,
35
34
  });
36
35
  export const buildContributor = (bibliographicName, role = 'author', priority = 0, userID, invitationID) => ({
37
36
  _id: generateID(ObjectTypes.Contributor),
@@ -249,3 +248,8 @@ export const buildElementsOrder = (elementType) => ({
249
248
  elementType: elementType,
250
249
  elements: [],
251
250
  });
251
+ export const buildTitles = (title) => ({
252
+ _id: generateID(ObjectTypes.Titles),
253
+ objectType: ObjectTypes.Titles,
254
+ title: title || '',
255
+ });