@manuscripts/transform 4.3.23 → 4.3.24

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.
@@ -1224,7 +1224,6 @@ class JATSExporter {
1224
1224
  }
1225
1225
  const tbodyRows = Array.from(tbody.childNodes);
1226
1226
  const thead = this.createElement('thead');
1227
- const tfoot = this.createElement('tfoot');
1228
1227
  tbodyRows.forEach((row, i) => {
1229
1228
  const isRow = row instanceof Element && row.tagName.toLowerCase() === 'tr';
1230
1229
  if (isRow) {
@@ -1237,18 +1236,11 @@ class JATSExporter {
1237
1236
  }
1238
1237
  thead.appendChild(row);
1239
1238
  }
1240
- else if (i === tbodyRows.length - 1) {
1241
- tbody?.removeChild(row);
1242
- tfoot.appendChild(row);
1243
- }
1244
1239
  }
1245
1240
  });
1246
1241
  if (thead.hasChildNodes()) {
1247
1242
  table.insertBefore(thead, tbody);
1248
1243
  }
1249
- if (tfoot.hasChildNodes()) {
1250
- table.insertBefore(tfoot, tbody);
1251
- }
1252
1244
  };
1253
1245
  this.unwrapBody = (body) => {
1254
1246
  const container = body.querySelector(':scope > sec[sec-type="body"]');
@@ -386,6 +386,16 @@ const fixTables = (doc, body, createElement) => {
386
386
  if (!table) {
387
387
  return;
388
388
  }
389
+ const tfoot = table.querySelector('tfoot');
390
+ const tbody = table.querySelector('tbody');
391
+ if (tfoot && tbody) {
392
+ const tfootRows = Array.from(tfoot.querySelectorAll(':scope > tr'));
393
+ for (const row of tfootRows) {
394
+ removeNodeFromParent(row);
395
+ tbody.appendChild(row);
396
+ }
397
+ removeNodeFromParent(tfoot);
398
+ }
389
399
  const colgroup = table.querySelector('colgroup');
390
400
  const cols = table.querySelectorAll('col');
391
401
  if (!colgroup && table.firstChild && cols.length > 0) {
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "4.3.23";
4
+ exports.VERSION = "4.3.24";
@@ -1184,7 +1184,6 @@ export class JATSExporter {
1184
1184
  }
1185
1185
  const tbodyRows = Array.from(tbody.childNodes);
1186
1186
  const thead = this.createElement('thead');
1187
- const tfoot = this.createElement('tfoot');
1188
1187
  tbodyRows.forEach((row, i) => {
1189
1188
  const isRow = row instanceof Element && row.tagName.toLowerCase() === 'tr';
1190
1189
  if (isRow) {
@@ -1197,18 +1196,11 @@ export class JATSExporter {
1197
1196
  }
1198
1197
  thead.appendChild(row);
1199
1198
  }
1200
- else if (i === tbodyRows.length - 1) {
1201
- tbody?.removeChild(row);
1202
- tfoot.appendChild(row);
1203
- }
1204
1199
  }
1205
1200
  });
1206
1201
  if (thead.hasChildNodes()) {
1207
1202
  table.insertBefore(thead, tbody);
1208
1203
  }
1209
- if (tfoot.hasChildNodes()) {
1210
- table.insertBefore(tfoot, tbody);
1211
- }
1212
1204
  };
1213
1205
  this.unwrapBody = (body) => {
1214
1206
  const container = body.querySelector(':scope > sec[sec-type="body"]');
@@ -364,6 +364,16 @@ export const fixTables = (doc, body, createElement) => {
364
364
  if (!table) {
365
365
  return;
366
366
  }
367
+ const tfoot = table.querySelector('tfoot');
368
+ const tbody = table.querySelector('tbody');
369
+ if (tfoot && tbody) {
370
+ const tfootRows = Array.from(tfoot.querySelectorAll(':scope > tr'));
371
+ for (const row of tfootRows) {
372
+ removeNodeFromParent(row);
373
+ tbody.appendChild(row);
374
+ }
375
+ removeNodeFromParent(tfoot);
376
+ }
367
377
  const colgroup = table.querySelector('colgroup');
368
378
  const cols = table.querySelectorAll('col');
369
379
  if (!colgroup && table.firstChild && cols.length > 0) {
@@ -1 +1 @@
1
- export const VERSION = "4.3.23";
1
+ export const VERSION = "4.3.24";
@@ -1 +1 @@
1
- export declare const VERSION = "4.3.23";
1
+ export declare const VERSION = "4.3.24";
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.23",
4
+ "version": "4.3.24",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",