@manuscripts/transform 2.3.9-LEAN-3307.0 → 2.3.9

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.
@@ -18,11 +18,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.backmatter = void 0;
19
19
  exports.backmatter = {
20
20
  content: 'sections*',
21
+ atom: true,
21
22
  attrs: {
22
23
  id: { default: '' },
23
- placeholder: { default: ' ' },
24
24
  },
25
- group: 'block element',
26
- parseDOM: [{ tag: 'div.backmatter' }],
25
+ group: 'block',
27
26
  toDOM: () => ['div', { class: 'backmatter' }, 0],
28
27
  };
@@ -20,6 +20,7 @@ exports.manuscript = {
20
20
  content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
21
21
  attrs: {
22
22
  id: { default: '' },
23
+ doi: { default: '' },
23
24
  },
24
25
  group: 'block',
25
26
  parseDOM: [
@@ -20,7 +20,6 @@ exports.title = {
20
20
  content: '(text | highlight_marker)*',
21
21
  attrs: {
22
22
  id: { default: '' },
23
- placeholder: { default: 'Insert title here...' },
24
23
  dataTracked: { default: null },
25
24
  },
26
25
  group: 'block element',
@@ -87,9 +87,6 @@ class Decoder {
87
87
  const affiliations = getAffiliations(this.modelMap)
88
88
  .map((a) => this.decode(a))
89
89
  .filter(Boolean);
90
- if (!affiliations.length) {
91
- return false;
92
- }
93
90
  return schema_1.schema.nodes.affiliations.createAndFill({}, affiliations);
94
91
  }
95
92
  createContributorsNode() {
@@ -100,18 +97,12 @@ class Decoder {
100
97
  .map((authorNote) => this.decode(authorNote))
101
98
  .filter(Boolean);
102
99
  const content = [...contributors, ...authorNotes];
103
- if (!content.length) {
104
- return false;
105
- }
106
100
  return schema_1.schema.nodes.contributors.createAndFill({}, content);
107
101
  }
108
102
  createKeywordsNode() {
109
103
  const elements = getKeywordElements(this.modelMap)
110
104
  .map((e) => this.decode(e))
111
105
  .filter(Boolean);
112
- if (!elements.length) {
113
- return false;
114
- }
115
106
  return schema_1.schema.nodes.keywords.createAndFill({}, [
116
107
  schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Keywords')),
117
108
  ...elements,
@@ -121,9 +112,6 @@ class Decoder {
121
112
  const elements = getSupplements(this.modelMap)
122
113
  .map((e) => this.decode(e))
123
114
  .filter(Boolean);
124
- if (!elements.length) {
125
- return false;
126
- }
127
115
  return schema_1.schema.nodes.supplements.createAndFill({}, [
128
116
  schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('SupplementaryMaterials')),
129
117
  ...elements,
@@ -156,7 +144,11 @@ class Decoder {
156
144
  const abstracts = schema_1.schema.nodes.abstracts.createAndFill({}, groups[section_group_type_1.abstractsType._id]);
157
145
  const body = schema_1.schema.nodes.body.createAndFill({}, groups[section_group_type_1.bodyType._id]);
158
146
  const backmatter = schema_1.schema.nodes.backmatter.createAndFill({}, groups[section_group_type_1.backmatterType._id]);
159
- return [abstracts, body, backmatter];
147
+ return {
148
+ abstracts,
149
+ body,
150
+ backmatter,
151
+ };
160
152
  }
161
153
  createCommentNodes(model) {
162
154
  const comments = [];
@@ -724,18 +716,27 @@ class Decoder {
724
716
  };
725
717
  this.getModel = (id) => this.modelMap.get(id);
726
718
  this.createArticleNode = (manuscriptID) => {
727
- const nodes = [
728
- this.createTitleNode(),
729
- this.createContributorsNode(),
730
- this.createAffiliationsNode(),
731
- this.createKeywordsNode(),
732
- this.createSupplementsNode(),
733
- ...this.createContentSections(),
734
- this.createCommentsNode(),
719
+ const title = this.createTitleNode();
720
+ const contributors = this.createContributorsNode();
721
+ const affiliations = this.createAffiliationsNode();
722
+ const keywords = this.createKeywordsNode();
723
+ const suppl = this.createSupplementsNode();
724
+ const { abstracts, body, backmatter } = this.createContentSections();
725
+ const comments = this.createCommentsNode();
726
+ const contents = [
727
+ title,
728
+ contributors,
729
+ affiliations,
730
+ keywords,
731
+ suppl,
732
+ abstracts,
733
+ body,
734
+ backmatter,
735
+ comments,
735
736
  ];
736
- const contents = nodes.filter((node) => node !== false);
737
737
  return schema_1.schema.nodes.manuscript.create({
738
738
  id: manuscriptID || this.getManuscriptID(),
739
+ doi: this.getManuscriptDOI() || '',
739
740
  }, contents);
740
741
  };
741
742
  this.addGeneratedLabels = (sections) => {
@@ -781,6 +782,13 @@ class Decoder {
781
782
  }
782
783
  }
783
784
  };
785
+ this.getManuscriptDOI = () => {
786
+ for (const item of this.modelMap.values()) {
787
+ if ((0, object_types_1.isManuscript)(item)) {
788
+ return item.DOI;
789
+ }
790
+ }
791
+ };
784
792
  this.getFigcaption = (model) => {
785
793
  const titleNode = schema_1.schema.nodes.caption_title.create();
786
794
  const captionTitle = model.title
@@ -274,7 +274,6 @@ const encoders = {
274
274
  title: (0, exports.inlineContents)(node),
275
275
  subtitle: node.attrs.subtitle,
276
276
  runningTitle: node.attrs.runningTitle,
277
- placeholder: node.attrs.placeholder,
278
277
  _id: node.attrs._id,
279
278
  }),
280
279
  bibliography_element: (node) => ({
@@ -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.9-LEAN-3307.0";
4
+ exports.VERSION = "2.3.9";
@@ -15,11 +15,10 @@
15
15
  */
16
16
  export const backmatter = {
17
17
  content: 'sections*',
18
+ atom: true,
18
19
  attrs: {
19
20
  id: { default: '' },
20
- placeholder: { default: ' ' },
21
21
  },
22
- group: 'block element',
23
- parseDOM: [{ tag: 'div.backmatter' }],
22
+ group: 'block',
24
23
  toDOM: () => ['div', { class: 'backmatter' }, 0],
25
24
  };
@@ -17,6 +17,7 @@ export const manuscript = {
17
17
  content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
18
18
  attrs: {
19
19
  id: { default: '' },
20
+ doi: { default: '' },
20
21
  },
21
22
  group: 'block',
22
23
  parseDOM: [
@@ -17,7 +17,6 @@ export const title = {
17
17
  content: '(text | highlight_marker)*',
18
18
  attrs: {
19
19
  id: { default: '' },
20
- placeholder: { default: 'Insert title here...' },
21
20
  dataTracked: { default: null },
22
21
  },
23
22
  group: 'block element',
@@ -78,9 +78,6 @@ export class Decoder {
78
78
  const affiliations = getAffiliations(this.modelMap)
79
79
  .map((a) => this.decode(a))
80
80
  .filter(Boolean);
81
- if (!affiliations.length) {
82
- return false;
83
- }
84
81
  return schema.nodes.affiliations.createAndFill({}, affiliations);
85
82
  }
86
83
  createContributorsNode() {
@@ -91,18 +88,12 @@ export class Decoder {
91
88
  .map((authorNote) => this.decode(authorNote))
92
89
  .filter(Boolean);
93
90
  const content = [...contributors, ...authorNotes];
94
- if (!content.length) {
95
- return false;
96
- }
97
91
  return schema.nodes.contributors.createAndFill({}, content);
98
92
  }
99
93
  createKeywordsNode() {
100
94
  const elements = getKeywordElements(this.modelMap)
101
95
  .map((e) => this.decode(e))
102
96
  .filter(Boolean);
103
- if (!elements.length) {
104
- return false;
105
- }
106
97
  return schema.nodes.keywords.createAndFill({}, [
107
98
  schema.nodes.section_title.create({}, schema.text('Keywords')),
108
99
  ...elements,
@@ -112,9 +103,6 @@ export class Decoder {
112
103
  const elements = getSupplements(this.modelMap)
113
104
  .map((e) => this.decode(e))
114
105
  .filter(Boolean);
115
- if (!elements.length) {
116
- return false;
117
- }
118
106
  return schema.nodes.supplements.createAndFill({}, [
119
107
  schema.nodes.section_title.create({}, schema.text('SupplementaryMaterials')),
120
108
  ...elements,
@@ -147,7 +135,11 @@ export class Decoder {
147
135
  const abstracts = schema.nodes.abstracts.createAndFill({}, groups[abstractsType._id]);
148
136
  const body = schema.nodes.body.createAndFill({}, groups[bodyType._id]);
149
137
  const backmatter = schema.nodes.backmatter.createAndFill({}, groups[backmatterType._id]);
150
- return [abstracts, body, backmatter];
138
+ return {
139
+ abstracts,
140
+ body,
141
+ backmatter,
142
+ };
151
143
  }
152
144
  createCommentNodes(model) {
153
145
  const comments = [];
@@ -715,18 +707,27 @@ export class Decoder {
715
707
  };
716
708
  this.getModel = (id) => this.modelMap.get(id);
717
709
  this.createArticleNode = (manuscriptID) => {
718
- const nodes = [
719
- this.createTitleNode(),
720
- this.createContributorsNode(),
721
- this.createAffiliationsNode(),
722
- this.createKeywordsNode(),
723
- this.createSupplementsNode(),
724
- ...this.createContentSections(),
725
- this.createCommentsNode(),
710
+ const title = this.createTitleNode();
711
+ const contributors = this.createContributorsNode();
712
+ const affiliations = this.createAffiliationsNode();
713
+ const keywords = this.createKeywordsNode();
714
+ const suppl = this.createSupplementsNode();
715
+ const { abstracts, body, backmatter } = this.createContentSections();
716
+ const comments = this.createCommentsNode();
717
+ const contents = [
718
+ title,
719
+ contributors,
720
+ affiliations,
721
+ keywords,
722
+ suppl,
723
+ abstracts,
724
+ body,
725
+ backmatter,
726
+ comments,
726
727
  ];
727
- const contents = nodes.filter((node) => node !== false);
728
728
  return schema.nodes.manuscript.create({
729
729
  id: manuscriptID || this.getManuscriptID(),
730
+ doi: this.getManuscriptDOI() || '',
730
731
  }, contents);
731
732
  };
732
733
  this.addGeneratedLabels = (sections) => {
@@ -772,6 +773,13 @@ export class Decoder {
772
773
  }
773
774
  }
774
775
  };
776
+ this.getManuscriptDOI = () => {
777
+ for (const item of this.modelMap.values()) {
778
+ if (isManuscript(item)) {
779
+ return item.DOI;
780
+ }
781
+ }
782
+ };
775
783
  this.getFigcaption = (model) => {
776
784
  const titleNode = schema.nodes.caption_title.create();
777
785
  const captionTitle = model.title
@@ -266,7 +266,6 @@ const encoders = {
266
266
  title: inlineContents(node),
267
267
  subtitle: node.attrs.subtitle,
268
268
  runningTitle: node.attrs.runningTitle,
269
- placeholder: node.attrs.placeholder,
270
269
  _id: node.attrs._id,
271
270
  }),
272
271
  bibliography_element: (node) => ({
@@ -1 +1 @@
1
- export const VERSION = "2.3.9-LEAN-3307.0";
1
+ export const VERSION = "2.3.9";
@@ -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;
@@ -18,6 +18,7 @@ import { ManuscriptNode } from '../types';
18
18
  export interface ActualManuscriptNode extends ManuscriptNode {
19
19
  attrs: {
20
20
  id: string;
21
+ doi: string;
21
22
  };
22
23
  }
23
24
  export declare const manuscript: NodeSpec;
@@ -20,7 +20,6 @@ interface Attrs {
20
20
  title: string;
21
21
  subtitle: string;
22
22
  runningTitle: string;
23
- placeholder: string;
24
23
  }
25
24
  export interface TitleNode extends ManuscriptNode {
26
25
  attrs: Attrs;
@@ -41,6 +41,7 @@ export declare class Decoder {
41
41
  addGeneratedLabels: (sections: Section[]) => Section[];
42
42
  parseContents: (contents: string, wrapper?: string, commentAnnotations?: CommentAnnotation[], options?: ParseOptions) => ManuscriptNode;
43
43
  private getManuscriptID;
44
+ private getManuscriptDOI;
44
45
  private getFigcaption;
45
46
  private createTable;
46
47
  private createTableColGroup;
@@ -1 +1 @@
1
- export declare const VERSION = "2.3.9-LEAN-3307.0";
1
+ export declare const VERSION = "2.3.9";
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.9-LEAN-3307.0",
4
+ "version": "2.3.9",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -30,8 +30,8 @@
30
30
  "version": "yarn build"
31
31
  },
32
32
  "dependencies": {
33
- "@manuscripts/json-schema": "2.2.9-LEAN-3307.0",
34
- "@manuscripts/library": "1.3.8-LEAN-3307.0",
33
+ "@manuscripts/json-schema": "2.2.8",
34
+ "@manuscripts/library": "1.3.7",
35
35
  "debug": "^4.3.4",
36
36
  "jszip": "^3.10.1",
37
37
  "mime": "^3.0.0",