@manuscripts/transform 2.0.3-LEAN-3074-0 → 2.0.4-LEAN-3092
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/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 -7
- package/dist/cjs/transformer/encode.js +4 -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/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 -7
- package/dist/es/transformer/encode.js +4 -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/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 +4 -5
- 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
|
@@ -1,59 +0,0 @@
|
|
|
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.convertTeXToSVG = void 0;
|
|
19
|
-
require("mathjax-full/js/util/entities/all");
|
|
20
|
-
const HTMLAdaptor_1 = require("mathjax-full/js/adaptors/HTMLAdaptor");
|
|
21
|
-
const HTMLDocument_1 = require("mathjax-full/js/handlers/html/HTMLDocument");
|
|
22
|
-
const tex_1 = require("mathjax-full/js/input/tex");
|
|
23
|
-
const svg_1 = require("mathjax-full/js/output/svg");
|
|
24
|
-
const transformer_1 = require("../transformer");
|
|
25
|
-
const mathjax_packages_1 = require("./mathjax-packages");
|
|
26
|
-
class ManuscriptsHTMLAdaptor extends HTMLAdaptor_1.HTMLAdaptor {
|
|
27
|
-
setAttribute(node, name, value, ns) {
|
|
28
|
-
if (name !== 'xmlns') {
|
|
29
|
-
ns ? node.setAttributeNS(ns, name, value) : node.setAttribute(name, value);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const InputJax = new tex_1.TeX({
|
|
34
|
-
packages: mathjax_packages_1.packages,
|
|
35
|
-
});
|
|
36
|
-
const OutputJax = new svg_1.SVG({
|
|
37
|
-
fontCache: 'none',
|
|
38
|
-
});
|
|
39
|
-
const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
40
|
-
const doc = new HTMLDocument_1.HTMLDocument(document, adaptor, {
|
|
41
|
-
InputJax,
|
|
42
|
-
OutputJax,
|
|
43
|
-
});
|
|
44
|
-
doc.addStyleSheet();
|
|
45
|
-
const convertTeXToSVG = (tex, display) => {
|
|
46
|
-
const item = doc.convert(tex, {
|
|
47
|
-
display,
|
|
48
|
-
em: 16,
|
|
49
|
-
ex: 8,
|
|
50
|
-
containerWidth: 1000000,
|
|
51
|
-
lineWidth: 1000000,
|
|
52
|
-
scale: 1,
|
|
53
|
-
});
|
|
54
|
-
if (!item || !item.firstChild) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return transformer_1.xmlSerializer.serializeToString(item.firstChild);
|
|
58
|
-
};
|
|
59
|
-
exports.convertTeXToSVG = convertTeXToSVG;
|
package/dist/es/mathjax/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const convertMathMLToSVG = async (mathml, display) => {
|
|
2
|
-
const { convertMathMLToSVG } = await import('./mathml-to-svg');
|
|
3
|
-
return convertMathMLToSVG(mathml, display);
|
|
4
|
-
};
|
|
5
|
-
export const convertTeXToMathML = async (tex, display) => {
|
|
6
|
-
const { convertTeXToMathML } = await import('./tex-to-mathml');
|
|
7
|
-
return convertTeXToMathML(tex, display);
|
|
8
|
-
};
|
|
9
|
-
export const convertTeXToSVG = async (tex, display) => {
|
|
10
|
-
const { convertTeXToSVG } = await import('./tex-to-svg');
|
|
11
|
-
return convertTeXToSVG(tex, display);
|
|
12
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
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 { AllPackages } from 'mathjax-full/js/input/tex/AllPackages';
|
|
17
|
-
export const packages = AllPackages.filter((name) => name !== 'html' && name !== 'bussproofs');
|
|
@@ -1,66 +0,0 @@
|
|
|
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 { MmlFactory } from 'mathjax-full/js/core/MmlTree/MmlFactory';
|
|
19
|
-
import { HTMLDocument } from 'mathjax-full/js/handlers/html/HTMLDocument';
|
|
20
|
-
import { MathML } from 'mathjax-full/js/input/mathml';
|
|
21
|
-
import { SVG } from 'mathjax-full/js/output/svg';
|
|
22
|
-
import { xmlSerializer } from '../transformer';
|
|
23
|
-
class ManuscriptsMmlFactory extends MmlFactory {
|
|
24
|
-
constructor() {
|
|
25
|
-
super();
|
|
26
|
-
this.nodeMap.set('image', this.nodeMap.get('none'));
|
|
27
|
-
}
|
|
28
|
-
create(kind, properties = {}, children = []) {
|
|
29
|
-
if (kind === 'image') {
|
|
30
|
-
return this.node['none'](properties, children);
|
|
31
|
-
}
|
|
32
|
-
return this.node[kind](properties, children);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
class ManuscriptsHTMLAdaptor extends HTMLAdaptor {
|
|
36
|
-
setAttribute(node, name, value, ns) {
|
|
37
|
-
if (name !== 'xmlns') {
|
|
38
|
-
ns ? node.setAttributeNS(ns, name, value) : node.setAttribute(name, value);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const InputJax = new MathML();
|
|
43
|
-
const OutputJax = new SVG({
|
|
44
|
-
fontCache: 'none',
|
|
45
|
-
});
|
|
46
|
-
const adaptor = new ManuscriptsHTMLAdaptor(window);
|
|
47
|
-
const doc = new HTMLDocument(document, adaptor, {
|
|
48
|
-
InputJax,
|
|
49
|
-
OutputJax,
|
|
50
|
-
MmlFactory: new ManuscriptsMmlFactory(),
|
|
51
|
-
});
|
|
52
|
-
doc.addStyleSheet();
|
|
53
|
-
export const convertMathMLToSVG = (mathml, display) => {
|
|
54
|
-
const item = doc.convert(mathml, {
|
|
55
|
-
display,
|
|
56
|
-
em: 16,
|
|
57
|
-
ex: 8,
|
|
58
|
-
containerWidth: 1000000,
|
|
59
|
-
lineWidth: 1000000,
|
|
60
|
-
scale: 1,
|
|
61
|
-
});
|
|
62
|
-
if (!item || !item.firstChild) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
return xmlSerializer.serializeToString(item.firstChild);
|
|
66
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
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 { STATE } from 'mathjax-full/js/core/MathItem.js';
|
|
19
|
-
import { SerializedMmlVisitor } from 'mathjax-full/js/core/MmlTree/SerializedMmlVisitor';
|
|
20
|
-
import { HTMLDocument } from 'mathjax-full/js/handlers/html/HTMLDocument';
|
|
21
|
-
import { TeX } from 'mathjax-full/js/input/tex';
|
|
22
|
-
import { packages } from './mathjax-packages';
|
|
23
|
-
const InputJax = new TeX({
|
|
24
|
-
packages,
|
|
25
|
-
});
|
|
26
|
-
const adaptor = new HTMLAdaptor(window);
|
|
27
|
-
const doc = new HTMLDocument(document, adaptor, {
|
|
28
|
-
InputJax,
|
|
29
|
-
});
|
|
30
|
-
const visitor = new SerializedMmlVisitor();
|
|
31
|
-
export const convertTeXToMathML = (tex, display) => {
|
|
32
|
-
const item = doc.convert(tex, {
|
|
33
|
-
display,
|
|
34
|
-
em: 16,
|
|
35
|
-
ex: 8,
|
|
36
|
-
containerWidth: 1000000,
|
|
37
|
-
lineWidth: 1000000,
|
|
38
|
-
scale: 1,
|
|
39
|
-
end: STATE.CONVERT,
|
|
40
|
-
});
|
|
41
|
-
if (!item) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
return visitor.visitTree(item);
|
|
45
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
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>;
|
|
@@ -1,16 +0,0 @@
|
|
|
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[];
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|