@manuscripts/transform 2.3.23-LEAN-3828.0 → 2.3.23

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.
@@ -143,7 +143,7 @@ class JATSExporter {
143
143
  const manuscript = (0, project_bundle_1.findManuscriptById)(this.modelMap, manuscriptID);
144
144
  article.setAttribute('article-type', manuscript.articleType || 'other');
145
145
  if (!frontMatterOnly) {
146
- this.labelTargets = (0, labels_1.buildTargets)(fragment, manuscript);
146
+ this.labelTargets = (0, labels_1.buildTargets)(fragment);
147
147
  const body = this.buildBody(fragment);
148
148
  article.appendChild(body);
149
149
  const back = this.buildBack(body);
@@ -21,6 +21,9 @@ exports.manuscript = {
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  doi: { default: '' },
24
+ prototype: { default: '' },
25
+ primaryLanguageCode: { default: '' },
26
+ articleType: { default: '' },
24
27
  },
25
28
  group: 'block',
26
29
  parseDOM: [
@@ -726,9 +726,13 @@ class Decoder {
726
726
  this.createCommentsNode(),
727
727
  ];
728
728
  const contents = nodes.filter((node) => node !== false);
729
+ const props = this.getManuscript();
729
730
  return schema_1.schema.nodes.manuscript.create({
730
731
  id: manuscriptID || this.getManuscriptID(),
731
- doi: this.getManuscriptDOI() || '',
732
+ doi: (props === null || props === void 0 ? void 0 : props.DOI) || '',
733
+ articleType: props === null || props === void 0 ? void 0 : props.articleType,
734
+ prototype: props === null || props === void 0 ? void 0 : props.prototype,
735
+ primaryLanguageCode: props === null || props === void 0 ? void 0 : props.primaryLanguageCode,
732
736
  }, contents);
733
737
  };
734
738
  this.addGeneratedLabels = (sections) => {
@@ -774,10 +778,10 @@ class Decoder {
774
778
  }
775
779
  }
776
780
  };
777
- this.getManuscriptDOI = () => {
781
+ this.getManuscript = () => {
778
782
  for (const item of this.modelMap.values()) {
779
783
  if ((0, object_types_1.isManuscript)(item)) {
780
- return item.DOI;
784
+ return item;
781
785
  }
782
786
  }
783
787
  };
@@ -75,8 +75,7 @@ class HTMLTransformer {
75
75
  this.serializeToHTML = async (fragment, modelMap, options = {}) => {
76
76
  const { idGenerator, mediaPathGenerator } = options;
77
77
  this.modelMap = modelMap;
78
- const manuscript = (0, project_bundle_1.findManuscript)(this.modelMap);
79
- this.labelTargets = (0, labels_1.buildTargets)(fragment, manuscript);
78
+ this.labelTargets = (0, labels_1.buildTargets)(fragment);
80
79
  this.document = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', document.implementation.createDocumentType('html', '', ''));
81
80
  const article = this.document.createElement('article');
82
81
  this.document.documentElement.appendChild(article);
@@ -24,28 +24,15 @@ const labelledNodeTypes = [
24
24
  schema_1.schema.nodes.equation_element,
25
25
  schema_1.schema.nodes.listing_element,
26
26
  ];
27
- const labelProperties = new Map([
28
- [schema_1.schema.nodes.figure_element, 'figureElementLabel'],
29
- [schema_1.schema.nodes.table_element, 'tableElementLabel'],
30
- [schema_1.schema.nodes.equation_element, 'equationElementLabel'],
31
- [schema_1.schema.nodes.listing_element, 'listingElementLabel'],
32
- ]);
33
27
  const excludedTypes = [schema_1.schema.nodes.graphical_abstract_section];
34
- const chooseLabel = (nodeType, manuscript) => {
35
- const labelProperty = labelProperties.get(nodeType);
36
- if (labelProperty) {
37
- const label = manuscript[labelProperty];
38
- if (label) {
39
- return label;
40
- }
41
- }
28
+ const chooseLabel = (nodeType) => {
42
29
  return node_names_1.nodeNames.get(nodeType);
43
30
  };
44
- const buildTargets = (fragment, manuscript) => {
31
+ const buildTargets = (fragment) => {
45
32
  const counters = {};
46
33
  for (const nodeType of labelledNodeTypes) {
47
34
  counters[nodeType.name] = {
48
- label: chooseLabel(nodeType, manuscript),
35
+ label: chooseLabel(nodeType),
49
36
  index: 0,
50
37
  };
51
38
  }
@@ -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.23-LEAN-3828.0";
4
+ exports.VERSION = "2.3.23";
@@ -135,7 +135,7 @@ export class JATSExporter {
135
135
  const manuscript = findManuscriptById(this.modelMap, manuscriptID);
136
136
  article.setAttribute('article-type', manuscript.articleType || 'other');
137
137
  if (!frontMatterOnly) {
138
- this.labelTargets = buildTargets(fragment, manuscript);
138
+ this.labelTargets = buildTargets(fragment);
139
139
  const body = this.buildBody(fragment);
140
140
  article.appendChild(body);
141
141
  const back = this.buildBack(body);
@@ -18,6 +18,9 @@ export const manuscript = {
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  doi: { default: '' },
21
+ prototype: { default: '' },
22
+ primaryLanguageCode: { default: '' },
23
+ articleType: { default: '' },
21
24
  },
22
25
  group: 'block',
23
26
  parseDOM: [
@@ -717,9 +717,13 @@ export class Decoder {
717
717
  this.createCommentsNode(),
718
718
  ];
719
719
  const contents = nodes.filter((node) => node !== false);
720
+ const props = this.getManuscript();
720
721
  return schema.nodes.manuscript.create({
721
722
  id: manuscriptID || this.getManuscriptID(),
722
- doi: this.getManuscriptDOI() || '',
723
+ doi: (props === null || props === void 0 ? void 0 : props.DOI) || '',
724
+ articleType: props === null || props === void 0 ? void 0 : props.articleType,
725
+ prototype: props === null || props === void 0 ? void 0 : props.prototype,
726
+ primaryLanguageCode: props === null || props === void 0 ? void 0 : props.primaryLanguageCode,
723
727
  }, contents);
724
728
  };
725
729
  this.addGeneratedLabels = (sections) => {
@@ -765,10 +769,10 @@ export class Decoder {
765
769
  }
766
770
  }
767
771
  };
768
- this.getManuscriptDOI = () => {
772
+ this.getManuscript = () => {
769
773
  for (const item of this.modelMap.values()) {
770
774
  if (isManuscript(item)) {
771
- return item.DOI;
775
+ return item;
772
776
  }
773
777
  }
774
778
  };
@@ -69,8 +69,7 @@ export class HTMLTransformer {
69
69
  this.serializeToHTML = async (fragment, modelMap, options = {}) => {
70
70
  const { idGenerator, mediaPathGenerator } = options;
71
71
  this.modelMap = modelMap;
72
- const manuscript = findManuscript(this.modelMap);
73
- this.labelTargets = buildTargets(fragment, manuscript);
72
+ this.labelTargets = buildTargets(fragment);
74
73
  this.document = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', document.implementation.createDocumentType('html', '', ''));
75
74
  const article = this.document.createElement('article');
76
75
  this.document.documentElement.appendChild(article);
@@ -21,28 +21,15 @@ const labelledNodeTypes = [
21
21
  schema.nodes.equation_element,
22
22
  schema.nodes.listing_element,
23
23
  ];
24
- const labelProperties = new Map([
25
- [schema.nodes.figure_element, 'figureElementLabel'],
26
- [schema.nodes.table_element, 'tableElementLabel'],
27
- [schema.nodes.equation_element, 'equationElementLabel'],
28
- [schema.nodes.listing_element, 'listingElementLabel'],
29
- ]);
30
24
  const excludedTypes = [schema.nodes.graphical_abstract_section];
31
- const chooseLabel = (nodeType, manuscript) => {
32
- const labelProperty = labelProperties.get(nodeType);
33
- if (labelProperty) {
34
- const label = manuscript[labelProperty];
35
- if (label) {
36
- return label;
37
- }
38
- }
25
+ const chooseLabel = (nodeType) => {
39
26
  return nodeNames.get(nodeType);
40
27
  };
41
- export const buildTargets = (fragment, manuscript) => {
28
+ export const buildTargets = (fragment) => {
42
29
  const counters = {};
43
30
  for (const nodeType of labelledNodeTypes) {
44
31
  counters[nodeType.name] = {
45
- label: chooseLabel(nodeType, manuscript),
32
+ label: chooseLabel(nodeType),
46
33
  index: 0,
47
34
  };
48
35
  }
@@ -1 +1 @@
1
- export const VERSION = "2.3.23-LEAN-3828.0";
1
+ export const VERSION = "2.3.23";
@@ -19,6 +19,9 @@ export interface ActualManuscriptNode extends ManuscriptNode {
19
19
  attrs: {
20
20
  id: string;
21
21
  doi: string;
22
+ articleType: string;
23
+ prototype: string;
24
+ primaryLanguageCode: string;
22
25
  };
23
26
  }
24
27
  export declare const manuscript: NodeSpec;
@@ -42,7 +42,7 @@ export declare class Decoder {
42
42
  addGeneratedLabels: (sections: Section[]) => Section[];
43
43
  parseContents: (contents: string, wrapper?: string, commentAnnotations?: CommentAnnotation[], options?: ParseOptions) => ManuscriptNode;
44
44
  private getManuscriptID;
45
- private getManuscriptDOI;
45
+ private getManuscript;
46
46
  private getFigcaption;
47
47
  private createTable;
48
48
  private createTableColGroup;
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Manuscript } from '@manuscripts/json-schema';
17
16
  import { ManuscriptFragment } from '../schema';
18
17
  export interface Target {
19
18
  type: string;
@@ -21,4 +20,4 @@ export interface Target {
21
20
  label: string;
22
21
  caption: string;
23
22
  }
24
- export declare const buildTargets: (fragment: ManuscriptFragment, manuscript: Manuscript) => Map<string, Target>;
23
+ export declare const buildTargets: (fragment: ManuscriptFragment) => Map<string, Target>;
@@ -1 +1 @@
1
- export declare const VERSION = "2.3.23-LEAN-3828.0";
1
+ export declare const VERSION = "2.3.23";
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.23-LEAN-3828.0",
4
+ "version": "2.3.23",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@manuscripts/json-schema": "2.2.10",
34
- "@manuscripts/library": "1.3.11-LEAN-3828.1",
34
+ "@manuscripts/library": "1.3.10",
35
35
  "debug": "^4.3.4",
36
36
  "jszip": "^3.10.1",
37
37
  "lodash": "^4.17.21",
@@ -82,4 +82,4 @@
82
82
  "rimraf": "^3.0.2",
83
83
  "typescript": "^4.0.5"
84
84
  }
85
- }
85
+ }