mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Option to control mathjax source URL
This commit is contained in:
parent
3dc7dad1b1
commit
4d85e84119
@ -24,10 +24,11 @@ class MathJax(Command):
|
|||||||
|
|
||||||
def add_options(self, parser):
|
def add_options(self, parser):
|
||||||
parser.add_option('--path-to-mathjax', help='Path to the MathJax source code')
|
parser.add_option('--path-to-mathjax', help='Path to the MathJax source code')
|
||||||
|
parser.add_option('--mathjax-url', default=self.MATH_JAX_URL, help='URL to MathJax source archive in zip format')
|
||||||
|
|
||||||
def download_mathjax_release(self, tdir):
|
def download_mathjax_release(self, tdir, url):
|
||||||
self.info('Downloading MathJax:', self.MATH_JAX_URL)
|
self.info('Downloading MathJax:', url)
|
||||||
filename = urlretrieve(self.MATH_JAX_URL)[0]
|
filename = urlretrieve(url)[0]
|
||||||
with ZipFile(filename) as zf:
|
with ZipFile(filename) as zf:
|
||||||
zf.extractall(tdir)
|
zf.extractall(tdir)
|
||||||
return os.path.join(tdir, 'MathJax-master')
|
return os.path.join(tdir, 'MathJax-master')
|
||||||
@ -56,7 +57,7 @@ class MathJax(Command):
|
|||||||
self.h = sha1()
|
self.h = sha1()
|
||||||
tdir = mkdtemp('calibre-mathjax-build')
|
tdir = mkdtemp('calibre-mathjax-build')
|
||||||
try:
|
try:
|
||||||
src = opts.path_to_mathjax or self.download_mathjax_release(tdir)
|
src = opts.path_to_mathjax or self.download_mathjax_release(tdir, opts.mathjax_url)
|
||||||
self.info('Compressing MathJax...')
|
self.info('Compressing MathJax...')
|
||||||
t = SpooledTemporaryFile()
|
t = SpooledTemporaryFile()
|
||||||
with ZipFile(t, 'w', ZIP_STORED) as zf:
|
with ZipFile(t, 'w', ZIP_STORED) as zf:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user