@manuscripts/transform 2.1.1-LEAN-3336-16 → 2.1.1-LEAN-3092-3

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 (57) hide show
  1. package/dist/cjs/index.js +0 -1
  2. package/dist/cjs/jats/importer/jats-body-dom-parser.js +33 -74
  3. package/dist/cjs/jats/jats-exporter.js +32 -64
  4. package/dist/cjs/schema/index.js +5 -4
  5. package/dist/cjs/schema/nodes/equation.js +12 -14
  6. package/dist/cjs/schema/nodes/equation_element.js +4 -5
  7. package/dist/cjs/schema/nodes/inline_equation.js +12 -16
  8. package/dist/cjs/schema/nodes/table.js +47 -156
  9. package/dist/cjs/schema/nodes/table_element.js +1 -1
  10. package/dist/cjs/schema/nodes/table_row.js +123 -0
  11. package/dist/cjs/transformer/builders.js +1 -8
  12. package/dist/cjs/transformer/decode.js +7 -26
  13. package/dist/cjs/transformer/encode.js +6 -27
  14. package/dist/cjs/transformer/node-types.js +0 -1
  15. package/dist/cjs/transformer/object-types.js +0 -1
  16. package/dist/es/index.js +0 -1
  17. package/dist/es/jats/importer/jats-body-dom-parser.js +34 -75
  18. package/dist/es/jats/jats-exporter.js +32 -64
  19. package/dist/es/schema/index.js +4 -3
  20. package/dist/es/schema/nodes/equation.js +12 -14
  21. package/dist/es/schema/nodes/equation_element.js +4 -5
  22. package/dist/es/schema/nodes/inline_equation.js +12 -16
  23. package/dist/es/schema/nodes/table.js +46 -155
  24. package/dist/es/schema/nodes/table_element.js +1 -1
  25. package/dist/es/schema/nodes/table_row.js +120 -0
  26. package/dist/es/transformer/builders.js +0 -6
  27. package/dist/es/transformer/decode.js +7 -26
  28. package/dist/es/transformer/encode.js +6 -27
  29. package/dist/es/transformer/node-types.js +0 -1
  30. package/dist/es/transformer/object-types.js +0 -1
  31. package/dist/types/index.d.ts +0 -1
  32. package/dist/types/jats/jats-exporter.d.ts +1 -0
  33. package/dist/types/schema/index.d.ts +1 -1
  34. package/dist/types/schema/nodes/equation.d.ts +3 -4
  35. package/dist/types/schema/nodes/equation_element.d.ts +1 -2
  36. package/dist/types/schema/nodes/inline_equation.d.ts +4 -4
  37. package/dist/types/schema/nodes/table.d.ts +12 -73
  38. package/dist/types/schema/nodes/table_row.d.ts +41 -0
  39. package/dist/types/schema/types.d.ts +1 -1
  40. package/dist/types/transformer/builders.d.ts +1 -2
  41. package/dist/types/transformer/decode.d.ts +0 -1
  42. package/package.json +5 -7
  43. package/dist/cjs/mathjax/index.js +0 -41
  44. package/dist/cjs/mathjax/mathjax-packages.js +0 -20
  45. package/dist/cjs/mathjax/mathml-to-svg.js +0 -70
  46. package/dist/cjs/mathjax/tex-to-mathml.js +0 -49
  47. package/dist/cjs/mathjax/tex-to-svg.js +0 -59
  48. package/dist/es/mathjax/index.js +0 -12
  49. package/dist/es/mathjax/mathjax-packages.js +0 -17
  50. package/dist/es/mathjax/mathml-to-svg.js +0 -66
  51. package/dist/es/mathjax/tex-to-mathml.js +0 -45
  52. package/dist/es/mathjax/tex-to-svg.js +0 -55
  53. package/dist/types/mathjax/index.d.ts +0 -3
  54. package/dist/types/mathjax/mathjax-packages.d.ts +0 -16
  55. package/dist/types/mathjax/mathml-to-svg.d.ts +0 -17
  56. package/dist/types/mathjax/tex-to-mathml.d.ts +0 -17
  57. package/dist/types/mathjax/tex-to-svg.d.ts +0 -17
package/dist/cjs/index.js CHANGED
@@ -18,7 +18,6 @@ exports.isSectionLabelNode = void 0;
18
18
  __exportStar(require("./lib/section-group-type"), exports);
19
19
  __exportStar(require("./lib/table-cell-styles"), exports);
20
20
  __exportStar(require("./lib/utils"), exports);
