@manuscripts/transform 4.3.7 → 4.3.9
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 +1 -1
- package/dist/cjs/jats/importer/jats-dom-parser.js +2 -6
- package/dist/cjs/jats/importer/jats-transformations.js +13 -27
- package/dist/cjs/jats/importer/parse-jats-article.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +1 -1
- package/dist/es/jats/importer/jats-dom-parser.js +2 -6
- package/dist/es/jats/importer/jats-transformations.js +11 -25
- package/dist/es/jats/importer/parse-jats-article.js +1 -1
- package/dist/es/version.js +1 -1
- package/dist/types/jats/importer/jats-transformations.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1084,7 +1084,7 @@ class JATSExporter {
|
|
|
1084
1084
|
role.setAttribute('vocab', 'CRediT');
|
|
1085
1085
|
role.setAttribute('vocab-term', cr.vocabTerm);
|
|
1086
1086
|
role.setAttribute('vocab-term-identifier', creditUrl);
|
|
1087
|
-
role.
|
|
1087
|
+
role.textContent = cr.vocabTerm;
|
|
1088
1088
|
}
|
|
1089
1089
|
contrib.appendChild(role);
|
|
1090
1090
|
});
|
|
@@ -486,7 +486,7 @@ class JATSDOMParser {
|
|
|
486
486
|
{
|
|
487
487
|
tag: 'caption',
|
|
488
488
|
node: 'figcaption',
|
|
489
|
-
context: 'figure_element/|table_element/|embed/|supplement/',
|
|
489
|
+
context: 'figure_element/|table_element/|embed/|supplement/|box_element/',
|
|
490
490
|
getContent: (node, schema) => {
|
|
491
491
|
const element = node;
|
|
492
492
|
const content = [];
|
|
@@ -813,7 +813,7 @@ class JATSDOMParser {
|
|
|
813
813
|
node: 'backmatter',
|
|
814
814
|
},
|
|
815
815
|
{
|
|
816
|
-
tag: '
|
|
816
|
+
tag: 'boxed-text',
|
|
817
817
|
node: 'box_element',
|
|
818
818
|
getAttrs: (node) => {
|
|
819
819
|
const element = node;
|
|
@@ -890,10 +890,6 @@ class JATSDOMParser {
|
|
|
890
890
|
context: 'keyword_group//',
|
|
891
891
|
node: 'keyword',
|
|
892
892
|
},
|
|
893
|
-
{
|
|
894
|
-
tag: 'boxed-text',
|
|
895
|
-
ignore: true,
|
|
896
|
-
},
|
|
897
893
|
{
|
|
898
894
|
tag: 'label',
|
|
899
895
|
context: 'section/',
|
|
@@ -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.createAccessibilityItems = exports.createSupplementaryMaterialsSection = exports.createKeywordsSection = exports.moveCaptionsToEnd = exports.createBackmatter = exports.createAbstracts = exports.createBody = exports.
|
|
18
|
+
exports.fixTables = exports.createAttachments = exports.orderTableFootnote = exports.moveReferencesToBackmatter = exports.createAccessibilityItems = exports.createSupplementaryMaterialsSection = exports.createKeywordsSection = exports.moveCaptionsToEnd = exports.createBackmatter = exports.createAbstracts = exports.createBody = exports.moveHeroImage = exports.moveAbstracts = exports.moveAffiliations = exports.moveContributors = exports.moveAwards = exports.moveAuthorNotes = exports.createTitles = exports.createBoxedElementSection = exports.addMissingCaptions = void 0;
|
|
19
19
|
const deafults_1 = require("../../lib/deafults");
|
|
20
20
|
const xml_1 = require("../../lib/xml");
|
|
21
21
|
const jats_parser_utils_1 = require("./jats-parser-utils");
|
|
@@ -27,7 +27,7 @@ const createSectionGroup = (type, createElement) => {
|
|
|
27
27
|
return sec;
|
|
28
28
|
};
|
|
29
29
|
const addMissingCaptions = (doc, createElement) => {
|
|
30
|
-
const elements = doc.querySelectorAll('fig, table-wrap, media, supplementary-material');
|
|
30
|
+
const elements = doc.querySelectorAll('fig, table-wrap, media, supplementary-material, boxed-text');
|
|
31
31
|
for (const element of elements) {
|
|
32
32
|
let caption = element.querySelector('caption');
|
|
33
33
|
if (!caption) {
|
|
@@ -39,12 +39,22 @@ const addMissingCaptions = (doc, createElement) => {
|
|
|
39
39
|
if (!caption.querySelector('title')) {
|
|
40
40
|
caption.prepend(createElement('title'));
|
|
41
41
|
}
|
|
42
|
-
if (!caption.querySelector('p')) {
|
|
42
|
+
if (!caption.querySelector('p') && element.nodeName !== 'boxed-text') {
|
|
43
43
|
caption.appendChild(createElement('p'));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
exports.addMissingCaptions = addMissingCaptions;
|
|
48
|
+
const createBoxedElementSection = (doc, createElement) => {
|
|
49
|
+
const boxedTexts = doc.querySelectorAll('boxed-text');
|
|
50
|
+
for (const boxedText of boxedTexts) {
|
|
51
|
+
const containerSec = createElement('sec');
|
|
52
|
+
const children = Array.from(boxedText.children).filter((child) => child.localName !== 'label' && child.localName !== 'caption');
|
|
53
|
+
containerSec.append(...children);
|
|
54
|
+
boxedText.appendChild(containerSec);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.createBoxedElementSection = createBoxedElementSection;
|
|
48
58
|
const createTitles = (front, createElement) => {
|
|
49
59
|
const titles = createElement('titles');
|
|
50
60
|
let title = front.querySelector('article-meta > title-group > article-title');
|
|
@@ -126,30 +136,6 @@ const moveHeroImage = (doc) => {
|
|
|
126
136
|
}
|
|
127
137
|
};
|
|
128
138
|
exports.moveHeroImage = moveHeroImage;
|
|
129
|
-
const createBoxedElementSection = (body, createElement) => {
|
|
130
|
-
const boxedTexts = body.querySelectorAll('boxed-text');
|
|
131
|
-
for (const boxedText of boxedTexts) {
|
|
132
|
-
const boxElementId = boxedText.getAttribute('id');
|
|
133
|
-
const boxElementSec = createElement('sec');
|
|
134
|
-
boxElementSec.setAttribute('sec-type', 'box-element');
|
|
135
|
-
if (boxElementId) {
|
|
136
|
-
boxElementSec.setAttribute('id', boxElementId);
|
|
137
|
-
}
|
|
138
|
-
const title = createElement('title');
|
|
139
|
-
title.textContent = 'BoxElement';
|
|
140
|
-
boxElementSec.append(title);
|
|
141
|
-
for (const element of [...boxedText.children]) {
|
|
142
|
-
if (element?.tagName === 'label' || element?.tagName === 'caption') {
|
|
143
|
-
boxElementSec.append(element);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
const containerSection = createElement('sec');
|
|
147
|
-
containerSection.append(...boxedText.children);
|
|
148
|
-
boxElementSec.append(containerSection);
|
|
149
|
-
boxedText.replaceWith(boxElementSec);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
exports.createBoxedElementSection = createBoxedElementSection;
|
|
153
139
|
const createBody = (doc, body, createElement) => {
|
|
154
140
|
const group = createSectionGroup('body', createElement);
|
|
155
141
|
const elements = body.querySelectorAll(':scope > *:not(sec), :scope > sec:not([sec-type="backmatter"]), :scope > sec:not([sec-type])');
|
|
@@ -30,6 +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.createBoxedElementSection)(doc, createElement);
|
|
33
34
|
(0, jats_transformations_1.createTitles)(front, createElement);
|
|
34
35
|
(0, jats_transformations_1.moveContributors)(front, createElement);
|
|
35
36
|
(0, jats_transformations_1.moveAffiliations)(front, createElement);
|
|
@@ -45,7 +46,6 @@ const processJATS = (doc, sectionCategories) => {
|
|
|
45
46
|
article.append(body);
|
|
46
47
|
}
|
|
47
48
|
(0, jats_transformations_1.moveCaptionsToEnd)(body);
|
|
48
|
-
(0, jats_transformations_1.createBoxedElementSection)(body, createElement);
|
|
49
49
|
(0, jats_transformations_1.createBody)(doc, body, createElement);
|
|
50
50
|
(0, jats_transformations_1.createAbstracts)(front, body, createElement);
|
|
51
51
|
(0, jats_transformations_1.createBackmatter)(doc, body, sectionCategories, createElement);
|
package/dist/cjs/version.js
CHANGED
|
@@ -1044,7 +1044,7 @@ export class JATSExporter {
|
|
|
1044
1044
|
role.setAttribute('vocab', 'CRediT');
|
|
1045
1045
|
role.setAttribute('vocab-term', cr.vocabTerm);
|
|
1046
1046
|
role.setAttribute('vocab-term-identifier', creditUrl);
|
|
1047
|
-
role.
|
|
1047
|
+
role.textContent = cr.vocabTerm;
|
|
1048
1048
|
}
|
|
1049
1049
|
contrib.appendChild(role);
|
|
1050
1050
|
});
|
|
@@ -483,7 +483,7 @@ export class JATSDOMParser {
|
|
|
483
483
|
{
|
|
484
484
|
tag: 'caption',
|
|
485
485
|
node: 'figcaption',
|
|
486
|
-
context: 'figure_element/|table_element/|embed/|supplement/',
|
|
486
|
+
context: 'figure_element/|table_element/|embed/|supplement/|box_element/',
|
|
487
487
|
getContent: (node, schema) => {
|
|
488
488
|
const element = node;
|
|
489
489
|
const content = [];
|
|
@@ -810,7 +810,7 @@ export class JATSDOMParser {
|
|
|
810
810
|
node: 'backmatter',
|
|
811
811
|
},
|
|
812
812
|
{
|
|
813
|
-
tag: '
|
|
813
|
+
tag: 'boxed-text',
|
|
814
814
|
node: 'box_element',
|
|
815
815
|
getAttrs: (node) => {
|
|
816
816
|
const element = node;
|
|
@@ -887,10 +887,6 @@ export class JATSDOMParser {
|
|
|
887
887
|
context: 'keyword_group//',
|
|
888
888
|
node: 'keyword',
|
|
889
889
|
},
|
|
890
|
-
{
|
|
891
|
-
tag: 'boxed-text',
|
|
892
|
-
ignore: true,
|
|
893
|
-
},
|
|
894
890
|
{
|
|
895
891
|
tag: 'label',
|
|
896
892
|
context: 'section/',
|
|
@@ -24,7 +24,7 @@ const createSectionGroup = (type, createElement) => {
|
|
|
24
24
|
return sec;
|
|
25
25
|
};
|
|
26
26
|
export const addMissingCaptions = (doc, createElement) => {
|
|
27
|
-
const elements = doc.querySelectorAll('fig, table-wrap, media, supplementary-material');
|
|
27
|
+
const elements = doc.querySelectorAll('fig, table-wrap, media, supplementary-material, boxed-text');
|
|
28
28
|
for (const element of elements) {
|
|
29
29
|
let caption = element.querySelector('caption');
|
|
30
30
|
if (!caption) {
|
|
@@ -36,11 +36,20 @@ export const addMissingCaptions = (doc, createElement) => {
|
|
|
36
36
|
if (!caption.querySelector('title')) {
|
|
37
37
|
caption.prepend(createElement('title'));
|
|
38
38
|
}
|
|
39
|
-
if (!caption.querySelector('p')) {
|
|
39
|
+
if (!caption.querySelector('p') && element.nodeName !== 'boxed-text') {
|
|
40
40
|
caption.appendChild(createElement('p'));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
+
export const createBoxedElementSection = (doc, createElement) => {
|
|
45
|
+
const boxedTexts = doc.querySelectorAll('boxed-text');
|
|
46
|
+
for (const boxedText of boxedTexts) {
|
|
47
|
+
const containerSec = createElement('sec');
|
|
48
|
+
const children = Array.from(boxedText.children).filter((child) => child.localName !== 'label' && child.localName !== 'caption');
|
|
49
|
+
containerSec.append(...children);
|
|
50
|
+
boxedText.appendChild(containerSec);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
44
53
|
export const createTitles = (front, createElement) => {
|
|
45
54
|
const titles = createElement('titles');
|
|
46
55
|
let title = front.querySelector('article-meta > title-group > article-title');
|
|
@@ -115,29 +124,6 @@ export const moveHeroImage = (doc) => {
|
|
|
115
124
|
doc.documentElement.appendChild(heroImage);
|
|
116
125
|
}
|
|
117
126
|
};
|
|
118
|
-
export const createBoxedElementSection = (body, createElement) => {
|
|
119
|
-
const boxedTexts = body.querySelectorAll('boxed-text');
|
|
120
|
-
for (const boxedText of boxedTexts) {
|
|
121
|
-
const boxElementId = boxedText.getAttribute('id');
|
|
122
|
-
const boxElementSec = createElement('sec');
|
|
123
|
-
boxElementSec.setAttribute('sec-type', 'box-element');
|
|
124
|
-
if (boxElementId) {
|
|
125
|
-
boxElementSec.setAttribute('id', boxElementId);
|
|
126
|
-
}
|
|
127
|
-
const title = createElement('title');
|
|
128
|
-
title.textContent = 'BoxElement';
|
|
129
|
-
boxElementSec.append(title);
|
|
130
|
-
for (const element of [...boxedText.children]) {
|
|
131
|
-
if (element?.tagName === 'label' || element?.tagName === 'caption') {
|
|
132
|
-
boxElementSec.append(element);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const containerSection = createElement('sec');
|
|
136
|
-
containerSection.append(...boxedText.children);
|
|
137
|
-
boxElementSec.append(containerSection);
|
|
138
|
-
boxedText.replaceWith(boxElementSec);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
127
|
export const createBody = (doc, body, createElement) => {
|
|
142
128
|
const group = createSectionGroup('body', createElement);
|
|
143
129
|
const elements = body.querySelectorAll(':scope > *:not(sec), :scope > sec:not([sec-type="backmatter"]), :scope > sec:not([sec-type])');
|
|
@@ -27,6 +27,7 @@ const processJATS = (doc, sectionCategories) => {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
addMissingCaptions(doc, createElement);
|
|
30
|
+
createBoxedElementSection(doc, createElement);
|
|
30
31
|
createTitles(front, createElement);
|
|
31
32
|
moveContributors(front, createElement);
|
|
32
33
|
moveAffiliations(front, createElement);
|
|
@@ -42,7 +43,6 @@ const processJATS = (doc, sectionCategories) => {
|
|
|
42
43
|
article.append(body);
|
|
43
44
|
}
|
|
44
45
|
moveCaptionsToEnd(body);
|
|
45
|
-
createBoxedElementSection(body, createElement);
|
|
46
46
|
createBody(doc, body, createElement);
|
|
47
47
|
createAbstracts(front, body, createElement);
|
|
48
48
|
createBackmatter(doc, body, sectionCategories, createElement);
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "4.3.
|
|
1
|
+
export const VERSION = "4.3.9";
|
|
@@ -16,6 +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 createBoxedElementSection: (doc: Document, createElement: CreateElement) => void;
|
|
19
20
|
export declare const createTitles: (front: Element, createElement: CreateElement) => void;
|
|
20
21
|
export declare const moveAuthorNotes: (front: Element, createElement: CreateElement) => void;
|
|
21
22
|
export declare const moveAwards: (front: Element) => void;
|
|
@@ -23,7 +24,6 @@ export declare const moveContributors: (front: Element, createElement: CreateEle
|
|
|
23
24
|
export declare const moveAffiliations: (front: Element, createElement: CreateElement) => void;
|
|
24
25
|
export declare const moveAbstracts: (front: Element, group: Element, createElement: CreateElement) => void;
|
|
25
26
|
export declare const moveHeroImage: (doc: Document) => void;
|
|
26
|
-
export declare const createBoxedElementSection: (body: Element, createElement: (tagName: string) => HTMLElement) => void;
|
|
27
27
|
export declare const createBody: (doc: Document, body: Element, createElement: CreateElement) => void;
|
|
28
28
|
export declare const createAbstracts: (front: Element, body: Element, createElement: CreateElement) => void;
|
|
29
29
|
export declare const createBackmatter: (doc: Document, body: Element, sectionCategories: SectionCategory[], createElement: CreateElement) => void;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.3.
|
|
1
|
+
export declare const VERSION = "4.3.9";
|
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.
|
|
4
|
+
"version": "4.3.9",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|