@manuscripts/transform 3.0.3 → 3.0.4-LEAN-4041.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.
Files changed (67) hide show
  1. package/dist/cjs/jats/exporter/jats-exporter.js +14 -38
  2. package/dist/cjs/schema/nodes/bibliography_element.js +0 -1
  3. package/dist/cjs/schema/nodes/bibliography_item.js +0 -1
  4. package/dist/cjs/schema/nodes/blockquote_element.js +0 -3
  5. package/dist/cjs/schema/nodes/citation.js +0 -2
  6. package/dist/cjs/schema/nodes/cross_reference.js +1 -13
  7. package/dist/cjs/schema/nodes/equation_element.js +0 -1
  8. package/dist/cjs/schema/nodes/figure.js +0 -1
  9. package/dist/cjs/schema/nodes/figure_element.js +1 -28
  10. package/dist/cjs/schema/nodes/footnote.js +1 -5
  11. package/dist/cjs/schema/nodes/footnotes_element.js +1 -5
  12. package/dist/cjs/schema/nodes/graphical_abstract_section.js +0 -1
  13. package/dist/cjs/schema/nodes/keywords_element.js +0 -2
  14. package/dist/cjs/schema/nodes/list.js +0 -3
  15. package/dist/cjs/schema/nodes/listing_element.js +0 -2
  16. package/dist/cjs/schema/nodes/missing_figure.js +0 -1
  17. package/dist/cjs/schema/nodes/paragraph.js +0 -3
  18. package/dist/cjs/schema/nodes/pullquote_element.js +1 -6
  19. package/dist/cjs/schema/nodes/section.js +2 -44
  20. package/dist/cjs/schema/nodes/table_element.js +0 -11
  21. package/dist/cjs/schema/nodes/toc_element.js +0 -1
  22. package/dist/cjs/version.js +1 -1
  23. package/dist/es/jats/exporter/jats-exporter.js +14 -38
  24. package/dist/es/schema/nodes/bibliography_element.js +0 -1
  25. package/dist/es/schema/nodes/bibliography_item.js +0 -1
  26. package/dist/es/schema/nodes/blockquote_element.js +0 -3
  27. package/dist/es/schema/nodes/citation.js +0 -2
  28. package/dist/es/schema/nodes/cross_reference.js +1 -13
  29. package/dist/es/schema/nodes/equation_element.js +0 -1
  30. package/dist/es/schema/nodes/figure.js +0 -1
  31. package/dist/es/schema/nodes/figure_element.js +1 -28
  32. package/dist/es/schema/nodes/footnote.js +1 -5
  33. package/dist/es/schema/nodes/footnotes_element.js +1 -5
  34. package/dist/es/schema/nodes/graphical_abstract_section.js +0 -1
  35. package/dist/es/schema/nodes/keywords_element.js +0 -2
  36. package/dist/es/schema/nodes/list.js +0 -3
  37. package/dist/es/schema/nodes/listing_element.js +0 -2
  38. package/dist/es/schema/nodes/missing_figure.js +0 -1
  39. package/dist/es/schema/nodes/paragraph.js +0 -3
  40. package/dist/es/schema/nodes/pullquote_element.js +1 -6
  41. package/dist/es/schema/nodes/section.js +1 -43
  42. package/dist/es/schema/nodes/table_element.js +0 -11
  43. package/dist/es/schema/nodes/toc_element.js +0 -1
  44. package/dist/es/version.js +1 -1
  45. package/dist/types/jats/exporter/jats-exporter.d.ts +1 -1
  46. package/dist/types/schema/nodes/bibliography_element.d.ts +0 -1
  47. package/dist/types/schema/nodes/bibliography_item.d.ts +0 -1
  48. package/dist/types/schema/nodes/blockquote_element.d.ts +0 -1
  49. package/dist/types/schema/nodes/citation.d.ts +0 -1
  50. package/dist/types/schema/nodes/cross_reference.d.ts +0 -1
  51. package/dist/types/schema/nodes/equation_element.d.ts +0 -1
  52. package/dist/types/schema/nodes/figure_element.d.ts +0 -14
  53. package/dist/types/schema/nodes/footnote.d.ts +0 -1
  54. package/dist/types/schema/nodes/footnotes_element.d.ts +0 -1
  55. package/dist/types/schema/nodes/keywords_element.d.ts +1 -2
  56. package/dist/types/schema/nodes/list.d.ts +0 -1
  57. package/dist/types/schema/nodes/listing_element.d.ts +0 -2
  58. package/dist/types/schema/nodes/paragraph.d.ts +0 -1
  59. package/dist/types/schema/nodes/pullquote_element.d.ts +0 -1
  60. package/dist/types/schema/nodes/section.d.ts +1 -8
  61. package/dist/types/schema/nodes/table_element.d.ts +0 -8
  62. package/dist/types/schema/nodes/toc_element.d.ts +0 -1
  63. package/dist/types/version.d.ts +1 -1
  64. package/package.json +1 -1
  65. package/dist/cjs/lib/attributes.js +0 -26
  66. package/dist/es/lib/attributes.js +0 -22
  67. package/dist/types/lib/attributes.d.ts +0 -20
