@manuscripts/transform 2.1.1-LEAN-3336-23 → 2.1.1-LEAN-3336-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.
@@ -252,7 +252,7 @@ exports.jatsBodyTransformations = {
252
252
  for (const col of cols) {
253
253
  colgroup.appendChild(col);
254
254
  }
255
- tableWrap.insertBefore(colgroup, tableWrap.firstChild);
255
+ tableWrap.insertBefore(colgroup, table.nextSibling);
256
256
  }
257
257
  });
258
258
  },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.tableElement = void 0;
19
19
  exports.tableElement = {
20
- content: 'table_colgroup? (table | placeholder) table_element_footer? figcaption? (listing | placeholder)',
20
+ content: '(table | placeholder) table_colgroup? table_element_footer? figcaption? (listing | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  paragraphStyle: { default: '' },
@@ -573,20 +573,16 @@ class Decoder {
573
573
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
574
574
  const content = [table];
575
575
  if (tableColGroup) {
576
- content.unshift(tableColGroup);
576
+ content.push(tableColGroup);
577
577
  }
578
578
  if (tableElementFooter) {
579
579
  content.push(tableElementFooter);
580
580
  }
581
581
  content.push(figcaption);
582
- if (model.listingID) {
583
- const listing = this.createListing(model.listingID);
584
- content.push(listing);
585
- }
586
- else {
587
- const listing = schema_1.schema.nodes.listing.create();
588
- content.push(listing);
589
- }
582
+ const listing = model.listingID
583
+ ? this.createListing(model.listingID)
584
+ : schema_1.schema.nodes.listing.create();
585
+ content.push(listing);
590
586
  return schema_1.schema.nodes.table_element.createChecked({
591
587
  id: model._id,
592
588
  table: model.containedObjectID,
@@ -775,26 +771,26 @@ class Decoder {
775
771
  this.allowMissingElements = allowMissingElements;
776
772
  }
777
773
  createTable(model) {
778
- const tableId = model.containedObjectID;
779
- const tableModel = this.getModel(tableId);
774
+ const tableID = model.containedObjectID;
775
+ const tableModel = this.getModel(tableID);
780
776
  let table;
781
777
  if (tableModel) {
782
778
  table = this.decode(tableModel);
783
779
  }
784
780
  else if (this.allowMissingElements) {
785
781
  table = schema_1.schema.nodes.placeholder.create({
786
- id: tableId,
782
+ id: tableID,
787
783
  label: 'A table',
788
784
  });
789
785
  }
790
786
  else {
791
- throw new errors_1.MissingElement(tableId);
787
+ throw new errors_1.MissingElement(tableID);
792
788
  }
793
789
  return table;
794
790
  }
795
791
  createTableColGroup(model) {
796
- const tableId = model.containedObjectID;
797
- const tableModel = this.getModel(tableId);
792
+ const tableID = model.containedObjectID;
793
+ const tableModel = this.getModel(tableID);
798
794
  if (!tableModel || !tableModel.contents.includes('<colgroup>')) {
799
795
  return undefined;
800
796
  }
@@ -249,7 +249,7 @@ export const jatsBodyTransformations = {
249
249
  for (const col of cols) {
250
250
  colgroup.appendChild(col);
251
251
  }
252
- tableWrap.insertBefore(colgroup, tableWrap.firstChild);
252
+ tableWrap.insertBefore(colgroup, table.nextSibling);
253
253
  }
254
254
  });
255
255
  },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const tableElement = {
17
- content: 'table_colgroup? (table | placeholder) table_element_footer? figcaption? (listing | placeholder)',
17
+ content: '(table | placeholder) table_colgroup? table_element_footer? figcaption? (listing | placeholder)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  paragraphStyle: { default: '' },
@@ -564,20 +564,16 @@ export class Decoder {
564
564
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
565
565
  const content = [table];
566
566
  if (tableColGroup) {
567
- content.unshift(tableColGroup);
567
+ content.push(tableColGroup);
568
568
  }
569
569
  if (tableElementFooter) {
570
570
  content.push(tableElementFooter);
571
571
  }
572
572
  content.push(figcaption);
573
- if (model.listingID) {
574
- const listing = this.createListing(model.listingID);
575
- content.push(listing);
576
- }
577
- else {
578
- const listing = schema.nodes.listing.create();
579
- content.push(listing);
580
- }
573
+ const listing = model.listingID
574
+ ? this.createListing(model.listingID)
575
+ : schema.nodes.listing.create();
576
+ content.push(listing);
581
577
  return schema.nodes.table_element.createChecked({
582
578
  id: model._id,
583
579
  table: model.containedObjectID,
@@ -766,26 +762,26 @@ export class Decoder {
766
762
  this.allowMissingElements = allowMissingElements;
767
763
  }
768
764
  createTable(model) {
769
- const tableId = model.containedObjectID;
770
- const tableModel = this.getModel(tableId);
765
+ const tableID = model.containedObjectID;
766
+ const tableModel = this.getModel(tableID);
771
767
  let table;
772
768
  if (tableModel) {
773
769
  table = this.decode(tableModel);
774
770
  }
775
771
  else if (this.allowMissingElements) {
776
772
  table = schema.nodes.placeholder.create({
777
- id: tableId,
773
+ id: tableID,
778
774
  label: 'A table',
779
775
  });
780
776
  }
781
777
  else {
782
- throw new MissingElement(tableId);
778
+ throw new MissingElement(tableID);
783
779
  }
784
780
  return table;
785
781
  }
786
782
  createTableColGroup(model) {
787
- const tableId = model.containedObjectID;
788
- const tableModel = this.getModel(tableId);
783
+ const tableID = model.containedObjectID;
784
+ const tableModel = this.getModel(tableID);
789
785
  if (!tableModel || !tableModel.contents.includes('<colgroup>')) {
790
786
  return undefined;
791
787
  }
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.1-LEAN-3336-23",
4
+ "version": "2.1.1-LEAN-3336-24",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",