@manuscripts/transform 1.1.3 → 1.1.4-LEAN-2410
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/jats-exporter.js +25 -1
- package/dist/cjs/schema/nodes/comment.js +1 -1
- package/dist/cjs/transformer/section-category.js +10 -1
- package/dist/es/jats/jats-exporter.js +26 -2
- package/dist/es/schema/nodes/comment.js +1 -1
- package/dist/es/transformer/section-category.js +8 -0
- package/dist/types/jats/jats-exporter.d.ts +1 -0
- package/dist/types/transformer/section-category.d.ts +1 -0
- package/package.json +1 -1
|
@@ -135,6 +135,7 @@ class JATSExporter {
|
|
|
135
135
|
const body = this.buildBody(fragment);
|
|
136
136
|
article.appendChild(body);
|
|
137
137
|
const back = this.buildBack(body);
|
|
138
|
+
this.moveCoiStatementToAuthorNotes(back, front);
|
|
138
139
|
article.appendChild(back);
|
|
139
140
|
this.moveAbstracts(front, body);
|
|
140
141
|
this.moveFloatsGroup(body, article);
|
|
@@ -1488,7 +1489,8 @@ class JATSExporter {
|
|
|
1488
1489
|
};
|
|
1489
1490
|
this.sectionToFootnote = (section, fnType) => {
|
|
1490
1491
|
const footNote = this.document.createElement('fn');
|
|
1491
|
-
|
|
1492
|
+
const footnoteType = (0, section_category_1.chooseJatsFnType)(fnType);
|
|
1493
|
+
footNote.setAttribute('fn-type', footnoteType);
|
|
1492
1494
|
const title = section.querySelector('title');
|
|
1493
1495
|
if (title) {
|
|
1494
1496
|
const footNoteTitle = this.document.createElement('p');
|
|
@@ -1568,5 +1570,27 @@ class JATSExporter {
|
|
|
1568
1570
|
}
|
|
1569
1571
|
}
|
|
1570
1572
|
}
|
|
1573
|
+
moveCoiStatementToAuthorNotes(back, front) {
|
|
1574
|
+
const fnGroups = back.querySelectorAll('fn-group');
|
|
1575
|
+
fnGroups.forEach((fnGroup) => {
|
|
1576
|
+
if (fnGroup) {
|
|
1577
|
+
const coiStatement = fnGroup.querySelector('fn[fn-type="coi-statement"]');
|
|
1578
|
+
if (coiStatement) {
|
|
1579
|
+
const authorNotes = this.document.createElement('author-notes');
|
|
1580
|
+
authorNotes.append(coiStatement);
|
|
1581
|
+
const articleMeta = front.querySelector('article-meta');
|
|
1582
|
+
if (articleMeta) {
|
|
1583
|
+
const authorNoteEl = articleMeta.querySelector('author-notes');
|
|
1584
|
+
if (authorNoteEl) {
|
|
1585
|
+
authorNoteEl.append(...authorNotes.childNodes);
|
|
1586
|
+
}
|
|
1587
|
+
else {
|
|
1588
|
+
articleMeta.appendChild(authorNotes);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1571
1595
|
}
|
|
1572
1596
|
exports.JATSExporter = JATSExporter;
|
|
@@ -21,7 +21,7 @@ exports.comment = {
|
|
|
21
21
|
id: { default: '' },
|
|
22
22
|
contents: { default: '' },
|
|
23
23
|
target: { default: '' },
|
|
24
|
-
selector: { default:
|
|
24
|
+
selector: { default: {} },
|
|
25
25
|
resolved: { default: false },
|
|
26
26
|
contributions: { default: [] },
|
|
27
27
|
originalText: { default: '' },
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.chooseSectionCategoryFromTitle = exports.chooseSectionCategory = exports.chooseSectionCategoryByType = exports.chooseSecType = exports.buildSectionCategory = exports.guessSectionCategory = exports.chooseSectionLableName = exports.chooseSectionNodeType = exports.isAnySectionNode = void 0;
|
|
18
|
+
exports.chooseSectionCategoryFromTitle = exports.chooseSectionCategory = exports.chooseSectionCategoryByType = exports.chooseSecType = exports.chooseJatsFnType = exports.buildSectionCategory = exports.guessSectionCategory = exports.chooseSectionLableName = exports.chooseSectionNodeType = exports.isAnySectionNode = void 0;
|
|
19
19
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const schema_1 = require("../schema");
|
|
21
21
|
const sectionNodeTypes = [
|
|
@@ -88,6 +88,15 @@ const buildSectionCategory = (node) => {
|
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
90
|
exports.buildSectionCategory = buildSectionCategory;
|
|
91
|
+
const chooseJatsFnType = (footnoteType) => {
|
|
92
|
+
switch (footnoteType) {
|
|
93
|
+
case 'competing-interests':
|
|
94
|
+
return 'coi-statement';
|
|
95
|
+
default:
|
|
96
|
+
return footnoteType;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
exports.chooseJatsFnType = chooseJatsFnType;
|
|
91
100
|
const chooseSecType = (sectionCategory) => {
|
|
92
101
|
const [, suffix] = sectionCategory.split(':', 2);
|
|
93
102
|
switch (suffix) {
|
|
@@ -26,7 +26,7 @@ import { buildTargets } from '../transformer/labels';
|
|
|
26
26
|
import { isExecutableNodeType, isNodeType } from '../transformer/node-types';
|
|
27
27
|
import { hasObjectType } from '../transformer/object-types';
|
|
28
28
|
import { findLatestManuscriptSubmission, findManuscript, findManuscriptById, } from '../transformer/project-bundle';
|
|
29
|
-
import { chooseSecType } from '../transformer/section-category';
|
|
29
|
+
import { chooseJatsFnType, chooseSecType, } from '../transformer/section-category';
|
|
30
30
|
import { selectVersionIds } from './jats-versions';
|
|
31
31
|
const warn = debug('manuscripts-transform');
|
|
32
32
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -128,6 +128,7 @@ export class JATSExporter {
|
|
|
128
128
|
const body = this.buildBody(fragment);
|
|
129
129
|
article.appendChild(body);
|
|
130
130
|
const back = this.buildBack(body);
|
|
131
|
+
this.moveCoiStatementToAuthorNotes(back, front);
|
|
131
132
|
article.appendChild(back);
|
|
132
133
|
this.moveAbstracts(front, body);
|
|
133
134
|
this.moveFloatsGroup(body, article);
|
|
@@ -1481,7 +1482,8 @@ export class JATSExporter {
|
|
|
1481
1482
|
};
|
|
1482
1483
|
this.sectionToFootnote = (section, fnType) => {
|
|
1483
1484
|
const footNote = this.document.createElement('fn');
|
|
1484
|
-
|
|
1485
|
+
const footnoteType = chooseJatsFnType(fnType);
|
|
1486
|
+
footNote.setAttribute('fn-type', footnoteType);
|
|
1485
1487
|
const title = section.querySelector('title');
|
|
1486
1488
|
if (title) {
|
|
1487
1489
|
const footNoteTitle = this.document.createElement('p');
|
|
@@ -1561,4 +1563,26 @@ export class JATSExporter {
|
|
|
1561
1563
|
}
|
|
1562
1564
|
}
|
|
1563
1565
|
}
|
|
1566
|
+
moveCoiStatementToAuthorNotes(back, front) {
|
|
1567
|
+
const fnGroups = back.querySelectorAll('fn-group');
|
|
1568
|
+
fnGroups.forEach((fnGroup) => {
|
|
1569
|
+
if (fnGroup) {
|
|
1570
|
+
const coiStatement = fnGroup.querySelector('fn[fn-type="coi-statement"]');
|
|
1571
|
+
if (coiStatement) {
|
|
1572
|
+
const authorNotes = this.document.createElement('author-notes');
|
|
1573
|
+
authorNotes.append(coiStatement);
|
|
1574
|
+
const articleMeta = front.querySelector('article-meta');
|
|
1575
|
+
if (articleMeta) {
|
|
1576
|
+
const authorNoteEl = articleMeta.querySelector('author-notes');
|
|
1577
|
+
if (authorNoteEl) {
|
|
1578
|
+
authorNoteEl.append(...authorNotes.childNodes);
|
|
1579
|
+
}
|
|
1580
|
+
else {
|
|
1581
|
+
articleMeta.appendChild(authorNotes);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1564
1588
|
}
|
|
@@ -18,7 +18,7 @@ export const comment = {
|
|
|
18
18
|
id: { default: '' },
|
|
19
19
|
contents: { default: '' },
|
|
20
20
|
target: { default: '' },
|
|
21
|
-
selector: { default:
|
|
21
|
+
selector: { default: {} },
|
|
22
22
|
resolved: { default: false },
|
|
23
23
|
contributions: { default: [] },
|
|
24
24
|
originalText: { default: '' },
|
|
@@ -80,6 +80,14 @@ export const buildSectionCategory = (node) => {
|
|
|
80
80
|
return node.attrs.category || undefined;
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
+
export const chooseJatsFnType = (footnoteType) => {
|
|
84
|
+
switch (footnoteType) {
|
|
85
|
+
case 'competing-interests':
|
|
86
|
+
return 'coi-statement';
|
|
87
|
+
default:
|
|
88
|
+
return footnoteType;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
83
91
|
export const chooseSecType = (sectionCategory) => {
|
|
84
92
|
const [, suffix] = sectionCategory.split(':', 2);
|
|
85
93
|
switch (suffix) {
|
|
@@ -22,6 +22,7 @@ export declare const chooseSectionNodeType: (category?: SectionCategory) => Manu
|
|
|
22
22
|
export declare const chooseSectionLableName: (type?: SecType) => string;
|
|
23
23
|
export declare const guessSectionCategory: (elements: Element[]) => SectionCategory | undefined;
|
|
24
24
|
export declare const buildSectionCategory: (node: ManuscriptNode) => SectionCategory | undefined;
|
|
25
|
+
export declare const chooseJatsFnType: (footnoteType: string) => string;
|
|
25
26
|
export declare const chooseSecType: (sectionCategory: SectionCategory) => SecType;
|
|
26
27
|
export declare const chooseSectionCategoryByType: (secType: string) => SectionCategory | undefined;
|
|
27
28
|
export declare const chooseSectionCategory: (section: HTMLElement) => SectionCategory | undefined;
|
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": "1.1.
|
|
4
|
+
"version": "1.1.4-LEAN-2410",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|