@manuscripts/transform 3.0.7-LEAN-4052.0 → 3.0.8

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.
@@ -106,20 +106,21 @@ const parseDates = (historyNode) => {
106
106
  return history;
107
107
  };
108
108
  const getEmail = (element) => {
109
- var _a, _b;
109
+ var _a, _b, _c;
110
110
  const email = element.querySelector('email');
111
111
  if (email) {
112
112
  return {
113
113
  href: (_a = email.getAttributeNS(XLINK_NAMESPACE, 'href')) !== null && _a !== void 0 ? _a : '',
114
- text: (_b = (0, utils_1.getTrimmedTextContent)(email)) !== null && _b !== void 0 ? _b : '',
114
+ text: (_c = (_b = email.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '',
115
115
  };
116
116
  }
117
117
  };
118
118
  const getInstitutionDetails = (element) => {
119
+ var _a;
119
120
  let department = '';
120
121
  let institution = '';
121
122
  for (const node of element.querySelectorAll('institution')) {
122
- const content = (0, utils_1.getTrimmedTextContent)(node);
123
+ const content = (_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim();
123
124
  if (!content) {
124
125
  continue;
125
126
  }
@@ -166,10 +167,10 @@ const parseRef = (element) => {
166
167
  const mixedCitation = element.querySelector('mixed-citation');
167
168
  if (authorNodes.length <= 0) {
168
169
  mixedCitation === null || mixedCitation === void 0 ? void 0 : mixedCitation.childNodes.forEach((item) => {
169
- var _a, _b;
170
+ var _a, _b, _c;
170
171
  if (item.nodeType === Node.TEXT_NODE &&
171
172
  ((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.match(/[A-Za-z]+/g))) {
172
- attrs.literal = (_b = (0, utils_1.getTrimmedTextContent)(mixedCitation)) !== null && _b !== void 0 ? _b : '';
173
+ attrs.literal = (_c = (_b = mixedCitation.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
173
174
  return attrs;
174
175
  }
175
176
  });
@@ -207,6 +208,7 @@ const parseRef = (element) => {
207
208
  }
208
209
  const authors = [];
209
210
  authorNodes.forEach((authorNode) => {
211
+ var _a;
210
212
  const name = (0, json_schema_1.buildBibliographicName)({});
211
213
  const given = (0, utils_1.getTrimmedTextContent)(authorNode, 'given-names');
212
214
  if (given) {
@@ -217,7 +219,7 @@ const parseRef = (element) => {
217
219
  name.family = family;
218
220
  }
219
221
  if (authorNode.nodeName === 'collab') {
220
- name.literal = (0, utils_1.getTrimmedTextContent)(authorNode);
222
+ name.literal = (_a = authorNode.textContent) === null || _a === void 0 ? void 0 : _a.trim();
221
223
  }
222
224
  authors.push(name);
223
225
  });
@@ -277,7 +279,7 @@ const nodes = [
277
279
  const doi = element.querySelector('front > article-meta > article-id[pub-id-type="doi"]');
278
280
  const history = element.querySelector('history');
279
281
  const dates = parseDates(history);
280
- return Object.assign({ doi: (0, utils_1.getTrimmedTextContent)(doi), articleType: (_a = element.getAttribute('article-type')) !== null && _a !== void 0 ? _a : '', primaryLanguageCode: (_b = element.getAttribute('lang')) !== null && _b !== void 0 ? _b : '' }, dates);
282
+ return Object.assign({ doi: doi === null || doi === void 0 ? void 0 : doi.textContent, articleType: (_a = element.getAttribute('article-type')) !== null && _a !== void 0 ? _a : '', primaryLanguageCode: (_b = element.getAttribute('lang')) !== null && _b !== void 0 ? _b : '' }, dates);
281
283
  },
282
284
  },
283
285
  {
@@ -309,7 +311,7 @@ const nodes = [
309
311
  return {
310
312
  id: element.getAttribute('id'),
311
313
  target: element.getAttribute('target-id'),
312
- contents: (0, utils_1.getTrimmedTextContent)(element),
314
+ contents: element.textContent,
313
315
  contributions: [(0, json_schema_1.buildContribution)(jats_comments_1.DEFAULT_PROFILE_ID)],
314
316
  };
315
317
  },
@@ -332,14 +334,15 @@ const nodes = [
332
334
  tag: 'award-group',
333
335
  node: 'award',
334
336
  getAttrs: (node) => {
337
+ var _a, _b;
335
338
  const element = node;
336
339
  return {
337
340
  id: element.getAttribute('id'),
338
- recipient: (0, utils_1.getTrimmedTextContent)(element, 'principal-award-recipient'),
341
+ recipient: (_a = element.querySelector('principal-award-recipient')) === null || _a === void 0 ? void 0 : _a.textContent,
339
342
  code: Array.from(element.querySelectorAll('award-id'))
340
- .map((awardID) => (0, utils_1.getTrimmedTextContent)(awardID))
343
+ .map((awardID) => awardID.textContent)
341
344
  .reduce((acc, text) => (acc ? `${acc};${text}` : text), ''),
342
- source: (0, utils_1.getTrimmedTextContent)(element, 'funding-source'),
345
+ source: (_b = element.querySelector('funding-source')) === null || _b === void 0 ? void 0 : _b.textContent,
343
346
  };
344
347
  },
345
348
  },
@@ -359,6 +362,7 @@ const nodes = [
359
362
  tag: 'corresp',
360
363
  node: 'corresp',
361
364
  getAttrs: (node) => {
365
+ var _a;
362
366
  const element = node;
363
367
  const label = element.querySelector('label');
364
368
  if (label) {
@@ -366,18 +370,20 @@ const nodes = [
366
370
  }
367
371
  return {
368
372
  id: element.getAttribute('id'),
369
- label: (0, utils_1.getTrimmedTextContent)(label),
373
+ label: (_a = label === null || label === void 0 ? void 0 : label.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
370
374
  };
371
375
  },
372
376
  getContent: (node) => {
377
+ var _a;
373
378
  const element = node;
374
- return prosemirror_model_1.Fragment.from(schema_1.schema.text((0, utils_1.getTrimmedTextContent)(element) || ''));
379
+ return prosemirror_model_1.Fragment.from(schema_1.schema.text(((_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || ''));
375
380
  },
376
381
  },
377
382
  {
378
383
  tag: 'contrib[contrib-type="author"]',
379
384
  node: 'contributor',
380
385
  getAttrs: (node) => {
386
+ var _a, _b;
381
387
  const element = node;
382
388
  const footnote = [];
383
389
  const affiliations = [];
@@ -393,13 +399,13 @@ const nodes = [
393
399
  case 'fn':
394
400
  footnote.push({
395
401
  noteID: rid,
396
- noteLabel: (0, utils_1.getTrimmedTextContent)(xref) || '',
402
+ noteLabel: ((_a = xref.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '',
397
403
  });
398
404
  break;
399
405
  case 'corresp':
400
406
  corresp.push({
401
407
  correspID: rid,
402
- correspLabel: (0, utils_1.getTrimmedTextContent)(xref) || '',
408
+ correspLabel: ((_b = xref.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '',
403
409
  });
404
410
  break;
405
411
  case 'aff':
@@ -522,12 +528,12 @@ const nodes = [
522
528
  node: 'listing',
523
529
  context: 'listing_element/',
524
530
  getAttrs: (node) => {
525
- var _a;
531
+ var _a, _b, _c;
526
532
  const element = node;
527
533
  return {
528
534
  id: element.getAttribute('id'),
529
535
  language: (_a = element.getAttribute('language')) !== null && _a !== void 0 ? _a : '',
530
- contents: (0, utils_1.getTrimmedTextContent)(element),
536
+ contents: (_c = (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '',
531
537
  };
532
538
  },
533
539
  },
@@ -543,11 +549,11 @@ const nodes = [
543
549
  tag: 'disp-formula',
544
550
  node: 'equation_element',
545
551
  getAttrs: (node) => {
546
- var _a;
552
+ var _a, _b;
547
553
  const element = node;
548
554
  return {
549
555
  id: element.getAttribute('id'),
550
- label: (_a = (0, utils_1.getTrimmedTextContent)(element, 'label')) !== null && _a !== void 0 ? _a : '',
556
+ label: (_b = (_a = element.querySelector('label')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : '',
551
557
  };
552
558
  },
553
559
  getContent: (node, schema) => {
@@ -640,7 +646,7 @@ const nodes = [
640
646
  tag: 'fig',
641
647
  node: 'figure_element',
642
648
  getAttrs: (node) => {
643
- var _a, _b;
649
+ var _a, _b, _c, _d;
644
650
  const element = node;
645
651
  const labelNode = element.querySelector('label');
646
652
  if (labelNode) {
@@ -650,12 +656,12 @@ const nodes = [
650
656
  const position = element.getAttribute('position');
651
657
  const attribution = attrib
652
658
  ? {
653
- literal: (_a = (0, utils_1.getTrimmedTextContent)(attrib)) !== null && _a !== void 0 ? _a : '',
659
+ literal: (_b = (_a = attrib.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '',
654
660
  }
655
661
  : undefined;
656
662
  return {
657
663
  id: element.getAttribute('id'),
658
- label: (_b = (0, utils_1.getTrimmedTextContent)(labelNode)) !== null && _b !== void 0 ? _b : '',
664
+ label: (_d = (_c = labelNode === null || labelNode === void 0 ? void 0 : labelNode.textContent) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : '',
659
665
  attribution: attribution,
660
666
  position,
661
667
  };
@@ -773,13 +779,14 @@ const nodes = [
773
779
  tag: 'supplementary-material',
774
780
  node: 'supplement',
775
781
  getAttrs: (node) => {
782
+ var _a;
776
783
  const element = node;
777
784
  return {
778
785
  id: element.getAttribute('id'),
779
786
  href: element.getAttributeNS(XLINK_NAMESPACE, 'href'),
780
787
  mimeType: element.getAttribute('mimetype'),
781
788
  mimeSubType: element.getAttribute('mime-subtype'),
782
- title: (0, utils_1.getTrimmedTextContent)(element, 'title'),
789
+ title: (_a = element.querySelector('title')) === null || _a === void 0 ? void 0 : _a.textContent,
783
790
  };
784
791
  },
785
792
  },
@@ -799,10 +806,11 @@ const nodes = [
799
806
  tag: 'sec[sec-type="box-element"]',
800
807
  node: 'box_element',
801
808
  getAttrs: (node) => {
809
+ var _a;
802
810
  const element = node;
803
811
  return {
804
812
  id: element.getAttribute('id'),
805
- label: (0, utils_1.getTrimmedTextContent)(element, 'label'),
813
+ label: (_a = element.querySelector('label')) === null || _a === void 0 ? void 0 : _a.textContent,
806
814
  };
807
815
  },
808
816
  },
@@ -955,11 +963,11 @@ const nodes = [
955
963
  tag: 'xref[ref-type="bibr"]',
956
964
  node: 'citation',
957
965
  getAttrs: (node) => {
958
- var _a;
966
+ var _a, _b;
959
967
  const element = node;
960
968
  return {
961
969
  rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
962
- contents: (0, utils_1.getTrimmedTextContent)(element),
970
+ contents: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
963
971
  };
964
972
  },
965
973
  },
@@ -967,11 +975,11 @@ const nodes = [
967
975
  tag: 'xref[ref-type="fn"]',
968
976
  node: 'inline_footnote',
969
977
  getAttrs: (node) => {
970
- var _a;
978
+ var _a, _b;
971
979
  const element = node;
972
980
  return {
973
981
  rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
974
- contents: (0, utils_1.getTrimmedTextContent)(element),
982
+ contents: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
975
983
  };
976
984
  },
977
985
  },
@@ -979,11 +987,11 @@ const nodes = [
979
987
  tag: 'xref',
980
988
  node: 'cross_reference',
981
989
  getAttrs: (node) => {
982
- var _a;
990
+ var _a, _b;
983
991
  const element = node;
984
992
  return {
985
993
  rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
986
- label: (0, utils_1.getTrimmedTextContent)(element),
994
+ label: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
987
995
  };
988
996
  },
989
997
  },
@@ -141,7 +141,6 @@ const renameJatsNodesToHTML = (node, container, createElement) => {
141
141
  });
142
142
  };
143
143
  const htmlFromJatsNode = (element, createElement) => {
144
- var _a;
145
144
  if (!element) {
146
145
  return undefined;
147
146
  }
@@ -150,6 +149,6 @@ const htmlFromJatsNode = (element, createElement) => {
150
149
  }
151
150
  const temp = createElement('template');
152
151
  renameJatsNodesToHTML(element, temp, createElement);
153
- return (_a = temp.innerHTML) === null || _a === void 0 ? void 0 : _a.trim();
152
+ return temp.innerHTML;
154
153
  };
155
154
  exports.htmlFromJatsNode = htmlFromJatsNode;
@@ -75,14 +75,12 @@ const findParentNodeClosestToPos = ($pos, predicate) => {
75
75
  }
76
76
  };
77
77
  exports.findParentNodeClosestToPos = findParentNodeClosestToPos;
78
- const getTrimmedTextContent = (node, selector) => {
79
- var _a, _b, _c;
78
+ const getTrimmedTextContent = (node, querySelector) => {
79
+ var _a, _b;
80
80
  if (!node) {
81
- return undefined;
81
+ return null;
82
82
  }
83
- return selector
84
- ? (_b = (_a = node.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()
85
- : (_c = node.textContent) === null || _c === void 0 ? void 0 : _c.trim();
83
+ return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
86
84
  };
87
85
  exports.getTrimmedTextContent = getTrimmedTextContent;
88
86
  const timestamp = () => Math.floor(Date.now() / 1000);
@@ -17,7 +17,6 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isInlineFootnoteNode = exports.inlineFootnote = void 0;
19
19
  exports.inlineFootnote = {
20
- name: 'Footnote marker',
21
20
  attrs: {
22
21
  rids: { default: [] },
23
22
  contents: { default: '' },
@@ -18,26 +18,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.nodeNames = void 0;
19
19
  const schema_1 = require("../schema");
20
20
  exports.nodeNames = new Map([
21
+ [schema_1.schema.nodes.title, 'Title'],
22
+ [schema_1.schema.nodes.contributor, 'Author'],
23
+ [schema_1.schema.nodes.keywords, 'Keywords'],
24
+ [schema_1.schema.nodes.keyword, 'Keyword'],
21
25
  [schema_1.schema.nodes.bibliography_element, 'Bibliography'],
26
+ [schema_1.schema.nodes.bibliography_item, 'Reference'],
22
27
  [schema_1.schema.nodes.bibliography_section, 'Section'],
23
28
  [schema_1.schema.nodes.citation, 'Citation'],
24
29
  [schema_1.schema.nodes.listing_element, 'Listing'],
25
30
  [schema_1.schema.nodes.cross_reference, 'Cross Reference'],
26
31
  [schema_1.schema.nodes.equation_element, 'Equation'],
27
32
  [schema_1.schema.nodes.figure_element, 'Figure'],
33
+ [schema_1.schema.nodes.table_element, 'Table'],
34
+ [schema_1.schema.nodes.table_cell, 'Table Cell'],
35
+ [schema_1.schema.nodes.table_col, 'Table Column'],
36
+ [schema_1.schema.nodes.table_row, 'Table Row'],
37
+ [schema_1.schema.nodes.table_header, 'Table Header'],
38
+ [schema_1.schema.nodes.general_table_footnote, 'General Table note'],
39
+ [schema_1.schema.nodes.table_element_footer, 'Table Footer'],
40
+ [schema_1.schema.nodes.equation, 'Equation'],
41
+ [schema_1.schema.nodes.inline_equation, 'Inline Equation'],
42
+ [schema_1.schema.nodes.inline_footnote, 'Footnote Reference'],
28
43
  [schema_1.schema.nodes.footnote, 'Footnote'],
29
44
  [schema_1.schema.nodes.footnotes_element, 'Notes'],
45
+ [schema_1.schema.nodes.footnotes_section, 'Footnotes Section'],
30
46
  [schema_1.schema.nodes.list, 'List'],
47
+ [schema_1.schema.nodes.list_item, 'List Item'],
31
48
  [schema_1.schema.nodes.manuscript, 'Manuscript'],
32
49
  [schema_1.schema.nodes.paragraph, 'Paragraph'],
33
50
  [schema_1.schema.nodes.section, 'Section'],
34
- [schema_1.schema.nodes.section_title, 'Section'],
35
- [schema_1.schema.nodes.section_title_plain, 'Section'],
51
+ [schema_1.schema.nodes.section_title, 'Section Title'],
52
+ [schema_1.schema.nodes.section_title_plain, 'Section Title'],
36
53
  [schema_1.schema.nodes.table, 'Table'],
37
54
  [schema_1.schema.nodes.table_element, 'Table'],
38
55
  [schema_1.schema.nodes.blockquote_element, 'Block Quote'],
39
56
  [schema_1.schema.nodes.pullquote_element, 'Pull Quote'],
40
- [schema_1.schema.nodes.keywords, 'Section'],
41
57
  [schema_1.schema.nodes.toc_section, 'Section'],
42
58
  [schema_1.schema.nodes.box_element, 'Box'],
43
59
  ]);
@@ -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.7-LEAN-4052.0";
4
+ exports.VERSION = "3.0.8";
@@ -100,20 +100,21 @@ const parseDates = (historyNode) => {
100
100
  return history;
101
101
  };
102
102
  const getEmail = (element) => {
103
- var _a, _b;
103
+ var _a, _b, _c;
104
104
  const email = element.querySelector('email');
105
105
  if (email) {
106
106
  return {
107
107
  href: (_a = email.getAttributeNS(XLINK_NAMESPACE, 'href')) !== null && _a !== void 0 ? _a : '',
108
- text: (_b = getTrimmedTextContent(email)) !== null && _b !== void 0 ? _b : '',
108
+ text: (_c = (_b = email.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '',
109
109
  };
110
110
  }
111
111
  };
112
112
  const getInstitutionDetails = (element) => {
113
+ var _a;
113
114
  let department = '';
114
115
  let institution = '';
115
116
  for (const node of element.querySelectorAll('institution')) {
116
- const content = getTrimmedTextContent(node);
117
+ const content = (_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim();
117
118
  if (!content) {
118
119
  continue;
119
120
  }
@@ -160,10 +161,10 @@ const parseRef = (element) => {
160
161
  const mixedCitation = element.querySelector('mixed-citation');
161
162
  if (authorNodes.length <= 0) {
162
163
  mixedCitation === null || mixedCitation === void 0 ? void 0 : mixedCitation.childNodes.forEach((item) => {
163
- var _a, _b;
164
+ var _a, _b, _c;
164
165
  if (item.nodeType === Node.TEXT_NODE &&
165
166
  ((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.match(/[A-Za-z]+/g))) {
166
- attrs.literal = (_b = getTrimmedTextContent(mixedCitation)) !== null && _b !== void 0 ? _b : '';
167
+ attrs.literal = (_c = (_b = mixedCitation.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
167
168
  return attrs;
168
169
  }
169
170
  });
@@ -201,6 +202,7 @@ const parseRef = (element) => {
201
202
  }
202
203
  const authors = [];
203
204
  authorNodes.forEach((authorNode) => {
205
+ var _a;
204
206
  const name = buildBibliographicName({});
205
207
  const given = getTrimmedTextContent(authorNode, 'given-names');
206
208
  if (given) {
@@ -211,7 +213,7 @@ const parseRef = (element) => {
211
213
  name.family = family;
212
214
  }
213
215
  if (authorNode.nodeName === 'collab') {
214
- name.literal = getTrimmedTextContent(authorNode);
216
+ name.literal = (_a = authorNode.textContent) === null || _a === void 0 ? void 0 : _a.trim();
215
217
  }
216
218
  authors.push(name);
217
219
  });
@@ -271,7 +273,7 @@ const nodes = [
271
273
  const doi = element.querySelector('front > article-meta > article-id[pub-id-type="doi"]');
272
274
  const history = element.querySelector('history');
273
275
  const dates = parseDates(history);
274
- return Object.assign({ doi: getTrimmedTextContent(doi), articleType: (_a = element.getAttribute('article-type')) !== null && _a !== void 0 ? _a : '', primaryLanguageCode: (_b = element.getAttribute('lang')) !== null && _b !== void 0 ? _b : '' }, dates);
276
+ return Object.assign({ doi: doi === null || doi === void 0 ? void 0 : doi.textContent, articleType: (_a = element.getAttribute('article-type')) !== null && _a !== void 0 ? _a : '', primaryLanguageCode: (_b = element.getAttribute('lang')) !== null && _b !== void 0 ? _b : '' }, dates);
275
277
  },
276
278
  },
277
279
  {
@@ -303,7 +305,7 @@ const nodes = [
303
305
  return {
304
306
  id: element.getAttribute('id'),
305
307
  target: element.getAttribute('target-id'),
306
- contents: getTrimmedTextContent(element),
308
+ contents: element.textContent,
307
309
  contributions: [buildContribution(DEFAULT_PROFILE_ID)],
308
310
  };
309
311
  },
@@ -326,14 +328,15 @@ const nodes = [
326
328
  tag: 'award-group',
327
329
  node: 'award',
328
330
  getAttrs: (node) => {
331
+ var _a, _b;
329
332
  const element = node;
330
333
  return {
331
334
  id: element.getAttribute('id'),
332
- recipient: getTrimmedTextContent(element, 'principal-award-recipient'),
335
+ recipient: (_a = element.querySelector('principal-award-recipient')) === null || _a === void 0 ? void 0 : _a.textContent,
333
336
  code: Array.from(element.querySelectorAll('award-id'))
334
- .map((awardID) => getTrimmedTextContent(awardID))
337
+ .map((awardID) => awardID.textContent)
335
338
  .reduce((acc, text) => (acc ? `${acc};${text}` : text), ''),
336
- source: getTrimmedTextContent(element, 'funding-source'),
339
+ source: (_b = element.querySelector('funding-source')) === null || _b === void 0 ? void 0 : _b.textContent,
337
340
  };
338
341
  },
339
342
  },
@@ -353,6 +356,7 @@ const nodes = [
353
356
  tag: 'corresp',
354
357
  node: 'corresp',
355
358
  getAttrs: (node) => {
359
+ var _a;
356
360
  const element = node;
357
361
  const label = element.querySelector('label');
358
362
  if (label) {
@@ -360,18 +364,20 @@ const nodes = [
360
364
  }
361
365
  return {
362
366
  id: element.getAttribute('id'),
363
- label: getTrimmedTextContent(label),
367
+ label: (_a = label === null || label === void 0 ? void 0 : label.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
364
368
  };
365
369
  },
366
370
  getContent: (node) => {
371
+ var _a;
367
372
  const element = node;
368
- return Fragment.from(schema.text(getTrimmedTextContent(element) || ''));
373
+ return Fragment.from(schema.text(((_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || ''));
369
374
  },
370
375
  },
371
376
  {
372
377
  tag: 'contrib[contrib-type="author"]',
373
378
  node: 'contributor',
374
379
  getAttrs: (node) => {
380
+ var _a, _b;
375
381
  const element = node;
376
382
  const footnote = [];
377
383
  const affiliations = [];
@@ -387,13 +393,13 @@ const nodes = [
387
393
  case 'fn':
388
394
  footnote.push({
389
395
  noteID: rid,
390
- noteLabel: getTrimmedTextContent(xref) || '',
396
+ noteLabel: ((_a = xref.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '',
391
397
  });
392
398
  break;
393
399
  case 'corresp':
394
400
  corresp.push({
395
401
  correspID: rid,
396
- correspLabel: getTrimmedTextContent(xref) || '',
402
+ correspLabel: ((_b = xref.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '',
397
403
  });
398
404
  break;
399
405
  case 'aff':
@@ -516,12 +522,12 @@ const nodes = [
516
522
  node: 'listing',
517
523
  context: 'listing_element/',
518
524
  getAttrs: (node) => {
519
- var _a;
525
+ var _a, _b, _c;
520
526
  const element = node;
521
527
  return {
522
528
  id: element.getAttribute('id'),
523
529
  language: (_a = element.getAttribute('language')) !== null && _a !== void 0 ? _a : '',
524
- contents: getTrimmedTextContent(element),
530
+ contents: (_c = (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '',
525
531
  };
526
532
  },
527
533
  },
@@ -537,11 +543,11 @@ const nodes = [
537
543
  tag: 'disp-formula',
538
544
  node: 'equation_element',
539
545
  getAttrs: (node) => {
540
- var _a;
546
+ var _a, _b;
541
547
  const element = node;
542
548
  return {
543
549
  id: element.getAttribute('id'),
544
- label: (_a = getTrimmedTextContent(element, 'label')) !== null && _a !== void 0 ? _a : '',
550
+ label: (_b = (_a = element.querySelector('label')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : '',
545
551
  };
546
552
  },
547
553
  getContent: (node, schema) => {
@@ -634,7 +640,7 @@ const nodes = [
634
640
  tag: 'fig',
635
641
  node: 'figure_element',
636
642
  getAttrs: (node) => {
637
- var _a, _b;
643
+ var _a, _b, _c, _d;
638
644
  const element = node;
639
645
  const labelNode = element.querySelector('label');
640
646
  if (labelNode) {
@@ -644,12 +650,12 @@ const nodes = [
644
650
  const position = element.getAttribute('position');
645
651
  const attribution = attrib
646
652
  ? {
647
- literal: (_a = getTrimmedTextContent(attrib)) !== null && _a !== void 0 ? _a : '',
653
+ literal: (_b = (_a = attrib.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '',
648
654
  }
649
655
  : undefined;
650
656
  return {
651
657
  id: element.getAttribute('id'),
652
- label: (_b = getTrimmedTextContent(labelNode)) !== null && _b !== void 0 ? _b : '',
658
+ label: (_d = (_c = labelNode === null || labelNode === void 0 ? void 0 : labelNode.textContent) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : '',
653
659
  attribution: attribution,
654
660
  position,
655
661
  };
@@ -767,13 +773,14 @@ const nodes = [
767
773
  tag: 'supplementary-material',
768
774
  node: 'supplement',
769
775
  getAttrs: (node) => {
776
+ var _a;
770
777
  const element = node;
771
778
  return {
772
779
  id: element.getAttribute('id'),
773
780
  href: element.getAttributeNS(XLINK_NAMESPACE, 'href'),
774
781
  mimeType: element.getAttribute('mimetype'),
775
782
  mimeSubType: element.getAttribute('mime-subtype'),
776
- title: getTrimmedTextContent(element, 'title'),
783
+ title: (_a = element.querySelector('title')) === null || _a === void 0 ? void 0 : _a.textContent,
777
784
  };
778
785
  },
779
786
  },
@@ -793,10 +800,11 @@ const nodes = [
793
800
  tag: 'sec[sec-type="box-element"]',
794
801
  node: 'box_element',
795
802
  getAttrs: (node) => {
803
+ var _a;
796
804
  const element = node;
797
805
  return {
798
806
  id: element.getAttribute('id'),
799
- label: getTrimmedTextContent(element, 'label'),
807
+ label: (_a = element.querySelector('label')) === null || _a === void 0 ? void 0 : _a.textContent,
800
808
  };
801
809
  },
802
810
  },
@@ -949,11 +957,11 @@ const nodes = [
949
957
  tag: 'xref[ref-type="bibr"]',
950
958
  node: 'citation',
951
959
  getAttrs: (node) => {
952
- var _a;
960
+ var _a, _b;
953
961
  const element = node;
954
962
  return {
955
963
  rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
956
- contents: getTrimmedTextContent(element),
964
+ contents: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
957
965
  };
958
966
  },
959
967
  },
@@ -961,11 +969,11 @@ const nodes = [
961
969
  tag: 'xref[ref-type="fn"]',
962
970
  node: 'inline_footnote',
963
971
  getAttrs: (node) => {
964
- var _a;
972
+ var _a, _b;
965
973
  const element = node;
966
974
  return {
967
975
  rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
968
- contents: getTrimmedTextContent(element),
976
+ contents: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
969
977
  };
970
978
  },
971
979
  },
@@ -973,11 +981,11 @@ const nodes = [
973
981
  tag: 'xref',
974
982
  node: 'cross_reference',
975
983
  getAttrs: (node) => {
976
- var _a;
984
+ var _a, _b;
977
985
  const element = node;
978
986
  return {
979
987
  rids: ((_a = element.getAttribute('rid')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
980
- label: getTrimmedTextContent(element),
988
+ label: (_b = element.textContent) === null || _b === void 0 ? void 0 : _b.trim(),
981
989
  };
982
990
  },
983
991
  },
@@ -137,7 +137,6 @@ const renameJatsNodesToHTML = (node, container, createElement) => {
137
137
  });
138
138
  };
139
139
  export const htmlFromJatsNode = (element, createElement) => {
140
- var _a;
141
140
  if (!element) {
142
141
  return undefined;
143
142
  }
@@ -146,5 +145,5 @@ export const htmlFromJatsNode = (element, createElement) => {
146
145
  }
147
146
  const temp = createElement('template');
148
147
  renameJatsNodesToHTML(element, temp, createElement);
149
- return (_a = temp.innerHTML) === null || _a === void 0 ? void 0 : _a.trim();
148
+ return temp.innerHTML;
150
149
  };
@@ -67,14 +67,12 @@ export const findParentNodeClosestToPos = ($pos, predicate) => {
67
67
  }
68
68
  }
69
69
  };
70
- export const getTrimmedTextContent = (node, selector) => {
71
- var _a, _b, _c;
70
+ export const getTrimmedTextContent = (node, querySelector) => {
71
+ var _a, _b;
72
72
  if (!node) {
73
- return undefined;
73
+ return null;
74
74
  }
75
- return selector
76
- ? (_b = (_a = node.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()
77
- : (_c = node.textContent) === null || _c === void 0 ? void 0 : _c.trim();
75
+ return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
78
76
  };
79
77
  export const timestamp = () => Math.floor(Date.now() / 1000);
80
78
  export const dateToTimestamp = (dateElement) => {
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const inlineFootnote = {
17
- name: 'Footnote marker',
18
17
  attrs: {
19
18
  rids: { default: [] },
20
19
  contents: { default: '' },
@@ -15,26 +15,42 @@
15
15
  */
16
16
  import { schema } from '../schema';
17
17
  export const nodeNames = new Map([
18
+ [schema.nodes.title, 'Title'],
19
+ [schema.nodes.contributor, 'Author'],
20
+ [schema.nodes.keywords, 'Keywords'],
21
+ [schema.nodes.keyword, 'Keyword'],
18
22
  [schema.nodes.bibliography_element, 'Bibliography'],
23
+ [schema.nodes.bibliography_item, 'Reference'],
19
24
  [schema.nodes.bibliography_section, 'Section'],
20
25
  [schema.nodes.citation, 'Citation'],
21
26
  [schema.nodes.listing_element, 'Listing'],
22
27
  [schema.nodes.cross_reference, 'Cross Reference'],
23
28
  [schema.nodes.equation_element, 'Equation'],
24
29
  [schema.nodes.figure_element, 'Figure'],
30
+ [schema.nodes.table_element, 'Table'],
31
+ [schema.nodes.table_cell, 'Table Cell'],
32
+ [schema.nodes.table_col, 'Table Column'],
33
+ [schema.nodes.table_row, 'Table Row'],
34
+ [schema.nodes.table_header, 'Table Header'],
35
+ [schema.nodes.general_table_footnote, 'General Table note'],
36
+ [schema.nodes.table_element_footer, 'Table Footer'],
37
+ [schema.nodes.equation, 'Equation'],
38
+ [schema.nodes.inline_equation, 'Inline Equation'],
39
+ [schema.nodes.inline_footnote, 'Footnote Reference'],
25
40
  [schema.nodes.footnote, 'Footnote'],
26
41
  [schema.nodes.footnotes_element, 'Notes'],
42
+ [schema.nodes.footnotes_section, 'Footnotes Section'],
27
43
  [schema.nodes.list, 'List'],
44
+ [schema.nodes.list_item, 'List Item'],
28
45
  [schema.nodes.manuscript, 'Manuscript'],
29
46
  [schema.nodes.paragraph, 'Paragraph'],
30
47
  [schema.nodes.section, 'Section'],
31
- [schema.nodes.section_title, 'Section'],
32
- [schema.nodes.section_title_plain, 'Section'],
48
+ [schema.nodes.section_title, 'Section Title'],
49
+ [schema.nodes.section_title_plain, 'Section Title'],
33
50
  [schema.nodes.table, 'Table'],
34
51
  [schema.nodes.table_element, 'Table'],
35
52
  [schema.nodes.blockquote_element, 'Block Quote'],
36
53
  [schema.nodes.pullquote_element, 'Pull Quote'],
37
- [schema.nodes.keywords, 'Section'],
38
54
  [schema.nodes.toc_section, 'Section'],
39
55
  [schema.nodes.box_element, 'Box'],
40
56
  ]);
@@ -1 +1 @@
1
- export const VERSION = "3.0.7-LEAN-4052.0";
1
+ export const VERSION = "3.0.8";
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare const TABLE_CELL_STYLES: readonly ["backgroundColor", "border-top", "border-right", "border-bottom", "border-left", "verticalAlign", "textAlign"];
17
- export type TableCellStyleKey = typeof TABLE_CELL_STYLES[number];
17
+ export type TableCellStyleKey = (typeof TABLE_CELL_STYLES)[number];
18
18
  export declare const serializeTableCellStyles: (styles: {
19
19
  backgroundColor?: string | null | undefined;
20
20
  "border-top"?: string | null | undefined;
@@ -25,6 +25,6 @@ export declare const findParentNodeClosestToPos: ($pos: ResolvedPos, predicate:
25
25
  depth: number;
26
26
  node: ProsemirrorNode;
27
27
  } | undefined;
28
- export declare const getTrimmedTextContent: (node: Element | Document | null, selector?: string) => string | undefined;
28
+ export declare const getTrimmedTextContent: (node: Element | Document | null, querySelector: string) => string | null | undefined;
29
29
  export declare const timestamp: () => number;
30
30
  export declare const dateToTimestamp: (dateElement: Element) => number | undefined;
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.7-LEAN-4052.0";
1
+ export declare const VERSION = "3.0.8";
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.7-LEAN-4052.0",
4
+ "version": "3.0.8",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",