@manuscripts/transform 2.1.0 → 2.1.1-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 +4 -1
- package/dist/cjs/schema/nodes/contributor.js +3 -1
- 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 +8 -7
- package/dist/cjs/transformer/encode.js +8 -25
- 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 +4 -1
- package/dist/es/schema/nodes/contributor.js +3 -1
- 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 +8 -7
- package/dist/es/transformer/encode.js +8 -25
- 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 +2 -0
- package/dist/types/schema/nodes/contributor.d.ts +4 -2
- 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
|
}
|
|
@@ -678,22 +679,23 @@ export class JATSExporter {
|
|
|
678
679
|
},
|
|
679
680
|
doc: () => '',
|
|
680
681
|
equation: (node) => {
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
682
|
+
const math = this.nodeFromJATS(node.attrs.contents);
|
|
683
|
+
const mathEl = math;
|
|
684
|
+
mathEl.setAttribute('id', normalizeID(node.attrs.id));
|
|
685
|
+
return mathEl;
|
|
686
|
+
},
|
|
687
|
+
inline_equation: (node) => {
|
|
688
|
+
const eqElement = this.document.createElement('inline-formula');
|
|
689
|
+
const math = this.nodeFromJATS(node.attrs.contents);
|
|
690
|
+
eqElement.append(math);
|
|
691
|
+
return eqElement;
|
|
692
|
+
},
|
|
693
|
+
equation_element: (node) => {
|
|
694
|
+
const eqElement = this.document.createElement('disp-formula');
|
|
695
|
+
eqElement.setAttribute('id', normalizeID(node.attrs.id));
|
|
696
|
+
processChildNodes(eqElement, node, schema.nodes.equation);
|
|
697
|
+
return eqElement;
|
|
695
698
|
},
|
|
696
|
-
equation_element: (node) => createFigureElement(node, 'fig', node.type.schema.nodes.equation, 'equation'),
|
|
697
699
|
figcaption: (node) => {
|
|
698
700
|
if (!node.textContent) {
|
|
699
701
|
return '';
|
|
@@ -743,28 +745,6 @@ export class JATSExporter {
|
|
|
743
745
|
},
|
|
744
746
|
hard_break: () => '',
|
|
745
747
|
highlight_marker: () => '',
|
|
746
|
-
inline_equation: (node) => {
|
|
747
|
-
const formula = this.document.createElement('inline-formula');
|
|
748
|
-
formula.setAttribute('id', normalizeID(node.attrs.id));
|
|
749
|
-
if (node.attrs.TeXRepresentation) {
|
|
750
|
-
const math = this.document.createElement('tex-math');
|
|
751
|
-
math.textContent = node.attrs.TeXRepresentation;
|
|
752
|
-
formula.appendChild(math);
|
|
753
|
-
}
|
|
754
|
-
else if (node.attrs.MathMLRepresentation) {
|
|
755
|
-
const math = this.nodeFromJATS(node.attrs.MathMLRepresentation);
|
|
756
|
-
if (math) {
|
|
757
|
-
formula.appendChild(math);
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
else if (node.attrs.SVGRepresentation) {
|
|
761
|
-
const math = this.nodeFromJATS(node.attrs.SVGRepresentation);
|
|
762
|
-
if (math) {
|
|
763
|
-
formula.appendChild(math);
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
return formula;
|
|
767
|
-
},
|
|
768
748
|
inline_footnote: (node) => {
|
|
769
749
|
const xref = this.document.createElement('xref');
|
|
770
750
|
xref.setAttribute('ref-type', 'fn');
|
package/dist/es/schema/index.js
CHANGED
|
@@ -100,7 +100,6 @@ export * from './nodes/footnotes_section';
|
|
|
100
100
|
export * from './nodes/graphical_abstract_section';
|
|
101
101
|
export * from './nodes/hard_break';
|
|
102
102
|
export * from './nodes/highlight_marker';
|
|
103
|
-
export * from './nodes/inline_equation';
|
|
104
103
|
export * from './nodes/inline_footnote';
|
|
105
104
|
export * from './nodes/keyword';
|
|
106
105
|
export * from './nodes/keywords_element';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const affiliation = {
|
|
2
|
+
content: 'inline*',
|
|
2
3
|
attrs: {
|
|
3
4
|
id: { default: '' },
|
|
4
5
|
institution: { default: '' },
|
|
@@ -8,6 +9,8 @@ export const affiliation = {
|
|
|
8
9
|
addressLine3: { default: '' },
|
|
9
10
|
postCode: { default: '' },
|
|
10
11
|
country: { default: '' },
|
|
12
|
+
county: { default: '' },
|
|
13
|
+
city: { default: '' },
|
|
11
14
|
priority: { default: undefined },
|
|
12
15
|
email: {
|
|
13
16
|
default: {
|
|
@@ -17,7 +20,7 @@ export const affiliation = {
|
|
|
17
20
|
},
|
|
18
21
|
dataTracked: { default: null },
|
|
19
22
|
},
|
|
20
|
-
group: 'block
|
|
23
|
+
group: 'block',
|
|
21
24
|
parseDOM: [
|
|
22
25
|
{
|
|
23
26
|
tag: 'div.affiliation',
|
|
@@ -3,6 +3,7 @@ export const contributor = {
|
|
|
3
3
|
attrs: {
|
|
4
4
|
id: { default: '' },
|
|
5
5
|
role: { default: '' },
|
|
6
|
+
email: { default: '' },
|
|
6
7
|
affiliations: { default: [] },
|
|
7
8
|
footnote: { default: undefined },
|
|
8
9
|
corresp: { default: undefined },
|
|
@@ -10,12 +11,13 @@ export const contributor = {
|
|
|
10
11
|
userID: { default: undefined },
|
|
11
12
|
invitationID: { default: undefined },
|
|
12
13
|
isCorresponding: { default: undefined },
|
|
14
|
+
isJointContributor: { default: undefined },
|
|
13
15
|
ORCIDIdentifier: { default: undefined },
|
|
14
16
|
priority: { default: undefined },
|
|
15
17
|
dataTracked: { default: null },
|
|
16
18
|
contents: { default: '' },
|
|
17
19
|
},
|
|
18
|
-
group: 'block
|
|
20
|
+
group: 'block',
|
|
19
21
|
toDOM: (node) => {
|
|
20
22
|
const contributorNode = node;
|
|
21
23
|
return [
|
|
@@ -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,
|
|
@@ -272,9 +272,8 @@ export class Decoder {
|
|
|
272
272
|
const model = data;
|
|
273
273
|
return schema.nodes.equation.createChecked({
|
|
274
274
|
id: model._id,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
TeXRepresentation: model.TeXRepresentation,
|
|
275
|
+
contents: model.contents,
|
|
276
|
+
format: model.format,
|
|
278
277
|
});
|
|
279
278
|
},
|
|
280
279
|
[ObjectTypes.EquationElement]: (data) => {
|
|
@@ -293,12 +292,10 @@ export class Decoder {
|
|
|
293
292
|
else {
|
|
294
293
|
throw new MissingElement(model.containedObjectID);
|
|
295
294
|
}
|
|
296
|
-
const figcaption = this.getFigcaption(model);
|
|
297
295
|
return schema.nodes.equation_element.createChecked({
|
|
298
296
|
id: model._id,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}, [equation, figcaption]);
|
|
297
|
+
label: model.label,
|
|
298
|
+
}, [equation]);
|
|
302
299
|
},
|
|
303
300
|
[ObjectTypes.FootnotesElement]: (data) => {
|
|
304
301
|
const foonotesElementModel = data;
|
|
@@ -619,6 +616,8 @@ export class Decoder {
|
|
|
619
616
|
addressLine3: model.addressLine3,
|
|
620
617
|
postCode: model.postCode,
|
|
621
618
|
country: model.country,
|
|
619
|
+
county: model.county,
|
|
620
|
+
city: model.city,
|
|
622
621
|
email: model.email,
|
|
623
622
|
department: model.department,
|
|
624
623
|
priority: model.priority,
|
|
@@ -630,6 +629,8 @@ export class Decoder {
|
|
|
630
629
|
id: model._id,
|
|
631
630
|
role: model.role,
|
|
632
631
|
affiliations: model.affiliations,
|
|
632
|
+
email: model.email,
|
|
633
|
+
isJointContributor: model.isJointContributor,
|
|
633
634
|
bibliographicName: model.bibliographicName,
|
|
634
635
|
userID: model.userID,
|
|
635
636
|
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),
|
|
@@ -500,8 +480,11 @@ const encoders = {
|
|
|
500
480
|
addressLine1: node.attrs.addressLine1,
|
|
501
481
|
addressLine2: node.attrs.addressLine2,
|
|
502
482
|
addressLine3: node.attrs.addressLine3,
|
|
483
|
+
department: node.attrs.department,
|
|
503
484
|
postCode: node.attrs.postCode,
|
|
504
485
|
country: node.attrs.country,
|
|
486
|
+
county: node.attrs.county,
|
|
487
|
+
city: node.attrs.city,
|
|
505
488
|
email: node.attrs.email,
|
|
506
489
|
priority: node.attrs.priority,
|
|
507
490
|
}),
|
|
@@ -512,6 +495,7 @@ const encoders = {
|
|
|
512
495
|
userID: node.attrs.userID,
|
|
513
496
|
invitationID: node.attrs.invitationID,
|
|
514
497
|
isCorresponding: node.attrs.isCorresponding,
|
|
498
|
+
isJointContributor: node.attrs.isJointContributor,
|
|
515
499
|
ORCIDIdentifier: node.attrs.ORCIDIdentifier,
|
|
516
500
|
footnote: node.attrs.footnote,
|
|
517
501
|
corresp: node.attrs.corresp,
|
|
@@ -579,8 +563,7 @@ export const encode = (node) => {
|
|
|
579
563
|
if (placeholderTypes.includes(child.type)) {
|
|
580
564
|
return;
|
|
581
565
|
}
|
|
582
|
-
if (parent.type === schema.nodes.paragraph
|
|
583
|
-
child.type !== schema.nodes.inline_equation) {
|
|
566
|
+
if (parent.type === schema.nodes.paragraph) {
|
|
584
567
|
return;
|
|
585
568
|
}
|
|
586
569
|
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,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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: string[];
|
|
8
8
|
bibliographicName: BibliographicName;
|
|
9
9
|
userID: string;
|
|
10
|
+
email: string;
|
|
10
11
|
invitationID: string;
|
|
11
12
|
isCorresponding: boolean;
|
|
12
13
|
ORCIDIdentifier: string;
|
|
13
14
|
priority: number;
|
|
15
|
+
isJointContributor: boolean;
|
|
14
16
|
}
|
|
15
17
|
export interface ContributorNode extends ManuscriptNode {
|
|
16
18
|
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 {
|