@manuscripts/transform 3.0.67 → 3.0.68-LEAN-4577.1
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.
- package/dist/cjs/jats/exporter/jats-exporter.js +20 -15
- package/dist/cjs/jats/importer/jats-transformations.js +5 -0
- package/dist/cjs/schema/index.js +3 -0
- package/dist/cjs/schema/nodes/abstracts.js +1 -1
- package/dist/cjs/schema/nodes/trans_abstract.js +43 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +20 -15
- package/dist/es/jats/importer/jats-transformations.js +5 -0
- package/dist/es/schema/index.js +3 -0
- package/dist/es/schema/nodes/abstracts.js +1 -1
- package/dist/es/schema/nodes/trans_abstract.js +39 -0
- package/dist/es/version.js +1 -1
- package/dist/types/schema/index.d.ts +1 -0
- package/dist/types/schema/nodes/trans_abstract.d.ts +26 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -43,22 +43,13 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
43
43
|
const normalizeID = (id) => id.replace(/:/g, '_');
|
|
44
44
|
const parser = prosemirror_model_1.DOMParser.fromSchema(schema_1.schema);
|
|
45
45
|
const insertAbstractNode = (articleMeta, abstractNode) => {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'custom-meta-group',
|
|
53
|
-
];
|
|
54
|
-
for (const sibling of siblings) {
|
|
55
|
-
const siblingNode = articleMeta.querySelector(`:scope > ${sibling}`);
|
|
56
|
-
if (siblingNode) {
|
|
57
|
-
articleMeta.insertBefore(abstractNode, siblingNode);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
46
|
+
const insertBeforeElement = articleMeta.querySelector('kwd-group, funding-group, support-group, conference, counts, custom-meta-group');
|
|
47
|
+
if (insertBeforeElement) {
|
|
48
|
+
articleMeta.insertBefore(abstractNode, insertBeforeElement);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
articleMeta.appendChild(abstractNode);
|
|
60
52
|
}
|
|
61
|
-
articleMeta.appendChild(abstractNode);
|
|
62
53
|
};
|
|
63
54
|
const createCounter = () => {
|
|
64
55
|
const counts = new Map();
|
|
@@ -564,6 +555,15 @@ class JATSExporter {
|
|
|
564
555
|
};
|
|
565
556
|
this.createSerializer = () => {
|
|
566
557
|
const nodes = {
|
|
558
|
+
trans_abstract: (node) => {
|
|
559
|
+
const attrs = {
|
|
560
|
+
id: normalizeID(node.attrs.id),
|
|
561
|
+
};
|
|
562
|
+
if (node.attrs.lang) {
|
|
563
|
+
attrs['xml:lang'] = node.attrs.category;
|
|
564
|
+
}
|
|
565
|
+
return ['trans-abstract', attrs, 0];
|
|
566
|
+
},
|
|
567
567
|
hero_image: () => '',
|
|
568
568
|
alt_text: (node) => {
|
|
569
569
|
if (node.textContent) {
|
|
@@ -1390,10 +1390,15 @@ class JATSExporter {
|
|
|
1390
1390
|
const container = body.querySelector(':scope > sec[sec-type="abstracts"]');
|
|
1391
1391
|
const abstractsNode = this.getFirstChildOfType(schema_1.schema.nodes.abstracts);
|
|
1392
1392
|
const abstractCategories = this.getAbstractCategories(abstractsNode);
|
|
1393
|
+
const articleMeta = front.querySelector(':scope > article-meta');
|
|
1393
1394
|
const abstractSections = this.getAbstractSections(container, body, abstractCategories);
|
|
1394
1395
|
if (abstractSections.length) {
|
|
1395
1396
|
this.processAbstractSections(abstractSections, front);
|
|
1396
1397
|
}
|
|
1398
|
+
const transAbstracts = body.querySelectorAll(':scope > trans-abstract');
|
|
1399
|
+
transAbstracts.forEach((transAbstract) => {
|
|
1400
|
+
insertAbstractNode(articleMeta, transAbstract);
|
|
1401
|
+
});
|
|
1397
1402
|
if (container) {
|
|
1398
1403
|
body.removeChild(container);
|
|
1399
1404
|
}
|
|
@@ -110,6 +110,11 @@ const moveAbstracts = (doc, group, createElement) => {
|
|
|
110
110
|
removeNodeFromParent(abstract);
|
|
111
111
|
group.appendChild(sec);
|
|
112
112
|
});
|
|
113
|
+
const transAbstractsSection = doc.querySelectorAll('front > article-meta > trans-abstract');
|
|
114
|
+
transAbstractsSection.forEach((transAbstract) => {
|
|
115
|
+
removeNodeFromParent(transAbstract);
|
|
116
|
+
group.appendChild(transAbstract);
|
|
117
|
+
});
|
|
113
118
|
};
|
|
114
119
|
exports.moveAbstracts = moveAbstracts;
|
|
115
120
|
const moveHeroImage = (doc) => {
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -105,6 +105,7 @@ const table_element_1 = require("./nodes/table_element");
|
|
|
105
105
|
const table_element_footer_1 = require("./nodes/table_element_footer");
|
|
106
106
|
const text_1 = require("./nodes/text");
|
|
107
107
|
const title_1 = require("./nodes/title");
|
|
108
|
+
const trans_abstract_1 = require("./nodes/trans_abstract");
|
|
108
109
|
__exportStar(require("./groups"), exports);
|
|
109
110
|
__exportStar(require("./nodes/affiliation"), exports);
|
|
110
111
|
__exportStar(require("./nodes/affiliations"), exports);
|
|
@@ -176,6 +177,7 @@ __exportStar(require("./nodes/alt_text"), exports);
|
|
|
176
177
|
__exportStar(require("./nodes/long_desc"), exports);
|
|
177
178
|
__exportStar(require("./nodes/quote_image"), exports);
|
|
178
179
|
__exportStar(require("./nodes/hero_image"), exports);
|
|
180
|
+
__exportStar(require("./nodes/trans_abstract"), exports);
|
|
179
181
|
exports.schema = new prosemirror_model_1.Schema({
|
|
180
182
|
marks: {
|
|
181
183
|
bold: marks_1.bold,
|
|
@@ -271,5 +273,6 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
271
273
|
long_desc: long_desc_1.longDesc,
|
|
272
274
|
quote_image: quote_image_1.quoteImage,
|
|
273
275
|
hero_image: hero_image_1.heroImage,
|
|
276
|
+
trans_abstract: trans_abstract_1.transAbstract,
|
|
274
277
|
},
|
|
275
278
|
});
|
|
@@ -0,0 +1,43 @@
|
|
|
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.isTransAbstractNode = exports.transAbstract = void 0;
|
|
19
|
+
const index_1 = require("../index");
|
|
20
|
+
exports.transAbstract = {
|
|
21
|
+
content: '(paragraph | element)* sections*',
|
|
22
|
+
attrs: {
|
|
23
|
+
id: { default: '' },
|
|
24
|
+
lang: { default: '' },
|
|
25
|
+
dataTracked: { default: null },
|
|
26
|
+
},
|
|
27
|
+
group: 'block element',
|
|
28
|
+
selectable: false,
|
|
29
|
+
toDOM: (node) => {
|
|
30
|
+
const { id, lang } = node.attrs;
|
|
31
|
+
return [
|
|
32
|
+
'section',
|
|
33
|
+
{
|
|
34
|
+
id,
|
|
35
|
+
lang,
|
|
36
|
+
class: 'trans-abstract',
|
|
37
|
+
},
|
|
38
|
+
0,
|
|
39
|
+
];
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const isTransAbstractNode = (node) => node.type === index_1.schema.nodes.transAbstract;
|
|
43
|
+
exports.isTransAbstractNode = isTransAbstractNode;
|
package/dist/cjs/version.js
CHANGED
|
@@ -37,22 +37,13 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
37
37
|
const normalizeID = (id) => id.replace(/:/g, '_');
|
|
38
38
|
const parser = ProsemirrorDOMParser.fromSchema(schema);
|
|
39
39
|
const insertAbstractNode = (articleMeta, abstractNode) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
'custom-meta-group',
|
|
47
|
-
];
|
|
48
|
-
for (const sibling of siblings) {
|
|
49
|
-
const siblingNode = articleMeta.querySelector(`:scope > ${sibling}`);
|
|
50
|
-
if (siblingNode) {
|
|
51
|
-
articleMeta.insertBefore(abstractNode, siblingNode);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
40
|
+
const insertBeforeElement = articleMeta.querySelector('kwd-group, funding-group, support-group, conference, counts, custom-meta-group');
|
|
41
|
+
if (insertBeforeElement) {
|
|
42
|
+
articleMeta.insertBefore(abstractNode, insertBeforeElement);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
articleMeta.appendChild(abstractNode);
|
|
54
46
|
}
|
|
55
|
-
articleMeta.appendChild(abstractNode);
|
|
56
47
|
};
|
|
57
48
|
export const createCounter = () => {
|
|
58
49
|
const counts = new Map();
|
|
@@ -556,6 +547,15 @@ export class JATSExporter {
|
|
|
556
547
|
};
|
|
557
548
|
this.createSerializer = () => {
|
|
558
549
|
const nodes = {
|
|
550
|
+
trans_abstract: (node) => {
|
|
551
|
+
const attrs = {
|
|
552
|
+
id: normalizeID(node.attrs.id),
|
|
553
|
+
};
|
|
554
|
+
if (node.attrs.lang) {
|
|
555
|
+
attrs['xml:lang'] = node.attrs.category;
|
|
556
|
+
}
|
|
557
|
+
return ['trans-abstract', attrs, 0];
|
|
558
|
+
},
|
|
559
559
|
hero_image: () => '',
|
|
560
560
|
alt_text: (node) => {
|
|
561
561
|
if (node.textContent) {
|
|
@@ -1382,10 +1382,15 @@ export class JATSExporter {
|
|
|
1382
1382
|
const container = body.querySelector(':scope > sec[sec-type="abstracts"]');
|
|
1383
1383
|
const abstractsNode = this.getFirstChildOfType(schema.nodes.abstracts);
|
|
1384
1384
|
const abstractCategories = this.getAbstractCategories(abstractsNode);
|
|
1385
|
+
const articleMeta = front.querySelector(':scope > article-meta');
|
|
1385
1386
|
const abstractSections = this.getAbstractSections(container, body, abstractCategories);
|
|
1386
1387
|
if (abstractSections.length) {
|
|
1387
1388
|
this.processAbstractSections(abstractSections, front);
|
|
1388
1389
|
}
|
|
1390
|
+
const transAbstracts = body.querySelectorAll(':scope > trans-abstract');
|
|
1391
|
+
transAbstracts.forEach((transAbstract) => {
|
|
1392
|
+
insertAbstractNode(articleMeta, transAbstract);
|
|
1393
|
+
});
|
|
1389
1394
|
if (container) {
|
|
1390
1395
|
body.removeChild(container);
|
|
1391
1396
|
}
|
|
@@ -101,6 +101,11 @@ export const moveAbstracts = (doc, group, createElement) => {
|
|
|
101
101
|
removeNodeFromParent(abstract);
|
|
102
102
|
group.appendChild(sec);
|
|
103
103
|
});
|
|
104
|
+
const transAbstractsSection = doc.querySelectorAll('front > article-meta > trans-abstract');
|
|
105
|
+
transAbstractsSection.forEach((transAbstract) => {
|
|
106
|
+
removeNodeFromParent(transAbstract);
|
|
107
|
+
group.appendChild(transAbstract);
|
|
108
|
+
});
|
|
104
109
|
};
|
|
105
110
|
export const moveHeroImage = (doc) => {
|
|
106
111
|
var _a;
|
package/dist/es/schema/index.js
CHANGED
|
@@ -88,6 +88,7 @@ import { tableElement } from './nodes/table_element';
|
|
|
88
88
|
import { tableElementFooter } from './nodes/table_element_footer';
|
|
89
89
|
import { text, textBlock } from './nodes/text';
|
|
90
90
|
import { title } from './nodes/title';
|
|
91
|
+
import { transAbstract } from './nodes/trans_abstract';
|
|
91
92
|
export * from './groups';
|
|
92
93
|
export * from './nodes/affiliation';
|
|
93
94
|
export * from './nodes/affiliations';
|
|
@@ -159,6 +160,7 @@ export * from './nodes/alt_text';
|
|
|
159
160
|
export * from './nodes/long_desc';
|
|
160
161
|
export * from './nodes/quote_image';
|
|
161
162
|
export * from './nodes/hero_image';
|
|
163
|
+
export * from './nodes/trans_abstract';
|
|
162
164
|
export const schema = new Schema({
|
|
163
165
|
marks: {
|
|
164
166
|
bold,
|
|
@@ -254,5 +256,6 @@ export const schema = new Schema({
|
|
|
254
256
|
long_desc: longDesc,
|
|
255
257
|
quote_image: quoteImage,
|
|
256
258
|
hero_image: heroImage,
|
|
259
|
+
trans_abstract: transAbstract,
|
|
257
260
|
},
|
|
258
261
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
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 transAbstract = {
|
|
18
|
+
content: '(paragraph | element)* sections*',
|
|
19
|
+
attrs: {
|
|
20
|
+
id: { default: '' },
|
|
21
|
+
lang: { default: '' },
|
|
22
|
+
dataTracked: { default: null },
|
|
23
|
+
},
|
|
24
|
+
group: 'block element',
|
|
25
|
+
selectable: false,
|
|
26
|
+
toDOM: (node) => {
|
|
27
|
+
const { id, lang } = node.attrs;
|
|
28
|
+
return [
|
|
29
|
+
'section',
|
|
30
|
+
{
|
|
31
|
+
id,
|
|
32
|
+
lang,
|
|
33
|
+
class: 'trans-abstract',
|
|
34
|
+
},
|
|
35
|
+
0,
|
|
36
|
+
];
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export const isTransAbstractNode = (node) => node.type === schema.nodes.transAbstract;
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.
|
|
1
|
+
export const VERSION = "3.0.68-LEAN-4577.1";
|
|
@@ -0,0 +1,26 @@
|
|
|
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 TransAbstractAttrs {
|
|
19
|
+
id: string;
|
|
20
|
+
lang: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TransAbstractNode extends ManuscriptNode {
|
|
23
|
+
attrs: TransAbstractAttrs;
|
|
24
|
+
}
|
|
25
|
+
export declare const transAbstract: NodeSpec;
|
|
26
|
+
export declare const isTransAbstractNode: (node: ManuscriptNode) => node is TransAbstractNode;
|
|
@@ -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';
|
|
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';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.
|
|
1
|
+
export declare const VERSION = "3.0.68-LEAN-4577.1";
|
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": "3.0.
|
|
4
|
+
"version": "3.0.68-LEAN-4577.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|