From 07cd282febe3a4e95f6cc5d2e6d7c8a9d2a0b292 Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Mon, 29 Sep 2014 22:42:20 +0200 Subject: [PATCH 01/14] first commit --- Gruntfile.js | 331 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 11 ++ 2 files changed, 342 insertions(+) create mode 100644 Gruntfile.js create mode 100644 package.json diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 000000000..72aa64386 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,331 @@ +module.exports = function(grunt) { + +// # Notes # +// NEVER remove: +// +// * LICENSE -- the Apache license. +// * jax/element/mml -- this implements MathJax's internal format. Keep either the packed or unpacked copy. +// + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + clean: { +// +// ## Early choices +// `unpacked` for development +// ``packed` for production + unpacked: [ + "unpacked" + ], + packed: [ + "config", + "docs", + "extensions", + "jax", + "localization" + ], +// If you don't need combined configuration files or want to build your own: + allConfigs: [ + "config", + "unpacked/config" + ], +// +// ## Choosing a font +// See http://docs.mathjax.org/en/latest/font-support.html#font-configuration for background information +// +// 1. Remove font files and font data for fonts you won't use. +// **IMPORTANT.** Make sure to prevent fallbacks and local fonts in your configuration! +// +// + fontAsana: [ + "fonts/HTML-CSS/Asana-Math", + "jax/output/HTML-CSS/fonts/Asana-Math", + "unpacked/jax/output/HTML-CSS/fonts/Asana-Math", + "jax/output/SVG/fonts/Asana-Math", + "unpacked/jax/output/SVG/fonts/Asana-Math" + ], + fontGyrePagella: [ + "fonts/HTML-CSS/Gyre-Pagella", + "jax/output/HTML-CSS/fonts/Gyre-Pagella", + "unpacked/jax/output/HTML-CSS/fonts/Gyre-Pagella", + "jax/output/SVG/fonts/Gyre-Pagella", + "unpacked/jax/output/SVG/fonts/Gyre-Pagella" + ], + fontGyreTermes: [ + "fonts/HTML-CSS/Gyre-Termes", + "jax/output/HTML-CSS/fonts/Gyre-Termes", + "unpacked/jax/output/HTML-CSS/fonts/Gyre-Termes", + "jax/output/SVG/fonts/Gyre-Termes", + "unpacked/jax/output/SVG/fonts/Gyre-Termes" + ], + fontLatinModern: [ + "fonts/HTML-CSS/Latin-Modern", + "jax/output/HTML-CSS/fonts/Latin-Modern", + "unpacked/jax/output/HTML-CSS/fonts/Latin-Modern", + "jax/output/SVG/fonts/Latin-Modern", + "unpacked/jax/output/SVG/fonts/Latin-Modern" + ], + fontNeoEuler: [ + "fonts/HTML-CSS/Neo-Euler", + "jax/output/HTML-CSS/fonts/Neo-Euler", + "unpacked/jax/output/HTML-CSS/fonts/Neo-Euler", + "jax/output/SVG/fonts/Neo-Euler", + "unpacked/jax/output/SVG/fonts/Neo-Euler" + ], + fontStix: [ + "fonts/HTML-CSS/STIX", + "jax/output/HTML-CSS/fonts/STIX", + "unpacked/jax/output/HTML-CSS/fonts/STIX", + "jax/output/SVG/fonts/STIX", + "unpacked/jax/output/SVG/fonts/STIX" + ], + fontStixWeb: [ + "fonts/HTML-CSS/STIX-Web", + "jax/output/HTML-CSS/fonts/STIX-Web", + "unpacked/jax/output/HTML-CSS/fonts/STIX-Web", + "jax/output/SVG/fonts/STIX-Web", + "unpacked/jax/output/SVG/fonts/STIX-Web" + ], + fontTeX: [ + "fonts/HTML-CSS/TeX", + "jax/output/HTML-CSS/fonts/TeX", + "unpacked/jax/output/HTML-CSS/fonts/TeX", + "jax/output/SVG/fonts/TeX", + "unpacked/jax/output/SVG/fonts/TeX" + ], +// +// Remove font formats +// If you know you only need a specific format of your remaining fonts (e.g., woff), then you can delete the others. + dropFonts: [ // if you usie SVG output, you can drop all font formats (SVG output uses the data in `jax/output/SVG/fonts/...`) + "fonts", + ], + eot: [ + "fonts/**/eot" + ], + otf: [ + "fonts/**/otf" + ], + png: [ + "fonts/**/png" + ], + svg: [ // **NOT** related to the SVG output! + "fonts/**/svg" + ], + woff: [ + "fonts/**/woff" + ], +// ## Choose the input +// Remove input that you don't need. +// **Note.** This includes combined configuration files. + asciimathInput: [ + "config/AM*", + "config/TeX-MML-AM*", + "jax/input/AsciiMath", + "unpacked/config/AM*", + "unpacked/config/TeX-MML-AM*", + "unpacked/jax/input/AsciiMath" + ], + mathmlInput: [ + "config/MML*", + "config/TeX-MML*", + "config/TeX-AMS-MML*", + "jax/input/TeX", + "unpacked/config/TeX*", + "unpacked/jax/input/TeX" + ], + texInput: [ + "config/TeX*", + "jax/input/TeX", + "unpacked/config/TeX*", + "unpacked/jax/input/TeX", + ], +// ## Extensions + extensionsAsciimath: [ + "extensions/asciimath2jax.js", + "unpacked/extensions/asciimath2jax.js" + ], + extensionsMathml: [ + "extensions/MathML", + "extensions/mml2jax.js", + "unpacked/extensions/MathML", + "unpacked/extensions/mml2jax.js" + ], + extensionsTeX: [ + "extensions/TeX", + "extensions/jsMath2jax.js", + "extensions/tex2jax.js", + "unpacked/extensions/TeX", + "unpacked/extensions/jsMath2jax.js", + "unpacked/extensions/tex2jax.js" + ], + extensionHtmlCss: [ + "extensions/HTML-CSS", + "unpacked/extensions/HTML-CSS" + ], +// ## Choose Output + htmlCssOutput: [ + "config/*HTMLorMML.js", + "config/*HTMLorMML-full.js", + "unpacked/config/*HTMLorMML.js", + "unpacked/config/*HTMLorMML-full.js", + "jax/output/HTML-CSS", + "unpacked/jax/output/HTML-CSS" + ], + mathmlOutput: [ + "config/*HTMLorMML.js", + "config/*HTMLorMML-full.js", + "unpacked/config/*HTMLorMML.js", + "unpacked/config/*HTMLorMML-full.js", + "jax/output/NativeMML", + "unpacked/jax/output/NativeMML" + ], + svgOutput: [ + "config/*SVG.js", + "config/*SVG-full.js", + "unpacked/config/*HTMLorMML.js", + "unpacked/config/*HTMLorMML-full.js", + "jax/output/SVG", + "unpacked/jax/output/SVG" + ], +// ## Locales +// Removes all locale files. Change this as needed to keep your preferred language. +// **NOTE.** English strings are hardcoded. +// **NOTE.** If you fix th locale, drop the menu entry: http://docs.mathjax.org/en/latest/options/MathMenu.html#configure-mathmenu + locales: [ + "localization", + "unpacked/localization" + ], +// ## Misc. + miscConfig: [ + "config/local", + "unpacked/config/local", + "config/Accessible-full.js", + "unpacked/config/Accessible-full.js", + "config/Accessible.js", + "unpacked/config/Accessible.js", + "config/default.js", + "unpacked/config/default.js", + "config/Safe.js", + "unpacked/config/Safe.js" + ], + miscExtensions: [ + "extensions/FontWarnings.js", + "extensions/HelpDialog.js", + "extensions/MatchWebFonts.js", + "extensions/MathEvents.js", + "extensions/MathMenu.js", + "extensions/MathZoom.js", + "extensions/Safe.js", +// "extensions/toMathML.js", // only remove `toMathML.js` if you know exactly what you are doing. + "unpacked/extensions/FontWarnings.js", + "unpacked/extensions/HelpDialog.js", + "unpacked/extensions/MatchWebFonts.js", + "unpacked/extensions/MathEvents.js", + "unpacked/extensions/MathMenu.js", + "unpacked/extensions/MathZoom.js", + "unpacked/extensions/Safe.js", +// "unpacked/extensions/toMathML.js", // only remove `toMathML.js` if you know exactly what you are doing. + ], + images: [ + "images" // these are used in the menu. Removing them will give you 404 errors but nothing will break. + ], + notcode: [ + ".gitignore", + "docs", + "test", + "CONTRIBUTING.md", + "README-branch.txt", + "README.md", + "bower.json", + "composer.json" + ] + } + }); + + grunt.loadNpmTasks('grunt-contrib-clean'); + + grunt.registerTask('template', [ +// **Notes** on the template. When instructions say "Pick one", this means commenting out one item (so that it's not cleaned). +// +// Early choices. + 'clean:unpacked', + 'clean:packed', // pick one -- packed for production, unpacked for development. + 'clean:allConfigs', // if you do not need any combined configuration files. +// Fonts. Pick at least one! Check notes above on configurations. + 'clean:fontAsana', + 'clean:fontGyrePagella', + 'clean:fontGyreTermes', + 'clean:fontLatinModern', + 'clean:fontNeoEuler', + 'clean:fontStix', + 'clean:fontStixWeb', + 'clean:fontTeX', +// Font formats. Pick at least one (unless you use SVG output; then clean all). + 'clean:dropFonts', // when using SVG output + 'clean:eot', + 'clean:otf', + 'clean:png', + 'clean:svg', + 'clean:woff', +// Input. Pick at least one. + 'clean:asciimathInput', + 'clean:mathmlInput', + 'clean:texInput', +// Output + 'clean:htmlCssOutput', + 'clean:mathmlOutput', + 'clean:svgOutput', +// Extensions. You probably want to leave the set matching your choices. + 'clean:extensionsAsciimath', + 'clean:extensionsMathml', + 'clean:extensionsTeX', + 'clean:extensionHtmlCss', +// Other items + 'clean:locales', + 'clean:miscConfig', +// 'clean:miscExtensions', // you probably want that + 'clean:images', + 'clean:notcode' + ]); + grunt.registerTask('MML_SVG_TeX', [ +// Early choices. + 'clean:unpacked', +// 'clean:packed', // pick one -- packed for production, unpacked for development. + 'clean:allConfigs', // if you do not need any combined configuration files. +// Fonts. Pick at least one! Check notes above on configurations. + 'clean:fontAsana', + 'clean:fontGyrePagella', + 'clean:fontGyreTermes', + 'clean:fontLatinModern', + 'clean:fontNeoEuler', + 'clean:fontStix', + 'clean:fontStixWeb', +// 'clean:fontTeX', +// Font formats. Pick at least one (unless you use SVG output; then clean all). + 'clean:dropFonts', // when using SVG output + 'clean:eot', + 'clean:otf', + 'clean:png', + 'clean:svg', + 'clean:woff', +// Input. Pick at least one. + 'clean:asciimathInput', +// 'clean:mathmlInput', + 'clean:texInput', +// Output + 'clean:htmlCssOutput', + 'clean:mathmlOutput', +// 'clean:svgOutput', +// Extensions. You probably want to leave the set matching your choices. + 'clean:extensionsAsciimath', +// 'clean:extensionsMathml', + 'clean:extensionsTeX', + 'clean:extensionHtmlCss', +// Other items + 'clean:locales', + 'clean:miscConfig', +// 'clean:miscExtensions', // you probably want that + 'clean:images', + 'clean:notcode' + ]); +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 000000000..ad8926a46 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "MathJax-concatenater", + "version": "0.1.0", + "author": "MathJax Consortium", + "private": true, + "devDependencies": { + "grunt": "^0.4.5", + "grunt-contrib-clean": "^0.6.0", + "matchdep": "*" + } +} From f805e67bebe3b2b8515433cb9af8b5a71ac89172 Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Mon, 29 Sep 2014 22:49:57 +0200 Subject: [PATCH 02/14] add license and readme --- Gruntfile.js | 26 ++++++++++++++++++++++++++ README.md | 8 ++++++++ 2 files changed, 34 insertions(+) create mode 100644 README.md diff --git a/Gruntfile.js b/Gruntfile.js index 72aa64386..66cd70ba2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,3 +1,29 @@ +/* +MathJax-grunt-cleaner +===================== +A grunt file to reduce the footprint of a MathJax installation + +Latest version at https://github.com/pkra/MathJax-grunt-cleaner + +Copyright (c) 2014 Mathjax Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + module.exports = function(grunt) { // # Notes # diff --git a/README.md b/README.md new file mode 100644 index 000000000..1f1914084 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# MathJax-grunt-cleaner + +A grunt file to reduce the footprint of a MathJax installation + +* copy & rename the `template` task +* comment out the components you want to keep (perhaps **counterintuitive**) + +See the comments in file for more details and caveats. \ No newline at end of file From d41e74cfcd0fff1d50747d0878ea157a13f873b2 Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Mon, 29 Sep 2014 23:00:54 +0200 Subject: [PATCH 03/14] minor fixes for readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1f1914084..c78b84db9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ A grunt file to reduce the footprint of a MathJax installation +* Fetch a copy of MathJax `wget https://github.com/mathjax/MathJax/archive/master.zip && unzip master.zip` * copy & rename the `template` task * comment out the components you want to keep (perhaps **counterintuitive**) From 8291a7cfe47ba87ea50f0f64694c868967aaf623 Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Thu, 16 Oct 2014 21:37:16 +0200 Subject: [PATCH 04/14] added template for mathjax-node --- Gruntfile.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 66cd70ba2..e71ac30d3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -122,7 +122,7 @@ module.exports = function(grunt) { // // Remove font formats // If you know you only need a specific format of your remaining fonts (e.g., woff), then you can delete the others. - dropFonts: [ // if you usie SVG output, you can drop all font formats (SVG output uses the data in `jax/output/SVG/fonts/...`) + dropFonts: [ // if you use SVG output, you can drop all font formats (SVG output uses the data in `jax/output/SVG/fonts/...`) "fonts", ], eot: [ @@ -354,4 +354,14 @@ module.exports = function(grunt) { 'clean:images', 'clean:notcode' ]); -}; \ No newline at end of file +}; + grunt.registerTask('mjNode', [ + 'clean:packed', // pick one -- packed for production, unpacked for development. + 'clean:allConfigs', // if you do not need any combined configuration files. + 'clean:dropFonts', // when using SVG output + 'clean:htmlCssOutput', + 'clean:locales', + 'clean:miscConfig', + 'clean:images', + 'clean:notcode' + ]); From 17c275cc156414d94ee69ab8075960be4ade023c Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Sat, 7 Feb 2015 18:33:10 +0100 Subject: [PATCH 05/14] update for MathJax v2.5 release --- Gruntfile.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index e71ac30d3..77d5d0c3f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -48,7 +48,8 @@ module.exports = function(grunt) { "docs", "extensions", "jax", - "localization" + "localization", + "MathJax.js" ], // If you don't need combined configuration files or want to build your own: allConfigs: [ @@ -213,6 +214,14 @@ module.exports = function(grunt) { "jax/output/SVG", "unpacked/jax/output/SVG" ], + commonHtmlOutput: [ + "configs", + "unpacked/config/", + "jax/output/CommonHTML", + "unpacked/jax/output/CommonHTML", + "extensions/CHTML-preview.js", + "unpacked/extensions/CHTML-preview.js", + ], // ## Locales // Removes all locale files. Change this as needed to keep your preferred language. // **NOTE.** English strings are hardcoded. @@ -242,6 +251,7 @@ module.exports = function(grunt) { "extensions/MathMenu.js", "extensions/MathZoom.js", "extensions/Safe.js", + "extensions/CHTML-preview.js", // "extensions/toMathML.js", // only remove `toMathML.js` if you know exactly what you are doing. "unpacked/extensions/FontWarnings.js", "unpacked/extensions/HelpDialog.js", @@ -250,6 +260,7 @@ module.exports = function(grunt) { "unpacked/extensions/MathMenu.js", "unpacked/extensions/MathZoom.js", "unpacked/extensions/Safe.js", + "unpacked/extensions/CHTML-preview.js", // "unpacked/extensions/toMathML.js", // only remove `toMathML.js` if you know exactly what you are doing. ], images: [ @@ -354,14 +365,15 @@ module.exports = function(grunt) { 'clean:images', 'clean:notcode' ]); -}; grunt.registerTask('mjNode', [ - 'clean:packed', // pick one -- packed for production, unpacked for development. - 'clean:allConfigs', // if you do not need any combined configuration files. - 'clean:dropFonts', // when using SVG output + 'clean:packed', + 'clean:allConfigs', + 'clean:dropFonts', 'clean:htmlCssOutput', 'clean:locales', 'clean:miscConfig', 'clean:images', - 'clean:notcode' + 'clean:notcode', + 'clean:miscExtensions' ]); +}; From 5173fc16bb6fa85de4dec603d3d886c093293115 Mon Sep 17 00:00:00 2001 From: James Bates Date: Fri, 24 Jul 2015 00:05:17 -0500 Subject: [PATCH 06/14] fix mathmlInput removing TeX folders instead of MathML --- Gruntfile.js | 140 +++++++++++++++++++++++++-------------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 77d5d0c3f..4ee5b8dce 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -28,7 +28,7 @@ module.exports = function(grunt) { // # Notes # // NEVER remove: -// +// // * LICENSE -- the Apache license. // * jax/element/mml -- this implements MathJax's internal format. Keep either the packed or unpacked copy. // @@ -56,14 +56,14 @@ module.exports = function(grunt) { "config", "unpacked/config" ], -// +// // ## Choosing a font // See http://docs.mathjax.org/en/latest/font-support.html#font-configuration for background information -// +// // 1. Remove font files and font data for fonts you won't use. -// **IMPORTANT.** Make sure to prevent fallbacks and local fonts in your configuration! -// -// +// **IMPORTANT.** Make sure to prevent fallbacks and local fonts in your configuration! +// +// fontAsana: [ "fonts/HTML-CSS/Asana-Math", "jax/output/HTML-CSS/fonts/Asana-Math", @@ -120,8 +120,8 @@ module.exports = function(grunt) { "jax/output/SVG/fonts/TeX", "unpacked/jax/output/SVG/fonts/TeX" ], -// -// Remove font formats +// +// Remove font formats // If you know you only need a specific format of your remaining fonts (e.g., woff), then you can delete the others. dropFonts: [ // if you use SVG output, you can drop all font formats (SVG output uses the data in `jax/output/SVG/fonts/...`) "fonts", @@ -142,7 +142,7 @@ module.exports = function(grunt) { "fonts/**/woff" ], // ## Choose the input -// Remove input that you don't need. +// Remove input that you don't need. // **Note.** This includes combined configuration files. asciimathInput: [ "config/AM*", @@ -156,9 +156,9 @@ module.exports = function(grunt) { "config/MML*", "config/TeX-MML*", "config/TeX-AMS-MML*", - "jax/input/TeX", - "unpacked/config/TeX*", - "unpacked/jax/input/TeX" + "jax/input/MathML", + "unpacked/config/MathML*", + "unpacked/jax/input/MathML" ], texInput: [ "config/TeX*", @@ -224,7 +224,7 @@ module.exports = function(grunt) { ], // ## Locales // Removes all locale files. Change this as needed to keep your preferred language. -// **NOTE.** English strings are hardcoded. +// **NOTE.** English strings are hardcoded. // **NOTE.** If you fix th locale, drop the menu entry: http://docs.mathjax.org/en/latest/options/MathMenu.html#configure-mathmenu locales: [ "localization", @@ -281,97 +281,97 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.registerTask('template', [ + grunt.registerTask('template', [ // **Notes** on the template. When instructions say "Pick one", this means commenting out one item (so that it's not cleaned). // // Early choices. - 'clean:unpacked', + 'clean:unpacked', 'clean:packed', // pick one -- packed for production, unpacked for development. 'clean:allConfigs', // if you do not need any combined configuration files. // Fonts. Pick at least one! Check notes above on configurations. - 'clean:fontAsana', - 'clean:fontGyrePagella', - 'clean:fontGyreTermes', - 'clean:fontLatinModern', - 'clean:fontNeoEuler', - 'clean:fontStix', - 'clean:fontStixWeb', - 'clean:fontTeX', + 'clean:fontAsana', + 'clean:fontGyrePagella', + 'clean:fontGyreTermes', + 'clean:fontLatinModern', + 'clean:fontNeoEuler', + 'clean:fontStix', + 'clean:fontStixWeb', + 'clean:fontTeX', // Font formats. Pick at least one (unless you use SVG output; then clean all). 'clean:dropFonts', // when using SVG output - 'clean:eot', - 'clean:otf', - 'clean:png', - 'clean:svg', + 'clean:eot', + 'clean:otf', + 'clean:png', + 'clean:svg', 'clean:woff', // Input. Pick at least one. - 'clean:asciimathInput', - 'clean:mathmlInput', - 'clean:texInput', + 'clean:asciimathInput', + 'clean:mathmlInput', + 'clean:texInput', // Output - 'clean:htmlCssOutput', - 'clean:mathmlOutput', - 'clean:svgOutput', + 'clean:htmlCssOutput', + 'clean:mathmlOutput', + 'clean:svgOutput', // Extensions. You probably want to leave the set matching your choices. - 'clean:extensionsAsciimath', - 'clean:extensionsMathml', - 'clean:extensionsTeX', - 'clean:extensionHtmlCss', + 'clean:extensionsAsciimath', + 'clean:extensionsMathml', + 'clean:extensionsTeX', + 'clean:extensionHtmlCss', // Other items - 'clean:locales', - 'clean:miscConfig', + 'clean:locales', + 'clean:miscConfig', // 'clean:miscExtensions', // you probably want that 'clean:images', 'clean:notcode' ]); - grunt.registerTask('MML_SVG_TeX', [ + grunt.registerTask('MML_SVG_TeX', [ // Early choices. - 'clean:unpacked', + 'clean:unpacked', // 'clean:packed', // pick one -- packed for production, unpacked for development. 'clean:allConfigs', // if you do not need any combined configuration files. // Fonts. Pick at least one! Check notes above on configurations. - 'clean:fontAsana', - 'clean:fontGyrePagella', - 'clean:fontGyreTermes', - 'clean:fontLatinModern', - 'clean:fontNeoEuler', - 'clean:fontStix', - 'clean:fontStixWeb', -// 'clean:fontTeX', + 'clean:fontAsana', + 'clean:fontGyrePagella', + 'clean:fontGyreTermes', + 'clean:fontLatinModern', + 'clean:fontNeoEuler', + 'clean:fontStix', + 'clean:fontStixWeb', +// 'clean:fontTeX', // Font formats. Pick at least one (unless you use SVG output; then clean all). 'clean:dropFonts', // when using SVG output - 'clean:eot', - 'clean:otf', - 'clean:png', - 'clean:svg', + 'clean:eot', + 'clean:otf', + 'clean:png', + 'clean:svg', 'clean:woff', // Input. Pick at least one. - 'clean:asciimathInput', -// 'clean:mathmlInput', - 'clean:texInput', + 'clean:asciimathInput', +// 'clean:mathmlInput', + 'clean:texInput', // Output - 'clean:htmlCssOutput', - 'clean:mathmlOutput', -// 'clean:svgOutput', + 'clean:htmlCssOutput', + 'clean:mathmlOutput', +// 'clean:svgOutput', // Extensions. You probably want to leave the set matching your choices. - 'clean:extensionsAsciimath', -// 'clean:extensionsMathml', - 'clean:extensionsTeX', - 'clean:extensionHtmlCss', + 'clean:extensionsAsciimath', +// 'clean:extensionsMathml', + 'clean:extensionsTeX', + 'clean:extensionHtmlCss', // Other items - 'clean:locales', - 'clean:miscConfig', + 'clean:locales', + 'clean:miscConfig', // 'clean:miscExtensions', // you probably want that 'clean:images', 'clean:notcode' ]); - grunt.registerTask('mjNode', [ - 'clean:packed', + grunt.registerTask('mjNode', [ + 'clean:packed', 'clean:allConfigs', 'clean:dropFonts', - 'clean:htmlCssOutput', - 'clean:locales', - 'clean:miscConfig', + 'clean:htmlCssOutput', + 'clean:locales', + 'clean:miscConfig', 'clean:images', 'clean:notcode', 'clean:miscExtensions' From 08932e468f09ff9b0453c14f75304af9d497f70d Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Fri, 24 Jul 2015 10:39:25 +0200 Subject: [PATCH 07/14] fix linting errors * add strict mode * fix trailing commas --- Gruntfile.js | 284 +++++++++++++++++++++++++-------------------------- 1 file changed, 142 insertions(+), 142 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4ee5b8dce..e3db2c467 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,21 +25,21 @@ THE SOFTWARE. */ module.exports = function(grunt) { - -// # Notes # -// NEVER remove: -// -// * LICENSE -- the Apache license. -// * jax/element/mml -- this implements MathJax's internal format. Keep either the packed or unpacked copy. -// + "use strict"; + // # Notes # + // NEVER remove: + // + // * LICENSE -- the Apache license. + // * jax/element/mml -- this implements MathJax"s internal format. Keep either the packed or unpacked copy. + // grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), + pkg: grunt.file.readJSON("package.json"), clean: { -// -// ## Early choices -// `unpacked` for development -// ``packed` for production + // + // ## Early choices + // `unpacked` for development + // ``packed` for production unpacked: [ "unpacked" ], @@ -51,19 +51,19 @@ module.exports = function(grunt) { "localization", "MathJax.js" ], -// If you don't need combined configuration files or want to build your own: - allConfigs: [ - "config", - "unpacked/config" - ], -// -// ## Choosing a font -// See http://docs.mathjax.org/en/latest/font-support.html#font-configuration for background information -// -// 1. Remove font files and font data for fonts you won't use. -// **IMPORTANT.** Make sure to prevent fallbacks and local fonts in your configuration! -// -// + // If you don"t need combined configuration files or want to build your own: + allConfigs: [ + "config", + "unpacked/config" + ], + // + // ## Choosing a font + // See http://docs.mathjax.org/en/latest/font-support.html#font-configuration for background information + // + // 1. Remove font files and font data for fonts you won"t use. + // **IMPORTANT.** Make sure to prevent fallbacks and local fonts in your configuration! + // + // fontAsana: [ "fonts/HTML-CSS/Asana-Math", "jax/output/HTML-CSS/fonts/Asana-Math", @@ -120,11 +120,11 @@ module.exports = function(grunt) { "jax/output/SVG/fonts/TeX", "unpacked/jax/output/SVG/fonts/TeX" ], -// -// Remove font formats -// If you know you only need a specific format of your remaining fonts (e.g., woff), then you can delete the others. + // + // Remove font formats + // If you know you only need a specific format of your remaining fonts (e.g., woff), then you can delete the others. dropFonts: [ // if you use SVG output, you can drop all font formats (SVG output uses the data in `jax/output/SVG/fonts/...`) - "fonts", + "fonts" ], eot: [ "fonts/**/eot" @@ -141,9 +141,9 @@ module.exports = function(grunt) { woff: [ "fonts/**/woff" ], -// ## Choose the input -// Remove input that you don't need. -// **Note.** This includes combined configuration files. + // ## Choose the input + // Remove input that you don"t need. + // **Note.** This includes combined configuration files. asciimathInput: [ "config/AM*", "config/TeX-MML-AM*", @@ -164,9 +164,9 @@ module.exports = function(grunt) { "config/TeX*", "jax/input/TeX", "unpacked/config/TeX*", - "unpacked/jax/input/TeX", + "unpacked/jax/input/TeX" ], -// ## Extensions + // ## Extensions extensionsAsciimath: [ "extensions/asciimath2jax.js", "unpacked/extensions/asciimath2jax.js" @@ -189,7 +189,7 @@ module.exports = function(grunt) { "extensions/HTML-CSS", "unpacked/extensions/HTML-CSS" ], -// ## Choose Output + // ## Choose Output htmlCssOutput: [ "config/*HTMLorMML.js", "config/*HTMLorMML-full.js", @@ -220,17 +220,17 @@ module.exports = function(grunt) { "jax/output/CommonHTML", "unpacked/jax/output/CommonHTML", "extensions/CHTML-preview.js", - "unpacked/extensions/CHTML-preview.js", + "unpacked/extensions/CHTML-preview.js" ], -// ## Locales -// Removes all locale files. Change this as needed to keep your preferred language. -// **NOTE.** English strings are hardcoded. -// **NOTE.** If you fix th locale, drop the menu entry: http://docs.mathjax.org/en/latest/options/MathMenu.html#configure-mathmenu + // ## Locales + // Removes all locale files. Change this as needed to keep your preferred language. + // **NOTE.** English strings are hardcoded. + // **NOTE.** If you fix th locale, drop the menu entry: http://docs.mathjax.org/en/latest/options/MathMenu.html#configure-mathmenu locales: [ "localization", "unpacked/localization" ], -// ## Misc. + // ## Misc. miscConfig: [ "config/local", "unpacked/config/local", @@ -242,7 +242,7 @@ module.exports = function(grunt) { "unpacked/config/default.js", "config/Safe.js", "unpacked/config/Safe.js" - ], + ], miscExtensions: [ "extensions/FontWarnings.js", "extensions/HelpDialog.js", @@ -252,7 +252,7 @@ module.exports = function(grunt) { "extensions/MathZoom.js", "extensions/Safe.js", "extensions/CHTML-preview.js", -// "extensions/toMathML.js", // only remove `toMathML.js` if you know exactly what you are doing. + // "extensions/toMathML.js", // only remove `toMathML.js` if you know exactly what you are doing. "unpacked/extensions/FontWarnings.js", "unpacked/extensions/HelpDialog.js", "unpacked/extensions/MatchWebFonts.js", @@ -260,9 +260,9 @@ module.exports = function(grunt) { "unpacked/extensions/MathMenu.js", "unpacked/extensions/MathZoom.js", "unpacked/extensions/Safe.js", - "unpacked/extensions/CHTML-preview.js", -// "unpacked/extensions/toMathML.js", // only remove `toMathML.js` if you know exactly what you are doing. - ], + "unpacked/extensions/CHTML-preview.js" + // "unpacked/extensions/toMathML.js", // only remove `toMathML.js` if you know exactly what you are doing. + ], images: [ "images" // these are used in the menu. Removing them will give you 404 errors but nothing will break. ], @@ -279,101 +279,101 @@ module.exports = function(grunt) { } }); - grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks("grunt-contrib-clean"); - grunt.registerTask('template', [ -// **Notes** on the template. When instructions say "Pick one", this means commenting out one item (so that it's not cleaned). -// -// Early choices. - 'clean:unpacked', - 'clean:packed', // pick one -- packed for production, unpacked for development. - 'clean:allConfigs', // if you do not need any combined configuration files. -// Fonts. Pick at least one! Check notes above on configurations. - 'clean:fontAsana', - 'clean:fontGyrePagella', - 'clean:fontGyreTermes', - 'clean:fontLatinModern', - 'clean:fontNeoEuler', - 'clean:fontStix', - 'clean:fontStixWeb', - 'clean:fontTeX', -// Font formats. Pick at least one (unless you use SVG output; then clean all). - 'clean:dropFonts', // when using SVG output - 'clean:eot', - 'clean:otf', - 'clean:png', - 'clean:svg', - 'clean:woff', -// Input. Pick at least one. - 'clean:asciimathInput', - 'clean:mathmlInput', - 'clean:texInput', -// Output - 'clean:htmlCssOutput', - 'clean:mathmlOutput', - 'clean:svgOutput', -// Extensions. You probably want to leave the set matching your choices. - 'clean:extensionsAsciimath', - 'clean:extensionsMathml', - 'clean:extensionsTeX', - 'clean:extensionHtmlCss', -// Other items - 'clean:locales', - 'clean:miscConfig', -// 'clean:miscExtensions', // you probably want that - 'clean:images', - 'clean:notcode' - ]); - grunt.registerTask('MML_SVG_TeX', [ -// Early choices. - 'clean:unpacked', -// 'clean:packed', // pick one -- packed for production, unpacked for development. - 'clean:allConfigs', // if you do not need any combined configuration files. -// Fonts. Pick at least one! Check notes above on configurations. - 'clean:fontAsana', - 'clean:fontGyrePagella', - 'clean:fontGyreTermes', - 'clean:fontLatinModern', - 'clean:fontNeoEuler', - 'clean:fontStix', - 'clean:fontStixWeb', -// 'clean:fontTeX', -// Font formats. Pick at least one (unless you use SVG output; then clean all). - 'clean:dropFonts', // when using SVG output - 'clean:eot', - 'clean:otf', - 'clean:png', - 'clean:svg', - 'clean:woff', -// Input. Pick at least one. - 'clean:asciimathInput', -// 'clean:mathmlInput', - 'clean:texInput', -// Output - 'clean:htmlCssOutput', - 'clean:mathmlOutput', -// 'clean:svgOutput', -// Extensions. You probably want to leave the set matching your choices. - 'clean:extensionsAsciimath', -// 'clean:extensionsMathml', - 'clean:extensionsTeX', - 'clean:extensionHtmlCss', -// Other items - 'clean:locales', - 'clean:miscConfig', -// 'clean:miscExtensions', // you probably want that - 'clean:images', - 'clean:notcode' - ]); - grunt.registerTask('mjNode', [ - 'clean:packed', - 'clean:allConfigs', - 'clean:dropFonts', - 'clean:htmlCssOutput', - 'clean:locales', - 'clean:miscConfig', - 'clean:images', - 'clean:notcode', - 'clean:miscExtensions' - ]); + grunt.registerTask("template", [ + // **Notes** on the template. When instructions say "Pick one", this means commenting out one item (so that it"s not cleaned). + // + // Early choices. + "clean:unpacked", + "clean:packed", // pick one -- packed for production, unpacked for development. + "clean:allConfigs", // if you do not need any combined configuration files. + // Fonts. Pick at least one! Check notes above on configurations. + "clean:fontAsana", + "clean:fontGyrePagella", + "clean:fontGyreTermes", + "clean:fontLatinModern", + "clean:fontNeoEuler", + "clean:fontStix", + "clean:fontStixWeb", + "clean:fontTeX", + // Font formats. Pick at least one (unless you use SVG output; then clean all). + "clean:dropFonts", // when using SVG output + "clean:eot", + "clean:otf", + "clean:png", + "clean:svg", + "clean:woff", + // Input. Pick at least one. + "clean:asciimathInput", + "clean:mathmlInput", + "clean:texInput", + // Output + "clean:htmlCssOutput", + "clean:mathmlOutput", + "clean:svgOutput", + // Extensions. You probably want to leave the set matching your choices. + "clean:extensionsAsciimath", + "clean:extensionsMathml", + "clean:extensionsTeX", + "clean:extensionHtmlCss", + // Other items + "clean:locales", + "clean:miscConfig", + // "clean:miscExtensions", // you probably want that + "clean:images", + "clean:notcode" + ]); + grunt.registerTask("MML_SVG_TeX", [ + // Early choices. + "clean:unpacked", + // "clean:packed", // pick one -- packed for production, unpacked for development. + "clean:allConfigs", // if you do not need any combined configuration files. + // Fonts. Pick at least one! Check notes above on configurations. + "clean:fontAsana", + "clean:fontGyrePagella", + "clean:fontGyreTermes", + "clean:fontLatinModern", + "clean:fontNeoEuler", + "clean:fontStix", + "clean:fontStixWeb", + // "clean:fontTeX", + // Font formats. Pick at least one (unless you use SVG output; then clean all). + "clean:dropFonts", // when using SVG output + "clean:eot", + "clean:otf", + "clean:png", + "clean:svg", + "clean:woff", + // Input. Pick at least one. + "clean:asciimathInput", + // "clean:mathmlInput", + "clean:texInput", + // Output + "clean:htmlCssOutput", + "clean:mathmlOutput", + // "clean:svgOutput", + // Extensions. You probably want to leave the set matching your choices. + "clean:extensionsAsciimath", + // "clean:extensionsMathml", + "clean:extensionsTeX", + "clean:extensionHtmlCss", + // Other items + "clean:locales", + "clean:miscConfig", + // "clean:miscExtensions", // you probably want that + "clean:images", + "clean:notcode" + ]); + grunt.registerTask("mjNode", [ + "clean:packed", + "clean:allConfigs", + "clean:dropFonts", + "clean:htmlCssOutput", + "clean:locales", + "clean:miscConfig", + "clean:images", + "clean:notcode", + "clean:miscExtensions" + ]); }; From a02ed2e6043df7e7b6258f241b67f7f87a7ae496 Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Fri, 24 Jul 2015 10:40:51 +0200 Subject: [PATCH 08/14] Update package name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad8926a46..574e643e0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "MathJax-concatenater", + "name": "MathJax-grunt-cleaner", "version": "0.1.0", "author": "MathJax Consortium", "private": true, From eec24e97fe56f45cbc21efbbe7067205978d965e Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 29 Jul 2015 21:12:23 -0700 Subject: [PATCH 09/14] add node_modules to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules From 48322fc7e5371bee9e7c9935487875890e56fbea Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 29 Jul 2015 21:13:51 -0700 Subject: [PATCH 10/14] add grunt-regex-replace --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 574e643e0..e329b13c4 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "devDependencies": { "grunt": "^0.4.5", "grunt-contrib-clean": "^0.6.0", + "grunt-regex-replace": "^0.2.6", "matchdep": "*" } } From 85cdc0c13e98222b6474d7de983b91f0b22ccb12 Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 29 Jul 2015 21:45:39 -0700 Subject: [PATCH 11/14] add component task - removes png image fonts - disables imageFont in HTML-CSS config --- Gruntfile.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index e3db2c467..972683032 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -276,10 +276,30 @@ module.exports = function(grunt) { "bower.json", "composer.json" ] + }, + "regex-replace": { + // disable image fonts in default HTML-CSS config + noImageFont: { + src: ['unpacked/jax/output/HTML-CSS/config.js'], + actions: [ + { + name: 'nullImageFont', + search: /imageFont:[^,]+,/, + replace: 'imageFont: null,', + } + ] + } } }); grunt.loadNpmTasks("grunt-contrib-clean"); + grunt.loadNpmTasks('grunt-regex-replace'); + + grunt.registerTask("component", [ + // components-mathjax excludes only PNG fonts + "regex-replace:noImageFont", + "clean:png", + ]); grunt.registerTask("template", [ // **Notes** on the template. When instructions say "Pick one", this means commenting out one item (so that it"s not cleaned). From 5fbf0b25319d3fe9cf8ca902c83403aa136c5500 Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Wed, 27 Jan 2016 17:29:21 +0100 Subject: [PATCH 12/14] update for MathJax v2.6.0 --- Gruntfile.js | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index e3db2c467..3326d1716 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -209,23 +209,41 @@ module.exports = function(grunt) { svgOutput: [ "config/*SVG.js", "config/*SVG-full.js", - "unpacked/config/*HTMLorMML.js", - "unpacked/config/*HTMLorMML-full.js", + "unpacked/config/*SVG.js", + "unpacked/config/*SVG-full.js", "jax/output/SVG", "unpacked/jax/output/SVG" ], commonHtmlOutput: [ - "configs", - "unpacked/config/", + "configs/*CHTML.js", + "configs/*CHTML-full.js", + "unpacked/config/*CHTML.js", + "unpacked/configs/*CHTML-full.js", "jax/output/CommonHTML", "unpacked/jax/output/CommonHTML", "extensions/CHTML-preview.js", "unpacked/extensions/CHTML-preview.js" ], + previewHtmlOutput: [ + "configs", + "unpacked/config/", + "jax/output/PreviewHTML", + "unpacked/jax/output/PreviewHTML", + "extensions/fast-preview.js", + "unpacked/extensions/fast-preview.js" + "extensions/CHTML-preview.js", + "unpacked/extensions/CHTML-preview.js" + ], + plainSourceOutput: [ + "configs", + "unpacked/config/", + "jax/output/PlainSource", + "unpacked/jax/output/PlainSource" + ], // ## Locales // Removes all locale files. Change this as needed to keep your preferred language. // **NOTE.** English strings are hardcoded. - // **NOTE.** If you fix th locale, drop the menu entry: http://docs.mathjax.org/en/latest/options/MathMenu.html#configure-mathmenu + // **NOTE.** If you fix the locale, drop the menu entry: http://docs.mathjax.org/en/latest/options/MathMenu.html#configure-mathmenu locales: [ "localization", "unpacked/localization" @@ -243,6 +261,10 @@ module.exports = function(grunt) { "config/Safe.js", "unpacked/config/Safe.js" ], + a11yExtensions: [ + "extensions/AssistiveMML.js", + "unpacked/extensions/AssistiveMML.js" + ], miscExtensions: [ "extensions/FontWarnings.js", "extensions/HelpDialog.js", @@ -274,7 +296,9 @@ module.exports = function(grunt) { "README-branch.txt", "README.md", "bower.json", - "composer.json" + "composer.json", + ".npmignore", + "package.json" ] } }); From 91cf225965890890cc24ec9e5b31f5d8f12ef9c0 Mon Sep 17 00:00:00 2001 From: Peter Krautzberger Date: Wed, 27 Jan 2016 17:31:31 +0100 Subject: [PATCH 13/14] update for MathJax v2.6.0 --- Gruntfile.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3326d1716..ff51da832 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -225,8 +225,6 @@ module.exports = function(grunt) { "unpacked/extensions/CHTML-preview.js" ], previewHtmlOutput: [ - "configs", - "unpacked/config/", "jax/output/PreviewHTML", "unpacked/jax/output/PreviewHTML", "extensions/fast-preview.js", @@ -235,8 +233,6 @@ module.exports = function(grunt) { "unpacked/extensions/CHTML-preview.js" ], plainSourceOutput: [ - "configs", - "unpacked/config/", "jax/output/PlainSource", "unpacked/jax/output/PlainSource" ], From 1f34ae18583731e8353da83b88bf229fdd2f1452 Mon Sep 17 00:00:00 2001 From: Brian Boyko Date: Tue, 16 Feb 2016 11:37:55 -0600 Subject: [PATCH 14/14] Bugfix - missing comma Replaced missing comma in line 232. --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 142fa1000..9b1c220e8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -228,7 +228,7 @@ module.exports = function(grunt) { "jax/output/PreviewHTML", "unpacked/jax/output/PreviewHTML", "extensions/fast-preview.js", - "unpacked/extensions/fast-preview.js" + "unpacked/extensions/fast-preview.js", "extensions/CHTML-preview.js", "unpacked/extensions/CHTML-preview.js" ],