Skip to content

Commit cb33e77

Browse files
committed
Merge branch 'develop' for v0.5.0-rc.1 release
2 parents 92f7754 + 1441c4a commit cb33e77

File tree

17 files changed

+1301
-120
lines changed

17 files changed

+1301
-120
lines changed

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
language: node_js
22
node_js:
3-
- '4.1'
3+
- '4'
4+
- '5'
5+
- stable
46
sudo: false
57
script:
68
- npm install
79
- npm test
10+
deploy:
11+
provider: npm
12+
13+
api_key:
14+
secure: Fd/yFRRrLDjleB7QnV/Juncg7dJP193IYOWZaJJFohSfPC3TylhJjUb2bD2fcBUbzM9bLPvhz+XJbWS2YXRGzCWABtyjpZTjO9oEkYBmEuNdVnD9b1j+BCWEEyXfBGF0/WBePRtn8XWQLTPbEJXP9Z2HKOUJJlq4cjTLZ7MHZLw=
15+
on:
16+
tags: true

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ directory for more details.
2525

2626
# Getting started
2727

28-
mathjax-node provides two libraries, `lib/mj-single.js` and `lib/mj-page.js`. Below are two very minimal examples -- be sure to check out the examples in `./bin/` for more advanced configurations.
28+
mathjax-node provides two libraries, `./lib/mj-single.js` and `./lib/mj-page.js`. Below are two very minimal examples -- be sure to check out the examples in `./bin/` for more advanced configurations.
2929

30-
* `lib/mj-single.js` is optimized for processing single equations.
30+
* `./lib/mj-single.js` is optimized for processing single equations.
3131

3232

3333
```javascript
3434
// a simple TeX-input example
35-
var mjAPI = require("./lib/mj-single.js");
35+
var mjAPI = require("mathjax-node/lib/mj-single.js");
3636
mjAPI.config({
3737
MathJax: {
3838
// traditional MathJax configuration
@@ -52,11 +52,11 @@ mjAPI.typeset({
5252
```
5353

5454

55-
* `lib/mj-page.js` is optimized for handling full HTML pages.
55+
* `./lib/mj-page.js` is optimized for handling full HTML pages.
5656

5757