21
- __exportStar(require("./mathjax"), exports);
22
21
  __exportStar(require("./schema"), exports);
23
22
  __exportStar(require("./transformer"), exports);
24
23
  __exportStar(require("./jats"), exports);
@@ -21,8 +21,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.jatsBodyDOMParser = void 0;
22
22
  const mime_1 = __importDefault(require("mime"));
23
23
  const prosemirror_model_1 = require("prosemirror-model");
24
- const mathml_to_svg_1 = require("../../mathjax/mathml-to-svg");
25
- const tex_to_svg_1 = require("../../mathjax/tex-to-svg");
26
24
  const schema_1 = require("../../schema");
27
25
  const transformer_1 = require("../../transformer");
28
26
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
@@ -39,6 +37,27 @@ const chooseContentType = (graphicNode) => {
39
37
  }
40
38
  }
41
39
  };
40
+ const getEquationContent = (p) => {
41
+ var _a;
42
+ const element = p;
43
+ const container = (_a = element.querySelector('alternatives')) !== null && _a !== void 0 ? _a : element;
44
+ let contents = '';
45
+ let format = '';
46
+ for (const child of container.childNodes) {
47
+ const nodeName = child.nodeName.replace(/^[a-z]:/, '');
48
+ switch (nodeName) {
49
+ case 'tex-math':
50
+ contents = child.innerHTML;
51
+ format = 'tex';
52
+ break;
53
+ case 'mml:math':
54
+ contents = child.outerHTML;
55
+ format = 'mathml';
56
+ break;
57
+ }
58
+ }
59
+ return { format, contents };
60
+ };
42
61
  const marks = [
43
62
  {
44
63
  tag: 'bold',
@@ -147,91 +166,27 @@ const nodes = [
147
166
  tag: 'inline-formula',
148
167
  node: 'inline_equation',
149
168
  getAttrs: (node) => {
150
- var _a, _b, _c, _d, _e;
151
169
  const element = node;
152
- const attrs = {
153
- id: element.getAttribute('id'),
154
- MathMLRepresentation: '',
155
- SVGRepresentation: '',
156
- TeXRepresentation: '',
157
- };
158
- const container = (_a = element.querySelector('alternatives')) !== null && _a !== void 0 ? _a : element;
159
- for (const child of container.childNodes) {
160
- const nodeName = child.nodeName.replace(/^[a-z]:/, '');
161
- switch (nodeName) {
162
- case 'tex-math':
163
- attrs.TeXRepresentation = (_c = (_b = child.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
164
- if (attrs.TeXRepresentation) {
165
- attrs.SVGRepresentation =
166
- (_d = (0, tex_to_svg_1.convertTeXToSVG)(attrs.TeXRepresentation, true)) !== null && _d !== void 0 ? _d : '';
167
- }
168
- break;
169
- case 'mml:math':
170
- ;
171
- child.removeAttribute('id');
172
- attrs.MathMLRepresentation = transformer_1.xmlSerializer.serializeToString(child);
173
- if (attrs.MathMLRepresentation) {
174
- attrs.SVGRepresentation =
175
- (_e = (0, mathml_to_svg_1.convertMathMLToSVG)(attrs.MathMLRepresentation, true)) !== null && _e !== void 0 ? _e : '';
176
- }
177
- break;
178
- }
179
- }
180
- return attrs;
170
+ return getEquationContent(element);
181
171
  },
182
172
  },
183
173
  {
184
174
  tag: 'disp-formula',
185
175
  node: 'equation_element',
186
176
  getAttrs: (node) => {
177
+ var _a, _b;
187
178
  const element = node;
188
- const caption = element.querySelector('figcaption');
189
179
  return {
190
180
  id: element.getAttribute('id'),
191
- suppressCaption: !caption,
181
+ label: (_b = (_a = element.querySelector('label')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : '',
192
182
  };
193
183
  },
194
184
  getContent: (node, schema) => {
195
- var _a, _b, _c, _d, _e;
196
185
  const element = node;
197
- const attrs = {
198
- MathMLStringRepresentation: '',
199
- SVGStringRepresentation: '',
200
- TeXRepresentation: '',
201
- };
202
- const container = (_a = element.querySelector('alternatives')) !== null && _a !== void 0 ? _a : element;
203
- for (const child of container.childNodes) {
204
- const nodeName = child.nodeName.replace(/^[a-z]:/, '');
205
- switch (nodeName) {
206
- case 'tex-math':
207
- attrs.TeXRepresentation = (_c = (_b = child.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
208
- if (attrs.TeXRepresentation) {
209
- attrs.SVGStringRepresentation =
210
- (_d = (0, tex_to_svg_1.convertTeXToSVG)(attrs.TeXRepresentation, true)) !== null && _d !== void 0 ? _d : '';
211
- }
212
- break;
213
- case 'mml:math':
214
- ;
215
- child.removeAttribute('id');
216
- attrs.MathMLStringRepresentation =
217
- transformer_1.xmlSerializer.serializeToString(child);
218
- if (attrs.MathMLStringRepresentation) {
219
- attrs.SVGStringRepresentation =
220
- (_e = (0, mathml_to_svg_1.convertMathMLToSVG)(attrs.MathMLStringRepresentation, true)) !== null && _e !== void 0 ? _e : '';
221
- }
222
- break;
223
- }
224
- }
225
- const caption = element.querySelector('figcaption');
226
- const figcaption = schema.nodes.figcaption.create();
186
+ const attrs = getEquationContent(element);
187
+ const id = element.getAttribute('id');
227
188
  return prosemirror_model_1.Fragment.from([
228
- schema.nodes.equation.createChecked(attrs),
229
- caption
230
- ?
231
- exports.jatsBodyDOMParser.parse(caption, {
232
- topNode: figcaption,
233
- })
234
- : figcaption,
189
+ schema.nodes.equation.createChecked(Object.assign({ id }, attrs)),
235
190
  ]);
236
191
  },
237
192
  },
@@ -530,6 +485,10 @@ const nodes = [
530
485
  };
531
486
  },
532
487
  },
488
+ {
489
+ tag: 'tbody',
490
+ skip: true,
491
+ },
533
492
  {
534
493
  tag: 'tfoot',
535
494
  skip: true,
@@ -564,12 +523,12 @@ const nodes = [
564
523
  },
565
524
  {
566
525
  tag: 'th',
567
- node: 'table_header',
526
+ node: 'table_cell',
568
527
  getAttrs: (node) => {
569
528
  const element = node;
570
529
  const colspan = element.getAttribute('colspan');
571
530
  const rowspan = element.getAttribute('rowspan');
572
- return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
531
+ return Object.assign(Object.assign(Object.assign({ celltype: 'th' }, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
573
532
  },
574
533
  },
575
534
  {
@@ -164,6 +164,7 @@ class JATSExporter {
164
164
  };
165
165
  this.nodeFromJATS = (JATSFragment) => {
166
166
  JATSFragment = JATSFragment.trim();
167
+ JATSFragment = JATSFragment.replace(' ', ' ');
167
168
  if (!JATSFragment.length) {
168
169
  return null;
169
170
  }
@@ -614,11 +615,6 @@ class JATSExporter {
614
615
  this.createSerializer = () => {
615
616
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
616
617
  const nodes = {
617
- table_header: (node) => [
618
- 'th',
619
- Object.assign(Object.assign({ valign: node.attrs.valign, align: node.attrs.align, scope: node.attrs.scope, style: node.attrs.style }, (node.attrs.rowspan > 1 && { rowspan: node.attrs.rowspan })), (node.attrs.colspan > 1 && { colspan: node.attrs.colspan })),
620
- 0,
621
- ],
622
618
  title: () => '',
623
619
  affiliations: () => '',
624
620
  contributors: () => '',
@@ -691,22 +687,20 @@ class JATSExporter {
691
687
  },
692
688
  doc: () => '',
693
689
  equation: (node) => {
694
- const formula = this.document.createElement('disp-formula');
695
- formula.setAttribute('id', normalizeID(node.attrs.id));
696
- if (node.attrs.TeXRepresentation) {
697
- const math = this.document.createElement('tex-math');
698
- math.textContent = node.attrs.TeXRepresentation;
699
- formula.appendChild(math);
700
- }
701
- else if (node.attrs.MathMLStringRepresentation) {
702
- const math = this.nodeFromJATS(node.attrs.MathMLStringRepresentation);
703
- if (math) {
704
- formula.appendChild(math);
705
- }
706
- }
707
- return formula;
690
+ return this.createEquation(node);
691
+ },
692
+ inline_equation: (node) => {
693
+ const eqElement = this.document.createElement('inline-formula');
694
+ const equation = this.createEquation(node, true);
695
+ eqElement.append(equation);
696
+ return eqElement;
697
+ },
698
+ equation_element: (node) => {
699
+ const eqElement = this.document.createElement('disp-formula');
700
+ eqElement.setAttribute('id', normalizeID(node.attrs.id));
701
+ processChildNodes(eqElement, node, schema_1.schema.nodes.equation);
702
+ return eqElement;
708
703
  },
709
- equation_element: (node) => createFigureElement(node, 'fig', node.type.schema.nodes.equation, 'equation'),
710
704
  figcaption: (node) => {
711
705
  if (!node.textContent) {
712
706
  return '';
@@ -756,28 +750,6 @@ class JATSExporter {
756
750
  },
757
751
  hard_break: () => '',
758
752
  highlight_marker: () => '',
759
- inline_equation: (node) => {
760
- const formula = this.document.createElement('inline-formula');
761
- formula.setAttribute('id', normalizeID(node.attrs.id));
762
- if (node.attrs.TeXRepresentation) {
763
- const math = this.document.createElement('tex-math');
764
- math.textContent = node.attrs.TeXRepresentation;
765
- formula.appendChild(math);
766
- }
767
- else if (node.attrs.MathMLRepresentation) {
768
- const math = this.nodeFromJATS(node.attrs.MathMLRepresentation);
769
- if (math) {
770
- formula.appendChild(math);
771
- }
772
- }
773
- else if (node.attrs.SVGRepresentation) {
774
- const math = this.nodeFromJATS(node.attrs.SVGRepresentation);
775
- if (math) {
776
- formula.appendChild(math);
777
- }
778
- }
779
- return formula;
780
- },
781
753
  inline_footnote: (node) => {
782
754
  const xref = this.document.createElement('xref');
783
755
  xref.setAttribute('ref-type', 'fn');
@@ -878,8 +850,9 @@ class JATSExporter {
878
850
  element.setAttribute('position', 'anchor');
879
851
  return element;
880
852
  },
853
+ table_body: () => ['tbody', 0],
881
854
  table_cell: (node) => [
882
- 'td',
855
+ node.attrs.celltype,
883
856
  Object.assign(Object.assign({ valign: node.attrs.valign, align: node.attrs.align, scope: node.attrs.scope, style: node.attrs.style }, (node.attrs.rowspan > 1 && { rowspan: node.attrs.rowspan })), (node.attrs.colspan > 1 && { colspan: node.attrs.colspan })),
884
857
  0,
885
858
  ],
@@ -960,26 +933,6 @@ class JATSExporter {
960
933
  element.appendChild(this.serializeNode(childNode));
961
934
  }
962
935
  };
963
- const appendTable = (element, node) => {
964
- const tableNode = findChildNodeOfType(node, node.type.schema.nodes.table);
965
- const colGroupNode = findChildNodeOfType(node, node.type.schema.nodes.table_colgroup);
966
- if (!tableNode) {
967
- return;
968
- }
969
- const table = this.serializeNode(tableNode);
970
- const tbodyElement = this.document.createElement('tbody');
971
- while (table.firstChild) {
972
- const child = table.firstChild;
973
- table.removeChild(child);
974
- tbodyElement.appendChild(child);
975
- }
976
- table.appendChild(tbodyElement);
977
- if (colGroupNode) {
978
- const colGroup = this.serializeNode(colGroupNode);
979
- table.insertBefore(colGroup, table.firstChild);
980
- }
981
- element.appendChild(table);
982
- };
983
936
  const createFigureElement = (node, nodeName, contentNodeType, figType) => {
984
937
  const element = createElement(node, nodeName);
985
938
  if (figType) {
@@ -1000,7 +953,7 @@ class JATSExporter {
1000
953
  const element = createElement(node, nodeName);
1001
954
  appendLabels(element, node);
1002
955
  appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
1003
- appendTable(element, node);
956
+ appendChildNodeOfType(element, node, node.type.schema.nodes.table);
1004
957
  appendChildNodeOfType(element, node, node.type.schema.nodes.table_element_footer);
1005
958
  if ((0, node_types_1.isExecutableNodeType)(node.type)) {
1006
959
  processExecutableNode(node, element);
@@ -1613,6 +1566,21 @@ class JATSExporter {
1613
1566
  this.citationTexts.set(id, output);
1614
1567
  });
1615
1568
  }
1569
+ createEquation(node, isInline = false) {
1570
+ if (node.attrs.format === 'tex') {
1571
+ const texMath = this.document.createElement('tex-math');
1572
+ texMath.innerHTML = node.attrs.contents;
1573
+ return texMath;
1574
+ }
1575
+ else {
1576
+ const math = this.nodeFromJATS(node.attrs.contents);
1577
+ const mathml = math;
1578
+ if (!isInline) {
1579
+ mathml.setAttribute('id', normalizeID(node.attrs.id));
1580
+ }
1581
+ return mathml;
1582
+ }
1583
+ }
1616
1584
  buildKeywords(articleMeta) {
1617
1585
  const keywords = [...this.modelMap.values()].filter((model) => model.objectType === json_schema_1.ObjectTypes.Keyword);
1618
1586
  const keywordGroups = new Map();
@@ -87,6 +87,7 @@ const table_1 = require("./nodes/table");
87
87
  const table_col_1 = require("./nodes/table_col");
88
88
  const table_element_1 = require("./nodes/table_element");
89
89
  const table_element_footer_1 = require("./nodes/table_element_footer");
90
+ const table_row_1 = require("./nodes/table_row");
90
91
  const text_1 = require("./nodes/text");
91
92
  const title_1 = require("./nodes/title");
92
93
  const toc_element_1 = require("./nodes/toc_element");
@@ -116,7 +117,6 @@ __exportStar(require("./nodes/footnotes_section"), exports);
116
117
  __exportStar(require("./nodes/graphical_abstract_section"), exports);
117
118
  __exportStar(require("./nodes/hard_break"), exports);
118
119
  __exportStar(require("./nodes/highlight_marker"), exports);
119
- __exportStar(require("./nodes/inline_equation"), exports);
120
120
  __exportStar(require("./nodes/inline_footnote"), exports);
121
121
  __exportStar(require("./nodes/keyword"), exports);
122
122
  __exportStar(require("./nodes/keywords_element"), exports);
@@ -136,6 +136,7 @@ __exportStar(require("./nodes/section_title"), exports);
136
136
  __exportStar(require("./nodes/table"), exports);
137
137
  __exportStar(require("./nodes/table_col"), exports);
138
138
  __exportStar(require("./nodes/table_element"), exports);
139
+ __exportStar(require("./nodes/table_row"), exports);
139
140
  __exportStar(require("./nodes/text"), exports);
140
141
  __exportStar(require("./nodes/toc_element"), exports);
141
142
  __exportStar(require("./nodes/toc_section"), exports);
@@ -211,9 +212,10 @@ exports.schema = new prosemirror_model_1.Schema({
211
212
  section_title: section_title_1.sectionTitle,
212
213
  section_title_plain: section_title_1.sectionTitle,
213
214
  table: table_1.table,
214
- table_cell: table_1.tableCell,
215
+ table_body: table_1.tableBody,
216
+ table_cell: table_row_1.tableCell,
215
217
  table_element: table_element_1.tableElement,
216
- table_row: table_1.tableRow,
218
+ table_row: table_row_1.tableRow,
217
219
  table_col: table_col_1.tableCol,
218
220
  table_colgroup: table_col_1.tableColGroup,
219
221
  text: text_1.text,
@@ -227,6 +229,5 @@ exports.schema = new prosemirror_model_1.Schema({
227
229
  contributors: contributors_1.contributors,
228
230
  supplements: supplements_1.supplements,
229
231
  supplement: supplement_1.supplement,
230
- table_header: table_1.tableHeader,
231
232
  },
232
233
  });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*!
3
- * © 2019 Atypon Systems LLC
3
+ * © 2023 Atypon Systems LLC
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -20,9 +20,8 @@ const json_schema_1 = require("@manuscripts/json-schema");
20
20
  exports.equation = {
21
21
  attrs: {
22
22
  id: { default: '' },
23
- MathMLStringRepresentation: { default: '' },
24
- SVGStringRepresentation: { default: '' },
25
- TeXRepresentation: { default: '' },
23
+ contents: { default: '' },
24
+ format: { default: '' },
26
25
  dataTracked: { default: null },
27
26
  },
28
27
  group: 'block',
@@ -30,26 +29,25 @@ exports.equation = {
30
29
  {
31
30
  tag: `div.${json_schema_1.ObjectTypes.Equation}`,
32
31
  getAttrs: (p) => {
33
- const dom = p;
32
+ const htmlEl = p;
34
33
  return {
35
- id: dom.getAttribute('id'),
36
- MathMLStringRepresentation: dom.getAttribute('data-mathml-string-representation'),
37
- SVGStringRepresentation: dom.innerHTML,
38
- TeXRepresentation: dom.getAttribute('data-tex-representation'),
34
+ id: htmlEl.getAttribute('id'),
35
+ format: htmlEl.getAttribute('data-equation-format'),
36
+ contents: htmlEl.innerHTML,
39
37
  };
40
38
  },
41
39
  },
42
40
  ],
43
41
  toDOM: (node) => {
44
42
  const equationNode = node;
43
+ const { id, contents, format } = equationNode.attrs;
45
44
  const dom = document.createElement('div');
46
- dom.setAttribute('id', equationNode.attrs.id);
47
45
  dom.classList.add(json_schema_1.ObjectTypes.Equation);
48
- if (equationNode.attrs.MathMLStringRepresentation) {
49
- dom.setAttribute('data-mathml-string-representation', equationNode.attrs.MathMLStringRepresentation);
46
+ dom.setAttribute('id', id);
47
+ if (format) {
48
+ dom.setAttribute('data-equation-format', format);
50
49
  }
51
- dom.setAttribute('data-tex-representation', equationNode.attrs.TeXRepresentation);
52
- dom.innerHTML = equationNode.attrs.SVGStringRepresentation;
50
+ dom.innerHTML = contents;
53
51
  return dom;
54
52
  },
55
53
  };
@@ -17,11 +17,10 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.equationElement = void 0;
19
19
  exports.equationElement = {
20
- content: '(equation | placeholder) figcaption',
20
+ content: '(equation | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
- suppressCaption: { default: true },
24
- suppressTitle: { default: undefined },
23
+ label: { default: '' },
25
24
  dataTracked: { default: null },
26
25
  comments: { default: null },
27
26
  },
@@ -29,7 +28,7 @@ exports.equationElement = {
29
28
  group: 'block element',
30
29
  parseDOM: [
31
30
  {
32
- tag: 'figure.equation',
31
+ tag: 'div.equation',
33
32
  getAttrs: (p) => {
34
33
  const dom = p;
35
34
  return {
@@ -41,7 +40,7 @@ exports.equationElement = {
41
40
  toDOM: (node) => {
42
41
  const equationElementNode = node;
43
42
  return [
44
- 'figure',
43
+ 'div',
45
44
  {
46
45
  class: 'equation',
47
46
  id: equationElementNode.attrs.id,
@@ -16,43 +16,39 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.inlineEquation = void 0;
19
- const json_schema_1 = require("@manuscripts/json-schema");
20
19
  exports.inlineEquation = {
21
20
  attrs: {
22
- id: { default: '' },
23
- MathMLRepresentation: { default: '' },
24
- SVGRepresentation: { default: '' },
25
- TeXRepresentation: { default: '' },
26
21
  dataTracked: { default: null },
22
+ comments: { default: null },
23
+ contents: { default: '' },
24
+ format: { default: '' },
27
25
  },
26
+ selectable: false,
28
27
  atom: true,
29
28
  inline: true,
30
29
  draggable: true,
31
30
  group: 'inline',
32
31
  parseDOM: [
33
32
  {
34
- tag: `span.${json_schema_1.ObjectTypes.InlineMathFragment}`,
33
+ tag: `span.MPInlineMathFragment`,
35
34
  getAttrs: (p) => {
36
35
  const dom = p;
37
36
  return {
38
- id: dom.getAttribute('id'),
39
- MathMLRepresentation: dom.getAttribute('data-mathml-representation') || '',
40
- SVGRepresentation: dom.innerHTML || '',
41
- TeXRepresentation: dom.getAttribute('data-tex-representation') || '',
37
+ format: dom.getAttribute('data-equation-format'),
38
+ contents: dom.innerHTML,
42
39
  };
43
40
  },
44
41
  },
45
42
  ],
46
43
  toDOM: (node) => {
47
44
  const inlineEquationNode = node;
45
+ const { contents, format } = inlineEquationNode.attrs;
48
46
  const dom = document.createElement('span');
49
- dom.classList.add(json_schema_1.ObjectTypes.InlineMathFragment);
50
- dom.setAttribute('id', inlineEquationNode.attrs.id);
51
- dom.setAttribute('data-tex-representation', inlineEquationNode.attrs.TeXRepresentation);
52
- if (inlineEquationNode.attrs.MathMLRepresentation) {
53
- dom.setAttribute('data-mathml-representation', inlineEquationNode.attrs.MathMLRepresentation);
47
+ dom.classList.add('MPInlineMathFragment');
48
+ if (format) {
49
+ dom.setAttribute('data-equation-format', format);
54
50
  }
55
- dom.innerHTML = inlineEquationNode.attrs.SVGRepresentation;
51
+ dom.innerHTML = contents;
56
52
  return dom;
57
53
  },
58
54
  };