@manuscripts/transform 2.0.1-LEAN-3092 → 2.0.2
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 +1 -0
- package/dist/cjs/jats/importer/jats-body-dom-parser.js +72 -24
- package/dist/cjs/jats/jats-exporter.js +81 -28
- package/dist/cjs/mathjax/index.js +41 -0
- package/dist/cjs/mathjax/mathjax-packages.js +20 -0
- package/dist/cjs/mathjax/mathml-to-svg.js +70 -0
- package/dist/cjs/mathjax/tex-to-mathml.js +49 -0
- package/dist/cjs/mathjax/tex-to-svg.js +59 -0
- package/dist/cjs/schema/index.js +1 -0
- package/dist/cjs/schema/nodes/equation.js +14 -12
- package/dist/cjs/schema/nodes/equation_element.js +5 -4
- package/dist/cjs/schema/nodes/inline_equation.js +16 -12
- package/dist/cjs/transformer/builders.js +8 -1
- package/dist/cjs/transformer/decode.js +7 -4
- package/dist/cjs/transformer/encode.js +25 -4
- package/dist/cjs/transformer/node-types.js +1 -0
- package/dist/cjs/transformer/object-types.js +1 -0
- package/dist/es/index.js +1 -0
- package/dist/es/jats/importer/jats-body-dom-parser.js +73 -25
- package/dist/es/jats/jats-exporter.js +80 -28
- package/dist/es/mathjax/index.js +12 -0
- package/dist/es/mathjax/mathjax-packages.js +17 -0
- package/dist/es/mathjax/mathml-to-svg.js +66 -0
- package/dist/es/mathjax/tex-to-mathml.js +45 -0
- package/dist/es/mathjax/tex-to-svg.js +55 -0
- package/dist/es/schema/index.js +1 -0
- package/dist/es/schema/nodes/equation.js +14 -12
- package/dist/es/schema/nodes/equation_element.js +5 -4
- package/dist/es/schema/nodes/inline_equation.js +16 -12
- package/dist/es/transformer/builders.js +6 -0
- package/dist/es/transformer/decode.js +7 -4
- package/dist/es/transformer/encode.js +25 -4
- package/dist/es/transformer/node-types.js +1 -0
- package/dist/es/transformer/object-types.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/jats/jats-exporter.d.ts +29 -2
- package/dist/types/mathjax/index.d.ts +3 -0
- package/dist/types/mathjax/mathjax-packages.d.ts +16 -0
- package/dist/types/mathjax/mathml-to-svg.d.ts +17 -0
- package/dist/types/mathjax/tex-to-mathml.d.ts +17 -0
- package/dist/types/mathjax/tex-to-svg.d.ts +17 -0
- package/dist/types/schema/index.d.ts +1 -0
- package/dist/types/schema/nodes/equation.d.ts +4 -3
- package/dist/types/schema/nodes/equation_element.d.ts +2 -1
- package/dist/types/schema/nodes/inline_equation.d.ts +4 -4
- package/dist/types/transformer/builders.d.ts +2 -1
- package/package.json +4 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import 'mathjax-full/js/util/entities/all';
|
|
17
|
+
import { HTMLAdaptor } from 'mathjax-full/js/adaptors/HTMLAdaptor';
|
|
18
|
+
import { HTMLDocument } from 'mathjax-full/js/handlers/html/HTMLDocument';
|
|
19
|
+
import { TeX } from 'mathjax-full/js/input/tex';
|
|
20
|
+
import { SVG } from 'mathjax-full/js/output/svg';
|
|
21
|
+
import { xmlSerializer } from '../transformer';
|
|
22
|
+
import { packages } from './mathjax-packages';
|
|
23
|
+
class ManuscriptsHTMLAdaptor extends HTMLAdaptor {
|
|
24
|
+
setAttribute(node, name, value, ns) {
|
|
25
|
+
if (name !== 'xmlns') {
|
|
26
|
+
ns ? node.setAttributeNS(ns, name, value) : node.setAttribute(name, value);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const InputJax = new TeX({
|
|
31
|
+
packages,
|
|
32
|
+
});
|
|
33
|
+
const OutputJax = new SVG({
|
|
34
|
+
fontCache: 'none',
|
|
35
|
+
});
|
|
36
|
+
const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
37
|
+
const doc = new HTMLDocument(document, adaptor, {
|
|
38
|
+
InputJax,
|
|
39
|
+
OutputJax,
|
|
40
|
+
});
|
|
41
|
+
doc.addStyleSheet();
|
|
42
|
+
export const convertTeXToSVG = (tex, display) => {
|
|
43
|
+
const item = doc.convert(tex, {
|
|
44
|
+
display,
|
|
45
|
+
em: 16,
|
|
46
|
+
ex: 8,
|
|
47
|
+
containerWidth: 1000000,
|
|
48
|
+
lineWidth: 1000000,
|
|
49
|
+
scale: 1,
|
|
50
|
+
});
|
|
51
|
+
if (!item || !item.firstChild) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return xmlSerializer.serializeToString(item.firstChild);
|
|
55
|
+
};
|
package/dist/es/schema/index.js
CHANGED
|
@@ -98,6 +98,7 @@ 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';
|
|
101
102
|
export * from './nodes/inline_footnote';
|
|
102
103
|
export * from './nodes/keyword';
|
|
103
104
|
export * from './nodes/keywords_element';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ©
|
|
2
|
+
* © 2019 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,8 +17,9 @@ import { ObjectTypes } from '@manuscripts/json-schema';
|
|
|
17
17
|
export const equation = {
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
MathMLStringRepresentation: { default: '' },
|
|
21
|
+
SVGStringRepresentation: { default: '' },
|
|
22
|
+
TeXRepresentation: { default: '' },
|
|
22
23
|
dataTracked: { default: null },
|
|
23
24
|
},
|
|
24
25
|
group: 'block',
|
|
@@ -26,25 +27,26 @@ export const equation = {
|
|
|
26
27
|
{
|
|
27
28
|
tag: `div.${ObjectTypes.Equation}`,
|
|
28
29
|
getAttrs: (p) => {
|
|
29
|
-
const
|
|
30
|
+
const dom = p;
|
|
30
31
|
return {
|
|
31
|
-
id:
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
id: dom.getAttribute('id'),
|
|
33
|
+
MathMLStringRepresentation: dom.getAttribute('data-mathml-string-representation'),
|
|
34
|
+
SVGStringRepresentation: dom.innerHTML,
|
|
35
|
+
TeXRepresentation: dom.getAttribute('data-tex-representation'),
|
|
34
36
|
};
|
|
35
37
|
},
|
|
36
38
|
},
|
|
37
39
|
],
|
|
38
40
|
toDOM: (node) => {
|
|
39
41
|
const equationNode = node;
|
|
40
|
-
const { id, contents, format } = equationNode.attrs;
|
|
41
42
|
const dom = document.createElement('div');
|
|
43
|
+
dom.setAttribute('id', equationNode.attrs.id);
|
|
42
44
|
dom.classList.add(ObjectTypes.Equation);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
dom.setAttribute('data-equation-format', format);
|
|
45
|
+
if (equationNode.attrs.MathMLStringRepresentation) {
|
|
46
|
+
dom.setAttribute('data-mathml-string-representation', equationNode.attrs.MathMLStringRepresentation);
|
|
46
47
|
}
|
|
47
|
-
dom.
|
|
48
|
+
dom.setAttribute('data-tex-representation', equationNode.attrs.TeXRepresentation);
|
|
49
|
+
dom.innerHTML = equationNode.attrs.SVGStringRepresentation;
|
|
48
50
|
return dom;
|
|
49
51
|
},
|
|
50
52
|
};
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const equationElement = {
|
|
17
|
-
content: '(equation | placeholder)',
|
|
17
|
+
content: '(equation | placeholder) figcaption',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
|
-
|
|
20
|
+
suppressCaption: { default: true },
|
|
21
|
+
suppressTitle: { default: undefined },
|
|
21
22
|
dataTracked: { default: null },
|
|
22
23
|
comments: { default: null },
|
|
23
24
|
},
|
|
@@ -25,7 +26,7 @@ export const equationElement = {
|
|
|
25
26
|
group: 'block element',
|
|
26
27
|
parseDOM: [
|
|
27
28
|
{
|
|
28
|
-
tag: '
|
|
29
|
+
tag: 'figure.equation',
|
|
29
30
|
getAttrs: (p) => {
|
|
30
31
|
const dom = p;
|
|
31
32
|
return {
|
|
@@ -37,7 +38,7 @@ export const equationElement = {
|
|
|
37
38
|
toDOM: (node) => {
|
|
38
39
|
const equationElementNode = node;
|
|
39
40
|
return [
|
|
40
|
-
'
|
|
41
|
+
'figure',
|
|
41
42
|
{
|
|
42
43
|
class: 'equation',
|
|
43
44
|
id: equationElementNode.attrs.id,
|
|
@@ -13,39 +13,43 @@
|
|
|
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';
|
|
16
17
|
export const inlineEquation = {
|
|
17
18
|
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
MathMLRepresentation: { default: '' },
|
|
21
|
+
SVGRepresentation: { default: '' },
|
|
22
|
+
TeXRepresentation: { default: '' },
|
|
18
23
|
dataTracked: { default: null },
|
|
19
|
-
comments: { default: null },
|
|
20
|
-
contents: { default: '' },
|
|
21
|
-
format: { default: '' },
|
|
22
24
|
},
|
|
23
|
-
selectable: false,
|
|
24
25
|
atom: true,
|
|
25
26
|
inline: true,
|
|
26
27
|
draggable: true,
|
|
27
28
|
group: 'inline',
|
|
28
29
|
parseDOM: [
|
|
29
30
|
{
|
|
30
|
-
tag: `span.
|
|
31
|
+
tag: `span.${ObjectTypes.InlineMathFragment}`,
|
|
31
32
|
getAttrs: (p) => {
|
|
32
33
|
const dom = p;
|
|
33
34
|
return {
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
id: dom.getAttribute('id'),
|
|
36
|
+
MathMLRepresentation: dom.getAttribute('data-mathml-representation') || '',
|
|
37
|
+
SVGRepresentation: dom.innerHTML || '',
|
|
38
|
+
TeXRepresentation: dom.getAttribute('data-tex-representation') || '',
|
|
36
39
|
};
|
|
37
40
|
},
|
|
38
41
|
},
|
|
39
42
|
],
|
|
40
43
|
toDOM: (node) => {
|
|
41
44
|
const inlineEquationNode = node;
|
|
42
|
-
const { contents, format } = inlineEquationNode.attrs;
|
|
43
45
|
const dom = document.createElement('span');
|
|
44
|
-
dom.classList.add(
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
dom.classList.add(ObjectTypes.InlineMathFragment);
|
|
47
|
+
dom.setAttribute('id', inlineEquationNode.attrs.id);
|
|
48
|
+
dom.setAttribute('data-tex-representation', inlineEquationNode.attrs.TeXRepresentation);
|
|
49
|
+
if (inlineEquationNode.attrs.MathMLRepresentation) {
|
|
50
|
+
dom.setAttribute('data-mathml-representation', inlineEquationNode.attrs.MathMLRepresentation);
|
|
47
51
|
}
|
|
48
|
-
dom.innerHTML =
|
|
52
|
+
dom.innerHTML = inlineEquationNode.attrs.SVGRepresentation;
|
|
49
53
|
return dom;
|
|
50
54
|
},
|
|
51
55
|
};
|
|
@@ -95,6 +95,12 @@ 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
|
+
});
|
|
98
104
|
export const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
|
|
99
105
|
_id: generateID(ObjectTypes.Footnote),
|
|
100
106
|
objectType: ObjectTypes.Footnote,
|
|
@@ -262,8 +262,9 @@ export class Decoder {
|
|
|
262
262
|
const model = data;
|
|
263
263
|
return schema.nodes.equation.createChecked({
|
|
264
264
|
id: model._id,
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
MathMLStringRepresentation: model.MathMLStringRepresentation,
|
|
266
|
+
SVGStringRepresentation: model.SVGStringRepresentation,
|
|
267
|
+
TeXRepresentation: model.TeXRepresentation,
|
|
267
268
|
});
|
|
268
269
|
},
|
|
269
270
|
[ObjectTypes.EquationElement]: (data) => {
|
|
@@ -282,10 +283,12 @@ export class Decoder {
|
|
|
282
283
|
else {
|
|
283
284
|
throw new MissingElement(model.containedObjectID);
|
|
284
285
|
}
|
|
286
|
+
const figcaption = this.getFigcaption(model);
|
|
285
287
|
return schema.nodes.equation_element.createChecked({
|
|
286
288
|
id: model._id,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
+
suppressCaption: Boolean(model.suppressCaption),
|
|
290
|
+
suppressTitle: Boolean(model.suppressTitle === undefined ? true : model.suppressTitle),
|
|
291
|
+
}, [equation, figcaption]);
|
|
289
292
|
},
|
|
290
293
|
[ObjectTypes.FootnotesElement]: (data) => {
|
|
291
294
|
const foonotesElementModel = data;
|
|
@@ -54,6 +54,12 @@ 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
|
+
};
|
|
57
63
|
const tableRowDisplayStyle = (tagName, parent) => {
|
|
58
64
|
switch (tagName) {
|
|
59
65
|
case 'thead':
|
|
@@ -339,12 +345,20 @@ const encoders = {
|
|
|
339
345
|
: false,
|
|
340
346
|
}),
|
|
341
347
|
equation: (node) => ({
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
MathMLStringRepresentation: node.attrs.MathMLStringRepresentation || undefined,
|
|
349
|
+
TeXRepresentation: node.attrs.TeXRepresentation,
|
|
350
|
+
SVGStringRepresentation: node.attrs.SVGStringRepresentation,
|
|
344
351
|
}),
|
|
345
352
|
equation_element: (node) => ({
|
|
346
353
|
containedObjectID: attributeOfNodeType(node, 'equation', 'id'),
|
|
347
|
-
|
|
354
|
+
caption: inlineContentOfChildNodeType(node, node.type.schema.nodes.figcaption, node.type.schema.nodes.caption),
|
|
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,
|
|
348
362
|
}),
|
|
349
363
|
figure: (node) => ({
|
|
350
364
|
contentType: node.attrs.contentType || undefined,
|
|
@@ -391,6 +405,12 @@ const encoders = {
|
|
|
391
405
|
.map((childNode) => childNode.attrs.id)
|
|
392
406
|
.filter((id) => id),
|
|
393
407
|
}),
|
|
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
|
+
}),
|
|
394
414
|
keyword: (node, parent) => ({
|
|
395
415
|
containedGroup: parent.attrs.id,
|
|
396
416
|
name: keywordContents(node),
|
|
@@ -551,7 +571,8 @@ export const encode = (node) => {
|
|
|
551
571
|
if (placeholderTypes.includes(child.type)) {
|
|
552
572
|
return;
|
|
553
573
|
}
|
|
554
|
-
if (parent.type === schema.nodes.paragraph
|
|
574
|
+
if (parent.type === schema.nodes.paragraph &&
|
|
575
|
+
child.type !== schema.nodes.inline_equation) {
|
|
555
576
|
return;
|
|
556
577
|
}
|
|
557
578
|
const { model, markers } = modelFromNode(child, parent, path, priority);
|
|
@@ -36,6 +36,7 @@ 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],
|
|
39
40
|
[schema.nodes.keyword, ObjectTypes.Keyword],
|
|
40
41
|
[schema.nodes.keywords_element, ObjectTypes.KeywordsElement],
|
|
41
42
|
[schema.nodes.keywords, ObjectTypes.Section],
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Model } from '@manuscripts/json-schema';
|
|
17
|
+
import { CitationProvider } from '@manuscripts/library';
|
|
17
18
|
import { DOMSerializer } from 'prosemirror-model';
|
|
18
|
-
import { ManuscriptFragment, ManuscriptNode } from '../schema';
|
|
19
|
+
import { CitationNode, ManuscriptFragment, ManuscriptNode } from '../schema';
|
|
19
20
|
import { Target } from '../transformer/labels';
|
|
20
21
|
import { IDGenerator, MediaPathGenerator } from '../types';
|
|
21
22
|
import { Version } from './jats-versions';
|
|
@@ -27,7 +28,12 @@ interface Links {
|
|
|
27
28
|
export declare const createCounter: () => {
|
|
28
29
|
increment: (field: string) => number;
|
|
29
30
|
};
|
|
31
|
+
export type CSLOptions = {
|
|
32
|
+
style: string;
|
|
33
|
+
locale: string;
|
|
34
|
+
};
|
|
30
35
|
export interface JATSExporterOptions {
|
|
36
|
+
csl: CSLOptions;
|
|
31
37
|
version?: Version;
|
|
32
38
|
doi?: string;
|
|
33
39
|
id?: string;
|
|
@@ -37,13 +43,34 @@ export interface JATSExporterOptions {
|
|
|
37
43
|
idGenerator?: IDGenerator;
|
|
38
44
|
mediaPathGenerator?: MediaPathGenerator;
|
|
39
45
|
}
|
|
46
|
+
export declare const buildCitations: (citations: CitationNode[]) => {
|
|
47
|
+
citationID: string;
|
|
48
|
+
citationItems: {
|
|
49
|
+
id: string;
|
|
50
|
+
}[];
|
|
51
|
+
properties: {
|
|
52
|
+
noteIndex: number;
|
|
53
|
+
};
|
|
54
|
+
}[];
|
|
40
55
|
export declare class JATSExporter {
|
|
41
56
|
protected document: Document;
|
|
42
57
|
protected modelMap: Map<string, Model>;
|
|
43
58
|
protected models: Model[];
|
|
44
59
|
protected serializer: DOMSerializer;
|
|
45
60
|
protected labelTargets?: Map<string, Target>;
|
|
46
|
-
|
|
61
|
+
protected citationTexts: Map<string, string>;
|
|
62
|
+
protected citationProvider: CitationProvider;
|
|
63
|
+
protected generateCitations(fragment: ManuscriptFragment): {
|
|
64
|
+
citationID: string;
|
|
65
|
+
citationItems: {
|
|
66
|
+
id: string;
|
|
67
|
+
}[];
|
|
68
|
+
properties: {
|
|
69
|
+
noteIndex: number;
|
|
70
|
+
};
|
|
71
|
+
}[];
|
|
72
|
+
protected generateCitationTexts(fragment: ManuscriptFragment, csl: CSLOptions): void;
|
|
73
|
+
serializeToJATS: (fragment: ManuscriptFragment, modelMap: Map<string, Model>, manuscriptID: string, options: JATSExporterOptions) => Promise<string>;
|
|
47
74
|
private nodeFromJATS;
|
|
48
75
|
protected rewriteCrossReferenceTypes: () => void;
|
|
49
76
|
protected rewriteMediaPaths: (mediaPathGenerator: MediaPathGenerator) => Promise<void>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const convertMathMLToSVG: (mathml: string, display: boolean) => Promise<string | null>;
|
|
2
|
+
export declare const convertTeXToMathML: (tex: string, display: boolean) => Promise<string | null>;
|
|
3
|
+
export declare const convertTeXToSVG: (tex: string, display: boolean) => Promise<string | null>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const packages: string[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import 'mathjax-full/js/util/entities/all';
|
|
17
|
+
export declare const convertMathMLToSVG: (mathml: string, display: boolean) => string | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import 'mathjax-full/js/util/entities/all';
|
|
17
|
+
export declare const convertTeXToMathML: (tex: string, display: boolean) => string | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import 'mathjax-full/js/util/entities/all';
|
|
17
|
+
export declare const convertTeXToSVG: (tex: string, display: boolean) => string | null;
|
|
@@ -40,6 +40,7 @@ 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';
|
|
43
44
|
export * from './nodes/inline_footnote';
|
|
44
45
|
export * from './nodes/keyword';
|
|
45
46
|
export * from './nodes/keywords_element';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ©
|
|
2
|
+
* © 2019 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,8 +17,9 @@ import { NodeSpec } from 'prosemirror-model';
|
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
18
|
interface Attrs {
|
|
19
19
|
id: string;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
MathMLStringRepresentation: string;
|
|
21
|
+
SVGStringRepresentation: string;
|
|
22
|
+
TeXRepresentation: string;
|
|
22
23
|
}
|
|
23
24
|
export interface EquationNode extends ManuscriptNode {
|
|
24
25
|
attrs: Attrs;
|
|
@@ -18,7 +18,8 @@ import { ManuscriptNode } from '../types';
|
|
|
18
18
|
import { CommentNode } from './comment';
|
|
19
19
|
interface Attrs {
|
|
20
20
|
id: string;
|
|
21
|
-
|
|
21
|
+
suppressCaption: boolean;
|
|
22
|
+
suppressTitle?: boolean;
|
|
22
23
|
comments?: CommentNode[];
|
|
23
24
|
}
|
|
24
25
|
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';
|
|
19
18
|
interface Attrs {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
id: string;
|
|
20
|
+
MathMLRepresentation: string;
|
|
21
|
+
SVGRepresentation: string;
|
|
22
|
+
TeXRepresentation: string;
|
|
23
23
|
}
|
|
24
24
|
export interface InlineEquationNode extends ManuscriptNode {
|
|
25
25
|
attrs: Attrs;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Affiliation, Attribution, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
|
|
16
|
+
import { Affiliation, Attribution, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, InlineMathFragment, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
|
|
17
17
|
import { FootnotesOrderIndexList } from './footnotes-order';
|
|
18
18
|
import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
|
|
19
19
|
export type Build<T> = Pick<T, Exclude<keyof T, keyof ManuscriptModel>> & {
|
|
@@ -44,6 +44,7 @@ export declare const buildAffiliation: (institution: string, priority?: number)
|
|
|
44
44
|
export declare const buildSupplementaryMaterial: (title: string, href: string) => Build<Supplement>;
|
|
45
45
|
export declare const buildComment: (target: string, contents?: string, selector?: CommentSelector, contributions?: Contribution[], annotationColor?: string) => Build<CommentAnnotation>;
|
|
46
46
|
export declare const buildNote: (target: string, source: 'EMAIL' | 'EDITOR' | 'DASHBOARD', contents?: string) => Build<ManuscriptNote>;
|
|
47
|
+
export declare const buildInlineMathFragment: (containingObject: string, TeXRepresentation: string) => Build<InlineMathFragment>;
|
|
47
48
|
export declare const buildFootnote: (containingObject: string, contents: string, kind?: 'footnote' | 'endnote') => Build<Footnote>;
|
|
48
49
|
export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList) => Build<FootnotesOrder>;
|
|
49
50
|
export declare const buildCorresp: (contents: string) => Build<Corresponding>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,9 +29,11 @@
|
|
|
29
29
|
"version": "yarn build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@manuscripts/json-schema": "2.2.
|
|
32
|
+
"@manuscripts/json-schema": "^2.2.2",
|
|
33
|
+
"@manuscripts/library": "^1.3.1",
|
|
33
34
|
"debug": "^4.3.4",
|
|
34
35
|
"jszip": "^3.10.1",
|
|
36
|
+
"mathjax-full": "^3.2.2",
|
|
35
37
|
"mime": "^3.0.0",
|
|
36
38
|
"prosemirror-model": "^1.18.3",
|
|
37
39
|
"uuid": "^9.0.0",
|