@manuscripts/transform 2.0.4 → 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 +44 -73
- package/dist/cjs/jats/importer/jats-body-transformations.js +14 -0
- package/dist/cjs/jats/importer/jats-front-parser.js +0 -19
- package/dist/cjs/jats/importer/parse-jats-article.js +1 -4
- package/dist/cjs/jats/jats-exporter.js +19 -37
- package/dist/cjs/schema/index.js +6 -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/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/schema/nodes/supplement.js +63 -0
- package/dist/cjs/schema/nodes/supplements.js +45 -0
- package/dist/cjs/transformer/builders.js +1 -8
- package/dist/cjs/transformer/decode.js +31 -7
- package/dist/cjs/transformer/encode.js +16 -25
- package/dist/cjs/transformer/node-types.js +1 -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 +45 -74
- package/dist/es/jats/importer/jats-body-transformations.js +14 -0
- package/dist/es/jats/importer/jats-front-parser.js +1 -20
- package/dist/es/jats/importer/parse-jats-article.js +1 -4
- package/dist/es/jats/jats-exporter.js +19 -37
- package/dist/es/schema/index.js +6 -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/schema/nodes/manuscript.js +1 -1
- package/dist/es/schema/nodes/supplement.js +60 -0
- package/dist/es/schema/nodes/supplements.js +42 -0
- package/dist/es/transformer/builders.js +0 -6
- package/dist/es/transformer/decode.js +31 -7
- package/dist/es/transformer/encode.js +16 -25
- package/dist/es/transformer/node-types.js +1 -1
- package/dist/es/transformer/object-types.js +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +1 -0
- package/dist/types/jats/importer/jats-front-parser.d.ts +0 -1
- package/dist/types/schema/index.d.ts +2 -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/{cjs/mathjax/mathjax-packages.js → types/schema/nodes/supplement.d.ts} +14 -5
- package/dist/{es/mathjax/mathjax-packages.js → types/schema/nodes/supplements.d.ts} +10 -2
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +1 -2
- package/dist/types/transformer/decode.d.ts +1 -0
- package/package.json +4 -5
- package/dist/cjs/mathjax/index.js +0 -41
- 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/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
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,24 @@ 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
|
+
case 'mml:math':
|
|
51
|
+
contents = child.outerHTML;
|
|
52
|
+
format = nodeName === 'tex-math' ? 'tex' : 'mathml';
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { format, contents };
|
|
57
|
+
};
|
|
42
58
|
const marks = [
|
|
43
59
|
{
|
|
44
60
|
tag: 'bold',
|
|
@@ -147,91 +163,27 @@ const nodes = [
|
|
|
147
163
|
tag: 'inline-formula',
|
|
148
164
|
node: 'inline_equation',
|
|
149
165
|
getAttrs: (node) => {
|
|
150
|
-
var _a, _b, _c, _d, _e;
|
|
151
166
|
const element = node;
|
|
152
|
-
|
|
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;
|
|
167
|
+
return getEquationContent(element);
|
|
181
168
|
},
|
|
182
169
|
},
|
|
183
170
|
{
|
|
184
171
|
tag: 'disp-formula',
|
|
185
172
|
node: 'equation_element',
|
|
186
173
|
getAttrs: (node) => {
|
|
174
|
+
var _a, _b;
|
|
187
175
|
const element = node;
|
|
188
|
-
const caption = element.querySelector('figcaption');
|
|
189
176
|
return {
|
|
190
177
|
id: element.getAttribute('id'),
|
|
191
|
-
|
|
178
|
+
label: (_b = (_a = element.querySelector('label')) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : '',
|
|
192
179
|
};
|
|
193
180
|
},
|
|
194
181
|
getContent: (node, schema) => {
|
|
195
|
-
var _a, _b, _c, _d, _e;
|
|
196
182
|
const element = node;
|
|
197
|
-
const attrs =
|
|
198
|
-
|
|
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();
|
|
183
|
+
const attrs = getEquationContent(element);
|
|
184
|
+
const id = element.getAttribute('id');
|
|
227
185
|
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,
|
|
186
|
+
schema.nodes.equation.createChecked(Object.assign({ id }, attrs)),
|
|
235
187
|
]);
|
|
236
188
|
},
|
|
237
189
|
},
|
|
@@ -430,6 +382,25 @@ const nodes = [
|
|
|
430
382
|
tag: 'sec[sec-type="keywords"]',
|
|
431
383
|
node: 'keywords',
|
|
432
384
|
},
|
|
385
|
+
{
|
|
386
|
+
tag: 'sec[sec-type="supplementary-material"]',
|
|
387
|
+
node: 'supplements',
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
tag: 'supplementary-material',
|
|
391
|
+
node: 'supplement',
|
|
392
|
+
getAttrs: (node) => {
|
|
393
|
+
var _a;
|
|
394
|
+
const element = node;
|
|
395
|
+
return {
|
|
396
|
+
id: element.getAttribute('id'),
|
|
397
|
+
href: element.getAttributeNS(XLINK_NAMESPACE, 'href'),
|
|
398
|
+
mimeType: element.getAttribute('mimetype'),
|
|
399
|
+
mimeSubType: element.getAttribute('mime-subtype'),
|
|
400
|
+
title: (_a = element.querySelector('title')) === null || _a === void 0 ? void 0 : _a.textContent,
|
|
401
|
+
};
|
|
402
|
+
},
|
|
403
|
+
},
|
|
433
404
|
{
|
|
434
405
|
tag: 'sec[sec-type="abstracts"]',
|
|
435
406
|
node: 'abstracts',
|
|
@@ -526,7 +497,7 @@ const nodes = [
|
|
|
526
497
|
{
|
|
527
498
|
tag: 'title',
|
|
528
499
|
node: 'section_title',
|
|
529
|
-
context: 'section/|footnotes_section/|bibliography_section/|keywords/',
|
|
500
|
+
context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/',
|
|
530
501
|
},
|
|
531
502
|
{
|
|
532
503
|
tag: 'title',
|
|
@@ -287,4 +287,18 @@ exports.jatsBodyTransformations = {
|
|
|
287
287
|
body.prepend(section);
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
|
+
createSuppleMaterials(document, body, createElement) {
|
|
291
|
+
const suppleMaterials = [
|
|
292
|
+
...document.querySelectorAll('article-meta > supplementary-material'),
|
|
293
|
+
];
|
|
294
|
+
if (suppleMaterials.length > 0) {
|
|
295
|
+
const section = createElement('sec');
|
|
296
|
+
section.setAttribute('sec-type', 'supplementary-material');
|
|
297
|
+
const title = createElement('title');
|
|
298
|
+
title.textContent = 'supplementary-material';
|
|
299
|
+
section.append(title);
|
|
300
|
+
section.append(...suppleMaterials);
|
|
301
|
+
body.prepend(section);
|
|
302
|
+
}
|
|
303
|
+
},
|
|
290
304
|
};
|
|
@@ -128,25 +128,6 @@ exports.jatsFrontParser = {
|
|
|
128
128
|
}
|
|
129
129
|
return history;
|
|
130
130
|
},
|
|
131
|
-
parseSupplements(elements) {
|
|
132
|
-
var _a, _b, _c, _d;
|
|
133
|
-
if (!(elements === null || elements === void 0 ? void 0 : elements.length)) {
|
|
134
|
-
return [];
|
|
135
|
-
}
|
|
136
|
-
const supplements = [];
|
|
137
|
-
for (const element of elements) {
|
|
138
|
-
const title = (_a = (0, utils_1.getTrimmedTextContent)(element, 'caption > title')) !== null && _a !== void 0 ? _a : '';
|
|
139
|
-
const href = (_b = element.getAttributeNS(XLINK_NAMESPACE, 'href')) !== null && _b !== void 0 ? _b : '';
|
|
140
|
-
const supplement = (0, transformer_1.buildSupplementaryMaterial)(title, href);
|
|
141
|
-
const mimeType = (_c = element.getAttribute('mimetype')) !== null && _c !== void 0 ? _c : '';
|
|
142
|
-
const mimeSubtype = (_d = element.getAttribute('mime-subtype')) !== null && _d !== void 0 ? _d : '';
|
|
143
|
-
if (mimeType && mimeSubtype) {
|
|
144
|
-
supplement.MIME = [mimeType, mimeSubtype].join('/');
|
|
145
|
-
}
|
|
146
|
-
supplements.push(supplement);
|
|
147
|
-
}
|
|
148
|
-
return supplements;
|
|
149
|
-
},
|
|
150
131
|
parseAffiliations(elements) {
|
|
151
132
|
const affiliationIDs = new Map();
|
|
152
133
|
const affiliations = elements.map((element, priority) => {
|
|
@@ -43,9 +43,6 @@ const parseJATSFront = (doc, front) => {
|
|
|
43
43
|
const authors = jats_front_parser_1.jatsFrontParser.parseContributors([
|
|
44
44
|
...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
|
|
45
45
|
], affiliationIDs, footnoteIDs, correspondingIDs);
|
|
46
|
-
const supplements = jats_front_parser_1.jatsFrontParser.parseSupplements([
|
|
47
|
-
...front.querySelectorAll('article-meta > supplementary-material'),
|
|
48
|
-
]);
|
|
49
46
|
const history = jats_front_parser_1.jatsFrontParser.parseDates(front.querySelector('article-meta > history'));
|
|
50
47
|
const counts = jats_front_parser_1.jatsFrontParser.parseCounts(front.querySelector('article-meta counts'));
|
|
51
48
|
const manuscript = Object.assign(Object.assign(Object.assign({}, (0, builders_1.buildManuscript)()), counts), history);
|
|
@@ -57,7 +54,6 @@ const parseJATSFront = (doc, front) => {
|
|
|
57
54
|
...authors,
|
|
58
55
|
...affiliations,
|
|
59
56
|
...correspondingList,
|
|
60
|
-
...supplements,
|
|
61
57
|
]);
|
|
62
58
|
};
|
|
63
59
|
exports.parseJATSFront = parseJATSFront;
|
|
@@ -69,6 +65,7 @@ const parseJATSBody = (doc, body, references) => {
|
|
|
69
65
|
jats_body_transformations_1.jatsBodyTransformations.createBody(doc, body, createElement);
|
|
70
66
|
jats_body_transformations_1.jatsBodyTransformations.createAbstracts(doc, body, createElement);
|
|
71
67
|
jats_body_transformations_1.jatsBodyTransformations.createBackmatter(doc, body, createElement);
|
|
68
|
+
jats_body_transformations_1.jatsBodyTransformations.createSuppleMaterials(doc, body, createElement);
|
|
72
69
|
jats_body_transformations_1.jatsBodyTransformations.createKeywords(doc, body, createElement);
|
|
73
70
|
const node = jats_body_dom_parser_1.jatsBodyDOMParser.parse(body).firstChild;
|
|
74
71
|
if (!node) {
|
|
@@ -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
|
}
|
|
@@ -628,6 +629,8 @@ class JATSExporter {
|
|
|
628
629
|
body: () => ['body', 0],
|
|
629
630
|
abstracts: () => ['abstract', 0],
|
|
630
631
|
backmatter: () => ['backmatter', 0],
|
|
632
|
+
supplement: () => '',
|
|
633
|
+
supplements: () => '',
|
|
631
634
|
bibliography_section: (node) => [
|
|
632
635
|
'ref-list',
|
|
633
636
|
{ id: normalizeID(node.attrs.id) },
|
|
@@ -684,22 +687,23 @@ class JATSExporter {
|
|
|
684
687
|
},
|
|
685
688
|
doc: () => '',
|
|
686
689
|
equation: (node) => {
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
690
|
+
const math = this.nodeFromJATS(node.attrs.contents);
|
|
691
|
+
const mathEl = math;
|
|
692
|
+
mathEl.setAttribute('id', normalizeID(node.attrs.id));
|
|
693
|
+
return mathEl;
|
|
694
|
+
},
|
|
695
|
+
inline_equation: (node) => {
|
|
696
|
+
const eqElement = this.document.createElement('inline-formula');
|
|
697
|
+
const math = this.nodeFromJATS(node.attrs.contents);
|
|
698
|
+
eqElement.append(math);
|
|
699
|
+
return eqElement;
|
|
700
|
+
},
|
|
701
|
+
equation_element: (node) => {
|
|
702
|
+
const eqElement = this.document.createElement('disp-formula');
|
|
703
|
+
eqElement.setAttribute('id', normalizeID(node.attrs.id));
|
|
704
|
+
processChildNodes(eqElement, node, schema_1.schema.nodes.equation);
|
|
705
|
+
return eqElement;
|
|
701
706
|
},
|
|
702
|
-
equation_element: (node) => createFigureElement(node, 'fig', node.type.schema.nodes.equation, 'equation'),
|
|
703
707
|
figcaption: (node) => {
|
|
704
708
|
if (!node.textContent) {
|
|
705
709
|
return '';
|
|
@@ -749,28 +753,6 @@ class JATSExporter {
|
|
|
749
753
|
},
|
|
750
754
|
hard_break: () => '',
|
|
751
755
|
highlight_marker: () => '',
|
|
752
|
-
inline_equation: (node) => {
|
|
753
|
-
const formula = this.document.createElement('inline-formula');
|
|
754
|
-
formula.setAttribute('id', normalizeID(node.attrs.id));
|
|
755
|
-
if (node.attrs.TeXRepresentation) {
|
|
756
|
-
const math = this.document.createElement('tex-math');
|
|
757
|
-
math.textContent = node.attrs.TeXRepresentation;
|
|
758
|
-
formula.appendChild(math);
|
|
759
|
-
}
|
|
760
|
-
else if (node.attrs.MathMLRepresentation) {
|
|
761
|
-
const math = this.nodeFromJATS(node.attrs.MathMLRepresentation);
|
|
762
|
-
if (math) {
|
|
763
|
-
formula.appendChild(math);
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
else if (node.attrs.SVGRepresentation) {
|
|
767
|
-
const math = this.nodeFromJATS(node.attrs.SVGRepresentation);
|
|
768
|
-
if (math) {
|
|
769
|
-
formula.appendChild(math);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
return formula;
|
|
773
|
-
},
|
|
774
756
|
inline_footnote: (node) => {
|
|
775
757
|
const xref = this.document.createElement('xref');
|
|
776
758
|
xref.setAttribute('ref-type', 'fn');
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -81,6 +81,8 @@ const pullquote_element_1 = require("./nodes/pullquote_element");
|
|
|
81
81
|
const section_1 = require("./nodes/section");
|
|
82
82
|
const section_label_1 = require("./nodes/section_label");
|
|
83
83
|
const section_title_1 = require("./nodes/section_title");
|
|
84
|
+
const supplement_1 = require("./nodes/supplement");
|
|
85
|
+
const supplements_1 = require("./nodes/supplements");
|
|
84
86
|
const table_1 = require("./nodes/table");
|
|
85
87
|
const table_col_1 = require("./nodes/table_col");
|
|
86
88
|
const table_element_1 = require("./nodes/table_element");
|
|
@@ -115,7 +117,6 @@ __exportStar(require("./nodes/footnotes_section"), exports);
|
|
|
115
117
|
__exportStar(require("./nodes/graphical_abstract_section"), exports);
|
|
116
118
|
__exportStar(require("./nodes/hard_break"), exports);
|
|
117
119
|
__exportStar(require("./nodes/highlight_marker"), exports);
|
|
118
|
-
__exportStar(require("./nodes/inline_equation"), exports);
|
|
119
120
|
__exportStar(require("./nodes/inline_footnote"), exports);
|
|
120
121
|
__exportStar(require("./nodes/keyword"), exports);
|
|
121
122
|
__exportStar(require("./nodes/keywords_element"), exports);
|
|
@@ -145,6 +146,8 @@ __exportStar(require("./nodes/table_element_footer"), exports);
|
|
|
145
146
|
__exportStar(require("./nodes/title"), exports);
|
|
146
147
|
__exportStar(require("./nodes/affiliations"), exports);
|
|
147
148
|
__exportStar(require("./nodes/contributors"), exports);
|
|
149
|
+
__exportStar(require("./nodes/supplement"), exports);
|
|
150
|
+
__exportStar(require("./nodes/supplements"), exports);
|
|
148
151
|
exports.schema = new prosemirror_model_1.Schema({
|
|
149
152
|
marks: {
|
|
150
153
|
bold: marks_1.bold,
|
|
@@ -224,5 +227,7 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
224
227
|
title: title_1.title,
|
|
225
228
|
affiliations: affiliations_1.affiliations,
|
|
226
229
|
contributors: contributors_1.contributors,
|
|
230
|
+
supplements: supplements_1.supplements,
|
|
231
|
+
supplement: supplement_1.supplement,
|
|
227
232
|
},
|
|
228
233
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isAffiliationNode = exports.affiliation = void 0;
|
|
4
4
|
exports.affiliation = {
|
|
5
|
+
content: 'inline*',
|
|
5
6
|
attrs: {
|
|
6
7
|
id: { default: '' },
|
|
7
8
|
institution: { default: '' },
|
|
@@ -11,6 +12,8 @@ exports.affiliation = {
|
|
|
11
12
|
addressLine3: { default: '' },
|
|
12
13
|
postCode: { default: '' },
|
|
13
14
|
country: { default: '' },
|
|
15
|
+
county: { default: '' },
|
|
16
|
+
city: { default: '' },
|
|
14
17
|
priority: { default: undefined },
|
|
15
18
|
email: {
|
|
16
19
|
default: {
|
|
@@ -20,7 +23,7 @@ exports.affiliation = {
|
|
|
20
23
|
},
|
|
21
24
|
dataTracked: { default: null },
|
|
22
25
|
},
|
|
23
|
-
group: 'block
|
|
26
|
+
group: 'block',
|
|
24
27
|
parseDOM: [
|
|
25
28
|
{
|
|
26
29
|
tag: 'div.affiliation',
|
|
@@ -6,6 +6,7 @@ exports.contributor = {
|
|
|
6
6
|
attrs: {
|
|
7
7
|
id: { default: '' },
|
|
8
8
|
role: { default: '' },
|
|
9
|
+
email: { default: '' },
|
|
9
10
|
affiliations: { default: [] },
|
|
10
11
|
footnote: { default: undefined },
|
|
11
12
|
corresp: { default: undefined },
|
|
@@ -13,12 +14,13 @@ exports.contributor = {
|
|
|
13
14
|
userID: { default: undefined },
|
|
14
15
|
invitationID: { default: undefined },
|
|
15
16
|
isCorresponding: { default: undefined },
|
|
17
|
+
isJointContributor: { default: undefined },
|
|
16
18
|
ORCIDIdentifier: { default: undefined },
|
|
17
19
|
priority: { default: undefined },
|
|
18
20
|
dataTracked: { default: null },
|
|
19
21
|
contents: { default: '' },
|
|
20
22
|
},
|
|
21
|
-
group: 'block
|
|
23
|
+
group: 'block',
|
|
22
24
|
toDOM: (node) => {
|
|
23
25
|
const contributorNode = node;
|
|
24
26
|
return [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
|
-
* ©
|
|
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
|
-
|
|
24
|
-
|
|
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
|
|
32
|
+
const htmlEl = p;
|
|
34
33
|
return {
|
|
35
|
-
id:
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
49
|
-
|
|
46
|
+
dom.setAttribute('id', id);
|
|
47
|
+
if (format) {
|
|
48
|
+
dom.setAttribute('data-equation-format', format);
|
|
50
49
|
}
|
|
51
|
-
dom.
|
|
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)
|
|
20
|
+
content: '(equation | placeholder)',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
|
-
|
|
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: '
|
|
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
|
-
'
|
|
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
|
|
33
|
+
tag: `span.MPInlineMathFragment`,
|
|
35
34
|
getAttrs: (p) => {
|
|
36
35
|
const dom = p;
|
|
37
36
|
return {
|
|
38
|
-
|
|
39
|
-
|
|
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(
|
|
50
|
-
|
|
51
|
-
|
|
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 =
|
|
51
|
+
dom.innerHTML = contents;
|
|
56
52
|
return dom;
|
|
57
53
|
},
|
|
58
54
|
};
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isManuscriptNode = exports.manuscript = void 0;
|
|
19
19
|
exports.manuscript = {
|
|
20
|
-
content: 'title? contributors? affiliations? keywords? abstracts body backmatter comments',
|
|
20
|
+
content: 'title? contributors? affiliations? keywords? supplements? abstracts body backmatter comments',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
},
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.supplement = void 0;
|
|
19
|
+
exports.supplement = {
|
|
20
|
+
attrs: {
|
|
21
|
+
id: { default: '' },
|
|
22
|
+
href: { default: '' },
|
|
23
|
+
mimeType: { default: '' },
|
|
24
|
+
mimeSubType: { default: '' },
|
|
25
|
+
title: { default: '' },
|
|
26
|
+
dataTracked: { default: null },
|
|
27
|
+
},
|
|
28
|
+
group: 'block',
|
|
29
|
+
parseDOM: [
|
|
30
|
+
{
|
|
31
|
+
tag: 'div.supplement',
|
|
32
|
+
getAttrs: (dom) => {
|
|
33
|
+
const el = dom;
|
|
34
|
+
const id = el.getAttribute('id');
|
|
35
|
+
const href = el.getAttribute('href');
|
|
36
|
+
const mimeType = el.getAttribute('mimeType');
|
|
37
|
+
const mimeSubType = el.getAttribute('mimeSubType');
|
|
38
|
+
const title = el.textContent;
|
|
39
|
+
return {
|
|
40
|
+
id,
|
|
41
|
+
href,
|
|
42
|
+
mimeType,
|
|
43
|
+
mimeSubType,
|
|
44
|
+
title,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
toDOM: (node) => {
|
|
50
|
+
const supplement = node;
|
|
51
|
+
return [
|
|
52
|
+
'div',
|
|
53
|
+
{
|
|
54
|
+
id: supplement.attrs.id,
|
|
55
|
+
class: 'Supplement',
|
|
56
|
+
href: node.attrs.href,
|
|
57
|
+
mimeType: node.attrs.mimeType,
|
|
58
|
+
mimeSubType: node.attrs.mimeSubType,
|
|
59
|
+
title: node.attrs.title,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
},
|
|
63
|
+
};
|