5858
```javascript
59-
var mjAPI = require("./lib/mj-page.js");
59+
var mjAPI = require("mathjax-node/lib/mj-page.js");
6060
var jsdom = require("jsdom").jsdom;
6161

6262
var document = jsdom("<!DOCTYPE html><html lang='en'><head><title>Test</title></head><body><h1>Let's test mj-page</h1> <p> \\[f: X \\to Y\\], where \\( X = 2^{\mathbb{N}}\\) </p></body></html>");

bin/am2html

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#! /usr/bin/env node
2+
3+
/*************************************************************************
4+
*
5+
* am2html
6+
*
7+
* Uses MathJax to convert an AsciiMath string to an HTML string.
8+
*
9+
* ----------------------------------------------------------------------
10+
*
11+
* Copyright (c) 2016 The MathJax Consortium
12+
*
13+
* Licensed under the Apache License, Version 2.0 (the "License");
14+
* you may not use this file except in compliance with the License.
15+
* You may obtain a copy of the License at
16+
*
17+
* http://www.apache.org/licenses/LICENSE-2.0
18+
*
19+
* Unless required by applicable law or agreed to in writing, software
20+
* distributed under the License is distributed on an "AS IS" BASIS,
21+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+
* See the License for the specific language governing permissions and
23+
* limitations under the License.
24+
*/
25+
26+
var mjAPI = require("../lib/mj-single.js");
27+
28+
var argv = require("yargs")
29+
.demand(1).strict()
30+
.usage("Usage: am2html [options] 'math' > file.html",{
31+
speech: {
32+
boolean: true,
33+
describe: "include speech text"
34+
},
35+
speechrules: {
36+
default: "mathspeak",
37+
describe: "ruleset to use for speech text (chromevox or mathspeak)"
38+
},
39+
speechstyle: {
40+
default: "default",
41+
describe: "style to use for speech text (default, brief, sbrief)"
42+
},
43+
linebreaks: {
44+
boolean: true,
45+
describe: "perform automatic line-breaking"
46+
},
47+
ex: {
48+
default: 6,
49+
describe: "ex-size in pixels"
50+
},
51+
width: {
52+
default: 100,
53+
describe: "width of container in ex"
54+
},
55+
extensions: {
56+
default: "",
57+
describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'"
58+
},
59+
css: {
60+
boolean: true,
61+
describe: "output the required CSS rather than the HTML itself"
62+
},
63+
fontURL: {
64+
default: "https://cdn.mathjax.org/mathjax/latest/fonts/HTML-CSS",
65+
describe: "the URL to use for web fonts"
66+
}
67+
})
68+
.argv;
69+
70+
mjAPI.config({extensions: argv.extensions, fontURL: argv.fontURL});
71+
mjAPI.start();
72+
73+
mjAPI.typeset({
74+
math: argv._[0],
75+
format: "AsciiMath",
76+
html:true, css: argv.css,
77+
speakText: argv.speech,
78+
speakRuleset: argv.speechrules.replace(/^chromevox$/i,"default"),
79+
speakStyle: argv.speechstyle,
80+
ex: argv.ex, width: argv.width,
81+
linebreaks: argv.linebreaks
82+
}, function (data) {
83+
if (!data.errors) {console.log(argv.css ? data.css : data.html)}
84+
});

bin/am2htmlcss

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#! /usr/bin/env node
2+
3+
/*************************************************************************
4+
*
5+
* am2htmlcss
6+
*
7+
* Uses MathJax to convert an AsciiMath string to an HTML page.
8+
*
9+
* ----------------------------------------------------------------------
10+
*
11+
* Copyright (c) 2016 The MathJax Consortium
12+
*
13+
* Licensed under the Apache License, Version 2.0 (the "License");
14+
* you may not use this file except in compliance with the License.
15+
* You may obtain a copy of the License at
16+
*
17+
* http://www.apache.org/licenses/LICENSE-2.0
18+
*
19+
* Unless required by applicable law or agreed to in writing, software
20+
* distributed under the License is distributed on an "AS IS" BASIS,
21+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+
* See the License for the specific language governing permissions and
23+
* limitations under the License.
24+
*/
25+
26+
var mjAPI = require("../lib/mj-single.js");
27+
28+
var argv = require("yargs")
29+
.demand(1).strict()
30+
.usage("Usage: am2htmlcss [options] 'math' > file.html",{
31+
speech: {
32+
boolean: true,
33+
describe: "include speech text"
34+
},
35+
speechrules: {
36+
default: "mathspeak",
37+
describe: "ruleset to use for speech text (chromevox or mathspeak)"
38+
},
39+
speechstyle: {
40+
default: "default",
41+
describe: "style to use for speech text (default, brief, sbrief)"
42+
},
43+
linebreaks: {
44+
boolean: true,
45+
describe: "perform automatic line-breaking"
46+
},
47+
ex: {
48+
default: 6,
49+
describe: "ex-size in pixels"
50+
},
51+
width: {
52+
default: 100,
53+
describe: "width of container in ex"
54+
},
55+
extensions: {
56+
default: "",
57+
describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'"
58+
},
59+
fontURL: {
60+
default: "https://cdn.mathjax.org/mathjax/latest/fonts/HTML-CSS",
61+
describe: "the URL to use for web fonts"
62+
}
63+
})
64+
.argv;
65+
66+
mjAPI.config({extensions: argv.extensions, fontURL: argv.fontURL});
67+
mjAPI.start();
68+
69+
mjAPI.typeset({
70+
math: argv._[0],
71+
format: "AsciiMath",
72+
html:true, css: true,
73+
speakText: argv.speech,
74+
speakRuleset: argv.speechrules.replace(/^chromevox$/i,"default"),
75+
speakStyle: argv.speechstyle,
76+
ex: argv.ex, width: argv.width,
77+
linebreaks: argv.linebreaks
78+
}, function (data) {
79+
if (!data.errors) {
80+
console.log("<!DOCTYPE html>\n<html>\n<head>");
81+
console.log('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />');
82+
console.log("<title></title>\n<style>");
83+
console.log(data.css);
84+
console.log("</style>\n</head>\n<body>");
85+
console.log(data.html);
86+
console.log("</body>\n</html>");
87+
}
88+
});

bin/mml2html

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#! /usr/bin/env node
2+
3+
/*************************************************************************
4+
*
5+
* mml2html
6+
*
7+
* Uses MathJax to convert a MathML string to an HTML string.
8+
*
9+
* ----------------------------------------------------------------------
10+
*
11+
* Copyright (c) 2016 The MathJax Consortium
12+
*
13+
* Licensed under the Apache License, Version 2.0 (the "License");
14+
* you may not use this file except in compliance with the License.
15+
* You may obtain a copy of the License at
16+
*
17+
* http://www.apache.org/licenses/LICENSE-2.0
18+
*
19+
* Unless required by applicable law or agreed to in writing, software
20+
* distributed under the License is distributed on an "AS IS" BASIS,
21+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+
* See the License for the specific language governing permissions and
23+
* limitations under the License.
24+
*/
25+
26+
var mjAPI = require("../lib/mj-single.js");
27+
28+
var argv = require("yargs")
29+
.demand(1).strict()
30+
.usage("Usage: mml2html [options] 'math' > file.html",{
31+
speech: {
32+
boolean: true,
33+
describe: "include speech text"
34+
},
35+
speechrules: {
36+
default: "mathspeak",
37+
describe: "ruleset to use for speech text (chromevox or mathspeak)"
38+
},
39+
speechstyle: {
40+
default: "default",
41+
describe: "style to use for speech text (default, brief, sbrief)"
42+
},
43+
linebreaks: {
44+
boolean: true,
45+
describe: "perform automatic line-breaking"
46+
},
47+
ex: {
48+
default: 6,
49+
describe: "ex-size in pixels"
50+
},
51+
width: {
52+
default: 100,
53+
describe: "width of container in ex"
54+
},
55+
extensions: {
56+
default: "",
57+
describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'"
58+
},
59+
css: {
60+
boolean: true,
61+
describe: "output the required CSS rather than the HTML itself"
62+
},
63+
fontURL: {
64+
default: "https://cdn.mathjax.org/mathjax/latest/fonts/HTML-CSS",
65+
describe: "the URL to use for web fonts"
66+
}
67+
})
68+
.argv;
69+
70+
mjAPI.config({extensions: argv.extensions});
71+
mjAPI.start();
72+
73+
mjAPI.typeset({
74+
math: argv._[0],
75+
format: "MathML",
76+
html:true, css: argv.css,
77+
speakText: argv.speech,
78+
speakRuleset: argv.speechrules.replace(/^chromevox$/i,"default"),
79+
speakStyle: argv.speechstyle,
80+
ex: argv.ex, width: argv.width,
81+
linebreaks: argv.linebreaks
82+
}, function (data) {
83+
if (!data.errors) {console.log(argv.css ? data.css : data.html)}
84+
});

bin/mml2htmlcss

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#! /usr/bin/env node
2+
3+
/*************************************************************************
4+
*
5+
* mml2htmlcss
6+
*
7+
* Uses MathJax to convert a MathML string to an HTML page.
8+
*
9+
* ----------------------------------------------------------------------
10+
*
11+
* Copyright (c) 2016 The MathJax Consortium
12+
*
13+
* Licensed under the Apache License, Version 2.0 (the "License");
14+
* you may not use this file except in compliance with the License.
15+
* You may obtain a copy of the License at
16+
*
17+
* http://www.apache.org/licenses/LICENSE-2.0
18+
*
19+
* Unless required by applicable law or agreed to in writing, software
20+
* distributed under the License is distributed on an "AS IS" BASIS,
21+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+
* See the License for the specific language governing permissions and
23+
* limitations under the License.
24+
*/
25+
26+
var mjAPI = require("../lib/mj-single.js");
27+
28+
var argv = require("yargs")
29+
.demand(1).strict()
30+
.usage("Usage: mml2htmlcss [options] 'math' > file.html",{
31+
speech: {
32+
boolean: true,
33+
describe: "include speech text"
34+
},
35+
speechrules: {
36+
default: "mathspeak",
37+
describe: "ruleset to use for speech text (chromevox or mathspeak)"
38+
},
39+
speechstyle: {
40+
default: "default",
41+
describe: "style to use for speech text (default, brief, sbrief)"
42+
},
43+
linebreaks: {
44+
boolean: true,
45+
describe: "perform automatic line-breaking"
46+
},
47+
ex: {
48+
default: 6,
49+
describe: "ex-size in pixels"
50+
},
51+
width: {
52+
default: 100,
53+
describe: "width of container in ex"
54+
},
55+
extensions: {
56+
default: "",
57+
describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'"
58+
},
59+
fontURL: {
60+
default: "https://cdn.mathjax.org/mathjax/latest/fonts/HTML-CSS",
61+
describe: "the URL to use for web fonts"
62+
}
63+
})
64+
.argv;
65+
66+
mjAPI.config({extensions: argv.extensions});
67+
mjAPI.start();
68+
69+
mjAPI.typeset({
70+
math: argv._[0],
71+
format: "MathML",
72+
html:true, css: true,
73+
speakText: argv.speech,
74+
speakRuleset: argv.speechrules.replace(/^chromevox$/i,"default"),
75+
speakStyle: argv.speechstyle,
76+
ex: argv.ex, width: argv.width,
77+
linebreaks: argv.linebreaks
78+
}, function (data) {
79+
if (!data.errors) {
80+
console.log("<!DOCTYPE html>\n<html>\n<head>");
81+
console.log('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />');
82+
console.log("<title></title>\n<style>");
83+
console.log(data.css);
84+
console.log("</style>\n</head>\n<body>");
85+
console.log(data.html);
86+
console.log("</body>\n</html>");
87+
}
88+
});

0 commit comments

Comments
 (0)