@manuscripts/transform 4.3.15 → 4.3.17

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.
@@ -497,6 +497,18 @@ class JATSExporter {
497
497
  }
498
498
  return ['trans-abstract', attrs, 0];
499
499
  },
500
+ trans_graphical_abstract: (node) => {
501
+ const attrs = {
502
+ id: normalizeID(node.attrs.id),
503
+ };
504
+ if (node.attrs.lang) {
505
+ attrs[`${xml_1.XML_NAMESPACE} lang`] = node.attrs.lang;
506
+ }
507
+ if (node.attrs.category) {
508
+ attrs['sec-type'] = node.attrs.category;
509
+ }
510
+ return ['trans-abstract', attrs, 0];
511
+ },
500
512
  hero_image: () => '',
501
513
  alt_text: (node) => {
502
514
  if (node.textContent) {
@@ -791,6 +791,28 @@ class JATSDOMParser {
791
791
  };
792
792
  },
793
793
  },
794
+ {
795
+ tag: 'trans-abstract[sec-type="abstract-graphical"]',
796
+ node: 'trans_graphical_abstract',
797
+ getAttrs: (node) => {
798
+ const element = node;
799
+ return {
800
+ lang: element.getAttributeNS(xml_1.XML_NAMESPACE, 'lang') ?? '',
801
+ category: this.chooseSectionCategory(element),
802
+ };
803
+ },
804
+ },
805
+ {
806
+ tag: 'trans-abstract[sec-type="abstract-key-image"]',
807
+ node: 'trans_graphical_abstract',
808
+ getAttrs: (node) => {
809
+ const element = node;
810
+ return {
811
+ lang: element.getAttributeNS(xml_1.XML_NAMESPACE, 'lang') ?? '',
812
+ category: this.chooseSectionCategory(element),
813
+ };
814
+ },
815
+ },
794
816
  {
795
817
  tag: 'trans-abstract',
796
818
  node: 'trans_abstract',
@@ -920,7 +942,7 @@ class JATSDOMParser {
920
942
  {
921
943
  tag: 'title',
922
944
  node: 'section_title',
923
- context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/|graphical_abstract_section/|trans_abstract/',
945
+ context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/|graphical_abstract_section/|trans_abstract/|trans_graphical_abstract/',
924
946
  },
925
947
  {
926
948
  tag: 'title',
@@ -1076,9 +1098,11 @@ class JATSDOMParser {
1076
1098
  }
1077
1099
  chooseSectionCategory(section) {
1078
1100
  const secType = section.getAttribute('sec-type');
1101
+ const abstractType = section.getAttribute('abstract-type');
1102
+ const effectiveSecType = secType || (abstractType ? `abstract-${abstractType}` : null);
1079
1103
  const titleNode = section.firstElementChild;
1080
1104
  for (const category of this.sectionCategories) {
1081
- if (this.isMatchingCategory(secType, titleNode, category)) {
1105
+ if (this.isMatchingCategory(effectiveSecType, titleNode, category)) {
1082
1106
  return category.id;
1083
1107
  }
1084
1108
  }
@@ -108,6 +108,7 @@ const table_element_footer_1 = require("./nodes/table_element_footer");
108
108
  const text_1 = require("./nodes/text");
109
109
  const title_1 = require("./nodes/title");
110
110
  const trans_abstract_1 = require("./nodes/trans_abstract");
111
+ const trans_graphical_abstract_1 = require("./nodes/trans_graphical_abstract");
111
112
  __exportStar(require("./groups"), exports);
112
113
  __exportStar(require("./nodes/affiliation"), exports);
113
114
  __exportStar(require("./nodes/affiliations"), exports);
@@ -182,6 +183,7 @@ __exportStar(require("./nodes/table_element_footer"), exports);
182
183
  __exportStar(require("./nodes/text"), exports);
183
184
  __exportStar(require("./nodes/title"), exports);
184
185
  __exportStar(require("./nodes/trans_abstract"), exports);
186
+ __exportStar(require("./nodes/trans_graphical_abstract"), exports);
185
187
  __exportStar(require("./types"), exports);
186
188
  exports.schema = new prosemirror_model_1.Schema({
187
189
  marks: {
@@ -279,6 +281,7 @@ exports.schema = new prosemirror_model_1.Schema({
279
281
  quote_image: quote_image_1.quoteImage,
280
282
  hero_image: hero_image_1.heroImage,
281
283
  trans_abstract: trans_abstract_1.transAbstract,
284
+ trans_graphical_abstract: trans_graphical_abstract_1.transGraphicalAbstract,
282
285
  subtitle: subtitle_1.subtitle,
283
286
  subtitles: subtitles_1.subtitles,
284
287
  },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.abstracts = void 0;
19
19
  exports.abstracts = {
20
- content: 'sections* trans_abstract*',
20
+ content: 'sections* (trans_abstract | trans_graphical_abstract)*',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  },
@@ -40,5 +40,5 @@ exports.transAbstract = {
40
40
  ];
41
41
  },
42
42
  };
43
- const isTransAbstractNode = (node) => node.type === index_1.schema.nodes.transAbstract;
43
+ const isTransAbstractNode = (node) => node.type === index_1.schema.nodes.trans_abstract;
44
44
  exports.isTransAbstractNode = isTransAbstractNode;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2025 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.isTransGraphicalAbstractNode = exports.transGraphicalAbstract = void 0;
19
+ const index_1 = require("../index");
20
+ exports.transGraphicalAbstract = {
21
+ content: 'section_title (figure_element | placeholder)',
22
+ attrs: {
23
+ id: { default: '' },
24
+ lang: { default: '' },
25
+ category: { default: '' },
26
+ dataTracked: { default: null },
27
+ },
28
+ group: 'block sections',
29
+ selectable: false,
30
+ parseDOM: [
31
+ {
32
+ tag: 'section.trans-graphical-abstract',
33
+ },
34
+ ],
35
+ toDOM: (node) => {
36
+ const transGraphicalAbstractNode = node;
37
+ const { id, lang } = transGraphicalAbstractNode.attrs;
38
+ return [
39
+ 'section',
40
+ {
41
+ id,
42
+ lang,
43
+ class: 'trans-graphical-abstract',
44
+ spellcheck: 'false',
45
+ },
46
+ 0,
47
+ ];
48
+ },
49
+ };
50
+ const isTransGraphicalAbstractNode = (node) => node.type === index_1.schema.nodes.trans_graphical_abstract;
51
+ exports.isTransGraphicalAbstractNode = isTransGraphicalAbstractNode;
@@ -52,6 +52,9 @@ exports.nodeNames = new Map([
52
52
  [schema_1.schema.nodes.paragraph, 'Paragraph'],
53
53
  [schema_1.schema.nodes.text_block, 'Paragraph'],
54
54
  [schema_1.schema.nodes.section, 'Section'],
55
+ [schema_1.schema.nodes.graphical_abstract_section, 'Graphical Abstract'],
56
+ [schema_1.schema.nodes.trans_abstract, 'Trans Abstract'],
57
+ [schema_1.schema.nodes.trans_graphical_abstract, 'Trans Graphical Abstract'],
55
58
  [schema_1.schema.nodes.section_title, 'Section Title'],
56
59
  [schema_1.schema.nodes.section_title_plain, 'Section Title'],
57
60
  [schema_1.schema.nodes.table, 'Table'],
@@ -52,6 +52,7 @@ const nodeTitle = (node) => {
52
52
  case nodes.footnotes_section:
53
53
  case nodes.keywords:
54
54
  case nodes.graphical_abstract_section:
55
+ case nodes.trans_graphical_abstract:
55
56
  return snippetOfNodeType(node, nodes.section_title);
56
57
  case nodes.footnotes_element:
57
58
  return node.attrs.collateByKind === 'footnote' ? 'Footnotes' : 'Endnotes';
@@ -38,6 +38,7 @@ exports.nodeTypesMap = new Map([
38
38
  [schema_1.schema.nodes.footnotes_element, json_schema_1.ObjectTypes.FootnotesElement],
39
39
  [schema_1.schema.nodes.footnotes_section, json_schema_1.ObjectTypes.Section],
40
40
  [schema_1.schema.nodes.graphical_abstract_section, json_schema_1.ObjectTypes.Section],
41
+ [schema_1.schema.nodes.trans_graphical_abstract, json_schema_1.ObjectTypes.Section],
41
42
  [schema_1.schema.nodes.highlight_marker, json_schema_1.ObjectTypes.HighlightMarker],
42
43
  [schema_1.schema.nodes.keyword, json_schema_1.ObjectTypes.Keyword],
43
44
  [schema_1.schema.nodes.keywords_element, json_schema_1.ObjectTypes.KeywordsElement],
@@ -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.3.15";
4
+ exports.VERSION = "4.3.17";
@@ -457,6 +457,18 @@ export class JATSExporter {
457
457
  }
458
458
  return ['trans-abstract', attrs, 0];
459
459
  },
460
+ trans_graphical_abstract: (node) => {
461
+ const attrs = {
462
+ id: normalizeID(node.attrs.id),
463
+ };
464
+ if (node.attrs.lang) {
465
+ attrs[`${XML_NAMESPACE} lang`] = node.attrs.lang;
466
+ }
467
+ if (node.attrs.category) {
468
+ attrs['sec-type'] = node.attrs.category;
469
+ }
470
+ return ['trans-abstract', attrs, 0];
471
+ },
460
472
  hero_image: () => '',
461
473
  alt_text: (node) => {
462
474
  if (node.textContent) {
@@ -788,6 +788,28 @@ export class JATSDOMParser {
788
788
  };
789
789
  },
790
790
  },
791
+ {
792
+ tag: 'trans-abstract[sec-type="abstract-graphical"]',
793
+ node: 'trans_graphical_abstract',
794
+ getAttrs: (node) => {
795
+ const element = node;
796
+ return {
797
+ lang: element.getAttributeNS(XML_NAMESPACE, 'lang') ?? '',
798
+ category: this.chooseSectionCategory(element),
799
+ };
800
+ },
801
+ },
802
+ {
803
+ tag: 'trans-abstract[sec-type="abstract-key-image"]',
804
+ node: 'trans_graphical_abstract',
805
+ getAttrs: (node) => {
806
+ const element = node;
807
+ return {
808
+ lang: element.getAttributeNS(XML_NAMESPACE, 'lang') ?? '',
809
+ category: this.chooseSectionCategory(element),
810
+ };
811
+ },
812
+ },
791
813
  {
792
814
  tag: 'trans-abstract',
793
815
  node: 'trans_abstract',
@@ -917,7 +939,7 @@ export class JATSDOMParser {
917
939
  {
918
940
  tag: 'title',
919
941
  node: 'section_title',
920
- context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/|graphical_abstract_section/|trans_abstract/',
942
+ context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/|graphical_abstract_section/|trans_abstract/|trans_graphical_abstract/',
921
943
  },
922
944
  {
923
945
  tag: 'title',
@@ -1073,9 +1095,11 @@ export class JATSDOMParser {
1073
1095
  }
1074
1096
  chooseSectionCategory(section) {
1075
1097
  const secType = section.getAttribute('sec-type');
1098
+ const abstractType = section.getAttribute('abstract-type');
1099
+ const effectiveSecType = secType || (abstractType ? `abstract-${abstractType}` : null);
1076
1100
  const titleNode = section.firstElementChild;
1077
1101
  for (const category of this.sectionCategories) {
1078
- if (this.isMatchingCategory(secType, titleNode, category)) {
1102
+ if (this.isMatchingCategory(effectiveSecType, titleNode, category)) {
1079
1103
  return category.id;
1080
1104
  }
1081
1105
  }
@@ -91,6 +91,7 @@ import { tableElementFooter } from './nodes/table_element_footer';
91
91
  import { text, textBlock } from './nodes/text';
92
92
  import { title } from './nodes/title';
93
93
  import { transAbstract } from './nodes/trans_abstract';
94
+ import { transGraphicalAbstract } from './nodes/trans_graphical_abstract';
94
95
  export * from './groups';
95
96
  export * from './nodes/affiliation';
96
97
  export * from './nodes/affiliations';
@@ -165,6 +166,7 @@ export * from './nodes/table_element_footer';
165
166
  export * from './nodes/text';
166
167
  export * from './nodes/title';
167
168
  export * from './nodes/trans_abstract';
169
+ export * from './nodes/trans_graphical_abstract';
168
170
  export * from './types';
169
171
  export const schema = new Schema({
170
172
  marks: {
@@ -262,6 +264,7 @@ export const schema = new Schema({
262
264
  quote_image: quoteImage,
263
265
  hero_image: heroImage,
264
266
  trans_abstract: transAbstract,
267
+ trans_graphical_abstract: transGraphicalAbstract,
265
268
  subtitle: subtitle,
266
269
  subtitles: subtitles,
267
270
  },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const abstracts = {
17
- content: 'sections* trans_abstract*',
17
+ content: 'sections* (trans_abstract | trans_graphical_abstract)*',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  },
@@ -37,4 +37,4 @@ export const transAbstract = {
37
37
  ];
38
38
  },
39
39
  };
40
- export const isTransAbstractNode = (node) => node.type === schema.nodes.transAbstract;
40
+ export const isTransAbstractNode = (node) => node.type === schema.nodes.trans_abstract;
@@ -0,0 +1,47 @@
1
+ /*!
2
+ * © 2025 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
+ import { schema } from '../index';
17
+ export const transGraphicalAbstract = {
18
+ content: 'section_title (figure_element | placeholder)',
19
+ attrs: {
20
+ id: { default: '' },
21
+ lang: { default: '' },
22
+ category: { default: '' },
23
+ dataTracked: { default: null },
24
+ },
25
+ group: 'block sections',
26
+ selectable: false,
27
+ parseDOM: [
28
+ {
29
+ tag: 'section.trans-graphical-abstract',
30
+ },
31
+ ],
32
+ toDOM: (node) => {
33
+ const transGraphicalAbstractNode = node;
34
+ const { id, lang } = transGraphicalAbstractNode.attrs;
35
+ return [
36
+ 'section',
37
+ {
38
+ id,
39
+ lang,
40
+ class: 'trans-graphical-abstract',
41
+ spellcheck: 'false',
42
+ },
43
+ 0,
44
+ ];
45
+ },
46
+ };
47
+ export const isTransGraphicalAbstractNode = (node) => node.type === schema.nodes.trans_graphical_abstract;
@@ -49,6 +49,9 @@ export const nodeNames = new Map([
49
49
  [schema.nodes.paragraph, 'Paragraph'],
50
50
  [schema.nodes.text_block, 'Paragraph'],
51
51
  [schema.nodes.section, 'Section'],
52
+ [schema.nodes.graphical_abstract_section, 'Graphical Abstract'],
53
+ [schema.nodes.trans_abstract, 'Trans Abstract'],
54
+ [schema.nodes.trans_graphical_abstract, 'Trans Graphical Abstract'],
52
55
  [schema.nodes.section_title, 'Section Title'],
53
56
  [schema.nodes.section_title_plain, 'Section Title'],
54
57
  [schema.nodes.table, 'Table'],
@@ -49,6 +49,7 @@ export const nodeTitle = (node) => {
49
49
  case nodes.footnotes_section:
50
50
  case nodes.keywords:
51
51
  case nodes.graphical_abstract_section:
52
+ case nodes.trans_graphical_abstract:
52
53
  return snippetOfNodeType(node, nodes.section_title);
53
54
  case nodes.footnotes_element:
54
55
  return node.attrs.collateByKind === 'footnote' ? 'Footnotes' : 'Endnotes';
@@ -35,6 +35,7 @@ export const nodeTypesMap = new Map([
35
35
  [schema.nodes.footnotes_element, ObjectTypes.FootnotesElement],
36
36
  [schema.nodes.footnotes_section, ObjectTypes.Section],
37
37
  [schema.nodes.graphical_abstract_section, ObjectTypes.Section],
38
+ [schema.nodes.trans_graphical_abstract, ObjectTypes.Section],
38
39
  [schema.nodes.highlight_marker, ObjectTypes.HighlightMarker],
39
40
  [schema.nodes.keyword, ObjectTypes.Keyword],
40
41
  [schema.nodes.keywords_element, ObjectTypes.KeywordsElement],
@@ -1 +1 @@
1
- export const VERSION = "4.3.15";
1
+ export const VERSION = "4.3.17";
@@ -89,5 +89,6 @@ export * from './nodes/table_element_footer';
89
89
  export * from './nodes/text';
90
90
  export * from './nodes/title';
91
91
  export * from './nodes/trans_abstract';
92
+ export * from './nodes/trans_graphical_abstract';
92
93
  export * from './types';
93
94
  export declare const schema: Schema<Nodes, Marks>;
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * © 2025 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
+ import { NodeSpec } from 'prosemirror-model';
17
+ import type { ManuscriptNode } from '../types';
18
+ export interface TransGraphicalAbstractAttrs {
19
+ id: string;
20
+ lang: string;
21
+ category: string;
22
+ }
23
+ export interface TransGraphicalAbstractNode extends ManuscriptNode {
24
+ attrs: TransGraphicalAbstractAttrs;
25
+ }
26
+ export declare const transGraphicalAbstract: NodeSpec;
27
+ export declare const isTransGraphicalAbstractNode: (node: ManuscriptNode) => node is TransGraphicalAbstractNode;
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
17
17
  import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
18
18
  import { EditorView, NodeView } from 'prosemirror-view';
19
19
  export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
20
- export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'quote_image' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'text_block' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element' | 'awards' | 'award' | 'embed' | 'image_element' | 'attachment' | 'attachments' | 'alt_title' | 'alt_text' | 'alt_titles' | 'long_desc' | 'hero_image' | 'trans_abstract' | 'subtitle' | 'subtitles';
20
+ export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'quote_image' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'text_block' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element' | 'awards' | 'award' | 'embed' | 'image_element' | 'attachment' | 'attachments' | 'alt_title' | 'alt_text' | 'alt_titles' | 'long_desc' | 'hero_image' | 'trans_abstract' | 'trans_graphical_abstract' | 'subtitle' | 'subtitles';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -1 +1 @@
1
- export declare const VERSION = "4.3.15";
1
+ export declare const VERSION = "4.3.17";
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.3.15",
4
+ "version": "4.3.17",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",