mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-04 11:36:23 +01:00
Fix loading of mathjax files
This commit is contained in:
parent
bd99a17186
commit
a3ac8282d4
2 changed files with 4 additions and 3 deletions
|
|
@ -25,14 +25,14 @@
|
|||
var name = ans.replace(/^\\//g, '');
|
||||
if (name.startsWith('../fonts')) name = name.slice(3);
|
||||
ans = mathjax_files[name];
|
||||
if (!ans) ans = '';
|
||||
if (!ans) ans = name;
|
||||
if (typeof ans !== 'string') {
|
||||
mathjax_files[name] = window.URL.createObjectURL(ans);
|
||||
ans = mathjax_files[name];
|
||||
}
|
||||
if (ans === name && !name.startsWith('blob:')) {
|
||||
if (ans.endsWith('.eot') || ans.endsWith('.otf')) return '';
|
||||
console.log('WARNING: Failed to resolve MathJax file: ' + mathjax_name);
|
||||
if (ans.endsWith('.eot') || ans.endsWith('.otf')) ans = '';
|
||||
else console.log('WARNING: Failed to resolve MathJax file: ' + mathjax_name);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ def requestStarted(self, rq):
|
|||
rq.fail(rq.RequestFailed)
|
||||
return
|
||||
if 'MathJax.js' in name:
|
||||
# raw = open(os.path.expanduser('~/work/mathjax/unpacked/MathJax.js')).read()
|
||||
raw = monkeypatch_mathjax(raw.decode('utf-8')).encode('utf-8')
|
||||
|
||||
self.send_reply(rq, mt, raw)
|
||||
|
|
|
|||
Loading…
Reference in a new issue