@manuscripts/transform 3.0.10-LEAN-3961.0 → 3.0.10

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.
Files changed (46) hide show
  1. package/dist/cjs/index.js +2 -0
  2. package/dist/cjs/jats/exporter/jats-exporter.js +9 -12
  3. package/dist/cjs/jats/importer/jats-dom-parser.js +945 -978
  4. package/dist/cjs/jats/importer/jats-transformations.js +6 -6
  5. package/dist/cjs/jats/importer/parse-jats-article.js +5 -7
  6. package/dist/cjs/lib/footnotes.js +63 -0
  7. package/dist/cjs/lib/table-cell-styles.js +52 -0
  8. package/dist/cjs/schema/nodes/general_table_footnote.js +3 -1
  9. package/dist/cjs/schema/nodes/inline_footnote.js +5 -5
  10. package/dist/cjs/schema/nodes/table_element.js +3 -1
  11. package/dist/cjs/schema/nodes/table_element_footer.js +3 -1
  12. package/dist/cjs/transformer/id.js +6 -4
  13. package/dist/cjs/transformer/index.js +1 -0
  14. package/dist/cjs/transformer/section-category.js +268 -0
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/es/index.js +2 -0
  17. package/dist/es/jats/exporter/jats-exporter.js +10 -13
  18. package/dist/es/jats/importer/jats-dom-parser.js +944 -976
  19. package/dist/es/jats/importer/jats-transformations.js +6 -6
  20. package/dist/es/jats/importer/parse-jats-article.js +6 -8
  21. package/dist/es/lib/footnotes.js +56 -0
  22. package/dist/es/lib/table-cell-styles.js +47 -0
  23. package/dist/es/schema/nodes/general_table_footnote.js +1 -0
  24. package/dist/es/schema/nodes/inline_footnote.js +5 -5
  25. package/dist/es/schema/nodes/table_element.js +1 -0
  26. package/dist/es/schema/nodes/table_element_footer.js +1 -0
  27. package/dist/es/transformer/id.js +6 -4
  28. package/dist/es/transformer/index.js +1 -0
  29. package/dist/es/transformer/section-category.js +254 -0
  30. package/dist/es/version.js +1 -1
  31. package/dist/types/index.d.ts +2 -0
  32. package/dist/types/jats/exporter/jats-exporter.d.ts +1 -0
  33. package/dist/types/jats/importer/jats-dom-parser.d.ts +9 -25
  34. package/dist/types/jats/importer/jats-transformations.d.ts +1 -2
  35. package/dist/types/jats/importer/parse-jats-article.d.ts +2 -2
  36. package/dist/types/lib/footnotes.d.ts +5 -0
  37. package/dist/types/lib/table-cell-styles.d.ts +27 -0
  38. package/dist/types/schema/nodes/general_table_footnote.d.ts +2 -1
  39. package/dist/types/schema/nodes/inline_footnote.d.ts +1 -1
  40. package/dist/types/schema/nodes/table_element.d.ts +1 -0
  41. package/dist/types/schema/nodes/table_element_footer.d.ts +1 -0
  42. package/dist/types/schema/types.d.ts +1 -24
  43. package/dist/types/transformer/index.d.ts +1 -0
  44. package/dist/types/transformer/section-category.d.ts +31 -0
  45. package/dist/types/version.d.ts +1 -1
  46. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -21,6 +21,8 @@ Object.defineProperty(exports, "getVersion", { enumerable: true, get: function (
21
21
  __exportStar(require("./jats"), exports);
22
22
  __exportStar(require("./jats/types"), exports);
23
23
  __exportStar(require("./lib/section-group-type"), exports);
24
+ __exportStar(require("./lib/table-cell-styles"), exports);
25
+ __exportStar(require("./lib/footnotes"), exports);
24
26
  __exportStar(require("./lib/utils"), exports);
25
27
  __exportStar(require("./schema"), exports);
26
28
  var migrate_1 = require("./schema/migration/migrate");
@@ -25,6 +25,7 @@ const debug_1 = __importDefault(require("debug"));
25
25
  const prosemirror_model_1 = require("prosemirror-model");
26
26
  const prosemirror_utils_1 = require("prosemirror-utils");
27
27
  const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
28
+ const footnotes_1 = require("../../lib/footnotes");
28
29
  const html_1 = require("../../lib/html");
29
30
  const schema_1 = require("../../schema");
30
31
  const transformer_1 = require("../../transformer");
@@ -139,6 +140,7 @@ class JATSExporter {
139
140
  article.appendChild(front);
140
141
  article.setAttribute('article-type', manuscriptNode.attrs.articleType || 'other');
141
142
  this.labelTargets = (0, labels_1.buildTargets)(manuscriptNode);
143
+ this.footnoteLabels = (0, footnotes_1.generateFootnoteLabels)(manuscriptNode);
142
144
  const body = this.buildBody();
143
145
  article.appendChild(body);
144
146
  const back = this.buildBack(body);
@@ -701,17 +703,13 @@ class JATSExporter {
701
703
  hard_break: () => '',
702
704
  highlight_marker: () => '',
703
705
  inline_footnote: (node) => {
704
- const rids = node.attrs.rids.filter((rid) => {
705
- var _a;
706
- return (_a = (0, prosemirror_utils_1.findChildrenByAttr)(this.manuscriptNode, (attrs) => attrs.id === rid)[0]) === null || _a === void 0 ? void 0 : _a.node;
707
- });
708
- if (rids.length == 0) {
709
- return '';
710
- }
706
+ const rids = node.attrs.rids;
711
707
  const xref = this.document.createElement('xref');
712
708
  xref.setAttribute('ref-type', 'fn');
713
709
  xref.setAttribute('rid', normalizeID(rids.join(' ')));
714
- xref.textContent = node.attrs.contents;
710
+ xref.textContent = rids
711
+ .map((rid) => this.footnoteLabels.get(rid))
712
+ .join(', ');
715
713
  return xref;
716
714
  },
717
715
  keyword: () => '',
@@ -786,8 +784,7 @@ class JATSExporter {
786
784
  id: normalizeID(node.attrs.id),
787
785
  };
788
786
  if (node.attrs.category) {
789
- const [, suffix] = node.attrs.category.split(':', 2);
790
- attrs['sec-type'] = suffix;
787
+ attrs['sec-type'] = (0, transformer_1.chooseSecType)(node.attrs.category);
791
788
  }
792
789
  return ['sec', attrs, 0];
793
790
  },
@@ -1389,7 +1386,7 @@ class JATSExporter {
1389
1386
  if (availabilitySection) {
1390
1387
  back.insertBefore(availabilitySection, back.firstChild);
1391
1388
  }
1392
- const section = body.querySelector('sec[sec-type="acknowledgements"]');
1389
+ const section = body.querySelector('sec[sec-type="acknowledgments"]');
1393
1390
  if (section) {
1394
1391
  const ack = this.document.createElement('ack');
1395
1392
  while (section.firstChild) {
@@ -1619,7 +1616,7 @@ class JATSExporter {
1619
1616
  footnotes.forEach((fn) => {
1620
1617
  const fnType = fn.getAttribute('fn-type');
1621
1618
  if (fnType) {
1622
- fn.setAttribute('fn-type', fnType === 'competing-interests' ? 'coi-statement' : fnType);
1619
+ fn.setAttribute('fn-type', (0, transformer_1.chooseJatsFnType)(fnType));
1623
1620
  }
1624
1621
  });
1625
1622
  }