@@ -581,17 +581,18 @@ class JATSExporter {
581
581
  return xref;
582
582
  },
583
583
  cross_reference: (node) => {
584
- var _a;
584
+ var _a, _b, _c;
585
585
  const cross = node;
586
586
  const rids = cross.attrs.rids;
587
587
  if (!rids.length) {
588
- return cross.attrs.label;
588
+ return (_a = cross.attrs.label) !== null && _a !== void 0 ? _a : '';
589
589
  }
590
- const text = cross.attrs.customLabel || cross.attrs.label;
591
- const target = (_a = (0, prosemirror_utils_1.findChildrenByAttr)(this.manuscriptNode, (attrs) => attrs.id === rids[0])[0]) === null || _a === void 0 ? void 0 : _a.node;
590
+ const rid = rids[0];
591
+ const text = cross.attrs.label || ((_b = this.labelTargets.get(rid)) === null || _b === void 0 ? void 0 : _b.label);
592
+ const target = (_c = (0, prosemirror_utils_1.findChildrenByAttr)(this.manuscriptNode, (attrs) => attrs.id === rid)[0]) === null || _c === void 0 ? void 0 : _c.node;
592
593
  if (!target) {
593
594
  warn('');
594
- return text;
595
+ return text || '';
595
596
  }
596
597
  const xref = this.document.createElement('xref');
597
598
  const type = chooseRefType(target.type);
@@ -602,7 +603,7 @@ class JATSExporter {
602
603
  warn(`Unset ref-type for schema type ${target.type.name}`);
603
604
  }
604
605
  xref.setAttribute('rid', normalizeID(rids.join(' ')));
605
- xref.textContent = text;
606
+ xref.textContent = text !== null && text !== void 0 ? text : '';
606
607
  return xref;
607
608
  },
608
609
  doc: () => '',
