@manuscripts/transform 3.0.44-LEAN-4351.1 → 3.0.44
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 +5 -11
- package/dist/cjs/jats/importer/jats-dom-parser.js +0 -1
- package/dist/cjs/jats/importer/jats-transformations.js +13 -17
- package/dist/cjs/jats/importer/parse-jats-article.js +1 -1
- package/dist/cjs/schema/migration/migration-scripts/index.js +0 -2
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/schema/nodes/title.js +0 -1
- package/dist/cjs/transformer/node-names.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +5 -11
- package/dist/es/jats/importer/jats-dom-parser.js +0 -1
- package/dist/es/jats/importer/jats-transformations.js +11 -15
- package/dist/es/jats/importer/parse-jats-article.js +2 -2
- package/dist/es/schema/migration/migration-scripts/index.js +0 -2
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/schema/nodes/title.js +0 -1
- package/dist/es/transformer/node-names.js +1 -1
- package/dist/es/version.js +1 -1
- package/dist/types/jats/importer/jats-transformations.d.ts +1 -1
- package/dist/types/schema/migration/migration-scripts/index.d.ts +1 -2
- package/dist/types/schema/nodes/title.d.ts +3 -3
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/schema/migration/migration-scripts/3.0.44.js +0 -15
- package/dist/es/schema/migration/migration-scripts/3.0.44.js +0 -13
- package/dist/types/schema/migration/migration-scripts/3.0.44.d.ts +0 -8
|
@@ -209,7 +209,8 @@ class JATSExporter {
|
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
this.buildFront = (journal) => {
|
|
212
|
-
|
|
212
|
+
var _a;
|
|
213
|
+
const titleNode = (_a = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.title)[0]) === null || _a === void 0 ? void 0 : _a.node;
|
|
213
214
|
const front = this.document.createElement('front');
|
|
214
215
|
const journalMeta = this.document.createElement('journal-meta');
|
|
215
216
|
front.appendChild(journalMeta);
|
|
@@ -272,18 +273,11 @@ class JATSExporter {
|
|
|
272
273
|
const titleGroup = this.document.createElement('title-group');
|
|
273
274
|
articleMeta.appendChild(titleGroup);
|
|
274
275
|
this.buildContributors(articleMeta);
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (titleNode.attrs.type === 'primary') {
|
|
278
|
-
element = this.document.createElement('article-title');
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
element = this.document.createElement('alt-title');
|
|
282
|
-
element.setAttribute('alt-title-type', titleNode.attrs.type);
|
|
283
|
-
}
|
|
276
|
+
if (titleNode) {
|
|
277
|
+
const element = this.document.createElement('article-title');
|
|
284
278
|
this.setTitleContent(element, titleNode.textContent);
|
|
285
279
|
titleGroup.appendChild(element);
|
|
286
|
-
}
|
|
280
|
+
}
|
|
287
281
|
const supplementsNodes = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.supplement);
|
|
288
282
|
supplementsNodes.forEach(({ node }) => {
|
|
289
283
|
var _a, _b, _c, _d;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.fixTables = exports.createAttachments = exports.orderTableFootnote = exports.moveReferencesToBackmatter = exports.createSupplementaryMaterialsSection = exports.createKeywordsSection = exports.moveCaptionsToEnd = exports.createBackmatter = exports.createAbstracts = exports.createBody = exports.createBoxedElementSection = exports.moveAbstracts = exports.moveAffiliations = exports.moveContributors = exports.moveAwards = exports.moveAuthorNotes = exports.
|
|
18
|
+
exports.fixTables = exports.createAttachments = exports.orderTableFootnote = exports.moveReferencesToBackmatter = exports.createSupplementaryMaterialsSection = exports.createKeywordsSection = exports.moveCaptionsToEnd = exports.createBackmatter = exports.createAbstracts = exports.createBody = exports.createBoxedElementSection = exports.moveAbstracts = exports.moveAffiliations = exports.moveContributors = exports.moveAwards = exports.moveAuthorNotes = exports.moveTitle = exports.addMissingCaptions = void 0;
|
|
19
19
|
const deafults_1 = require("../../lib/deafults");
|
|
20
20
|
const jats_parser_utils_1 = require("./jats-parser-utils");
|
|
21
21
|
const removeNodeFromParent = (node) => node.parentNode && node.parentNode.removeChild(node);
|
|
@@ -44,23 +44,19 @@ const addMissingCaptions = (doc, createElement) => {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
exports.addMissingCaptions = addMissingCaptions;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
insertTitle('article-meta > title-group > article-title', 'primary', deafults_1.defaultTitle);
|
|
60
|
-
insertTitle('article-meta > title-group > alt-title[alt-title-type="running"]', 'running');
|
|
61
|
-
insertTitle('article-meta > title-group > alt-title[alt-title-type="short"]', 'short');
|
|
47
|
+
const moveTitle = (front, createElement) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
let title = front.querySelector('article-meta > title-group > article-title');
|
|
50
|
+
if (title) {
|
|
51
|
+
title.innerHTML = (_a = (0, jats_parser_utils_1.htmlFromJatsNode)(title, createElement)) !== null && _a !== void 0 ? _a : deafults_1.defaultTitle;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
title = createElement('article-title');
|
|
55
|
+
title.innerHTML = deafults_1.defaultTitle;
|
|
56
|
+
}
|
|
57
|
+
(_b = front.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(title, front);
|
|
62
58
|
};
|
|
63
|
-
exports.
|
|
59
|
+
exports.moveTitle = moveTitle;
|
|
64
60
|
const moveAuthorNotes = (front, createElement) => {
|
|
65
61
|
var _a;
|
|
66
62
|
const authorNotes = front.querySelector('article-meta > author-notes');
|
|
@@ -30,7 +30,7 @@ const processJATS = (doc, sectionCategories) => {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
(0, jats_transformations_1.addMissingCaptions)(doc, createElement);
|
|
33
|
-
(0, jats_transformations_1.
|
|
33
|
+
(0, jats_transformations_1.moveTitle)(front, createElement);
|
|
34
34
|
(0, jats_transformations_1.moveContributors)(front, createElement);
|
|
35
35
|
(0, jats_transformations_1.moveAffiliations)(front, createElement);
|
|
36
36
|
(0, jats_transformations_1.moveAuthorNotes)(front, createElement);
|
|
@@ -25,7 +25,6 @@ const _3_0_21_1 = __importDefault(require("./3.0.21"));
|
|
|
25
25
|
const _3_0_30_1 = __importDefault(require("./3.0.30"));
|
|
26
26
|
const _3_0_31_1 = __importDefault(require("./3.0.31"));
|
|
27
27
|
const _3_0_41_1 = __importDefault(require("./3.0.41"));
|
|
28
|
-
const _3_0_44_1 = __importDefault(require("./3.0.44"));
|
|
29
28
|
const migrations = [
|
|
30
29
|
new _1_2_5_1.default(),
|
|
31
30
|
new _2_3_22_1.default(),
|
|
@@ -34,6 +33,5 @@ const migrations = [
|
|
|
34
33
|
new _3_0_30_1.default(),
|
|
35
34
|
new _3_0_31_1.default(),
|
|
36
35
|
new _3_0_41_1.default(),
|
|
37
|
-
new _3_0_44_1.default(),
|
|
38
36
|
];
|
|
39
37
|
exports.default = migrations;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isManuscriptNode = exports.manuscript = void 0;
|
|
19
19
|
exports.manuscript = {
|
|
20
|
-
content: 'title
|
|
20
|
+
content: 'title? contributors? affiliations? author_notes? awards? keywords? supplements? abstracts body backmatter comments attachments?',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
doi: { default: '' },
|
|
@@ -57,5 +57,5 @@ exports.nodeNames = new Map([
|
|
|
57
57
|
[schema_1.schema.nodes.table_element, 'Table'],
|
|
58
58
|
[schema_1.schema.nodes.blockquote_element, 'Block Quote'],
|
|
59
59
|
[schema_1.schema.nodes.pullquote_element, 'Pull Quote'],
|
|
60
|
-
[schema_1.schema.nodes.box_element, '
|
|
60
|
+
[schema_1.schema.nodes.box_element, 'Box'],
|
|
61
61
|
]);
|
package/dist/cjs/version.js
CHANGED
|
@@ -201,7 +201,8 @@ export class JATSExporter {
|
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
203
|
this.buildFront = (journal) => {
|
|
204
|
-
|
|
204
|
+
var _a;
|
|
205
|
+
const titleNode = (_a = findChildrenByType(this.manuscriptNode, schema.nodes.title)[0]) === null || _a === void 0 ? void 0 : _a.node;
|
|
205
206
|
const front = this.document.createElement('front');
|
|
206
207
|
const journalMeta = this.document.createElement('journal-meta');
|
|
207
208
|
front.appendChild(journalMeta);
|
|
@@ -264,18 +265,11 @@ export class JATSExporter {
|
|
|
264
265
|
const titleGroup = this.document.createElement('title-group');
|
|
265
266
|
articleMeta.appendChild(titleGroup);
|
|
266
267
|
this.buildContributors(articleMeta);
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
if (titleNode.attrs.type === 'primary') {
|
|
270
|
-
element = this.document.createElement('article-title');
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
element = this.document.createElement('alt-title');
|
|
274
|
-
element.setAttribute('alt-title-type', titleNode.attrs.type);
|
|
275
|
-
}
|
|
268
|
+
if (titleNode) {
|
|
269
|
+
const element = this.document.createElement('article-title');
|
|
276
270
|
this.setTitleContent(element, titleNode.textContent);
|
|
277
271
|
titleGroup.appendChild(element);
|
|
278
|
-
}
|
|
272
|
+
}
|
|
279
273
|
const supplementsNodes = findChildrenByType(this.manuscriptNode, schema.nodes.supplement);
|
|
280
274
|
supplementsNodes.forEach(({ node }) => {
|
|
281
275
|
var _a, _b, _c, _d;
|
|
@@ -40,21 +40,17 @@ export const addMissingCaptions = (doc, createElement) => {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
export const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
insertTitle('article-meta > title-group > article-title', 'primary', defaultTitle);
|
|
56
|
-
insertTitle('article-meta > title-group > alt-title[alt-title-type="running"]', 'running');
|
|
57
|
-
insertTitle('article-meta > title-group > alt-title[alt-title-type="short"]', 'short');
|
|
43
|
+
export const moveTitle = (front, createElement) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
let title = front.querySelector('article-meta > title-group > article-title');
|
|
46
|
+
if (title) {
|
|
47
|
+
title.innerHTML = (_a = htmlFromJatsNode(title, createElement)) !== null && _a !== void 0 ? _a : defaultTitle;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
title = createElement('article-title');
|
|
51
|
+
title.innerHTML = defaultTitle;
|
|
52
|
+
}
|
|
53
|
+
(_b = front.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(title, front);
|
|
58
54
|
};
|
|
59
55
|
export const moveAuthorNotes = (front, createElement) => {
|
|
60
56
|
var _a;
|
|
@@ -18,7 +18,7 @@ import { markComments } from './jats-comments';
|
|
|
18
18
|
import { JATSDOMParser } from './jats-dom-parser';
|
|
19
19
|
import { parseJournal } from './jats-journal-meta-parser';
|
|
20
20
|
import { updateDocumentIDs } from './jats-parser-utils';
|
|
21
|
-
import { addMissingCaptions, createAbstracts, createAttachments, createBackmatter, createBody, createBoxedElementSection, createKeywordsSection, createSupplementaryMaterialsSection,
|
|
21
|
+
import { addMissingCaptions, createAbstracts, createAttachments, createBackmatter, createBody, createBoxedElementSection, createKeywordsSection, createSupplementaryMaterialsSection, fixTables, moveAffiliations, moveAuthorNotes, moveAwards, moveCaptionsToEnd, moveContributors, moveReferencesToBackmatter, moveTitle, orderTableFootnote, } from './jats-transformations';
|
|
22
22
|
const processJATS = (doc, sectionCategories) => {
|
|
23
23
|
const createElement = createElementFn(doc);
|
|
24
24
|
markComments(doc);
|
|
@@ -27,7 +27,7 @@ const processJATS = (doc, sectionCategories) => {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
addMissingCaptions(doc, createElement);
|
|
30
|
-
|
|
30
|
+
moveTitle(front, createElement);
|
|
31
31
|
moveContributors(front, createElement);
|
|
32
32
|
moveAffiliations(front, createElement);
|
|
33
33
|
moveAuthorNotes(front, createElement);
|
|
@@ -20,7 +20,6 @@ import Migration3021 from './3.0.21';
|
|
|
20
20
|
import Migration3030 from './3.0.30';
|
|
21
21
|
import Migration3031 from './3.0.31';
|
|
22
22
|
import Migration3041 from './3.0.41';
|
|
23
|
-
import Migration3044 from './3.0.44';
|
|
24
23
|
const migrations = [
|
|
25
24
|
new Migration125(),
|
|
26
25
|
new Migration2322(),
|
|
@@ -29,6 +28,5 @@ const migrations = [
|
|
|
29
28
|
new Migration3030(),
|
|
30
29
|
new Migration3031(),
|
|
31
30
|
new Migration3041(),
|
|
32
|
-
new Migration3044(),
|
|
33
31
|
];
|
|
34
32
|
export default migrations;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const manuscript = {
|
|
17
|
-
content: 'title
|
|
17
|
+
content: 'title? contributors? affiliations? author_notes? awards? keywords? supplements? abstracts body backmatter comments attachments?',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
doi: { default: '' },
|
|
@@ -54,5 +54,5 @@ export const nodeNames = new Map([
|
|
|
54
54
|
[schema.nodes.table_element, 'Table'],
|
|
55
55
|
[schema.nodes.blockquote_element, 'Block Quote'],
|
|
56
56
|
[schema.nodes.pullquote_element, 'Pull Quote'],
|
|
57
|
-
[schema.nodes.box_element, '
|
|
57
|
+
[schema.nodes.box_element, 'Box'],
|
|
58
58
|
]);
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.44
|
|
1
|
+
export const VERSION = "3.0.44";
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { SectionCategory } from '../../schema';
|
|
17
17
|
export type CreateElement = (tagName: string) => HTMLElement;
|
|
18
18
|
export declare const addMissingCaptions: (doc: Document, createElement: CreateElement) => void;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const moveTitle: (front: Element, createElement: CreateElement) => void;
|
|
20
20
|
export declare const moveAuthorNotes: (front: Element, createElement: CreateElement) => void;
|
|
21
21
|
export declare const moveAwards: (front: Element) => void;
|
|
22
22
|
export declare const moveContributors: (front: Element, createElement: CreateElement) => void;
|
|
@@ -20,6 +20,5 @@ import Migration3021 from './3.0.21';
|
|
|
20
20
|
import Migration3030 from './3.0.30';
|
|
21
21
|
import Migration3031 from './3.0.31';
|
|
22
22
|
import Migration3041 from './3.0.41';
|
|
23
|
-
|
|
24
|
-
declare const migrations: (Migration125 | Migration2322 | Migration3012 | Migration3021 | Migration3030 | Migration3031 | Migration3041 | Migration3044)[];
|
|
23
|
+
declare const migrations: (Migration125 | Migration2322 | Migration3012 | Migration3021 | Migration3030 | Migration3031 | Migration3041)[];
|
|
25
24
|
export default migrations;
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
|
-
|
|
18
|
+
interface Attrs {
|
|
19
19
|
id: string;
|
|
20
|
-
type: string;
|
|
21
20
|
placeholder: string;
|
|
22
21
|
}
|
|
23
22
|
export interface TitleNode extends ManuscriptNode {
|
|
24
|
-
attrs:
|
|
23
|
+
attrs: Attrs;
|
|
25
24
|
}
|
|
26
25
|
export declare const title: NodeSpec;
|
|
26
|
+
export {};
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.44
|
|
1
|
+
export declare const VERSION = "3.0.44";
|
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.44
|
|
4
|
+
"version": "3.0.44",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"husky": "^8.0.2",
|
|
75
75
|
"jest": "^29.3.1",
|
|
76
76
|
"jest-environment-jsdom": "^29.3.1",
|
|
77
|
-
"libxmljs2": "^0.
|
|
77
|
+
"libxmljs2": "^0.33.0",
|
|
78
78
|
"migration-base": "npm:@manuscripts/transform@2.3.20",
|
|
79
79
|
"npm-run-all": "^4.1.5",
|
|
80
80
|
"prettier": "^2.8.1",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class Migration3044 {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.fromVersion = '3.0.43';
|
|
6
|
-
this.toVersion = '3.0.44';
|
|
7
|
-
}
|
|
8
|
-
migrateNode(node) {
|
|
9
|
-
if (node.type === 'title') {
|
|
10
|
-
return Object.assign(Object.assign({}, node), { attrs: Object.assign(Object.assign({}, node.attrs), { type: 'primary' }) });
|
|
11
|
-
}
|
|
12
|
-
return node;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.default = Migration3044;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
class Migration3044 {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.fromVersion = '3.0.43';
|
|
4
|
-
this.toVersion = '3.0.44';
|
|
5
|
-
}
|
|
6
|
-
migrateNode(node) {
|
|
7
|
-
if (node.type === 'title') {
|
|
8
|
-
return Object.assign(Object.assign({}, node), { attrs: Object.assign(Object.assign({}, node.attrs), { type: 'primary' }) });
|
|
9
|
-
}
|
|
10
|
-
return node;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export default Migration3044;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { JSONNode } from '../migrate';
|
|
2
|
-
import { MigrationScript } from '../migration-script';
|
|
3
|
-
declare class Migration3044 implements MigrationScript {
|
|
4
|
-
fromVersion: string;
|
|
5
|
-
toVersion: string;
|
|
6
|
-
migrateNode(node: JSONNode): JSONNode;
|
|
7
|
-
}
|
|
8
|
-
export default Migration3044;
|