@manuscripts/transform 3.0.18 → 3.0.19
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/importer/create-article-node.js +22 -4
- package/dist/cjs/jats/importer/jats-transformations.js +3 -24
- package/dist/cjs/jats/importer/parse-jats-article.js +0 -1
- package/dist/cjs/schema/nodes/body.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/importer/create-article-node.js +22 -4
- package/dist/es/jats/importer/jats-transformations.js +2 -22
- package/dist/es/jats/importer/parse-jats-article.js +1 -2
- package/dist/es/schema/nodes/body.js +1 -1
- package/dist/es/version.js +1 -1
- package/dist/types/jats/importer/create-article-node.d.ts +4 -2
- package/dist/types/jats/importer/jats-transformations.d.ts +0 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -22,9 +22,27 @@ const createArticleNode = (attrs) => {
|
|
|
22
22
|
const title = schema_1.schema.nodes.title.createChecked({
|
|
23
23
|
id: (0, transformer_1.generateNodeID)(schema_1.schema.nodes.title),
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
25
|
+
const abstracts = schema_1.schema.nodes.abstracts.createChecked({
|
|
26
|
+
id: (0, transformer_1.generateNodeID)(schema_1.schema.nodes.abstracts),
|
|
27
|
+
});
|
|
28
|
+
const paragraph = schema_1.schema.nodes.paragraph.createChecked({
|
|
29
|
+
id: (0, transformer_1.generateNodeID)(schema_1.schema.nodes.paragraph),
|
|
30
|
+
});
|
|
31
|
+
const body = schema_1.schema.nodes.body.createChecked({
|
|
32
|
+
id: (0, transformer_1.generateNodeID)(schema_1.schema.nodes.body),
|
|
33
|
+
}, paragraph);
|
|
34
|
+
const backmatter = schema_1.schema.nodes.backmatter.createChecked({
|
|
35
|
+
id: (0, transformer_1.generateNodeID)(schema_1.schema.nodes.backmatter),
|
|
36
|
+
});
|
|
37
|
+
const comments = schema_1.schema.nodes.comments.createChecked({
|
|
38
|
+
id: (0, transformer_1.generateNodeID)(schema_1.schema.nodes.comments),
|
|
39
|
+
});
|
|
40
|
+
return schema_1.schema.nodes.manuscript.createChecked(attrs, [
|
|
41
|
+
title,
|
|
42
|
+
abstracts,
|
|
43
|
+
body,
|
|
44
|
+
backmatter,
|
|
45
|
+
comments,
|
|
46
|
+
]);
|
|
29
47
|
};
|
|
30
48
|
exports.createArticleNode = createArticleNode;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.fixTables = 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 =
|
|
18
|
+
exports.fixTables = 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 = void 0;
|
|
19
19
|
const deafults_1 = require("../../lib/deafults");
|
|
20
20
|
const section_group_type_1 = require("../../lib/section-group-type");
|
|
21
21
|
const transformer_1 = require("../../transformer");
|
|
@@ -30,29 +30,6 @@ const createSectionGroup = (type, createElement) => {
|
|
|
30
30
|
sec.appendChild(title);
|
|
31
31
|
return sec;
|
|
32
32
|
};
|
|
33
|
-
const ensureSection = (body, createElement) => {
|
|
34
|
-
let section;
|
|
35
|
-
const element = body.firstElementChild;
|
|
36
|
-
if (element && element.tagName === 'sec') {
|
|
37
|
-
section = element;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
section = createElement('sec');
|
|
41
|
-
body.insertBefore(section, body.firstChild);
|
|
42
|
-
}
|
|
43
|
-
body.childNodes.forEach((child) => {
|
|
44
|
-
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
45
|
-
const element = child;
|
|
46
|
-
if (element.tagName !== 'sec') {
|
|
47
|
-
section.appendChild(element);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
section = element;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
exports.ensureSection = ensureSection;
|
|
56
33
|
const moveTitle = (front, createElement) => {
|
|
57
34
|
var _a, _b;
|
|
58
35
|
let title = front.querySelector('article-meta > title-group > article-title');
|
|
@@ -139,6 +116,8 @@ const createBoxedElementSection = (body, createElement) => {
|
|
|
139
116
|
exports.createBoxedElementSection = createBoxedElementSection;
|
|
140
117
|
const createBody = (doc, body, createElement) => {
|
|
141
118
|
const group = createSectionGroup(section_group_type_1.bodyType, createElement);
|
|
119
|
+
const paragraphs = doc.querySelectorAll('body > p');
|
|
120
|
+
group.append(...paragraphs);
|
|
142
121
|
const sections = doc.querySelectorAll('body > sec:not([sec-type="backmatter"]), body > sec:not([sec-type])');
|
|
143
122
|
sections.forEach((section) => {
|
|
144
123
|
removeNodeFromParent(section);
|
|
@@ -37,7 +37,6 @@ const processJATS = (doc) => {
|
|
|
37
37
|
if (!body) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
(0, jats_transformations_1.ensureSection)(body, createElement);
|
|
41
40
|
(0, jats_transformations_1.moveCaptionsToEnd)(body);
|
|
42
41
|
(0, jats_transformations_1.createBoxedElementSection)(body, createElement);
|
|
43
42
|
(0, jats_transformations_1.createBody)(doc, body, createElement);
|
package/dist/cjs/version.js
CHANGED
|
@@ -19,8 +19,26 @@ export const createArticleNode = (attrs) => {
|
|
|
19
19
|
const title = schema.nodes.title.createChecked({
|
|
20
20
|
id: generateNodeID(schema.nodes.title),
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
22
|
+
const abstracts = schema.nodes.abstracts.createChecked({
|
|
23
|
+
id: generateNodeID(schema.nodes.abstracts),
|
|
24
|
+
});
|
|
25
|
+
const paragraph = schema.nodes.paragraph.createChecked({
|
|
26
|
+
id: generateNodeID(schema.nodes.paragraph),
|
|
27
|
+
});
|
|
28
|
+
const body = schema.nodes.body.createChecked({
|
|
29
|
+
id: generateNodeID(schema.nodes.body),
|
|
30
|
+
}, paragraph);
|
|
31
|
+
const backmatter = schema.nodes.backmatter.createChecked({
|
|
32
|
+
id: generateNodeID(schema.nodes.backmatter),
|
|
33
|
+
});
|
|
34
|
+
const comments = schema.nodes.comments.createChecked({
|
|
35
|
+
id: generateNodeID(schema.nodes.comments),
|
|
36
|
+
});
|
|
37
|
+
return schema.nodes.manuscript.createChecked(attrs, [
|
|
38
|
+
title,
|
|
39
|
+
abstracts,
|
|
40
|
+
body,
|
|
41
|
+
backmatter,
|
|
42
|
+
comments,
|
|
43
|
+
]);
|
|
26
44
|
};
|
|
@@ -27,28 +27,6 @@ const createSectionGroup = (type, createElement) => {
|
|
|
27
27
|
sec.appendChild(title);
|
|
28
28
|
return sec;
|
|
29
29
|
};
|
|
30
|
-
export const ensureSection = (body, createElement) => {
|
|
31
|
-
let section;
|
|
32
|
-
const element = body.firstElementChild;
|
|
33
|
-
if (element && element.tagName === 'sec') {
|
|
34
|
-
section = element;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
section = createElement('sec');
|
|
38
|
-
body.insertBefore(section, body.firstChild);
|
|
39
|
-
}
|
|
40
|
-
body.childNodes.forEach((child) => {
|
|
41
|
-
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
42
|
-
const element = child;
|
|
43
|
-
if (element.tagName !== 'sec') {
|
|
44
|
-
section.appendChild(element);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
section = element;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
30
|
export const moveTitle = (front, createElement) => {
|
|
53
31
|
var _a, _b;
|
|
54
32
|
let title = front.querySelector('article-meta > title-group > article-title');
|
|
@@ -128,6 +106,8 @@ export const createBoxedElementSection = (body, createElement) => {
|
|
|
128
106
|
};
|
|
129
107
|
export const createBody = (doc, body, createElement) => {
|
|
130
108
|
const group = createSectionGroup(bodyType, createElement);
|
|
109
|
+
const paragraphs = doc.querySelectorAll('body > p');
|
|
110
|
+
group.append(...paragraphs);
|
|
131
111
|
const sections = doc.querySelectorAll('body > sec:not([sec-type="backmatter"]), body > sec:not([sec-type])');
|
|
132
112
|
sections.forEach((section) => {
|
|
133
113
|
removeNodeFromParent(section);
|
|
@@ -17,7 +17,7 @@ import { markComments } from './jats-comments';
|
|
|
17
17
|
import { jatsDOMParser } from './jats-dom-parser';
|
|
18
18
|
import { parseJournal } from './jats-journal-meta-parser';
|
|
19
19
|
import { updateDocumentIDs } from './jats-parser-utils';
|
|
20
|
-
import { createAbstracts, createBackmatter, createBody, createBoxedElementSection, createKeywordsSection, createSupplementaryMaterialsSection,
|
|
20
|
+
import { createAbstracts, createBackmatter, createBody, createBoxedElementSection, createKeywordsSection, createSupplementaryMaterialsSection, fixTables, moveAffiliations, moveAuthorNotes, moveAwards, moveCaptionsToEnd, moveContributors, moveReferencesToBackmatter, moveTitle, orderTableFootnote, } from './jats-transformations';
|
|
21
21
|
const processJATS = (doc) => {
|
|
22
22
|
const createElement = createElementFn(doc);
|
|
23
23
|
markComments(doc);
|
|
@@ -34,7 +34,6 @@ const processJATS = (doc) => {
|
|
|
34
34
|
if (!body) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
ensureSection(body, createElement);
|
|
38
37
|
moveCaptionsToEnd(body);
|
|
39
38
|
createBoxedElementSection(body, createElement);
|
|
40
39
|
createBody(doc, body, createElement);
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.
|
|
1
|
+
export const VERSION = "3.0.19";
|
|
@@ -13,5 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ManuscriptAttrs } from '../../schema';
|
|
17
|
-
export declare const createArticleNode: (attrs: Partial<ManuscriptAttrs>
|
|
16
|
+
import { ManuscriptAttrs, ManuscriptNode } from '../../schema';
|
|
17
|
+
export declare const createArticleNode: (attrs: Partial<ManuscriptAttrs> & {
|
|
18
|
+
id: string;
|
|
19
|
+
}) => ManuscriptNode;
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export type CreateElement = (tagName: string) => HTMLElement;
|
|
17
|
-
export declare const ensureSection: (body: Element, createElement: CreateElement) => void;
|
|
18
17
|
export declare const moveTitle: (front: Element, createElement: CreateElement) => void;
|
|
19
18
|
export declare const moveAuthorNotes: (front: Element, createElement: CreateElement) => void;
|
|
20
19
|
export declare const moveAwards: (front: Element) => void;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.
|
|
1
|
+
export declare const VERSION = "3.0.19";
|
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.19",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|