@@ -1190,22 +1191,6 @@ class JATSExporter {
1190
1191
  this.fixBody = (body) => {
1191
1192
  this.manuscriptNode.descendants((node) => {
1192
1193
  if (node.attrs.id) {
1193
- if (node.attrs.titleSuppressed) {
1194
- const title = body.querySelector(`#${normalizeID(node.attrs.id)} > title`);
1195
- if (title && title.parentNode) {
1196
- title.parentNode.removeChild(title);
1197
- }
1198
- }
1199
- if (node.attrs.suppressCaption) {
1200
- const caption = body.querySelector(`#${normalizeID(node.attrs.id)} > caption`);
1201
- if (caption) {
1202
- caption.remove();
1203
- }
1204
- const label = body.querySelector(`#${normalizeID(node.attrs.id)} > label`);
1205
- if (label) {
1206
- label.remove();
1207
- }
1208
- }
1209
1194
  if ((0, transformer_1.isNodeType)(node, 'general_table_footnote')) {
1210
1195
  const generalTableFootnote = body.querySelector(`#${normalizeID(node.attrs.id)}`);
1211
1196
  if (generalTableFootnote) {
@@ -1221,13 +1206,8 @@ class JATSExporter {
1221
1206
  for (const childNode of tableElement.childNodes) {
1222
1207
  switch (childNode.nodeName) {
1223
1208
  case 'caption': {
1224
- if (node.attrs.suppressCaption) {
1225
- tableElement.removeChild(childNode);
1226
- }
1227
- else {
1228
- const label = tableElement.querySelector('label');
1229
- tableElement.insertBefore(childNode, label ? label.nextSibling : tableElement.firstChild);
1230
- }
1209
+ const label = tableElement.querySelector('label');
1210
+ tableElement.insertBefore(childNode, label ? label.nextSibling : tableElement.firstChild);
1231
1211
  break;
1232
1212
  }
1233
1213
  case 'table': {
@@ -1271,19 +1251,15 @@ class JATSExporter {
1271
1251
  const headerCell = row.querySelector('th[scope="col"], th[scope="colgroup"]');
1272
1252
  if (i === 0 || headerCell) {
1273
1253
  tbody === null || tbody === void 0 ? void 0 : tbody.removeChild(row);
1274
- if (!node.attrs.suppressHeader) {
1275
- const tableCells = row.querySelectorAll('td');
1276
- for (const td of tableCells) {
1277
- this.changeTag(td, 'th');
1278
- }
1279
- thead.appendChild(row);
1254
+ const tableCells = row.querySelectorAll('td');
1255
+ for (const td of tableCells) {
1256
+ this.changeTag(td, 'th');
1280
1257
  }
1258
+ thead.appendChild(row);
1281
1259
  }
1282
1260
  else if (i === tbodyRows.length - 1) {
1283
1261
  tbody === null || tbody === void 0 ? void 0 : tbody.removeChild(row);
1284
- if (!node.attrs.suppressFooter) {
1285
- tfoot.appendChild(row);
1286
- }
1262
+ tfoot.appendChild(row);
1287
1263
  }
1288
1264
  }
1289
1265
  });
@@ -21,7 +21,6 @@ exports.bibliographyElement = {
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  contents: { default: '' },
24
- paragraphStyle: { default: '' },
25
24
  dataTracked: { default: null },
26
25
  },
27
26
  selectable: false,
@@ -31,7 +31,6 @@ exports.bibliographyItem = {
31
31
  page: { default: undefined },
32
32
  title: { default: undefined },
33
33
  literal: { default: undefined },
34
- paragraphStyle: { default: '' },
35
34
  dataTracked: { default: null },
36
35
  },
37
36
  selectable: false,
@@ -17,12 +17,10 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isBlockquoteElement = exports.blockquoteElement = void 0;
19
19
  const json_schema_1 = require("@manuscripts/json-schema");
20
- const attributes_1 = require("../../lib/attributes");
21
20
  exports.blockquoteElement = {
22
21
  content: 'paragraph+ attribution',
23
22
  attrs: {
24
23
  id: { default: '' },
25
- paragraphStyle: { default: '' },
26
24
  placeholder: { default: '' },
27
25
  dataTracked: { default: null },
28
26
  },
@@ -50,7 +48,6 @@ exports.blockquoteElement = {
50
48
  if (blockquoteElementNode.attrs.id) {
51
49
  attrs.id = blockquoteElementNode.attrs.id;
52
50
  }
53
- attrs.class = (0, attributes_1.buildElementClass)(blockquoteElementNode.attrs);
54
51
  attrs['data-object-type'] = json_schema_1.ObjectTypes.QuoteElement;
55
52
  if (blockquoteElementNode.attrs.placeholder) {
56
53
  attrs['data-placeholder-text'] = blockquoteElementNode.attrs.placeholder;
@@ -24,7 +24,6 @@ exports.citation = {
24
24
  attrs: {
25
25
  id: { default: '' },
26
26
  rids: { default: [] },
27
- contents: { default: '' },
28
27
  selectedText: { default: '' },
29
28
  dataTracked: { default: null },
30
29
  },
@@ -37,7 +36,6 @@ exports.citation = {
37
36
  return {
38
37
  id: dom.getAttribute('data-id'),
39
38
  rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
40
- contents: dom.innerHTML,
41
39
  };
42
40
  },
43
41
  },
@@ -24,7 +24,6 @@ exports.crossReference = {
24
24
  attrs: {
25
25
  rids: { default: [] },
26
26
  label: { default: '' },
27
- customLabel: { default: '' },
28
27
  dataTracked: { default: null },
29
28
  },
30
29
  parseDOM: [
@@ -35,7 +34,6 @@ exports.crossReference = {
35
34
  const dom = p;
36
35
  return {
37
36
  rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
38
- label: dom.textContent,
39
37
  };
40
38
  },
41
39
  },
@@ -48,17 +46,7 @@ exports.crossReference = {
48
46
  class: 'cross-reference',
49
47
  'data-reference-id': crossReferenceNode.attrs.rids.join(' '),
50
48
  },
51
- [
52
- 'span',
53
- {
54
- class: 'kind elementIndex',
55
- },
56
- [
57
- 'b',
58
- crossReferenceNode.attrs.customLabel ||
59
- crossReferenceNode.attrs.label,
60
- ],
61
- ],
49
+ crossReferenceNode.attrs.label,
62
50
  ];
63
51
  },
64
52
  };
@@ -20,7 +20,6 @@ exports.equationElement = {
20
20
  content: '(equation | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
- label: { default: '' },
24
23
  dataTracked: { default: null },
25
24
  },
26
25
  selectable: false,
@@ -21,7 +21,6 @@ exports.figure = {
21
21
  id: { default: '' },
22
22
  src: { default: '' },
23
23
  contentType: { default: '' },
24
- position: { default: undefined },
25
24
  dataTracked: { default: null },
26
25
  },
27
26
  selectable: false,
@@ -19,16 +19,8 @@ exports.isFigureElementNode = exports.figureElement = void 0;
19
19
  exports.figureElement = {
20
20
  content: '(paragraph | figure | missing_figure | placeholder)+ attribution* figcaption (listing | placeholder)',
21
21
  attrs: {
22
- figureLayout: { default: '' },
23
- figureStyle: { default: '' },
24
22
  id: { default: '' },
25
- label: { default: '' },
26
- sizeFraction: { default: 0 },
27
- alignment: { default: undefined },
28
- suppressCaption: { default: false },
29
- suppressTitle: { default: undefined },
30
23
  attribution: { default: undefined },
31
- alternatives: { default: undefined },
32
24
  dataTracked: { default: null },
33
25
  },
34
26
  selectable: false,
@@ -40,36 +32,17 @@ exports.figureElement = {
40
32
  const dom = p;
41
33
  return {
42
34
  id: dom.getAttribute('id'),
43
- figureStyle: dom.getAttribute('data-figure-style'),
44
- figureLayout: dom.getAttribute('data-figure-layout'),
45
- sizeFraction: Number(dom.getAttribute('data-size-fraction')) || 0,
46
- alignment: dom.getAttribute('data-alignment') || undefined,
47
35
  };
48
36
  },
49
37
  },
50
38
  ],
51
39
  toDOM: (node) => {
52
40
  const figureElementNode = node;
53
- const { id, figureStyle, figureLayout, alignment, sizeFraction } = figureElementNode.attrs;
41
+ const { id } = figureElementNode.attrs;
54
42
  const attrs = {};
55
43
  const classes = ['figure-group'];
56
- if (sizeFraction === 2) {
57
- classes.push('figure-group--static');
58
- }
59
44
  attrs.class = classes.join(' ');
60
45
  attrs.id = id;
61
- if (figureStyle) {
62
- attrs['data-figure-style'] = figureStyle;
63
- }
64
- if (figureLayout) {
65
- attrs['data-figure-layout'] = figureLayout;
66
- }
67
- if (sizeFraction) {
68
- attrs['data-size-fraction'] = String(sizeFraction);
69
- }
70
- if (alignment) {
71
- attrs['data-alignment'] = alignment;
72
- }
73
46
  return ['figure', attrs, 0];
74
47
  },
75
48
  };
@@ -22,7 +22,6 @@ exports.footnote = {
22
22
  attrs: {
23
23
  id: { default: '' },
24
24
  kind: { default: 'footnote' },
25
- paragraphStyle: { default: '' },
26
25
  placeholder: { default: '' },
27
26
  dataTracked: { default: null },
28
27
  },
@@ -45,7 +44,7 @@ exports.footnote = {
45
44
  ],
46
45
  toDOM: (node) => {
47
46
  const footnoteNode = node;
48
- const { kind, paragraphStyle, placeholder, id } = footnoteNode.attrs;
47
+ const { kind, placeholder, id } = footnoteNode.attrs;
49
48
  const attrs = { class: 'footnote-text', id: '' };
50
49
  if (kind) {
51
50
  attrs['data-kind'] = kind;
@@ -53,9 +52,6 @@ exports.footnote = {
53
52
  if (id) {
54
53
  attrs.id = id;
55
54
  }
56
- if (paragraphStyle) {
57
- attrs.paragraphStyle = paragraphStyle;
58
- }
59
55
  if (placeholder) {
60
56
  attrs['data-placeholder-text'] = placeholder;
61
57
  }
@@ -20,7 +20,6 @@ exports.footnotesElement = {
20
20
  attrs: {
21
21
  id: { default: '' },
22
22
  kind: { default: 'footnote' },
23
- paragraphStyle: { default: '' },
24
23
  dataTracked: { default: null },
25
24
  },
26
25
  content: 'footnote*',
@@ -39,14 +38,11 @@ exports.footnotesElement = {
39
38
  ],
40
39
  toDOM: (node) => {
41
40
  const footnotesElementNode = node;
42
- const { id, kind, paragraphStyle } = footnotesElementNode.attrs;
41
+ const { id, kind } = footnotesElementNode.attrs;
43
42
  const attrs = { class: 'footnotes', id };
44
43
  if (kind) {
45
44
  attrs['data-kind'] = kind;
46
45
  }
47
- if (paragraphStyle) {
48
- attrs['paragraphStyle'] = paragraphStyle;
49
- }
50
46
  return ['div', attrs, 0];
51
47
  },
52
48
  };
@@ -20,7 +20,6 @@ exports.graphicalAbstractSection = {
20
20
  content: 'section_title (figure_element | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
- category: { default: '' },
24
23
  dataTracked: { default: null },
25
24
  },
26
25
  group: 'block sections',
@@ -22,8 +22,6 @@ exports.keywordsElement = {
22
22
  attrs: {
23
23
  id: { default: '' },
24
24
  contents: { default: '' },
25
- paragraphStyle: { default: '' },
26
- type: { default: '' },
27
25
  dataTracked: { default: null },
28
26
  },
29
27
  group: 'block element',
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isListNode = exports.listItem = exports.list = exports.getListType = void 0;
4
4
  const json_schema_1 = require("@manuscripts/json-schema");
5
- const attributes_1 = require("../../lib/attributes");
6
5
  const getListType = (style) => {
7
6
  switch (style) {
8
7
  case 'simple':
@@ -29,7 +28,6 @@ exports.list = {
29
28
  group: 'block list element',
30
29
  attrs: {
31
30
  id: { default: '' },
32
- paragraphStyle: { default: '' },
33
31
  dataTracked: { default: null },
34
32
  listStyleType: { default: null },
35
33
  },
@@ -63,7 +61,6 @@ exports.list = {
63
61
  {
64
62
  id: list.attrs.id,
65
63
  'list-type': list.attrs.listStyleType,
66
- class: (0, attributes_1.buildElementClass)(list.attrs),
67
64
  'data-object-type': json_schema_1.ObjectTypes.ListElement,
68
65
  },
69
66
  0,
@@ -20,8 +20,6 @@ exports.listingElement = {
20
20
  content: '(listing | placeholder) figcaption',
21
21
  attrs: {
22
22
  id: { default: '' },
23
- suppressCaption: { default: true },
24
- suppressTitle: { default: undefined },
25
23
  dataTracked: { default: null },
26
24
  },
27
25
  group: 'block element',
@@ -19,7 +19,6 @@ exports.missingFigure = void 0;
19
19
  exports.missingFigure = {
20
20
  attrs: {
21
21
  id: { default: '' },
22
- position: { default: undefined },
23
22
  dataTracked: { default: null },
24
23
  },
25
24
  selectable: false,
@@ -17,12 +17,10 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isParagraphNode = exports.paragraph = void 0;
19
19
  const json_schema_1 = require("@manuscripts/json-schema");
20
- const attributes_1 = require("../../lib/attributes");
21
20
  exports.paragraph = {
22
21
  content: 'inline*',
23
22
  attrs: {
24
23
  id: { default: '' },
25
- paragraphStyle: { default: '' },
26
24
  placeholder: { default: '' },
27
25
  dataTracked: { default: null },
28
26
  },
@@ -50,7 +48,6 @@ exports.paragraph = {
50
48
  if (paragraphNode.attrs.id) {
51
49
  attrs.id = paragraphNode.attrs.id;
52
50
  }
53
- attrs.class = (0, attributes_1.buildElementClass)(paragraphNode.attrs);
54
51
  attrs['data-object-type'] = json_schema_1.ObjectTypes.ParagraphElement;
55
52
  if (paragraphNode.attrs.placeholder) {
56
53
  attrs['data-placeholder-text'] = paragraphNode.attrs.placeholder;
@@ -17,12 +17,10 @@
17
17
  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
- const attributes_1 = require("../../lib/attributes");
21
20
  exports.pullquoteElement = {
22
21
  content: 'paragraph+ attribution',
23
22
  attrs: {
24
23
  id: { default: '' },
25
- paragraphStyle: { default: '' },
26
24
  placeholder: { default: '' },
27
25
  dataTracked: { default: null },
28
26
  },
@@ -50,10 +48,7 @@ exports.pullquoteElement = {
50
48
  if (pullquoteElementNode.attrs.id) {
51
49
  attrs.id = pullquoteElementNode.attrs.id;
52
50
  }
53
- attrs.class = [
54
- 'pullquote',
55
- (0, attributes_1.buildElementClass)(pullquoteElementNode.attrs),
56
- ].join(' ');
51
+ attrs.class = 'pullquote';
57
52
  attrs['data-object-type'] = json_schema_1.ObjectTypes.QuoteElement;
58
53
  if (pullquoteElementNode.attrs.placeholder) {
59
54
  attrs['data-placeholder-text'] = pullquoteElementNode.attrs.placeholder;
@@ -15,33 +15,12 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isSectionNode = exports.section = exports.PAGE_BREAK_BEFORE_AND_AFTER = exports.PAGE_BREAK_AFTER = exports.PAGE_BREAK_BEFORE = exports.PAGE_BREAK_NONE = void 0;
19
- exports.PAGE_BREAK_NONE = 0;
20
- exports.PAGE_BREAK_BEFORE = 1;
21
- exports.PAGE_BREAK_AFTER = 2;
22
- exports.PAGE_BREAK_BEFORE_AND_AFTER = 4;
23
- const choosePageBreakStyle = (element) => {
24
- const pageBreakAfter = element.classList.contains('page-break-after');
25
- const pageBreakBefore = element.classList.contains('page-break-before');
26
- if (pageBreakBefore && pageBreakAfter) {
27
- return exports.PAGE_BREAK_BEFORE_AND_AFTER;
28
- }
29
- if (pageBreakBefore) {
30
- return exports.PAGE_BREAK_BEFORE;
31
- }
32
- if (pageBreakAfter) {
33
- return exports.PAGE_BREAK_AFTER;
34
- }
35
- return exports.PAGE_BREAK_NONE;
36
- };
18
+ exports.isSectionNode = exports.section = void 0;
37
19
  exports.section = {
38
20
  content: 'section_label? section_title (paragraph | element)* sections*',
39
21
  attrs: {
40
22
  id: { default: '' },
41
23
  category: { default: '' },
42
- titleSuppressed: { default: false },
43
- generatedLabel: { default: undefined },
44
- pageBreakStyle: { default: undefined },
45
24
  dataTracked: { default: null },
46
25
  },
47
26
  group: 'block sections',
@@ -54,35 +33,14 @@ exports.section = {
54
33
  return {
55
34
  id: element.getAttribute('id') || '',
56
35
  category: element.getAttribute('data-category') || '',
57
- titleSuppressed: element.classList.contains('title-suppressed'),
58
- generatedLabel: element.classList.contains('generated-label'),
59
- pageBreakStyle: choosePageBreakStyle(element) || undefined,
60
36
  };
61
37
  },
62
38
  },
63
39
  ],
64
40
  toDOM: (node) => {
65
41
  const sectionNode = node;
66
- const { id, category, titleSuppressed, generatedLabel, pageBreakStyle } = sectionNode.attrs;
67
- const classnames = [];
68
- if (titleSuppressed) {
69
- classnames.push('title-suppressed');
70
- }
71
- if (typeof generatedLabel === 'undefined' || generatedLabel) {
72
- classnames.push('generated-label');
73
- }
74
- if (pageBreakStyle === exports.PAGE_BREAK_BEFORE ||
75
- pageBreakStyle === exports.PAGE_BREAK_BEFORE_AND_AFTER) {
76
- classnames.push('page-break-before');
77
- }
78
- if (pageBreakStyle === exports.PAGE_BREAK_AFTER ||
79
- pageBreakStyle === exports.PAGE_BREAK_BEFORE_AND_AFTER) {
80
- classnames.push('page-break-after');
81
- }
42
+ const { id, category } = sectionNode.attrs;
82
43
  const attrs = { id };
83
- if (classnames.length) {
84
- attrs['class'] = classnames.join(' ');
85
- }
86
44
  if (category) {
87
45
  attrs['data-category'] = node.attrs.category;
88
46
  }
@@ -20,14 +20,7 @@ exports.tableElement = {
20
20
  content: ' figcaption? (table | placeholder) table_colgroup? table_element_footer? (listing | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
- paragraphStyle: { default: '' },
24
- tableStyle: { default: '' },
25
23
  label: { default: '' },
26
- suppressCaption: { default: false },
27
- suppressTitle: { default: undefined },
28
- suppressFooter: { default: false },
29
- suppressHeader: { default: false },
30
- expandListing: { default: false },
31
24
  dataTracked: { default: null },
32
25
  },
33
26
  selectable: false,
@@ -39,8 +32,6 @@ exports.tableElement = {
39
32
  const element = dom;
40
33
  return {
41
34
  id: element.getAttribute('id'),
42
- paragraphStyle: element.getAttribute('data-paragraph-style') || '',
43
- tableStyle: element.getAttribute('data-table-style') || '',
44
35
  };
45
36
  },
46
37
  },
@@ -52,8 +43,6 @@ exports.tableElement = {
52
43
  {
53
44
  class: 'table',
54
45
  id: tableElementNode.attrs.id,
55
- 'data-paragraph-style': tableElementNode.attrs.paragraphStyle,
56
- 'data-table-style': tableElementNode.attrs.tableStyle,
57
46
  },
58
47
  0,
59
48
  ];
@@ -28,7 +28,6 @@ exports.tocElement = {
28
28
  attrs: {
29
29
  id: { default: '' },
30
30
  contents: { default: '' },
31
- paragraphStyle: { default: '' },
32
31
  dataTracked: { default: null },
33
32
  },
34
33
  group: 'block element',
@@ -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.3";
4
+ exports.VERSION = "3.0.4-LEAN-4041.0";
@@ -573,17 +573,18 @@ export class JATSExporter {
573
573
  return xref;
574
574
  },
575
575
  cross_reference: (node) => {
576
- var _a;
576
+ var _a, _b, _c;
577
577
  const cross = node;
578
578
  const rids = cross.attrs.rids;
579
579
  if (!rids.length) {
580
- return cross.attrs.label;
580
+ return (_a = cross.attrs.label) !== null && _a !== void 0 ? _a : '';
581
581
  }
582
- const text = cross.attrs.customLabel || cross.attrs.label;
583
- const target = (_a = findChildrenByAttr(this.manuscriptNode, (attrs) => attrs.id === rids[0])[0]) === null || _a === void 0 ? void 0 : _a.node;
582
+ const rid = rids[0];
583
+ const text = cross.attrs.label || ((_b = this.labelTargets.get(rid)) === null || _b === void 0 ? void 0 : _b.label);
584
+ const target = (_c = findChildrenByAttr(this.manuscriptNode, (attrs) => attrs.id === rid)[0]) === null || _c === void 0 ? void 0 : _c.node;
584
585
  if (!target) {
585
586
  warn('');
586
- return text;
587
+ return text || '';
587
588
  }
588
589
  const xref = this.document.createElement('xref');
589
590
  const type = chooseRefType(target.type);
@@ -594,7 +595,7 @@ export class JATSExporter {
594
595
  warn(`Unset ref-type for schema type ${target.type.name}`);
595
596
  }
596
597
  xref.setAttribute('rid', normalizeID(rids.join(' ')));
597
- xref.textContent = text;
598
+ xref.textContent = text !== null && text !== void 0 ? text : '';
598
599
  return xref;
599
600
  },
600
601
  doc: () => '',
@@ -1182,22 +1183,6 @@ export class JATSExporter {
1182
1183
  this.fixBody = (body) => {
1183
1184
  this.manuscriptNode.descendants((node) => {
1184
1185
  if (node.attrs.id) {
1185
- if (node.attrs.titleSuppressed) {
1186
- const title = body.querySelector(`#${normalizeID(node.attrs.id)} > title`);
1187
- if (title && title.parentNode) {
1188
- title.parentNode.removeChild(title);
1189
- }
1190
- }
1191
- if (node.attrs.suppressCaption) {
1192
- const caption = body.querySelector(`#${normalizeID(node.attrs.id)} > caption`);
1193
- if (caption) {
1194
- caption.remove();
1195
- }
1196
- const label = body.querySelector(`#${normalizeID(node.attrs.id)} > label`);
1197
- if (label) {
1198
- label.remove();
1199
- }
1200
- }
1201
1186
  if (isNodeType(node, 'general_table_footnote')) {
1202
1187
  const generalTableFootnote = body.querySelector(`#${normalizeID(node.attrs.id)}`);
1203
1188
  if (generalTableFootnote) {
@@ -1213,13 +1198,8 @@ export class JATSExporter {
1213
1198
  for (const childNode of tableElement.childNodes) {
1214
1199
  switch (childNode.nodeName) {
1215
1200
  case 'caption': {
1216
- if (node.attrs.suppressCaption) {
1217
- tableElement.removeChild(childNode);
1218
- }
1219
- else {
1220
- const label = tableElement.querySelector('label');
1221
- tableElement.insertBefore(childNode, label ? label.nextSibling : tableElement.firstChild);
1222
- }
1201
+ const label = tableElement.querySelector('label');
1202
+ tableElement.insertBefore(childNode, label ? label.nextSibling : tableElement.firstChild);
1223
1203
  break;
1224
1204
  }
1225
1205
  case 'table': {
@@ -1263,19 +1243,15 @@ export class JATSExporter {
1263
1243
  const headerCell = row.querySelector('th[scope="col"], th[scope="colgroup"]');
1264
1244
  if (i === 0 || headerCell) {
1265
1245
  tbody === null || tbody === void 0 ? void 0 : tbody.removeChild(row);
1266
- if (!node.attrs.suppressHeader) {
1267
- const tableCells = row.querySelectorAll('td');
1268
- for (const td of tableCells) {
1269
- this.changeTag(td, 'th');
1270
- }
1271
- thead.appendChild(row);
1246
+ const tableCells = row.querySelectorAll('td');
1247
+ for (const td of tableCells) {
1248
+ this.changeTag(td, 'th');
1272
1249
  }
1250
+ thead.appendChild(row);
1273
1251
  }
1274
1252
  else if (i === tbodyRows.length - 1) {
1275
1253
  tbody === null || tbody === void 0 ? void 0 : tbody.removeChild(row);
1276
- if (!node.attrs.suppressFooter) {
1277
- tfoot.appendChild(row);
1278
- }
1254
+ tfoot.appendChild(row);
1279
1255
  }
1280
1256
  }
1281
1257
  });
@@ -18,7 +18,6 @@ export const bibliographyElement = {
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  contents: { default: '' },
21
- paragraphStyle: { default: '' },
22
21
  dataTracked: { default: null },
23
22
  },
24
23
  selectable: false,