@manuscripts/transform 1.5.0 → 1.5.1

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.
@@ -1302,7 +1302,7 @@ class JATSExporter {
1302
1302
  authorNotesEl.appendChild(correspondingEl);
1303
1303
  });
1304
1304
  if (authorNotesEl.childNodes.length > 0) {
1305
- articleMeta.appendChild(authorNotesEl);
1305
+ articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1306
1306
  }
1307
1307
  }
1308
1308
  }
@@ -1626,7 +1626,22 @@ class JATSExporter {
1626
1626
  authorNoteEl.append(...authorNotes.childNodes);
1627
1627
  }
1628
1628
  else {
1629
- articleMeta.appendChild(authorNotes);
1629
+ const appendableSelectors = [
1630
+ 'contrib-group',
1631
+ 'title-group',
1632
+ 'article-id',
1633
+ ];
1634
+ const appendable = [
1635
+ ...articleMeta.querySelectorAll(appendableSelectors.join(', ')),
1636
+ ];
1637
+ for (let i = 0; i < appendableSelectors.length; i++) {
1638
+ const sel = appendableSelectors[i];
1639
+ const match = appendable.find((el) => el.matches(sel));
1640
+ if (match) {
1641
+ articleMeta.insertBefore(authorNotes, match.nextSibling);
1642
+ break;
1643
+ }
1644
+ }
1630
1645
  }
1631
1646
  }
1632
1647
  }
@@ -1295,7 +1295,7 @@ export class JATSExporter {
1295
1295
  authorNotesEl.appendChild(correspondingEl);
1296
1296
  });
1297
1297
  if (authorNotesEl.childNodes.length > 0) {
1298
- articleMeta.appendChild(authorNotesEl);
1298
+ articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1299
1299
  }
1300
1300
  }
1301
1301
  }
@@ -1619,7 +1619,22 @@ export class JATSExporter {
1619
1619
  authorNoteEl.append(...authorNotes.childNodes);
1620
1620
  }
1621
1621
  else {
1622
- articleMeta.appendChild(authorNotes);
1622
+ const appendableSelectors = [
1623
+ 'contrib-group',
1624
+ 'title-group',
1625
+ 'article-id',
1626
+ ];
1627
+ const appendable = [
1628
+ ...articleMeta.querySelectorAll(appendableSelectors.join(', ')),
1629
+ ];
1630
+ for (let i = 0; i < appendableSelectors.length; i++) {
1631
+ const sel = appendableSelectors[i];
1632
+ const match = appendable.find((el) => el.matches(sel));
1633
+ if (match) {
1634
+ articleMeta.insertBefore(authorNotes, match.nextSibling);
1635
+ break;
1636
+ }
1637
+ }
1623
1638
  }
1624
1639
  }
1625
1640
  }
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": "1.5.0",
4
+ "version": "1.5.1",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",