@manuscripts/transform 4.3.18 → 4.3.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/exporter/jats-exporter.js +21 -0
- package/dist/cjs/jats/importer/jats-transformations.js +5 -2
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +21 -0
- package/dist/es/jats/importer/jats-transformations.js +5 -2
- package/dist/es/version.js +1 -1
- package/dist/types/jats/exporter/jats-exporter.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -146,6 +146,7 @@ class JATSExporter {
|
|
|
146
146
|
this.footnoteLabels = (0, footnotes_1.generateFootnoteLabels)(manuscriptNode);
|
|
147
147
|
const body = this.buildBody();
|
|
148
148
|
article.appendChild(body);
|
|
149
|
+
this.addParagraphsToSections(article);
|
|
149
150
|
const back = this.buildBack(body);
|
|
150
151
|
this.moveCoiStatementToAuthorNotes(back, front);
|
|
151
152
|
article.appendChild(back);
|
|
@@ -1620,6 +1621,26 @@ class JATSExporter {
|
|
|
1620
1621
|
const emptyElements = Array.from(articleElement.querySelectorAll(selector)).filter((element) => !element.innerHTML);
|
|
1621
1622
|
emptyElements.forEach((element) => element.appendChild(this.createElement(tagName)));
|
|
1622
1623
|
}
|
|
1624
|
+
addParagraphsToSections(articleElement) {
|
|
1625
|
+
const sections = articleElement.querySelectorAll('sec');
|
|
1626
|
+
const TITLE_TAGS = new Set(['title', 'label', 'sec-meta']);
|
|
1627
|
+
for (const section of sections) {
|
|
1628
|
+
const hasContent = Array.from(section.children).some((child) => !TITLE_TAGS.has(child.tagName));
|
|
1629
|
+
if (hasContent) {
|
|
1630
|
+
continue;
|
|
1631
|
+
}
|
|
1632
|
+
const p = this.createElement('p');
|
|
1633
|
+
const insertAfterElement = section.querySelector(':scope > title') ??
|
|
1634
|
+
section.querySelector(':scope > label') ??
|
|
1635
|
+
section.querySelector(':scope > sec-meta');
|
|
1636
|
+
if (insertAfterElement) {
|
|
1637
|
+
insertAfterElement.insertAdjacentElement('afterend', p);
|
|
1638
|
+
}
|
|
1639
|
+
else {
|
|
1640
|
+
section.prepend(p);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1623
1644
|
fillEmptyFootnotes(articleElement) {
|
|
1624
1645
|
this.fillEmptyElements(articleElement, 'fn');
|
|
1625
1646
|
}
|
|
@@ -189,15 +189,18 @@ const moveSpecialFootnotes = (doc, group, sectionCategories, createElement) => {
|
|
|
189
189
|
const section = createElement('sec');
|
|
190
190
|
const fnTitle = fn.querySelector('label') ||
|
|
191
191
|
fn.querySelector('p[content-type="fn-title"]');
|
|
192
|
+
const title = createElement('title');
|
|
192
193
|
if (fnTitle) {
|
|
193
|
-
const title = createElement('title');
|
|
194
194
|
const titleText = fnTitle.textContent?.trim();
|
|
195
195
|
if (titleText) {
|
|
196
196
|
title.textContent = titleText;
|
|
197
197
|
}
|
|
198
198
|
removeNodeFromParent(fnTitle);
|
|
199
|
-
section.append(title);
|
|
200
199
|
}
|
|
200
|
+
else {
|
|
201
|
+
title.textContent = category.titles[0];
|
|
202
|
+
}
|
|
203
|
+
section.append(title);
|
|
201
204
|
section.append(...fn.children);
|
|
202
205
|
removeNodeFromParent(fn);
|
|
203
206
|
section.setAttribute('sec-type', category.id);
|
package/dist/cjs/version.js
CHANGED
|
@@ -106,6 +106,7 @@ export class JATSExporter {
|
|
|
106
106
|
this.footnoteLabels = generateFootnoteLabels(manuscriptNode);
|
|
107
107
|
const body = this.buildBody();
|
|
108
108
|
article.appendChild(body);
|
|
109
|
+
this.addParagraphsToSections(article);
|
|
109
110
|
const back = this.buildBack(body);
|
|
110
111
|
this.moveCoiStatementToAuthorNotes(back, front);
|
|
111
112
|
article.appendChild(back);
|
|
@@ -1580,6 +1581,26 @@ export class JATSExporter {
|
|
|
1580
1581
|
const emptyElements = Array.from(articleElement.querySelectorAll(selector)).filter((element) => !element.innerHTML);
|
|
1581
1582
|
emptyElements.forEach((element) => element.appendChild(this.createElement(tagName)));
|
|
1582
1583
|
}
|
|
1584
|
+
addParagraphsToSections(articleElement) {
|
|
1585
|
+
const sections = articleElement.querySelectorAll('sec');
|
|
1586
|
+
const TITLE_TAGS = new Set(['title', 'label', 'sec-meta']);
|
|
1587
|
+
for (const section of sections) {
|
|
1588
|
+
const hasContent = Array.from(section.children).some((child) => !TITLE_TAGS.has(child.tagName));
|
|
1589
|
+
if (hasContent) {
|
|
1590
|
+
continue;
|
|
1591
|
+
}
|
|
1592
|
+
const p = this.createElement('p');
|
|
1593
|
+
const insertAfterElement = section.querySelector(':scope > title') ??
|
|
1594
|
+
section.querySelector(':scope > label') ??
|
|
1595
|
+
section.querySelector(':scope > sec-meta');
|
|
1596
|
+
if (insertAfterElement) {
|
|
1597
|
+
insertAfterElement.insertAdjacentElement('afterend', p);
|
|
1598
|
+
}
|
|
1599
|
+
else {
|
|
1600
|
+
section.prepend(p);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1583
1604
|
fillEmptyFootnotes(articleElement) {
|
|
1584
1605
|
this.fillEmptyElements(articleElement, 'fn');
|
|
1585
1606
|
}
|
|
@@ -174,15 +174,18 @@ const moveSpecialFootnotes = (doc, group, sectionCategories, createElement) => {
|
|
|
174
174
|
const section = createElement('sec');
|
|
175
175
|
const fnTitle = fn.querySelector('label') ||
|
|
176
176
|
fn.querySelector('p[content-type="fn-title"]');
|
|
177
|
+
const title = createElement('title');
|
|
177
178
|
if (fnTitle) {
|
|
178
|
-
const title = createElement('title');
|
|
179
179
|
const titleText = fnTitle.textContent?.trim();
|
|
180
180
|
if (titleText) {
|
|
181
181
|
title.textContent = titleText;
|
|
182
182
|
}
|
|
183
183
|
removeNodeFromParent(fnTitle);
|
|
184
|
-
section.append(title);
|
|
185
184
|
}
|
|
185
|
+
else {
|
|
186
|
+
title.textContent = category.titles[0];
|
|
187
|
+
}
|
|
188
|
+
section.append(title);
|
|
186
189
|
section.append(...fn.children);
|
|
187
190
|
removeNodeFromParent(fn);
|
|
188
191
|
section.setAttribute('sec-type', category.id);
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "4.3.
|
|
1
|
+
export const VERSION = "4.3.19";
|
|
@@ -88,6 +88,7 @@ export declare class JATSExporter {
|
|
|
88
88
|
private moveCoiStatementToAuthorNotes;
|
|
89
89
|
private updateFootnoteTypes;
|
|
90
90
|
private fillEmptyElements;
|
|
91
|
+
private addParagraphsToSections;
|
|
91
92
|
private fillEmptyFootnotes;
|
|
92
93
|
private fillEmptyTableFooters;
|
|
93
94
|
private fillEmptyListItem;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.3.
|
|
1
|
+
export declare const VERSION = "4.3.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": "4.3.
|
|
4
|
+
"version": "4.3.19",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|