@manuscripts/transform 4.2.3 → 4.2.5

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.
@@ -19,7 +19,10 @@ const create_article_node_1 = require("../importer/create-article-node");
19
19
  const utils_1 = require("./utils");
20
20
  describe('Create empty document', () => {
21
21
  it('should create an empty document', () => {
22
- const doc = (0, create_article_node_1.createArticleNode)({ id: 'manuscript:123' });
22
+ const doc = (0, create_article_node_1.createArticleNode)({
23
+ id: 'manuscript:123',
24
+ articleType: 'research-article',
25
+ });
23
26
  (0, utils_1.changeIDs)(doc);
24
27
  expect(doc).toMatchSnapshot();
25
28
  });
@@ -917,7 +917,10 @@ class JATSExporter {
917
917
  const createGraphic = (node) => {
918
918
  const graphic = this.createElement('graphic');
919
919
  graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', node.attrs.src);
920
- if (!isChildOfNodeType(node.attrs.id, schema_1.schema.nodes.figure_element) &&
920
+ if (isChildOfNodeType(node.attrs.id, schema_1.schema.nodes.hero_image)) {
921
+ graphic.setAttribute('content-type', 'leading');
922
+ }
923
+ else if (!isChildOfNodeType(node.attrs.id, schema_1.schema.nodes.figure_element) &&
921
924
  node.attrs.type) {
922
925
  graphic.setAttribute('content-type', node.attrs.type);
923
926
  }
@@ -235,7 +235,7 @@ class JATSDOMParser {
235
235
  const dates = this.parseHistoryDates(history);
236
236
  return {
237
237
  doi: (0, utils_1.getTrimmedTextContent)(doi),
238
- articleType: element.getAttribute('article-type') ?? '',
238
+ articleType: element.getAttribute('article-type') || '',
239
239
  primaryLanguageCode: element.getAttribute('lang') ?? '',
240
240
  ...dates,
241
241
  };
@@ -92,7 +92,7 @@ exports.tableRow = {
92
92
  attrs: {
93
93
  ...tableNodes.table_row.attrs,
94
94
  id: { default: '' },
95
- dataTracked: { default: null }
95
+ dataTracked: { default: null },
96
96
  },
97
97
  };
98
98
  exports.tableCell = {
@@ -100,7 +100,7 @@ exports.tableCell = {
100
100
  attrs: {
101
101
  ...tableNodes.table_cell.attrs,
102
102
  id: { default: '' },
103
- dataTracked: { default: null }
103
+ dataTracked: { default: null },
104
104
  },
105
105
  };
106
106
  exports.tableHeader = {
@@ -108,6 +108,6 @@ exports.tableHeader = {
108
108
  attrs: {
109
109
  ...tableNodes.table_header.attrs,
110
110
  id: { default: '' },
111
- dataTracked: { default: null }
111
+ dataTracked: { default: null },
112
112
  },
113
113
  };
@@ -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 = "4.2.3";
4
+ exports.VERSION = "4.2.5";
@@ -17,7 +17,10 @@ import { createArticleNode } from '../importer/create-article-node';
17
17
  import { changeIDs } from './utils';
18
18
  describe('Create empty document', () => {
19
19
  it('should create an empty document', () => {
20
- const doc = createArticleNode({ id: 'manuscript:123' });
20
+ const doc = createArticleNode({
21
+ id: 'manuscript:123',
22
+ articleType: 'research-article',
23
+ });
21
24
  changeIDs(doc);
22
25
  expect(doc).toMatchSnapshot();
23
26
  });
@@ -887,7 +887,10 @@ export class JATSExporter {
887
887
  const createGraphic = (node) => {
888
888
  const graphic = this.createElement('graphic');
889
889
  graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', node.attrs.src);
890
- if (!isChildOfNodeType(node.attrs.id, schema.nodes.figure_element) &&
890
+ if (isChildOfNodeType(node.attrs.id, schema.nodes.hero_image)) {
891
+ graphic.setAttribute('content-type', 'leading');
892
+ }
893
+ else if (!isChildOfNodeType(node.attrs.id, schema.nodes.figure_element) &&
891
894
  node.attrs.type) {
892
895
  graphic.setAttribute('content-type', node.attrs.type);
893
896
  }
@@ -232,7 +232,7 @@ export class JATSDOMParser {
232
232
  const dates = this.parseHistoryDates(history);
233
233
  return {
234
234
  doi: getTrimmedTextContent(doi),
235
- articleType: element.getAttribute('article-type') ?? '',
235
+ articleType: element.getAttribute('article-type') || '',
236
236
  primaryLanguageCode: element.getAttribute('lang') ?? '',
237
237
  ...dates,
238
238
  };
@@ -89,7 +89,7 @@ export const tableRow = {
89
89
  attrs: {
90
90
  ...tableNodes.table_row.attrs,
91
91
  id: { default: '' },
92
- dataTracked: { default: null }
92
+ dataTracked: { default: null },
93
93
  },
94
94
  };
95
95
  export const tableCell = {
@@ -97,7 +97,7 @@ export const tableCell = {
97
97
  attrs: {
98
98
  ...tableNodes.table_cell.attrs,
99
99
  id: { default: '' },
100
- dataTracked: { default: null }
100
+ dataTracked: { default: null },
101
101
  },
102
102
  };
103
103
  export const tableHeader = {
@@ -105,6 +105,6 @@ export const tableHeader = {
105
105
  attrs: {
106
106
  ...tableNodes.table_header.attrs,
107
107
  id: { default: '' },
108
- dataTracked: { default: null }
108
+ dataTracked: { default: null },
109
109
  },
110
110
  };
@@ -1 +1 @@
1
- export const VERSION = "4.2.3";
1
+ export const VERSION = "4.2.5";
@@ -56,6 +56,7 @@ export type ManuscriptTemplate = {
56
56
  bundle: string;
57
57
  title: string;
58
58
  sectionCategories: SectionCategory[];
59
+ articleType: string;
59
60
  };
60
61
  export type MarkRule = ParseRule & {
61
62
  mark: Marks | null;
@@ -1 +1 @@
1
- export declare const VERSION = "4.2.3";
1
+ export declare const VERSION = "4.2.5";
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": "4.2.3",
4
+ "version": "4.2.5",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",