Merge pull request #2192 from NoelDeMartin/MOBILE-3232

MOBILE-3232 filters: Use svg mathjax output
main
Juan Leyva 2019-12-05 16:40:11 +01:00 committed by GitHub
commit 69664c306c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 17 deletions

View File

@ -14,24 +14,24 @@ module.exports = {
dest: '{{WWW}}/' dest: '{{WWW}}/'
}, },
copyMathJaxMain: { copyMathJaxMain: {
src: ['{{ROOT}}/node_modules/mathjax/*.js'], src: ['{{ROOT}}/node_modules/mathjax/MathJax.js'],
dest: '{{WWW}}/lib/mathjax' dest: '{{WWW}}/lib/mathjax'
}, },
copyMathJaxConfig: {
src: ['{{ROOT}}/node_modules/mathjax/config/**/*'],
dest: '{{WWW}}/lib/mathjax/config'
},
copyMathJaxExtensions: { copyMathJaxExtensions: {
src: ['{{ROOT}}/node_modules/mathjax/extensions/**/*'], src: ['{{ROOT}}/node_modules/mathjax/extensions/**/*'],
dest: '{{WWW}}/lib/mathjax/extensions' dest: '{{WWW}}/lib/mathjax/extensions'
}, },
copyMathJaxFonts: { copyMathJaxElement: {
src: ['{{ROOT}}/node_modules/mathjax/fonts/**/*'], src: ['{{ROOT}}/node_modules/mathjax/jax/element/**/*'],
dest: '{{WWW}}/lib/mathjax/fonts' dest: '{{WWW}}/lib/mathjax/jax/element'
}, },
copyMathJaxJax: { copyMathJaxInput: {
src: ['{{ROOT}}/node_modules/mathjax/jax/**/*'], src: ['{{ROOT}}/node_modules/mathjax/jax/input/**/*'],
dest: '{{WWW}}/lib/mathjax/jax' dest: '{{WWW}}/lib/mathjax/jax/input'
},
copyMathJaxOutput: {
src: ['{{ROOT}}/node_modules/mathjax/jax/output/SVG/**/*'],
dest: '{{WWW}}/lib/mathjax/jax/output/SVG'
}, },
copyMathJaxLocalization: { copyMathJaxLocalization: {
src: ['{{ROOT}}/node_modules/mathjax/localization/**/*'], src: ['{{ROOT}}/node_modules/mathjax/localization/**/*'],

View File

@ -32,12 +32,35 @@ export class AddonFilterMathJaxLoaderHandler extends CoreFilterDefaultHandler {
// Default values for MathJax config for sites where we cannot retrieve it. // Default values for MathJax config for sites where we cannot retrieve it.
protected DEFAULT_URL = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js'; protected DEFAULT_URL = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js';
protected DEFAULT_CONFIG = 'MathJax.Hub.Config({' + protected DEFAULT_CONFIG = `
'config: ["Accessible.js", "Safe.js"],' + MathJax.Hub.Config({
'errorSettings: { message: ["!"] },' + extensions: [
'skipStartupTypeset: true,' + "Safe.js",
'messageStyle: "none"' + "tex2jax.js",
'});'; "mml2jax.js",
"MathEvents.js",
"MathZoom.js",
"MathMenu.js",
"toMathML.js",
"TeX/noErrors.js",
"TeX/noUndefined.js",
"TeX/AMSmath.js",
"TeX/AMSsymbols.js",
"fast-preview.js",
"AssistiveMML.js",
"[a11y]/accessibility-menu.js"
],
jax: ["input/TeX","input/MathML","output/SVG"],
menuSettings: {
zoom: "Double-Click",
mpContext: true,
mpMouse: true
},
errorSettings: { message: ["!"] },
skipStartupTypeset: true,
messageStyle: "none"
});
`;
// List of language codes found in the MathJax/localization/ directory. // List of language codes found in the MathJax/localization/ directory.
protected MATHJAX_LANG_CODES = [ protected MATHJAX_LANG_CODES = [