@manuscripts/transform 3.0.49 → 3.0.50-LEAN-4430.0

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.
@@ -127,9 +127,20 @@ class JATSExporter {
127
127
  };
128
128
  };
129
129
  };
130
+ this.nodesMap = new Map();
131
+ this.populateNodesMap = () => {
132
+ this.manuscriptNode.descendants((node) => {
133
+ var _a;
134
+ const type = node.type;
135
+ const nodes = (_a = this.nodesMap.get(type)) !== null && _a !== void 0 ? _a : [];
136
+ nodes.push(node);
137
+ this.nodesMap.set(type, nodes);
138
+ });
139
+ };
130
140
  this.serializeToJATS = async (manuscriptNode, options) => {
131
141
  var _a;
132
142
  this.manuscriptNode = manuscriptNode;
143
+ this.populateNodesMap();
133
144
  this.generateCitationTexts(options.csl, manuscriptNode.attrs.id);
134
145
  this.createSerializer();
135
146
  const versionIds = (0, jats_versions_1.selectVersionIds)((_a = options.version) !== null && _a !== void 0 ? _a : '1.2');
@@ -209,6 +220,7 @@ class JATSExporter {
209
220
  }
210
221
  };
211
222
  this.buildFront = (journal) => {
223
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
212
224
  const front = this.document.createElement('front');
213
225
  const journalMeta = this.document.createElement('journal-meta');
214
226
  front.appendChild(journalMeta);
@@ -269,13 +281,13 @@ class JATSExporter {
269
281
  articleMeta.appendChild(articleID);
270
282
  }
271
283
  const titleGroup = this.document.createElement('title-group');
272
- const titleNode = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.title).map((r) => r.node)[0];
284
+ const titleNode = (_a = this.nodesMap.get(schema_1.schema.nodes.title)) === null || _a === void 0 ? void 0 : _a[0];
273
285
  if (titleNode) {
274
286
  const element = this.document.createElement('article-title');
275
287
  this.setTitleContent(element, titleNode.textContent);
276
288
  titleGroup.appendChild(element);
277
289
  }
