@manuscripts/transform 2.0.4-LEAN-3083 → 2.0.4-LEAN-3094
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.
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/jats/importer/jats-body-dom-parser.js +24 -72
- package/dist/cjs/jats/jats-exporter.js +17 -37
- package/dist/cjs/schema/index.js +0 -1
- package/dist/cjs/schema/nodes/affiliation.js +0 -2
- package/dist/cjs/schema/nodes/contributor.js +0 -2
- package/dist/cjs/schema/nodes/equation.js +12 -14
- package/dist/cjs/schema/nodes/equation_element.js +4 -5
- package/dist/cjs/schema/nodes/inline_equation.js +12 -16
- package/dist/cjs/transformer/builders.js +1 -8
- package/dist/cjs/transformer/decode.js +4 -11
- package/dist/cjs/transformer/encode.js +4 -28
- package/dist/cjs/transformer/node-types.js +0 -1
- package/dist/cjs/transformer/object-types.js +0 -1
- package/dist/es/index.js +0 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +25 -73
- package/dist/es/jats/jats-exporter.js +17 -37
- package/dist/es/schema/index.js +0 -1
- package/dist/es/schema/nodes/affiliation.js +0 -2
- package/dist/es/schema/nodes/contributor.js +0 -2
- package/dist/es/schema/nodes/equation.js +12 -14
- package/dist/es/schema/nodes/equation_element.js +4 -5
- package/dist/es/schema/nodes/inline_equation.js +12 -16
- package/dist/es/transformer/builders.js +0 -6
- package/dist/es/transformer/decode.js +4 -11
- package/dist/es/transformer/encode.js +4 -28
- package/dist/es/transformer/node-types.js +0 -1
- package/dist/es/transformer/object-types.js +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/schema/index.d.ts +0 -1
- package/dist/types/schema/nodes/affiliation.d.ts +0 -2
- package/dist/types/schema/nodes/contributor.d.ts +2 -4
- package/dist/types/schema/nodes/equation.d.ts +3 -4
- package/dist/types/schema/nodes/equation_element.d.ts +1 -2
- package/dist/types/schema/nodes/inline_equation.d.ts +4 -4
- package/dist/types/transformer/builders.d.ts +1 -2
- package/package.json +3 -4
- package/dist/cjs/mathjax/index.js +0 -41
- package/dist/cjs/mathjax/mathjax-packages.js +0 -20
- package/dist/cjs/mathjax/mathml-to-svg.js +0 -70
- package/dist/cjs/mathjax/tex-to-mathml.js +0 -49
- package/dist/cjs/mathjax/tex-to-svg.js +0 -59
- package/dist/es/mathjax/index.js +0 -12
- package/dist/es/mathjax/mathjax-packages.js +0 -17
- package/dist/es/mathjax/mathml-to-svg.js +0 -66
- package/dist/es/mathjax/tex-to-mathml.js +0 -45
- package/dist/es/mathjax/tex-to-svg.js +0 -55
- package/dist/types/mathjax/index.d.ts +0 -3
- package/dist/types/mathjax/mathjax-packages.d.ts +0 -16
- package/dist/types/mathjax/mathml-to-svg.d.ts +0 -17
- package/dist/types/mathjax/tex-to-mathml.d.ts +0 -17
- package/dist/types/mathjax/tex-to-svg.d.ts +0 -17
|
@@ -15,10 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import mime from 'mime';
|
|
17
17
|
import { DOMParser, Fragment } from 'prosemirror-model';
|
|
18
|
-
import { convertMathMLToSVG } from '../../mathjax/mathml-to-svg';
|
|
19
|
-
import { convertTeXToSVG } from '../../mathjax/tex-to-svg';
|
|
20
18
|
import { schema } from '../../schema';
|
|
21
|
-
import { chooseSectionCategory
|
|
19
|
+
import { chooseSectionCategory } from '../../transformer';
|
|
22
20
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
23
21
|
const chooseContentType = (graphicNode) => {
|
|
24
22
|
if (graphicNode) {
|
|
@@ -33,6 +31,24 @@ const chooseContentType = (graphicNode) => {
|
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
33
|
};
|
|
34
|
+
const getEquationContent = (p) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const element = p;
|
|
37
|
+
const container = (_a = element.querySelector('alternatives')) !== null && _a !== void 0 ? _a : element;
|
|
38
|
+
let contents = '';
|
|
39
|
+
let format = '';
|
|
40
|
+
for (const child of container.childNodes) {
|
|
41
|
+
const nodeName = child.nodeName.replace(/^[a-z]:/, '');
|
|
42
|
+
switch (nodeName) {
|
|
43
|
+
case 'tex-math':
|
|
44
|
+
case 'mml:math':
|
|
45
|
+
contents = child.outerHTML;
|
|
46
|
+
format = nodeName === 'tex-math' ? 'tex' : 'mathml';
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { format, contents };
|
|
51
|
+
};
|
|
36
52
|
const marks = [
|
|
37
53
|
{
|
|
38
54
|
tag: 'bold',
|
|
@@ -141,91 +157,27 @@ const nodes = [
|
|
|
141
157
|
tag: 'inline-formula',
|
|
142
158
|
node: 'inline_equation',
|
|
143
159
|
getAttrs: (node) => {
|
|
144
|
-
var _a, _b, _c, _d, _e;
|
|
145
160
|
const element = node;
|
|
146
|
-
|
|
147
|
-
id: element.getAttribute('id'),
|
|
148
|
-
MathMLRepresentation: '',
|
|
149
|
-
SVGRepresentation: '',
|
|
150
|
-
TeXRepresentation: '',
|
|
151
|
-
};
|
|
152
|
-
const container = (_a = element.querySelector('alternatives')) !== null && _a !== void 0 ? _a : element;
|
|
153
|
-
for (const child of container.childNodes) {
|
|
154
|
-
const nodeName = child.nodeName.replace(/^[a-z]:/, '');
|
|
155
|
-
switch (nodeName) {
|
|
156
|
-
case 'tex-math':
|
|
157
|
-
attrs.TeXRepresentation = (_c = (_b = child.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
|
|
158
|
-
if (attrs.TeXRepresentation) {
|
|
159
|
-
attrs.SVGRepresentation =
|
|
160
|
-
(_d = convertTeXToSVG(attrs.TeXRepresentation, true)) !== null && _d !== void 0 ? _d : '';
|
|
161
|
-
}
|
|
162
|
-
break;
|
|
163
|
-
case 'mml:math':
|
|
164
|
-
;
|
|
165
|
-
child.removeAttribute('id');
|
|
166
|
-
attrs.MathMLRepresentation = xmlSerializer.serializeToString(child);
|
|
167
|
-
if (attrs.MathMLRepresentation) {
|
|
168
|
-
attrs.SVGRepresentation =
|
|
169
|
-
(_e = convertMathMLToSVG(attrs.MathMLRepresentation, true)) !== null && _e !== void 0 ? _e : '';
|
|
170
|
-
}
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return attrs;
|
|
161
|
+
return getEquationContent(element);
|
|
175
162
|
},
|
|
176
163
|
},
|
|
177
164
|
{
|
|
178
165
|
tag: 'disp-formula',
|
|
179
166
|
node: 'equation_element',
|
|
180
167
|
getAttrs: (node) => {
|
|
168
|
+
var _a, _b;
|
|
181
169
|
const element = node;
|
|
182
|
-
const caption = element.querySelector('figcaption');
|
|
183
170
|
return {
|
|
184
171
|
id: element.getAttribute('id'),
|
|
185
|
-
|
|
172
|
+
label: (_b = (_a = element.querySelector('label')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : '',
|
|
186
173
|
};
|
|
187
174
|
},
|
|
188
175
|
getContent: (node, schema) => {
|
|
189
|
-
var _a, _b, _c, _d, _e;
|
|
190
176
|
const element = node;
|
|
191
|
-
const attrs =
|
|
192
|
-
|
|
193
|
-
SVGStringRepresentation: '',
|
|
194
|
-
TeXRepresentation: '',
|
|
195
|
-
};
|
|
196
|
-
const container = (_a = element.querySelector('alternatives')) !== null && _a !== void 0 ? _a : element;
|
|
197
|
-
for (const child of container.childNodes) {
|
|
198
|
-
const nodeName = child.nodeName.replace(/^[a-z]:/, '');
|
|
199
|
-
switch (nodeName) {
|
|
200
|
-
case 'tex-math':
|
|
201
|
-
attrs.TeXRepresentation = (_c = (_b = child.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
|
|
202
|
-
if (attrs.TeXRepresentation) {
|
|
203
|
-
attrs.SVGStringRepresentation =
|
|
204
|
-
(_d = convertTeXToSVG(attrs.TeXRepresentation, true)) !== null && _d !== void 0 ? _d : '';
|
|
205
|
-
}
|
|
206
|
-
break;
|
|
207
|
-
case 'mml:math':
|
|
208
|
-
;
|
|
209
|
-
child.removeAttribute('id');
|
|
210
|
-
attrs.MathMLStringRepresentation =
|
|
211
|
-
xmlSerializer.serializeToString(child);
|
|
212
|
-
if (attrs.MathMLStringRepresentation) {
|
|
213
|
-
attrs.SVGStringRepresentation =
|
|
214
|
-
(_e = convertMathMLToSVG(attrs.MathMLStringRepresentation, true)) !== null && _e !== void 0 ? _e : '';
|
|
215
|
-
}
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const caption = element.querySelector('figcaption');
|
|
220
|
-
const figcaption = schema.nodes.figcaption.create();
|
|
177
|
+
const attrs = getEquationContent(element);
|
|
178
|
+
const id = element.getAttribute('id');
|
|
221
179
|
return Fragment.from([
|
|
222
|
-
schema.nodes.equation.createChecked(attrs),
|
|
223
|
-
caption
|
|
224
|
-
?
|
|
225
|
-
jatsBodyDOMParser.parse(caption, {
|
|
226
|
-
topNode: figcaption,
|
|
227
|
-
})
|
|
228
|
-
: figcaption,
|
|
180
|
+
schema.nodes.equation.createChecked(Object.assign({ id }, attrs)),
|
|
229
181
|
]);
|
|
230
182
|
},
|
|
231
183
|
},
|
|
@@ -156,6 +156,7 @@ export class JATSExporter {
|
|
|
156
156
|
};
|
|
157
157
|
this.nodeFromJATS = (JATSFragment) => {
|
|
158
158
|
JATSFragment = JATSFragment.trim();
|
|
159
|
+
JATSFragment = JATSFragment.replace(' ', ' ');
|
|
159
160
|
if (!JATSFragment.length) {
|
|
160
161
|
return null;
|
|
161
162
|
}
|
|
@@ -676,22 +677,23 @@ export class JATSExporter {
|
|
|
676
677
|
},
|
|
677
678
|
doc: () => '',
|
|
678
679
|
equation: (node) => {
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
680
|
+
const math = this.nodeFromJATS(node.attrs.contents);
|
|
681
|
+
const mathEl = math;
|
|
682
|
+
mathEl.setAttribute('id', normalizeID(node.attrs.id));
|
|
683
|
+
return mathEl;
|
|
684
|
+
},
|
|
685
|
+
inline_equation: (node) => {
|
|
686
|
+
const eqElement = this.document.createElement('inline-formula');
|
|
687
|
+
const math = this.nodeFromJATS(node.attrs.contents);
|
|
688
|
+
eqElement.append(math);
|
|
689
|
+
return eqElement;
|
|
690
|
+
},
|
|
691
|
+
equation_element: (node) => {
|
|
692
|
+
const eqElement = this.document.createElement('disp-formula');
|
|
693
|
+
eqElement.setAttribute('id', normalizeID(node.attrs.id));
|
|
694
|
+
processChildNodes(eqElement, node, schema.nodes.equation);
|
|
695
|
+
return eqElement;
|
|
693
696
|
},
|
|
694
|
-
equation_element: (node) => createFigureElement(node, 'fig', node.type.schema.nodes.equation, 'equation'),
|
|
695
697
|
figcaption: (node) => {
|
|
696
698
|
if (!node.textContent) {
|
|
697
699
|
return '';
|
|
@@ -741,28 +743,6 @@ export class JATSExporter {
|
|
|
741
743
|
},
|
|
742
744
|
hard_break: () => '',
|
|
743
745
|
highlight_marker: () => '',
|
|
744
|
-
inline_equation: (node) => {
|
|
745
|
-
const formula = this.document.createElement('inline-formula');
|
|
746
|
-
formula.setAttribute('id', normalizeID(node.attrs.id));
|
|
747
|
-
if (node.attrs.TeXRepresentation) {
|
|
748
|
-
const math = this.document.createElement('tex-math');
|
|
749
|
-
math.textContent = node.attrs.TeXRepresentation;
|
|
750
|
-
formula.appendChild(math);
|
|
751
|
-
}
|
|
752
|
-
else if (node.attrs.MathMLRepresentation) {
|
|
753
|
-
const math = this.nodeFromJATS(node.attrs.MathMLRepresentation);
|
|
754
|
-
if (math) {
|
|
755
|
-
formula.appendChild(math);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
else if (node.attrs.SVGRepresentation) {
|
|
759
|
-
const math = this.nodeFromJATS(node.attrs.SVGRepresentation);
|
|
760
|
-
if (math) {
|
|
761
|
-
formula.appendChild(math);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
return formula;
|
|
765
|
-
},
|
|
766
746
|
inline_footnote: (node) => {
|
|
767
747
|
const xref = this.document.createElement('xref');
|
|
768
748
|
xref.setAttribute('ref-type', 'fn');
|
package/dist/es/schema/index.js
CHANGED
|
@@ -98,7 +98,6 @@ export * from './nodes/footnotes_section';
|
|
|
98
98
|
export * from './nodes/graphical_abstract_section';
|
|
99
99
|
export * from './nodes/hard_break';
|
|
100
100
|
export * from './nodes/highlight_marker';
|
|
101
|
-
export * from './nodes/inline_equation';
|
|
102
101
|
export * from './nodes/inline_footnote';
|
|
103
102
|
export * from './nodes/keyword';
|
|
104
103
|
export * from './nodes/keywords_element';
|
|
@@ -3,7 +3,6 @@ export const contributor = {
|
|
|
3
3
|
attrs: {
|
|
4
4
|
id: { default: '' },
|
|
5
5
|
role: { default: '' },
|
|
6
|
-
email: { default: '' },
|
|
7
6
|
affiliations: { default: [] },
|
|
8
7
|
footnote: { default: undefined },
|
|
9
8
|
corresp: { default: undefined },
|
|
@@ -11,7 +10,6 @@ export const contributor = {
|
|
|
11
10
|
userID: { default: undefined },
|
|
12
11
|
invitationID: { default: undefined },
|
|
13
12
|
isCorresponding: { default: undefined },
|
|
14
|
-
isJointContributor: { default: undefined },
|
|
15
13
|
ORCIDIdentifier: { default: undefined },
|
|
16
14
|
priority: { default: undefined },
|
|
17
15
|
dataTracked: { default: null },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ©
|
|
2
|
+
* © 2023 Atypon Systems LLC
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -17,9 +17,8 @@ import { ObjectTypes } from '@manuscripts/json-schema';
|
|
|
17
17
|
export const equation = {
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
TeXRepresentation: { default: '' },
|
|
20
|
+
contents: { default: '' },
|
|
21
|
+
format: { default: '' },
|
|
23
22
|
dataTracked: { default: null },
|
|
24
23
|
},
|
|
25
24
|
group: 'block',
|
|
@@ -27,26 +26,25 @@ export const equation = {
|
|
|
27
26
|
{
|
|
28
27
|
tag: `div.${ObjectTypes.Equation}`,
|
|
29
28
|
getAttrs: (p) => {
|
|
30
|
-
const
|
|
29
|
+
const htmlEl = p;
|
|
31
30
|
return {
|
|
32
|
-
id:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
TeXRepresentation: dom.getAttribute('data-tex-representation'),
|
|
31
|
+
id: htmlEl.getAttribute('id'),
|
|
32
|
+
format: htmlEl.getAttribute('data-equation-format'),
|
|
33
|
+
contents: htmlEl.innerHTML,
|
|
36
34
|
};
|
|
37
35
|
},
|
|
38
36
|
},
|
|
39
37
|
],
|
|
40
38
|
toDOM: (node) => {
|
|
41
39
|
const equationNode = node;
|
|
40
|
+
const { id, contents, format } = equationNode.attrs;
|
|
42
41
|
const dom = document.createElement('div');
|
|
43
|
-
dom.setAttribute('id', equationNode.attrs.id);
|
|
44
42
|
dom.classList.add(ObjectTypes.Equation);
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
dom.setAttribute('id', id);
|
|
44
|
+
if (format) {
|
|
45
|
+
dom.setAttribute('data-equation-format', format);
|
|
47
46
|
}
|
|
48
|
-
dom.
|
|
49
|
-
dom.innerHTML = equationNode.attrs.SVGStringRepresentation;
|
|
47
|
+
dom.innerHTML = contents;
|
|
50
48
|
return dom;
|
|
51
49
|
},
|
|
52
50
|
};
|
|
@@ -14,11 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const equationElement = {
|
|
17
|
-
content: '(equation | placeholder)
|
|
17
|
+
content: '(equation | placeholder)',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
|
-
|
|
21
|
-
suppressTitle: { default: undefined },
|
|
20
|
+
label: { default: '' },
|
|
22
21
|
dataTracked: { default: null },
|
|
23
22
|
comments: { default: null },
|
|
24
23
|
},
|
|
@@ -26,7 +25,7 @@ export const equationElement = {
|
|
|
26
25
|
group: 'block element',
|
|
27
26
|
parseDOM: [
|
|
28
27
|
{
|
|
29
|
-
tag: '
|
|
28
|
+
tag: 'div.equation',
|
|
30
29
|
getAttrs: (p) => {
|
|
31
30
|
const dom = p;
|
|
32
31
|
return {
|
|
@@ -38,7 +37,7 @@ export const equationElement = {
|
|
|
38
37
|
toDOM: (node) => {
|
|
39
38
|
const equationElementNode = node;
|
|
40
39
|
return [
|
|
41
|
-
'
|
|
40
|
+
'div',
|
|
42
41
|
{
|
|
43
42
|
class: 'equation',
|
|
44
43
|
id: equationElementNode.attrs.id,
|
|
@@ -13,43 +13,39 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
16
|
export const inlineEquation = {
|
|
18
17
|
attrs: {
|
|
19
|
-
id: { default: '' },
|
|
20
|
-
MathMLRepresentation: { default: '' },
|
|
21
|
-
SVGRepresentation: { default: '' },
|
|
22
|
-
TeXRepresentation: { default: '' },
|
|
23
18
|
dataTracked: { default: null },
|
|
19
|
+
comments: { default: null },
|
|
20
|
+
contents: { default: '' },
|
|
21
|
+
format: { default: '' },
|
|
24
22
|
},
|
|
23
|
+
selectable: false,
|
|
25
24
|
atom: true,
|
|
26
25
|
inline: true,
|
|
27
26
|
draggable: true,
|
|
28
27
|
group: 'inline',
|
|
29
28
|
parseDOM: [
|
|
30
29
|
{
|
|
31
|
-
tag: `span
|
|
30
|
+
tag: `span.MPInlineMathFragment`,
|
|
32
31
|
getAttrs: (p) => {
|
|
33
32
|
const dom = p;
|
|
34
33
|
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
SVGRepresentation: dom.innerHTML || '',
|
|
38
|
-
TeXRepresentation: dom.getAttribute('data-tex-representation') || '',
|
|
34
|
+
format: dom.getAttribute('data-equation-format'),
|
|
35
|
+
contents: dom.innerHTML,
|
|
39
36
|
};
|
|
40
37
|
},
|
|
41
38
|
},
|
|
42
39
|
],
|
|
43
40
|
toDOM: (node) => {
|
|
44
41
|
const inlineEquationNode = node;
|
|
42
|
+
const { contents, format } = inlineEquationNode.attrs;
|
|
45
43
|
const dom = document.createElement('span');
|
|
46
|
-
dom.classList.add(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (inlineEquationNode.attrs.MathMLRepresentation) {
|
|
50
|
-
dom.setAttribute('data-mathml-representation', inlineEquationNode.attrs.MathMLRepresentation);
|
|
44
|
+
dom.classList.add('MPInlineMathFragment');
|
|
45
|
+
if (format) {
|
|
46
|
+
dom.setAttribute('data-equation-format', format);
|
|
51
47
|
}
|
|
52
|
-
dom.innerHTML =
|
|
48
|
+
dom.innerHTML = contents;
|
|
53
49
|
return dom;
|
|
54
50
|
},
|
|
55
51
|
};
|
|
@@ -95,12 +95,6 @@ export const buildNote = (target, source, contents = '') => ({
|
|
|
95
95
|
source,
|
|
96
96
|
contents,
|
|
97
97
|
});
|
|
98
|
-
export const buildInlineMathFragment = (containingObject, TeXRepresentation) => ({
|
|
99
|
-
_id: generateID(ObjectTypes.InlineMathFragment),
|
|
100
|
-
objectType: ObjectTypes.InlineMathFragment,
|
|
101
|
-
containingObject: containingObject || undefined,
|
|
102
|
-
TeXRepresentation,
|
|
103
|
-
});
|
|
104
98
|
export const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
|
|
105
99
|
_id: generateID(ObjectTypes.Footnote),
|
|
106
100
|
objectType: ObjectTypes.Footnote,
|
|
@@ -262,9 +262,8 @@ export class Decoder {
|
|
|
262
262
|
const model = data;
|
|
263
263
|
return schema.nodes.equation.createChecked({
|
|
264
264
|
id: model._id,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
TeXRepresentation: model.TeXRepresentation,
|
|
265
|
+
contents: model.contents,
|
|
266
|
+
format: model.format,
|
|
268
267
|
});
|
|
269
268
|
},
|
|
270
269
|
[ObjectTypes.EquationElement]: (data) => {
|
|
@@ -283,12 +282,10 @@ export class Decoder {
|
|
|
283
282
|
else {
|
|
284
283
|
throw new MissingElement(model.containedObjectID);
|
|
285
284
|
}
|
|
286
|
-
const figcaption = this.getFigcaption(model);
|
|
287
285
|
return schema.nodes.equation_element.createChecked({
|
|
288
286
|
id: model._id,
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}, [equation, figcaption]);
|
|
287
|
+
label: model.label,
|
|
288
|
+
}, [equation]);
|
|
292
289
|
},
|
|
293
290
|
[ObjectTypes.FootnotesElement]: (data) => {
|
|
294
291
|
const foonotesElementModel = data;
|
|
@@ -609,8 +606,6 @@ export class Decoder {
|
|
|
609
606
|
addressLine3: model.addressLine3,
|
|
610
607
|
postCode: model.postCode,
|
|
611
608
|
country: model.country,
|
|
612
|
-
county: model.county,
|
|
613
|
-
city: model.city,
|
|
614
609
|
email: model.email,
|
|
615
610
|
department: model.department,
|
|
616
611
|
priority: model.priority,
|
|
@@ -622,8 +617,6 @@ export class Decoder {
|
|
|
622
617
|
id: model._id,
|
|
623
618
|
role: model.role,
|
|
624
619
|
affiliations: model.affiliations,
|
|
625
|
-
email: model.email,
|
|
626
|
-
isJointContributor: model.isJointContributor,
|
|
627
620
|
bibliographicName: model.bibliographicName,
|
|
628
621
|
userID: model.userID,
|
|
629
622
|
invitationID: model.invitationID,
|
|
@@ -54,12 +54,6 @@ const listContents = (node) => {
|
|
|
54
54
|
}
|
|
55
55
|
return serializeToXML(output);
|
|
56
56
|
};
|
|
57
|
-
const svgDefs = (svg) => {
|
|
58
|
-
const template = document.createElement('template');
|
|
59
|
-
template.innerHTML = svg.trim();
|
|
60
|
-
const defs = template.content.querySelector('defs');
|
|
61
|
-
return defs ? serializeToXML(defs) : undefined;
|
|
62
|
-
};
|
|
63
57
|
const tableRowDisplayStyle = (tagName, parent) => {
|
|
64
58
|
switch (tagName) {
|
|
65
59
|
case 'thead':
|
|
@@ -345,20 +339,12 @@ const encoders = {
|
|
|
345
339
|
: false,
|
|
346
340
|
}),
|
|
347
341
|
equation: (node) => ({
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
SVGStringRepresentation: node.attrs.SVGStringRepresentation,
|
|
342
|
+
contents: node.attrs.contents,
|
|
343
|
+
format: node.attrs.format,
|
|
351
344
|
}),
|
|
352
345
|
equation_element: (node) => ({
|
|
353
346
|
containedObjectID: attributeOfNodeType(node, 'equation', 'id'),
|
|
354
|
-
|
|
355
|
-
title: inlineContentOfChildNodeType(node, node.type.schema.nodes.figcaption, node.type.schema.nodes.caption_title, false),
|
|
356
|
-
elementType: 'p',
|
|
357
|
-
suppressCaption: Boolean(node.attrs.suppressCaption) || undefined,
|
|
358
|
-
suppressTitle: node.attrs.suppressTitle === undefined ||
|
|
359
|
-
node.attrs.suppressTitle === true
|
|
360
|
-
? undefined
|
|
361
|
-
: false,
|
|
347
|
+
label: node.attrs.label,
|
|
362
348
|
}),
|
|
363
349
|
figure: (node) => ({
|
|
364
350
|
contentType: node.attrs.contentType || undefined,
|
|
@@ -405,12 +391,6 @@ const encoders = {
|
|
|
405
391
|
.map((childNode) => childNode.attrs.id)
|
|
406
392
|
.filter((id) => id),
|
|
407
393
|
}),
|
|
408
|
-
inline_equation: (node, parent) => ({
|
|
409
|
-
containingObject: parent.attrs.id,
|
|
410
|
-
TeXRepresentation: node.attrs.TeXRepresentation,
|
|
411
|
-
SVGRepresentation: node.attrs.SVGRepresentation,
|
|
412
|
-
SVGGlyphs: svgDefs(node.attrs.SVGRepresentation),
|
|
413
|
-
}),
|
|
414
394
|
keyword: (node, parent) => ({
|
|
415
395
|
containedGroup: parent.attrs.id,
|
|
416
396
|
name: keywordContents(node),
|
|
@@ -502,8 +482,6 @@ const encoders = {
|
|
|
502
482
|
addressLine3: node.attrs.addressLine3,
|
|
503
483
|
postCode: node.attrs.postCode,
|
|
504
484
|
country: node.attrs.country,
|
|
505
|
-
county: node.attrs.county,
|
|
506
|
-
city: node.attrs.city,
|
|
507
485
|
email: node.attrs.email,
|
|
508
486
|
priority: node.attrs.priority,
|
|
509
487
|
}),
|
|
@@ -514,7 +492,6 @@ const encoders = {
|
|
|
514
492
|
userID: node.attrs.userID,
|
|
515
493
|
invitationID: node.attrs.invitationID,
|
|
516
494
|
isCorresponding: node.attrs.isCorresponding,
|
|
517
|
-
isJointContributor: node.attrs.isJointContributor,
|
|
518
495
|
ORCIDIdentifier: node.attrs.ORCIDIdentifier,
|
|
519
496
|
footnote: node.attrs.footnote,
|
|
520
497
|
corresp: node.attrs.corresp,
|
|
@@ -574,8 +551,7 @@ export const encode = (node) => {
|
|
|
574
551
|
if (placeholderTypes.includes(child.type)) {
|
|
575
552
|
return;
|
|
576
553
|
}
|
|
577
|
-
if (parent.type === schema.nodes.paragraph
|
|
578
|
-
child.type !== schema.nodes.inline_equation) {
|
|
554
|
+
if (parent.type === schema.nodes.paragraph) {
|
|
579
555
|
return;
|
|
580
556
|
}
|
|
581
557
|
const { model, markers } = modelFromNode(child, parent, path, priority);
|
|
@@ -36,7 +36,6 @@ export const nodeTypesMap = new Map([
|
|
|
36
36
|
[schema.nodes.footnotes_section, ObjectTypes.Section],
|
|
37
37
|
[schema.nodes.graphical_abstract_section, ObjectTypes.Section],
|
|
38
38
|
[schema.nodes.highlight_marker, ObjectTypes.HighlightMarker],
|
|
39
|
-
[schema.nodes.inline_equation, ObjectTypes.InlineMathFragment],
|
|
40
39
|
[schema.nodes.keyword, ObjectTypes.Keyword],
|
|
41
40
|
[schema.nodes.keywords_element, ObjectTypes.KeywordsElement],
|
|
42
41
|
[schema.nodes.keywords, ObjectTypes.Section],
|
package/dist/types/index.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export * from './nodes/footnotes_section';
|
|
|
40
40
|
export * from './nodes/graphical_abstract_section';
|
|
41
41
|
export * from './nodes/hard_break';
|
|
42
42
|
export * from './nodes/highlight_marker';
|
|
43
|
-
export * from './nodes/inline_equation';
|
|
44
43
|
export * from './nodes/inline_footnote';
|
|
45
44
|
export * from './nodes/keyword';
|
|
46
45
|
export * from './nodes/keywords_element';
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { BibliographicName } from '@manuscripts/json-schema';
|
|
1
|
+
import { Affiliation, BibliographicName } from '@manuscripts/json-schema';
|
|
2
2
|
import { NodeSpec } from 'prosemirror-model';
|
|
3
3
|
import { ManuscriptNode } from '../types';
|
|
4
4
|
interface Attrs {
|
|
5
5
|
id: string;
|
|
6
6
|
role: string;
|
|
7
|
-
affiliations:
|
|
7
|
+
affiliations: Affiliation[];
|
|
8
8
|
bibliographicName: BibliographicName;
|
|
9
9
|
userID: string;
|
|
10
|
-
email: string;
|
|
11
10
|
invitationID: string;
|
|
12
11
|
isCorresponding: boolean;
|
|
13
12
|
ORCIDIdentifier: string;
|
|
14
13
|
priority: number;
|
|
15
|
-
isJointContributor: boolean;
|
|
16
14
|
}
|
|
17
15
|
export interface ContributorNode extends ManuscriptNode {
|
|
18
16
|
attrs: Attrs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ©
|
|
2
|
+
* © 2023 Atypon Systems LLC
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -17,9 +17,8 @@ import { NodeSpec } from 'prosemirror-model';
|
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
18
|
interface Attrs {
|
|
19
19
|
id: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
TeXRepresentation: string;
|
|
20
|
+
format: string;
|
|
21
|
+
contents: string;
|
|
23
22
|
}
|
|
24
23
|
export interface EquationNode extends ManuscriptNode {
|
|
25
24
|
attrs: Attrs;
|
|
@@ -18,8 +18,7 @@ import { ManuscriptNode } from '../types';
|
|
|
18
18
|
import { CommentNode } from './comment';
|
|
19
19
|
interface Attrs {
|
|
20
20
|
id: string;
|
|
21
|
-
|
|
22
|
-
suppressTitle?: boolean;
|
|
21
|
+
label: string;
|
|
23
22
|
comments?: CommentNode[];
|
|
24
23
|
}
|
|
25
24
|
export interface EquationElementNode extends ManuscriptNode {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
|
+
import { CommentNode } from './comment';
|
|
18
19
|
interface Attrs {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
TeXRepresentation: string;
|
|
20
|
+
contents: string;
|
|
21
|
+
format: string;
|
|
22
|
+
comments?: CommentNode[];
|
|
23
23
|
}
|
|
24
24
|
export interface InlineEquationNode extends ManuscriptNode {
|
|
25
25
|
attrs: Attrs;
|