@manuscripts/transform 2.3.4-LEAN-3579.3 → 2.3.4-LEAN-3579.5
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.
|
@@ -154,7 +154,7 @@ class JATSExporter {
|
|
|
154
154
|
this.moveFloatsGroup(body, article);
|
|
155
155
|
this.removeBackContainer(body);
|
|
156
156
|
this.updateFootnoteTypes(front, back);
|
|
157
|
-
this.
|
|
157
|
+
this.fillEmptyTableFooters(article);
|
|
158
158
|
this.fillEmptyFootnotes(article);
|
|
159
159
|
}
|
|
160
160
|
await this.rewriteIDs(idGenerator);
|
|
@@ -599,7 +599,9 @@ class JATSExporter {
|
|
|
599
599
|
title: () => '',
|
|
600
600
|
affiliations: () => '',
|
|
601
601
|
contributors: () => '',
|
|
602
|
-
table_element_footer: () =>
|
|
602
|
+
table_element_footer: (node) => node.childCount == 0
|
|
603
|
+
? ['table-wrap-foot', ['fn-group', ['fn', ['p']]]]
|
|
604
|
+
: ['table-wrap-foot', 0],
|
|
603
605
|
contributor: () => '',
|
|
604
606
|
affiliation: () => '',
|
|
605
607
|
attribution: () => ['attrib', 0],
|
|
@@ -720,14 +722,9 @@ class JATSExporter {
|
|
|
720
722
|
}
|
|
721
723
|
return ['fn', attrs, 0];
|
|
722
724
|
},
|
|
723
|
-
footnotes_element: (node) =>
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
if (kind && kind.includes('table')) {
|
|
727
|
-
tag = 'table-wrap-foot';
|
|
728
|
-
}
|
|
729
|
-
return [tag, { id: normalizeID(node.attrs.id) }, 0];
|
|
730
|
-
},
|
|
725
|
+
footnotes_element: (node) => node.childCount == 0
|
|
726
|
+
? ['fn-group', { id: normalizeID(node.attrs.id) }, ['fn', ['p']]]
|
|
727
|
+
: ['fn-group', { id: normalizeID(node.attrs.id) }, 0],
|
|
731
728
|
footnotes_section: (node) => {
|
|
732
729
|
const attrs = {
|
|
733
730
|
id: normalizeID(node.attrs.id),
|
|
@@ -738,9 +735,13 @@ class JATSExporter {
|
|
|
738
735
|
hard_break: () => '',
|
|
739
736
|
highlight_marker: () => '',
|
|
740
737
|
inline_footnote: (node) => {
|
|
738
|
+
const rids = node.attrs.rids.filter(getModel);
|
|
739
|
+
if (rids.length == 0) {
|
|
740
|
+
return '';
|
|
741
|
+
}
|
|
741
742
|
const xref = this.document.createElement('xref');
|
|
742
743
|
xref.setAttribute('ref-type', 'fn');
|
|
743
|
-
xref.setAttribute('rid', normalizeID(
|
|
744
|
+
xref.setAttribute('rid', normalizeID(rids.join(' ')));
|
|
744
745
|
xref.textContent = node.attrs.contents;
|
|
745
746
|
return xref;
|
|
746
747
|
},
|
|
@@ -1701,13 +1702,15 @@ class JATSExporter {
|
|
|
1701
1702
|
}
|
|
1702
1703
|
});
|
|
1703
1704
|
}
|
|
1705
|
+
fillEmptyElements(articleElement, selector, tagName = 'p') {
|
|
1706
|
+
const emptyElements = Array.from(articleElement.querySelectorAll(selector)).filter((element) => !element.innerHTML);
|
|
1707
|
+
emptyElements.forEach((element) => element.appendChild(this.document.createElement(tagName)));
|
|
1708
|
+
}
|
|
1704
1709
|
fillEmptyFootnotes(articleElement) {
|
|
1705
|
-
|
|
1706
|
-
emptyFootnotes.forEach((fn) => fn.appendChild(this.document.createElement('p')));
|
|
1710
|
+
this.fillEmptyElements(articleElement, 'fn');
|
|
1707
1711
|
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
emptyElements.forEach((element) => element.appendChild(this.document.createElement('fn')));
|
|
1712
|
+
fillEmptyTableFooters(articleElement) {
|
|
1713
|
+
this.fillEmptyElements(articleElement, 'table-wrap-foot');
|
|
1711
1714
|
}
|
|
1712
1715
|
}
|
|
1713
1716
|
exports.JATSExporter = JATSExporter;
|
|
@@ -146,7 +146,7 @@ export class JATSExporter {
|
|
|
146
146
|
this.moveFloatsGroup(body, article);
|
|
147
147
|
this.removeBackContainer(body);
|
|
148
148
|
this.updateFootnoteTypes(front, back);
|
|
149
|
-
this.
|
|
149
|
+
this.fillEmptyTableFooters(article);
|
|
150
150
|
this.fillEmptyFootnotes(article);
|
|
151
151
|
}
|
|
152
152
|
await this.rewriteIDs(idGenerator);
|
|
@@ -591,7 +591,9 @@ export class JATSExporter {
|
|
|
591
591
|
title: () => '',
|
|
592
592
|
affiliations: () => '',
|
|
593
593
|
contributors: () => '',
|
|
594
|
-
table_element_footer: () =>
|
|
594
|
+
table_element_footer: (node) => node.childCount == 0
|
|
595
|
+
? ['table-wrap-foot', ['fn-group', ['fn', ['p']]]]
|
|
596
|
+
: ['table-wrap-foot', 0],
|
|
595
597
|
contributor: () => '',
|
|
596
598
|
affiliation: () => '',
|
|
597
599
|
attribution: () => ['attrib', 0],
|
|
@@ -712,14 +714,9 @@ export class JATSExporter {
|
|
|
712
714
|
}
|
|
713
715
|
return ['fn', attrs, 0];
|
|
714
716
|
},
|
|
715
|
-
footnotes_element: (node) =>
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (kind && kind.includes('table')) {
|
|
719
|
-
tag = 'table-wrap-foot';
|
|
720
|
-
}
|
|
721
|
-
return [tag, { id: normalizeID(node.attrs.id) }, 0];
|
|
722
|
-
},
|
|
717
|
+
footnotes_element: (node) => node.childCount == 0
|
|
718
|
+
? ['fn-group', { id: normalizeID(node.attrs.id) }, ['fn', ['p']]]
|
|
719
|
+
: ['fn-group', { id: normalizeID(node.attrs.id) }, 0],
|
|
723
720
|
footnotes_section: (node) => {
|
|
724
721
|
const attrs = {
|
|
725
722
|
id: normalizeID(node.attrs.id),
|
|
@@ -730,9 +727,13 @@ export class JATSExporter {
|
|
|
730
727
|
hard_break: () => '',
|
|
731
728
|
highlight_marker: () => '',
|
|
732
729
|
inline_footnote: (node) => {
|
|
730
|
+
const rids = node.attrs.rids.filter(getModel);
|
|
731
|
+
if (rids.length == 0) {
|
|
732
|
+
return '';
|
|
733
|
+
}
|
|
733
734
|
const xref = this.document.createElement('xref');
|
|
734
735
|
xref.setAttribute('ref-type', 'fn');
|
|
735
|
-
xref.setAttribute('rid', normalizeID(
|
|
736
|
+
xref.setAttribute('rid', normalizeID(rids.join(' ')));
|
|
736
737
|
xref.textContent = node.attrs.contents;
|
|
737
738
|
return xref;
|
|
738
739
|
},
|
|
@@ -1693,12 +1694,14 @@ export class JATSExporter {
|
|
|
1693
1694
|
}
|
|
1694
1695
|
});
|
|
1695
1696
|
}
|
|
1697
|
+
fillEmptyElements(articleElement, selector, tagName = 'p') {
|
|
1698
|
+
const emptyElements = Array.from(articleElement.querySelectorAll(selector)).filter((element) => !element.innerHTML);
|
|
1699
|
+
emptyElements.forEach((element) => element.appendChild(this.document.createElement(tagName)));
|
|
1700
|
+
}
|
|
1696
1701
|
fillEmptyFootnotes(articleElement) {
|
|
1697
|
-
|
|
1698
|
-
emptyFootnotes.forEach((fn) => fn.appendChild(this.document.createElement('p')));
|
|
1702
|
+
this.fillEmptyElements(articleElement, 'fn');
|
|
1699
1703
|
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
emptyElements.forEach((element) => element.appendChild(this.document.createElement('fn')));
|
|
1704
|
+
fillEmptyTableFooters(articleElement) {
|
|
1705
|
+
this.fillEmptyElements(articleElement, 'table-wrap-foot');
|
|
1703
1706
|
}
|
|
1704
1707
|
}
|
|
@@ -105,7 +105,8 @@ export declare class JATSExporter {
|
|
|
105
105
|
private buildContributorName;
|
|
106
106
|
private moveCoiStatementToAuthorNotes;
|
|
107
107
|
private updateFootnoteTypes;
|
|
108
|
+
private fillEmptyElements;
|
|
108
109
|
private fillEmptyFootnotes;
|
|
109
|
-
private
|
|
110
|
+
private fillEmptyTableFooters;
|
|
110
111
|
}
|
|
111
112
|
export {};
|
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": "2.3.4-LEAN-3579.
|
|
4
|
+
"version": "2.3.4-LEAN-3579.5",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|