278
- const altTitlesNodes = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.alt_title).map((r) => r.node);
290
+ const altTitlesNodes = (_b = this.nodesMap.get(schema_1.schema.nodes.alt_title)) !== null && _b !== void 0 ? _b : [];
279
291
  altTitlesNodes.forEach((titleNode) => {
280
292
  const element = this.document.createElement('alt-title');
281
293
  element.setAttribute('alt-title-type', titleNode.attrs.type);
@@ -284,8 +296,8 @@ class JATSExporter {
284
296
  });
285
297
  articleMeta.appendChild(titleGroup);
286
298
  this.buildContributors(articleMeta);
287
- const supplementsNodes = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.supplement);
288
- supplementsNodes.forEach(({ node }) => {
299
+ const supplementsNodes = (_c = this.nodesMap.get(schema_1.schema.nodes.supplement)) !== null && _c !== void 0 ? _c : [];
300
+ supplementsNodes.forEach((node) => {
289
301
  var _a, _b, _c, _d;
290
302
  const supplementaryMaterial = this.document.createElement('supplementary-material');
291
303
  supplementaryMaterial.setAttribute('id', normalizeID(node.attrs.id));
@@ -330,13 +342,13 @@ class JATSExporter {
330
342
  }
331
343
  this.buildKeywords(articleMeta);
332
344
  let countingElements = [];
333
- const figureCount = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.figure).length;
345
+ const figureCount = (_e = (_d = this.nodesMap.get(schema_1.schema.nodes.figure)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
334
346
  countingElements.push(this.buildCountingElement('fig-count', figureCount));
335
- const tableCount = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.table).length;
347
+ const tableCount = (_g = (_f = this.nodesMap.get(schema_1.schema.nodes.table)) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0;
336
348
  countingElements.push(this.buildCountingElement('table-count', tableCount));
337
- const equationCount = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.equation_element).length;
349
+ const equationCount = (_j = (_h = this.nodesMap.get(schema_1.schema.nodes.equation_element)) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : 0;
338
350
  countingElements.push(this.buildCountingElement('equation-count', equationCount));
339
- const referencesCount = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.bibliography_item).length;
351
+ const referencesCount = (_l = (_k = this.nodesMap.get(schema_1.schema.nodes.bibliography_item)) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0;
340
352
  countingElements.push(this.buildCountingElement('ref-count', referencesCount));
341
353
  const wordCount = this.manuscriptNode.textContent.split(/\s+/).length;
342
354
  countingElements.push(this.buildCountingElement('word-count', wordCount));
@@ -349,7 +361,7 @@ class JATSExporter {
349
361
  if (!journalMeta.hasChildNodes()) {
350
362
  journalMeta.remove();
351
363
  }
352
- const selfUriAttachments = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.attachment).map((r) => r.node);
364
+ const selfUriAttachments = (_m = this.nodesMap.get(schema_1.schema.nodes.attachment)) !== null && _m !== void 0 ? _m : [];
353
365
  selfUriAttachments.forEach((attachment) => {
354
366
  const selfUriElement = this.document.createElement('self-uri');
355
367
  selfUriElement.setAttribute('content-type', attachment.attrs.type);
@@ -394,6 +406,7 @@ class JATSExporter {
394
406
  return body;
395
407
  };
396
408
  this.buildBack = (body) => {
409
+ var _a;
397
410
  const back = this.document.createElement('back');
398
411
  this.moveSectionsToBack(back, body);
399
412
  const footnotesElements = this.document.querySelectorAll('sec > fn-group');
@@ -416,7 +429,7 @@ class JATSExporter {
416
429
  refList = this.document.createElement('ref-list');
417
430
  }
418
431
  back.appendChild(refList);
419
- const bibliographyItems = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.bibliography_item).map((n) => n.node);
432
+ const bibliographyItems = (_a = this.nodesMap.get(schema_1.schema.nodes.bibliography_item)) !== null && _a !== void 0 ? _a : [];
420
433
  const [meta] = this.citationProvider.makeBibliography();
421
434
  for (const [id] of meta.entry_ids) {
422
435
  const bibliographyItem = bibliographyItems.find((n) => n.attrs.id === id);
@@ -805,11 +818,14 @@ class JATSExporter {
805
818
  placeholder_element: () => {
806
819
  return this.document.createElement('boxed-text');
807
820
  },
808
- pullquote_element: () => [
809
- 'disp-quote',
810
- { 'content-type': 'pullquote' },
811
- 0,
812
- ],
821
+ pullquote_element: (node) => {
822
+ var _a;
823
+ let type = 'pullquote';
824
+ if (((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.type) === schema_1.schema.nodes.figure) {
825
+ type = 'quote-with-image';
826
+ }
827
+ return ['disp-quote', { 'content-type': type }, 0];
828
+ },
813
829
  graphical_abstract_section: (node) => {
814
830
  const attrs = {
815
831
  id: normalizeID(node.attrs.id),
@@ -947,6 +963,14 @@ class JATSExporter {
947
963
  processChildNodes(element, node, node.type.schema.nodes.section);
948
964
  return element;
949
965
  };
966
+ const isChildOfNodeType = (targetID, type, descend = false) => {
967
+ var _a;
968
+ const nodes = (_a = this.nodesMap.get(type)) !== null && _a !== void 0 ? _a : [];
969
+ return nodes.some((node) => {
970
+ const result = (0, prosemirror_utils_1.findChildrenByAttr)(node, (attrs) => attrs.id === targetID, descend)[0];
971
+ return !!result;
972
+ });
973
+ };
950
974
  const createImage = (node) => {
951
975
  const graphicNode = node.content.firstChild;
952
976
  if (graphicNode) {
@@ -957,10 +981,11 @@ class JATSExporter {
957
981
  }
958
982
  return '';
959
983
  };
960
- const createGraphic = (node, isChildOfFigure = true) => {
984
+ const createGraphic = (node) => {
961
985
  const graphic = this.document.createElement('graphic');
962
986
  graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', node.attrs.src);
963
- if (!isChildOfFigure && node.attrs.type) {
987
+ if (!isChildOfNodeType(node.attrs.id, schema_1.schema.nodes.figure_element) &&
988
+ node.attrs.type) {
964
989
  graphic.setAttribute('content-type', node.attrs.type);
965
990
  }
966
991
  return graphic;
@@ -1029,7 +1054,8 @@ class JATSExporter {
1029
1054
  }
1030
1055
  };
1031
1056
  this.buildContributors = (articleMeta) => {
1032
- const contributorNodes = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.contributor).map((result) => result.node);
1057
+ var _a;
1058
+ const contributorNodes = ((_a = this.nodesMap.get(schema_1.schema.nodes.contributor)) !== null && _a !== void 0 ? _a : []);
1033
1059
  const authorContributorNodes = contributorNodes
1034
1060
  .filter((n) => n.attrs.role === 'author')
1035
1061
  .sort(sortContributors);
@@ -1163,7 +1189,7 @@ class JATSExporter {
1163
1189
  affiliationRIDs.push(...contributor.attrs.affiliations);
1164
1190
  }
1165
1191
  }
1166
- const affiliations = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.affiliation).map((result) => result.node);
1192
+ const affiliations = this.nodesMap.get(schema_1.schema.nodes.affiliation);
1167
1193
  if (affiliations) {
1168
1194
  const usedAffiliations = affiliations.filter((affiliation) => affiliationRIDs.includes(affiliation.attrs.id));
1169
1195
  usedAffiliations.sort((a, b) => affiliationRIDs.indexOf(a.attrs.id) -
@@ -1232,7 +1258,7 @@ class JATSExporter {
1232
1258
  this.createAuthorNotesElement = () => {
1233
1259
  var _a;
1234
1260
  const authorNotesEl = this.document.createElement('author-notes');
1235
- const authorNotesNode = (_a = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.author_notes)[0]) === null || _a === void 0 ? void 0 : _a.node;
1261
+ const authorNotesNode = (_a = this.nodesMap.get(schema_1.schema.nodes.author_notes)) === null || _a === void 0 ? void 0 : _a[0];
1236
1262
  if (authorNotesNode) {
1237
1263
  this.appendModelsToAuthorNotes(authorNotesEl, authorNotesNode);
1238
1264
  }
@@ -1396,7 +1422,7 @@ class JATSExporter {
1396
1422
  this.moveAbstracts = (front, body) => {
1397
1423
  var _a;
1398
1424
  const container = body.querySelector(':scope > sec[sec-type="abstracts"]');
1399
- const abstractsNode = (_a = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.abstracts)[0]) === null || _a === void 0 ? void 0 : _a.node;
1425
+ const abstractsNode = (_a = this.nodesMap.get(schema_1.schema.nodes.abstracts)) === null || _a === void 0 ? void 0 : _a[0];
1400
1426
  const abstractCategories = this.getAbstractCategories(abstractsNode);
1401
1427
  const abstractSections = this.getAbstractSections(container, body, abstractCategories);
1402
1428
  if (abstractSections.length) {
@@ -1554,7 +1580,8 @@ class JATSExporter {
1554
1580
  }
1555
1581
  }
1556
1582
  appendModelsToAuthorNotes(authorNotesEl, authorNotesNode) {
1557
- const contributorsNodes = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.contributor).map((result) => result.node);
1583
+ var _a;
1584
+ const contributorsNodes = ((_a = this.nodesMap.get(schema_1.schema.nodes.contributor)) !== null && _a !== void 0 ? _a : []);
1558
1585
  const usedCorrespondings = this.getUsedCorrespondings(contributorsNodes);
1559
1586
  authorNotesNode.descendants((node) => {
1560
1587
  switch (node.type) {
@@ -1583,7 +1610,8 @@ class JATSExporter {
1583
1610
  .filter((corresp) => !!corresp);
1584
1611
  }
1585
1612
  buildKeywords(articleMeta) {
1586
- const keywordGroups = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.keyword_group).map((result) => result.node);
1613
+ var _a;
1614
+ const keywordGroups = (_a = this.nodesMap.get(schema_1.schema.nodes.keyword_group)) !== null && _a !== void 0 ? _a : [];
1587
1615
  keywordGroups.forEach((group) => {
1588
1616
  const kwdGroup = this.document.createElement('kwd-group');
1589
1617
  if (group.attrs.type) {
@@ -553,7 +553,7 @@ class JATSDOMParser {
553
553
  },
554
554
  },
555
555
  {
556
- tag: 'disp-quote[content-type=pullquote]',
556
+ tag: 'disp-quote',
557
557
  node: 'pullquote_element',
558
558
  getAttrs: (node) => {
559
559
  const element = node;
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isPullquoteElement = exports.pullquoteElement = void 0;
19
19
  const json_schema_1 = require("@manuscripts/json-schema");
20
20
  exports.pullquoteElement = {
21
- content: 'paragraph+ attribution',
21
+ content: 'figure? paragraph+ attribution',
22
22
  attrs: {
23
23
  id: { default: '' },
24
24
  placeholder: { default: '' },
@@ -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 = "3.0.49";
4
+ exports.VERSION = "3.0.50-LEAN-4430.0";
@@ -119,9 +119,20 @@ export class JATSExporter {
119
119
  };
120
120
  };
121
121
  };
122
+ this.nodesMap = new Map();
123
+ this.populateNodesMap = () => {
124
+ this.manuscriptNode.descendants((node) => {
125
+ var _a;
126
+ const type = node.type;
127
+ const nodes = (_a = this.nodesMap.get(type)) !== null && _a !== void 0 ? _a : [];
128
+ nodes.push(node);
129
+ this.nodesMap.set(type, nodes);
130
+ });
131
+ };
122
132
  this.serializeToJATS = async (manuscriptNode, options) => {
123
133
  var _a;
124
134
  this.manuscriptNode = manuscriptNode;
135
+ this.populateNodesMap();
125
136
  this.generateCitationTexts(options.csl, manuscriptNode.attrs.id);
126
137
  this.createSerializer();
127
138
  const versionIds = selectVersionIds((_a = options.version) !== null && _a !== void 0 ? _a : '1.2');
@@ -201,6 +212,7 @@ export class JATSExporter {
201
212
  }
202
213
  };
203
214
  this.buildFront = (journal) => {
215
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
204
216
  const front = this.document.createElement('front');
205
217
  const journalMeta = this.document.createElement('journal-meta');
206
218
  front.appendChild(journalMeta);
@@ -261,13 +273,13 @@ export class JATSExporter {
261
273
  articleMeta.appendChild(articleID);
262
274
  }
263
275
  const titleGroup = this.document.createElement('title-group');
264
- const titleNode = findChildrenByType(this.manuscriptNode, schema.nodes.title).map((r) => r.node)[0];
276
+ const titleNode = (_a = this.nodesMap.get(schema.nodes.title)) === null || _a === void 0 ? void 0 : _a[0];
265
277
  if (titleNode) {
266
278
  const element = this.document.createElement('article-title');
267
279
  this.setTitleContent(element, titleNode.textContent);
268
280
  titleGroup.appendChild(element);
269
281
  }
270
- const altTitlesNodes = findChildrenByType(this.manuscriptNode, schema.nodes.alt_title).map((r) => r.node);
282
+ const altTitlesNodes = (_b = this.nodesMap.get(schema.nodes.alt_title)) !== null && _b !== void 0 ? _b : [];
271
283
  altTitlesNodes.forEach((titleNode) => {
272
284
  const element = this.document.createElement('alt-title');
273
285
  element.setAttribute('alt-title-type', titleNode.attrs.type);
@@ -276,8 +288,8 @@ export class JATSExporter {
276
288
  });
277
289
  articleMeta.appendChild(titleGroup);
278
290
  this.buildContributors(articleMeta);
279
- const supplementsNodes = findChildrenByType(this.manuscriptNode, schema.nodes.supplement);
280
- supplementsNodes.forEach(({ node }) => {
291
+ const supplementsNodes = (_c = this.nodesMap.get(schema.nodes.supplement)) !== null && _c !== void 0 ? _c : [];
292
+ supplementsNodes.forEach((node) => {
281
293
  var _a, _b, _c, _d;
282
294
  const supplementaryMaterial = this.document.createElement('supplementary-material');
283
295
  supplementaryMaterial.setAttribute('id', normalizeID(node.attrs.id));
@@ -322,13 +334,13 @@ export class JATSExporter {
322
334
  }
323
335
  this.buildKeywords(articleMeta);
324
336
  let countingElements = [];
325
- const figureCount = findChildrenByType(this.manuscriptNode, schema.nodes.figure).length;
337
+ const figureCount = (_e = (_d = this.nodesMap.get(schema.nodes.figure)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
326
338
  countingElements.push(this.buildCountingElement('fig-count', figureCount));
327
- const tableCount = findChildrenByType(this.manuscriptNode, schema.nodes.table).length;
339
+ const tableCount = (_g = (_f = this.nodesMap.get(schema.nodes.table)) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0;
328
340
  countingElements.push(this.buildCountingElement('table-count', tableCount));
329
- const equationCount = findChildrenByType(this.manuscriptNode, schema.nodes.equation_element).length;
341
+ const equationCount = (_j = (_h = this.nodesMap.get(schema.nodes.equation_element)) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : 0;
330
342
  countingElements.push(this.buildCountingElement('equation-count', equationCount));
331
- const referencesCount = findChildrenByType(this.manuscriptNode, schema.nodes.bibliography_item).length;
343
+ const referencesCount = (_l = (_k = this.nodesMap.get(schema.nodes.bibliography_item)) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0;
332
344
  countingElements.push(this.buildCountingElement('ref-count', referencesCount));
333
345
  const wordCount = this.manuscriptNode.textContent.split(/\s+/).length;
334
346
  countingElements.push(this.buildCountingElement('word-count', wordCount));
@@ -341,7 +353,7 @@ export class JATSExporter {
341
353
  if (!journalMeta.hasChildNodes()) {
342
354
  journalMeta.remove();
343
355
  }
344
- const selfUriAttachments = findChildrenByType(this.manuscriptNode, schema.nodes.attachment).map((r) => r.node);
356
+ const selfUriAttachments = (_m = this.nodesMap.get(schema.nodes.attachment)) !== null && _m !== void 0 ? _m : [];
345
357
  selfUriAttachments.forEach((attachment) => {
346
358
  const selfUriElement = this.document.createElement('self-uri');
347
359
  selfUriElement.setAttribute('content-type', attachment.attrs.type);
@@ -386,6 +398,7 @@ export class JATSExporter {
386
398
  return body;
387
399
  };
388
400
  this.buildBack = (body) => {
401
+ var _a;
389
402
  const back = this.document.createElement('back');
390
403
  this.moveSectionsToBack(back, body);
391
404
  const footnotesElements = this.document.querySelectorAll('sec > fn-group');
@@ -408,7 +421,7 @@ export class JATSExporter {
408
421
  refList = this.document.createElement('ref-list');
409
422
  }
410
423
  back.appendChild(refList);
411
- const bibliographyItems = findChildrenByType(this.manuscriptNode, schema.nodes.bibliography_item).map((n) => n.node);
424
+ const bibliographyItems = (_a = this.nodesMap.get(schema.nodes.bibliography_item)) !== null && _a !== void 0 ? _a : [];
412
425
  const [meta] = this.citationProvider.makeBibliography();
413
426
  for (const [id] of meta.entry_ids) {
414
427
  const bibliographyItem = bibliographyItems.find((n) => n.attrs.id === id);
@@ -797,11 +810,14 @@ export class JATSExporter {
797
810
  placeholder_element: () => {
798
811
  return this.document.createElement('boxed-text');
799
812
  },
800
- pullquote_element: () => [
801
- 'disp-quote',
802
- { 'content-type': 'pullquote' },
803
- 0,
804
- ],
813
+ pullquote_element: (node) => {
814
+ var _a;
815
+ let type = 'pullquote';
816
+ if (((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.type) === schema.nodes.figure) {
817
+ type = 'quote-with-image';
818
+ }
819
+ return ['disp-quote', { 'content-type': type }, 0];
820
+ },
805
821
  graphical_abstract_section: (node) => {
806
822
  const attrs = {
807
823
  id: normalizeID(node.attrs.id),
@@ -939,6 +955,14 @@ export class JATSExporter {
939
955
  processChildNodes(element, node, node.type.schema.nodes.section);
940
956
  return element;
941
957
  };
958
+ const isChildOfNodeType = (targetID, type, descend = false) => {
959
+ var _a;
960
+ const nodes = (_a = this.nodesMap.get(type)) !== null && _a !== void 0 ? _a : [];
961
+ return nodes.some((node) => {
962
+ const result = findChildrenByAttr(node, (attrs) => attrs.id === targetID, descend)[0];
963
+ return !!result;
964
+ });
965
+ };
942
966
  const createImage = (node) => {
943
967
  const graphicNode = node.content.firstChild;
944
968
  if (graphicNode) {
@@ -949,10 +973,11 @@ export class JATSExporter {
949
973
  }
950
974
  return '';
951
975
  };
952
- const createGraphic = (node, isChildOfFigure = true) => {
976
+ const createGraphic = (node) => {
953
977
  const graphic = this.document.createElement('graphic');
954
978
  graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', node.attrs.src);
955
- if (!isChildOfFigure && node.attrs.type) {
979
+ if (!isChildOfNodeType(node.attrs.id, schema.nodes.figure_element) &&
980
+ node.attrs.type) {
956
981
  graphic.setAttribute('content-type', node.attrs.type);
957
982
  }
958
983
  return graphic;
@@ -1021,7 +1046,8 @@ export class JATSExporter {
1021
1046
  }
1022
1047
  };
1023
1048
  this.buildContributors = (articleMeta) => {
1024
- const contributorNodes = findChildrenByType(this.manuscriptNode, schema.nodes.contributor).map((result) => result.node);
1049
+ var _a;
1050
+ const contributorNodes = ((_a = this.nodesMap.get(schema.nodes.contributor)) !== null && _a !== void 0 ? _a : []);
1025
1051
  const authorContributorNodes = contributorNodes
1026
1052
  .filter((n) => n.attrs.role === 'author')
1027
1053
  .sort(sortContributors);
@@ -1155,7 +1181,7 @@ export class JATSExporter {
1155
1181
  affiliationRIDs.push(...contributor.attrs.affiliations);
1156
1182
  }
1157
1183
  }
1158
- const affiliations = findChildrenByType(this.manuscriptNode, schema.nodes.affiliation).map((result) => result.node);
1184
+ const affiliations = this.nodesMap.get(schema.nodes.affiliation);
1159
1185
  if (affiliations) {
1160
1186
  const usedAffiliations = affiliations.filter((affiliation) => affiliationRIDs.includes(affiliation.attrs.id));
1161
1187
  usedAffiliations.sort((a, b) => affiliationRIDs.indexOf(a.attrs.id) -
@@ -1224,7 +1250,7 @@ export class JATSExporter {
1224
1250
  this.createAuthorNotesElement = () => {
1225
1251
  var _a;
1226
1252
  const authorNotesEl = this.document.createElement('author-notes');
1227
- const authorNotesNode = (_a = findChildrenByType(this.manuscriptNode, schema.nodes.author_notes)[0]) === null || _a === void 0 ? void 0 : _a.node;
1253
+ const authorNotesNode = (_a = this.nodesMap.get(schema.nodes.author_notes)) === null || _a === void 0 ? void 0 : _a[0];
1228
1254
  if (authorNotesNode) {
1229
1255
  this.appendModelsToAuthorNotes(authorNotesEl, authorNotesNode);
1230
1256
  }
@@ -1388,7 +1414,7 @@ export class JATSExporter {
1388
1414
  this.moveAbstracts = (front, body) => {
1389
1415
  var _a;
1390
1416
  const container = body.querySelector(':scope > sec[sec-type="abstracts"]');
1391
- const abstractsNode = (_a = findChildrenByType(this.manuscriptNode, schema.nodes.abstracts)[0]) === null || _a === void 0 ? void 0 : _a.node;
1417
+ const abstractsNode = (_a = this.nodesMap.get(schema.nodes.abstracts)) === null || _a === void 0 ? void 0 : _a[0];
1392
1418
  const abstractCategories = this.getAbstractCategories(abstractsNode);
1393
1419
  const abstractSections = this.getAbstractSections(container, body, abstractCategories);
1394
1420
  if (abstractSections.length) {
@@ -1546,7 +1572,8 @@ export class JATSExporter {
1546
1572
  }
1547
1573
  }
1548
1574
  appendModelsToAuthorNotes(authorNotesEl, authorNotesNode) {
1549
- const contributorsNodes = findChildrenByType(this.manuscriptNode, schema.nodes.contributor).map((result) => result.node);
1575
+ var _a;
1576
+ const contributorsNodes = ((_a = this.nodesMap.get(schema.nodes.contributor)) !== null && _a !== void 0 ? _a : []);
1550
1577
  const usedCorrespondings = this.getUsedCorrespondings(contributorsNodes);
1551
1578
  authorNotesNode.descendants((node) => {
1552
1579
  switch (node.type) {
@@ -1575,7 +1602,8 @@ export class JATSExporter {
1575
1602
  .filter((corresp) => !!corresp);
1576
1603
  }
1577
1604
  buildKeywords(articleMeta) {
1578
- const keywordGroups = findChildrenByType(this.manuscriptNode, schema.nodes.keyword_group).map((result) => result.node);
1605
+ var _a;
1606
+ const keywordGroups = (_a = this.nodesMap.get(schema.nodes.keyword_group)) !== null && _a !== void 0 ? _a : [];
1579
1607
  keywordGroups.forEach((group) => {
1580
1608
  const kwdGroup = this.document.createElement('kwd-group');
1581
1609
  if (group.attrs.type) {
@@ -550,7 +550,7 @@ export class JATSDOMParser {
550
550
  },
551
551
  },
552
552
  {
553
- tag: 'disp-quote[content-type=pullquote]',
553
+ tag: 'disp-quote',
554
554
  node: 'pullquote_element',
555
555
  getAttrs: (node) => {
556
556
  const element = node;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { ObjectTypes } from '@manuscripts/json-schema';
17
17
  export const pullquoteElement = {
18
- content: 'paragraph+ attribution',
18
+ content: 'figure? paragraph+ attribution',
19
19
  attrs: {
20
20
  id: { default: '' },
21
21
  placeholder: { default: '' },
@@ -1 +1 @@
1
- export const VERSION = "3.0.49";
1
+ export const VERSION = "3.0.50-LEAN-4430.0";
@@ -60,6 +60,8 @@ export declare class JATSExporter {
60
60
  }[];
61
61
  protected getLibraryItem: (manuscriptID: string) => (id: string) => BibliographyItem | undefined;
62
62
  protected generateCitationTexts(csl: CSLOptions, manuscriptID: string): void;
63
+ private nodesMap;
64
+ private populateNodesMap;
63
65
  serializeToJATS: (manuscriptNode: ManuscriptNode, options: ExportOptions) => Promise<string>;
64
66
  private nodeFromJATS;
65
67
  protected rewriteIDs: (generator?: IDGenerator) => Promise<void>;
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.49";
1
+ export declare const VERSION = "3.0.50-LEAN-4430.0";
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": "3.0.49",
4
+ "version": "3.0.50-LEAN-4430.0",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",