├── README.md ├── test └── tex2mml.js ├── .gitignore ├── .travis.yml ├── package.json ├── bin ├── mml2mml ├── am2mml ├── tex2mml ├── mml2svg ├── am2svg ├── tex2svg ├── mml2html ├── am2html ├── tex2html ├── mml2htmlcss ├── am2htmlcss ├── tex2htmlcss └── mml2svg-html5 └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # mathjax-node-cli 2 | [![Build Status](https://travis-ci.org/mathjax/mathjax-node-cli.svg?branch=master)](https://travis-ci.org/mathjax/mathjax-node-cli) 3 | 4 | CLI tools for mathjax-node. -------------------------------------------------------------------------------- /test/tex2mml.js: -------------------------------------------------------------------------------- 1 | var tape = require('tape'); 2 | var exec = require('child_process').exec 3 | tape('A basic test', function(t) { 4 | t.plan(1); 5 | var expected = `\n x\n\n` 6 | var child = exec('node ./bin/tex2mml "x"', 7 | function (error, stdout, stderr) { 8 | console.log(stdout); 9 | t.equal(stdout, expected, 'Virtual Console not activated'); 10 | }); 11 | 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - stable 4 | sudo: false 5 | script: 6 | - npm install 7 | - npm test 8 | deploy: 9 | provider: npm 10 | email: manager@mathjax.org 11 | on: 12 | tags: true 13 | repo: mathjax/mathjax-node-cli 14 | api_key: 15 | secure: eSOoR+JW6zwi5iPz3SCiNGEzv5EXimZ0sl+doJ1iCX5TT9VcKlBuj2HhWHoqgEJriRr6XHyvy+k0ftqW0HdoBi1BaMQIuSxx65aOrVBM4YLIYJ5ShO6h0Qu9zpGlekliDmxfal3pQweE02Pl+6I5utm9txQCQ9591e0B5Yu4ZxLslMTr9FmC34RLk9TNI6v8gUAzOuP477e1DcBqnSwIsJ9hUe1tTxOWdBPHJQX+1sgoN+SicW3s8Nc01NO3HZQse+qQfcYsxlCJrxjQzMLGro2FljmuMdD7qGI+2+NnCHyqbd8ujBDEu4Kn/h6NRofIjM0YyYcWkVskIci+CI7kyWQkfSaOunFC5IH9/jeF9Uzoi1Iy6p5KAduSlyf1+ICHL8MRk+VWf02Y2wyOVrTeldq0oZ8Utc3mxxZ9BQCWgRHYjQ5YV1vRLUQcft/vtR0BJPVd4TjgUayvpeBWTz4yUza84H9/OEfIMnIEFOt1aAt4bGDisDU6D5JfvZMfTqtSeu75zmf2es7Aeg23jfMt1Fq9+NbpC9+Yl3Vuy6FmDnv/VA9AF/OZhgmQnFsiD/Kh0AIXfK7z3XTiRYW0JljIt+ysjWY+6zV7Srmeb/DyFSfel7LsG+aqJW/j16EfG88PKM2P5hnlkxxK6TICxUkANaLOOiEduxyizzJZxffOdPM= 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mathjax-node-cli", 3 | "version": "1.0.1", 4 | "description": "CLI tools for calling mathjax-node", 5 | "keywords": [ 6 | "mathjax-node", 7 | "cli", 8 | "MathJax", 9 | "math", 10 | "svg", 11 | "HTML", 12 | "MathML", 13 | "TeX", 14 | "AsciiMath" 15 | ], 16 | "maintainers": [ 17 | "MathJax Consortium (http://www.mathjax.org)" 18 | ], 19 | "bugs": { 20 | "url": "http://github.com/mathjax/mathjax-node-cli/issues" 21 | }, 22 | "license": "Apache-2.0", 23 | "repository": { 24 | "type": "git", 25 | "url": "git://github.com/mathjax/mathjax-node-cli.git" 26 | }, 27 | "dependencies": { 28 | "mathjax-node-sre": "*", 29 | "yargs": ">=11.*" 30 | }, 31 | "scripts": { 32 | "test": "tape test/*.js" 33 | }, 34 | "bin": { 35 | "am2html": "./bin/am2html", 36 | "am2mml": "./bin/am2mml", 37 | "mml2html": "./bin/mml2html", 38 | "mml2mml": "./bin/mml2mml", 39 | "mml2svg-html5": "./bin/mml2svg-html5", 40 | "tex2htmlcss": "./bin/tex2htmlcss", 41 | "tex2svg": "./bin/tex2svg", 42 | "am2htmlcss": "./bin/am2htmlcss", 43 | "am2svg": "./bin/am2svg", 44 | "mml2htmlcss": "./bin/mml2htmlcss", 45 | "mml2svg": "./bin/mml2svg", 46 | "tex2html": "./bin/tex2html", 47 | "tex2mml": "./bin/tex2mml" 48 | }, 49 | "devDependencies": { 50 | "tape": "^4.0.3" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /bin/mml2mml: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * mml2mml 6 | * 7 | * Uses MathJax to convert a MathML string to a normalized MathML 8 | * string (can include speech text). 9 | * 10 | * ---------------------------------------------------------------------- 11 | * 12 | * Copyright (c) 2014 The MathJax Consortium 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the "License"); 15 | * you may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * http://www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | */ 26 | 27 | var mjAPI = require("mathjax-node-sre"); 28 | 29 | var argv = require("yargs") 30 | .demand(1).strict() 31 | .usage("$0 [options] 'math' > file.mml") 32 | .options({ 33 | speech: { 34 | boolean: true, 35 | default: true, 36 | describe: "include speech text" 37 | }, 38 | extensions: { 39 | default: "", 40 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 41 | } 42 | }) 43 | .argv; 44 | 45 | mjAPI.config({extensions: argv.extensions}); 46 | mjAPI.start(); 47 | 48 | mjAPI.typeset({ 49 | math: argv._[0], 50 | format: "MathML", mml:true, 51 | speakText: argv.speech 52 | }, function (data) { 53 | if (!data.errors) {console.log(data.mml)} 54 | }); 55 | -------------------------------------------------------------------------------- /bin/am2mml: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * am2mml 6 | * 7 | * Uses MathJax to convert an AsciiMath string to a MathML string. 8 | * 9 | * ---------------------------------------------------------------------- 10 | * 11 | * Copyright (c) 2014 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.mml") 31 | .options({ 32 | speech: { 33 | boolean: true, 34 | default: true, 35 | describe: "include speech text" 36 | }, 37 | semantics: { 38 | boolean: true, 39 | describe: "add AsciiMath code in tag" 40 | }, 41 | extensions: { 42 | default: "", 43 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 44 | } 45 | }) 46 | .argv; 47 | 48 | mjAPI.config({ 49 | MathJax: { 50 | menuSettings: { 51 | semantics: argv.semantics 52 | } 53 | }, 54 | extensions: argv.extensions 55 | }); 56 | mjAPI.start(); 57 | 58 | mjAPI.typeset({ 59 | math: argv._[0], 60 | format: "AsciiMath", mml:true, 61 | speakText: argv.speech 62 | }, function (data) { 63 | if (!data.errors) {console.log(data.mml)} 64 | }); 65 | -------------------------------------------------------------------------------- /bin/tex2mml: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * tex2mml 6 | * 7 | * Uses MathJax to convert a TeX or LaTeX string to a MathML string. 8 | * 9 | * ---------------------------------------------------------------------- 10 | * 11 | * Copyright (c) 2014 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.mml") 31 | .options({ 32 | inline: { 33 | boolean: true, 34 | describe: "process as in-line TeX" 35 | }, 36 | speech: { 37 | boolean: true, 38 | default: true, 39 | describe: "include speech text" 40 | }, 41 | semantics: { 42 | boolean: true, 43 | describe: "add TeX code in tag" 44 | }, 45 | notexhints: { 46 | boolean: true, 47 | describe: "don't add TeX-specific classes" 48 | }, 49 | extensions: { 50 | default: "", 51 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 52 | } 53 | }) 54 | .argv; 55 | 56 | mjAPI.config({ 57 | MathJax: { 58 | menuSettings: { 59 | semantics: argv.semantics, 60 | texHints: !argv.notexhints 61 | } 62 | }, 63 | extensions: argv.extensions 64 | }); 65 | mjAPI.start(); 66 | 67 | mjAPI.typeset({ 68 | math: argv._[0], 69 | format: (argv.inline ? "inline-TeX" : "TeX"), 70 | mml:true, 71 | speakText: argv.speech 72 | }, function (data) { 73 | if (!data.errors) {console.log(data.mml)} 74 | }); 75 | -------------------------------------------------------------------------------- /bin/mml2svg: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * mml2svg 6 | * 7 | * Uses MathJax to convert a MathML string to an SVG file. 8 | * 9 | * ---------------------------------------------------------------------- 10 | * 11 | * Copyright (c) 2014 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.svg") 31 | .options({ 32 | linebreaks: { 33 | boolean: true, 34 | describe: "perform automatic line-breaking" 35 | }, 36 | speech: { 37 | boolean: true, 38 | default: true, 39 | describe: "include speech text" 40 | }, 41 | font: { 42 | default: "TeX", 43 | describe: "web font to use" 44 | }, 45 | ex: { 46 | default: 6, 47 | describe: "ex-size in pixels" 48 | }, 49 | width: { 50 | default: 100, 51 | describe: "width of container in ex" 52 | }, 53 | extensions: { 54 | default: "", 55 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 56 | } 57 | }) 58 | .argv; 59 | 60 | if (argv.font === "STIX") argv.font = "STIX-Web"; 61 | mjAPI.config({MathJax: {SVG: {font: argv.font}}, extensions: argv.extensions}); 62 | mjAPI.start(); 63 | 64 | mjAPI.typeset({ 65 | math: argv._[0], 66 | format: "MathML", 67 | svg:true, 68 | speakText: argv.speech, 69 | ex: argv.ex, width: argv.width, 70 | linebreaks: argv.linebreaks 71 | }, function (data) { 72 | if (!data.errors) {console.log(data.svg)} 73 | }); 74 | -------------------------------------------------------------------------------- /bin/am2svg: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * am2svg 6 | * 7 | * Uses MathJax to convert an AsciiMath string to an SVG image 8 | * 9 | * ---------------------------------------------------------------------- 10 | * 11 | * Copyright (c) 2014 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.svg") 31 | .options({ 32 | linebreaks: { 33 | boolean: true, 34 | default: true, 35 | describe: "perform automatic line-breaking" 36 | }, 37 | speech: { 38 | boolean: true, 39 | describe: "include speech text" 40 | }, 41 | font: { 42 | default: "TeX", 43 | describe: "web font to use" 44 | }, 45 | ex: { 46 | default: 6, 47 | describe: "ex-size in pixels" 48 | }, 49 | width: { 50 | default: 100, 51 | describe: "width of container in ex" 52 | }, 53 | extensions: { 54 | default: "", 55 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 56 | } 57 | }) 58 | .argv; 59 | 60 | if (argv.font === "STIX") argv.font = "STIX-Web"; 61 | mjAPI.config({MathJax: {SVG: {font: argv.font}}, extensions: argv.extensions}); 62 | mjAPI.start(); 63 | 64 | mjAPI.typeset({ 65 | math: argv._[0], 66 | format: "AsciiMath", 67 | svg:true, 68 | speakText: argv.speech, 69 | ex: argv.ex, width: argv.width, 70 | linebreaks: argv.linebreaks 71 | }, function (data) { 72 | if (!data.errors) {console.log(data.svg)} 73 | }); 74 | -------------------------------------------------------------------------------- /bin/tex2svg: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * tex2svg 6 | * 7 | * Uses MathJax to convert a TeX or LaTeX string to an SVG file. 8 | * 9 | * ---------------------------------------------------------------------- 10 | * 11 | * Copyright (c) 2014 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.svg") 31 | .options({ 32 | inline: { 33 | boolean: true, 34 | describe: "process as in-line TeX" 35 | }, 36 | speech: { 37 | boolean: true, 38 | default: true, 39 | describe: "include speech text" 40 | }, 41 | linebreaks: { 42 | boolean: true, 43 | describe: "perform automatic line-breaking" 44 | }, 45 | font: { 46 | default: "TeX", 47 | describe: "web font to use" 48 | }, 49 | ex: { 50 | default: 6, 51 | describe: "ex-size in pixels" 52 | }, 53 | width: { 54 | default: 100, 55 | describe: "width of container in ex" 56 | }, 57 | extensions: { 58 | default: "", 59 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 60 | } 61 | }) 62 | .argv; 63 | 64 | if (argv.font === "STIX") argv.font = "STIX-Web"; 65 | mjAPI.config({MathJax: {SVG: {font: argv.font}}, extensions: argv.extensions}); 66 | mjAPI.start(); 67 | 68 | mjAPI.typeset({ 69 | math: argv._[0], 70 | format: (argv.inline ? "inline-TeX" : "TeX"), 71 | svg:true, 72 | speakText: argv.speech, 73 | ex: argv.ex, width: argv.width, 74 | linebreaks: argv.linebreaks 75 | }, function (data) { 76 | if (!data.errors) {console.log(data.svg)} 77 | }); 78 | -------------------------------------------------------------------------------- /bin/mml2html: -------------------------------------------------------------------------------- 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.html") 31 | .options({ 32 | speech: { 33 | boolean: true, 34 | default: true, 35 | describe: "include speech text" 36 | }, 37 | linebreaks: { 38 | boolean: true, 39 | describe: "perform automatic line-breaking" 40 | }, 41 | ex: { 42 | default: 6, 43 | describe: "ex-size in pixels" 44 | }, 45 | width: { 46 | default: 100, 47 | describe: "width of container in ex" 48 | }, 49 | extensions: { 50 | default: "", 51 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 52 | }, 53 | css: { 54 | boolean: true, 55 | describe: "output the required CSS rather than the HTML itself" 56 | }, 57 | fontURL: { 58 | default: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/fonts/HTML-CSS", 59 | describe: "the URL to use for web fonts" 60 | } 61 | }) 62 | .argv; 63 | 64 | mjAPI.config({extensions: argv.extensions}); 65 | mjAPI.start(); 66 | 67 | mjAPI.typeset({ 68 | math: argv._[0], 69 | format: "MathML", 70 | html:true, css: argv.css, 71 | speakText: argv.speech, 72 | ex: argv.ex, width: argv.width, 73 | linebreaks: argv.linebreaks 74 | }, function (data) { 75 | if (!data.errors) {console.log(argv.css ? data.css : data.html)} 76 | }); 77 | -------------------------------------------------------------------------------- /bin/am2html: -------------------------------------------------------------------------------- 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.html") 31 | .options({ 32 | speech: { 33 | boolean: true, 34 | default: true, 35 | describe: "include speech text" 36 | }, 37 | linebreaks: { 38 | boolean: true, 39 | describe: "perform automatic line-breaking" 40 | }, 41 | ex: { 42 | default: 6, 43 | describe: "ex-size in pixels" 44 | }, 45 | width: { 46 | default: 100, 47 | describe: "width of container in ex" 48 | }, 49 | extensions: { 50 | default: "", 51 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 52 | }, 53 | css: { 54 | boolean: true, 55 | describe: "output the required CSS rather than the HTML itself" 56 | }, 57 | fontURL: { 58 | default: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/fonts/HTML-CSS", 59 | describe: "the URL to use for web fonts" 60 | } 61 | }) 62 | .argv; 63 | 64 | mjAPI.config({extensions: argv.extensions, fontURL: argv.fontURL}); 65 | mjAPI.start(); 66 | 67 | mjAPI.typeset({ 68 | math: argv._[0], 69 | format: "AsciiMath", 70 | html:true, css: argv.css, 71 | speakText: argv.speech, 72 | ex: argv.ex, width: argv.width, 73 | linebreaks: argv.linebreaks 74 | }, function (data) { 75 | if (!data.errors) {console.log(argv.css ? data.css : data.html)} 76 | }); 77 | -------------------------------------------------------------------------------- /bin/tex2html: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * tex2html 6 | * 7 | * Uses MathJax to convert a TeX or LaTeX 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.html") 31 | .options({ 32 | inline: { 33 | boolean: true, 34 | describe: "process as in-line TeX" 35 | }, 36 | speech: { 37 | boolean: true, 38 | default: true, 39 | describe: "include speech text" 40 | }, 41 | linebreaks: { 42 | boolean: true, 43 | describe: "perform automatic line-breaking" 44 | }, 45 | ex: { 46 | default: 6, 47 | describe: "ex-size in pixels" 48 | }, 49 | width: { 50 | default: 100, 51 | describe: "width of container in ex" 52 | }, 53 | extensions: { 54 | default: "", 55 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 56 | }, 57 | css: { 58 | boolean: true, 59 | describe: "output the required CSS rather than the HTML itself" 60 | }, 61 | fontURL: { 62 | default: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/fonts/HTML-CSS", 63 | describe: "the URL to use for web fonts" 64 | } 65 | }) 66 | .argv; 67 | 68 | mjAPI.config({extensions: argv.extensions, fontURL: argv.fontURL}); 69 | mjAPI.start(); 70 | 71 | mjAPI.typeset({ 72 | math: argv._[0], 73 | format: (argv.inline ? "inline-TeX" : "TeX"), 74 | html:true, css: argv.css, 75 | speakText: argv.speech, 76 | ex: argv.ex, width: argv.width, 77 | linebreaks: argv.linebreaks 78 | }, function (data) { 79 | if (!data.errors) {console.log(argv.css ? data.css : data.html)} 80 | }); 81 | -------------------------------------------------------------------------------- /bin/mml2htmlcss: -------------------------------------------------------------------------------- 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.html") 31 | .options({ 32 | speech: { 33 | boolean: true, 34 | default: true, 35 | describe: "include speech text" 36 | }, 37 | linebreaks: { 38 | boolean: true, 39 | describe: "perform automatic line-breaking" 40 | }, 41 | ex: { 42 | default: 6, 43 | describe: "ex-size in pixels" 44 | }, 45 | width: { 46 | default: 100, 47 | describe: "width of container in ex" 48 | }, 49 | extensions: { 50 | default: "", 51 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 52 | }, 53 | fontURL: { 54 | default: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/fonts/HTML-CSS", 55 | describe: "the URL to use for web fonts" 56 | } 57 | }) 58 | .argv; 59 | 60 | mjAPI.config({extensions: argv.extensions}); 61 | mjAPI.start(); 62 | 63 | mjAPI.typeset({ 64 | math: argv._[0], 65 | format: "MathML", 66 | html:true, css: true, 67 | speakText: argv.speech, 68 | ex: argv.ex, width: argv.width, 69 | linebreaks: argv.linebreaks 70 | }, function (data) { 71 | if (!data.errors) { 72 | console.log("\n\n"); 73 | console.log(''); 74 | console.log("\n\n\n"); 77 | console.log(data.html); 78 | console.log("\n"); 79 | } 80 | }); 81 | -------------------------------------------------------------------------------- /bin/am2htmlcss: -------------------------------------------------------------------------------- 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.html") 31 | .options({ 32 | speech: { 33 | boolean: true, 34 | default: true, 35 | describe: "include speech text" 36 | }, 37 | linebreaks: { 38 | boolean: true, 39 | describe: "perform automatic line-breaking" 40 | }, 41 | ex: { 42 | default: 6, 43 | describe: "ex-size in pixels" 44 | }, 45 | width: { 46 | default: 100, 47 | describe: "width of container in ex" 48 | }, 49 | extensions: { 50 | default: "", 51 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 52 | }, 53 | fontURL: { 54 | default: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/fonts/HTML-CSS", 55 | describe: "the URL to use for web fonts" 56 | } 57 | }) 58 | .argv; 59 | 60 | mjAPI.config({extensions: argv.extensions, fontURL: argv.fontURL}); 61 | mjAPI.start(); 62 | 63 | mjAPI.typeset({ 64 | math: argv._[0], 65 | format: "AsciiMath", 66 | html:true, css: true, 67 | speakText: argv.speech, 68 | ex: argv.ex, width: argv.width, 69 | linebreaks: argv.linebreaks 70 | }, function (data) { 71 | if (!data.errors) { 72 | console.log("\n\n"); 73 | console.log(''); 74 | console.log("\n\n\n"); 77 | console.log(data.html); 78 | console.log("\n"); 79 | } 80 | }); 81 | -------------------------------------------------------------------------------- /bin/tex2htmlcss: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * tex2htmlcss 6 | * 7 | * Uses MathJax to convert a TeX or LaTeX 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("mathjax-node-sre"); 27 | 28 | var argv = require("yargs") 29 | .demand(1).strict() 30 | .usage("$0 [options] 'math' > file.html") 31 | .options({ 32 | inline: { 33 | boolean: true, 34 | describe: "process as in-line TeX" 35 | }, 36 | speech: { 37 | boolean: true, 38 | default: true, 39 | describe: "include speech text" 40 | }, 41 | linebreaks: { 42 | boolean: true, 43 | describe: "perform automatic line-breaking" 44 | }, 45 | ex: { 46 | default: 6, 47 | describe: "ex-size in pixels" 48 | }, 49 | width: { 50 | default: 100, 51 | describe: "width of container in ex" 52 | }, 53 | extensions: { 54 | default: "", 55 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 56 | }, 57 | fontURL: { 58 | default: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/fonts/HTML-CSS", 59 | describe: "the URL to use for web fonts" 60 | } 61 | }) 62 | .argv; 63 | 64 | mjAPI.config({extensions: argv.extensions, fontURL: argv.fontURL}); 65 | mjAPI.start(); 66 | 67 | mjAPI.typeset({ 68 | math: argv._[0], 69 | format: (argv.inline ? "inline-TeX" : "TeX"), 70 | html:true, css: true, 71 | speakText: argv.speech, 72 | ex: argv.ex, width: argv.width, 73 | linebreaks: argv.linebreaks 74 | }, function (data) { 75 | if (!data.errors) { 76 | console.log("\n\n"); 77 | console.log(''); 78 | console.log("\n\n\n"); 81 | console.log(data.html); 82 | console.log("\n"); 83 | } 84 | }); 85 | -------------------------------------------------------------------------------- /bin/mml2svg-html5: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | /************************************************************************* 4 | * 5 | * mml2svg-html5 6 | * 7 | * Reads an HTML5 file from stdin that contains MathML 8 | * and writes a new HTML5 document to stdout that 9 | * contains SVG versions of the math instead. 10 | * 11 | * ---------------------------------------------------------------------- 12 | * 13 | * Copyright (c) 2014 The MathJax Consortium 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | var mjAPI = require("mathjax-node-sre"); 29 | var fs = require('fs'); 30 | var jsdom = require('jsdom').jsdom; 31 | 32 | var argv = require("yargs") 33 | .strict() 34 | .usage("$0 [options] < input.html > output.html") 35 | .options({ 36 | localcache: { 37 | boolean: true, 38 | description: "don't use the global font cache" 39 | }, 40 | linebreaks: { 41 | boolean: true, 42 | describe: "perform automatic line-breaking" 43 | }, 44 | speech: { 45 | boolean: true, 46 | default: true, 47 | describe: "include speech text" 48 | }, 49 | font: { 50 | default: "TeX", 51 | describe: "web font to use" 52 | }, 53 | ex: { 54 | default: 6, 55 | describe: "ex-size in pixels" 56 | }, 57 | width: { 58 | default: 100, 59 | describe: "width of container in ex" 60 | }, 61 | extensions: { 62 | default: "", 63 | describe: "extra MathJax extensions e.g. 'Safe,TeX/noUndefined'" 64 | } 65 | }) 66 | .argv; 67 | 68 | if (argv.font === "STIX") argv.font = "STIX-Web"; 69 | mjAPI.config({MathJax: {SVG: {font: argv.font}}, extensions: argv.extensions}); 70 | mjAPI.start(); 71 | 72 | // 73 | // Process an HTML file: 74 | // Find all math elements, 75 | // Loop through them, and make typeset calls for each math tag, 76 | // If the MathML processes correctly, 77 | // replace the math tag by the svg result. 78 | // If this is the last one, 79 | // do the callback with the complete page. 80 | // 81 | function processHTML(html,callback) { 82 | var document = jsdom(html,null,{features:{FetchExternalResources: false}}); 83 | var xmlns = getXMLNS(document); 84 | var sheet = document.head.appendChild(document.createElement("style")); 85 | sheet.innerHTML = ".MathJax_SVG_display {text-align:center; margin:1em 0}"; 86 | var math = document.getElementsByTagName("math"); 87 | var mathns = document.getElementsByTagName(xmlns+":math"); 88 | math = [].slice.call(math,0).concat([].slice.call(mathns,0)); // combine the two lists 89 | var state = {}; 90 | for (var i = 0, m = math.length; i < m; i++) { 91 | var data = { 92 | math:math[i].outerHTML, 93 | format:"MathML", 94 | svg:true, useGlobalCache: !argv.localcache, 95 | speakText: argv.speech, 96 | ex: argv.ex, width: argv.width, 97 | linebreaks: argv.linebreaks, 98 | state:state, xmlns:xmlns 99 | }; 100 | mjAPI.typeset(data,(function (node,last) {return function (result) { 101 | if (result.svg) { 102 | var div = document.createElement("div"); 103 | div.innerHTML = result.svg; 104 | if (node.getAttribute("display") === "block" || 105 | node.getAttribute("mode") === "display") { 106 | node.parentNode.replaceChild(div,node); 107 | div.className = "MathJax_SVG_display"; 108 | } else { 109 | node.parentNode.replaceChild(div.firstChild,node); 110 | } 111 | } 112 | if (last) { 113 | if (!argv.localcache) { 114 | var svg = document.createElement("svg"); svg.style.display = "none"; 115 | svg.appendChild(document.importNode(data.state.defs,true)); 116 | document.body.insertBefore(svg,document.body.firstChild); 117 | } 118 | callback(document.documentElement.outerHTML); 119 | } 120 | }})(math[i],i == m-1)); 121 | } 122 | } 123 | 124 | // 125 | // Look up the MathML namespace from the attributes 126 | // 127 | function getXMLNS(document) { 128 | var html = document.head.parentNode; 129 | for (var i = 0, m = html.attributes.length; i < m; i++) { 130 | var attr = html.attributes[i]; 131 | if (attr.nodeName.substr(0,6) === "xmlns:" && 132 | attr.nodeValue === "http://www.w3.org/1998/Math/MathML") 133 | {return attr.nodeName.substr(6)} 134 | } 135 | return "mml"; 136 | } 137 | 138 | // 139 | // Read the input file and collect the file contents 140 | // When done, process the HTML. 141 | // 142 | var html = []; 143 | process.stdin.on("readable",function (block) { 144 | var chunk = process.stdin.read(); 145 | if (chunk) html.push(chunk.toString('utf8')); 146 | }); 147 | process.stdin.on("end",function () { 148 | processHTML(html.join(""), function(html) { 149 | process.stdout.write(html); 150 | }); 151 | }); 152 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------