@manuscripts/transform 2.1.6 → 2.1.7
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,6 +154,7 @@ class JATSExporter {
|
|
|
154
154
|
this.moveFloatsGroup(body, article);
|
|
155
155
|
this.removeBackContainer(body);
|
|
156
156
|
this.updateFootnoteTypes(front, back);
|
|
157
|
+
this.fillEmptyFootnotes(article);
|
|
157
158
|
}
|
|
158
159
|
await this.rewriteIDs(idGenerator);
|
|
159
160
|
if (mediaPathGenerator) {
|
|
@@ -1706,5 +1707,9 @@ class JATSExporter {
|
|
|
1706
1707
|
}
|
|
1707
1708
|
});
|
|
1708
1709
|
}
|
|
1710
|
+
fillEmptyFootnotes(articleElement) {
|
|
1711
|
+
const emptyFootnotes = Array.from(articleElement.querySelectorAll('fn')).filter((fn) => { var _a; return !((_a = fn.textContent) === null || _a === void 0 ? void 0 : _a.trim()); });
|
|
1712
|
+
emptyFootnotes.forEach((fn) => fn.appendChild(this.document.createElement('p')));
|
|
1713
|
+
}
|
|
1709
1714
|
}
|
|
1710
1715
|
exports.JATSExporter = JATSExporter;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { getModelsByType, ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
import { CitationProvider } from '@manuscripts/library';
|
|
18
18
|
import debug from 'debug';
|
|
19
|
-
import { DOMParser as
|
|
19
|
+
import { DOMParser as ProsemirrorDOMParser, DOMSerializer, } from 'prosemirror-model';
|
|
20
20
|
import serializeToXML from 'w3c-xmlserializer';
|
|
21
21
|
import { nodeFromHTML, textFromHTML } from '../lib/html';
|
|
22
22
|
import { normalizeStyleName } from '../lib/styled-content';
|
|
@@ -32,7 +32,7 @@ import { selectVersionIds } from './jats-versions';
|
|
|
32
32
|
const warn = debug('manuscripts-transform');
|
|
33
33
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
34
34
|
const normalizeID = (id) => id.replace(/:/g, '_');
|
|
35
|
-
const parser =
|
|
35
|
+
const parser = ProsemirrorDOMParser.fromSchema(schema);
|
|
36
36
|
const findChildNodeOfType = (node, nodeType) => {
|
|
37
37
|
for (const child of iterateChildren(node)) {
|
|
38
38
|
if (child.type === nodeType) {
|
|
@@ -146,6 +146,7 @@ export class JATSExporter {
|
|
|
146
146
|
this.moveFloatsGroup(body, article);
|
|
147
147
|
this.removeBackContainer(body);
|
|
148
148
|
this.updateFootnoteTypes(front, back);
|
|
149
|
+
this.fillEmptyFootnotes(article);
|
|
149
150
|
}
|
|
150
151
|
await this.rewriteIDs(idGenerator);
|
|
151
152
|
if (mediaPathGenerator) {
|
|
@@ -1698,4 +1699,8 @@ export class JATSExporter {
|
|
|
1698
1699
|
}
|
|
1699
1700
|
});
|
|
1700
1701
|
}
|
|
1702
|
+
fillEmptyFootnotes(articleElement) {
|
|
1703
|
+
const emptyFootnotes = Array.from(articleElement.querySelectorAll('fn')).filter((fn) => { var _a; return !((_a = fn.textContent) === null || _a === void 0 ? void 0 : _a.trim()); });
|
|
1704
|
+
emptyFootnotes.forEach((fn) => fn.appendChild(this.document.createElement('p')));
|
|
1705
|
+
}
|
|
1701
1706
|
}
|
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.1.
|
|
4
|
+
"version": "2.1.7",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|