Show More
@@ -1,6 +1,6 b'' | |||
|
1 | 1 | #!/usr/bin/python |
|
2 | 2 | """Utility function for installing MathJax javascript library into |
|
3 |
your IPython nb |
|
|
3 | your IPython nbextensions directory, for offline use. | |
|
4 | 4 | |
|
5 | 5 | Authors: |
|
6 | 6 | |
@@ -66,7 +66,7 b' from IPython.utils.path import get_ipython_dir' | |||
|
66 | 66 | |
|
67 | 67 | # Where mathjax will be installed |
|
68 | 68 | |
|
69 |
default_dest = os.path.join(get_ipython_dir(), 'nb |
|
|
69 | default_dest = os.path.join(get_ipython_dir(), 'nbextensions', 'mathjax') | |
|
70 | 70 | |
|
71 | 71 | # Test for access to install mathjax |
|
72 | 72 | |
@@ -128,7 +128,7 b' def extract_zip(fd, dest):' | |||
|
128 | 128 | def install_mathjax(tag='v2.2', dest=default_dest, replace=False, file=None, extractor=extract_tar): |
|
129 | 129 | """Download and/or install MathJax for offline use. |
|
130 | 130 | |
|
131 |
This will install mathjax to the |
|
|
131 | This will install mathjax to the nbextensions dir in your IPYTHONDIR. | |
|
132 | 132 | |
|
133 | 133 | MathJax is a ~15MB download, and ~150MB installed. |
|
134 | 134 | |
@@ -137,7 +137,7 b" def install_mathjax(tag='v2.2', dest=default_dest, replace=False, file=None, ext" | |||
|
137 | 137 | |
|
138 | 138 | replace : bool [False] |
|
139 | 139 | Whether to remove and replace an existing install. |
|
140 |
dest : str [IPYTHONDIR/ |
|
|
140 | dest : str [IPYTHONDIR/nbextensions] | |
|
141 | 141 | Where to locally install mathjax |
|
142 | 142 | tag : str ['v2.2'] |
|
143 | 143 | Which tag to download. Default is 'v2.2', the current stable release, |
@@ -170,7 +170,7 b' class NotebookWebApplication(web.Application):' | |||
|
170 | 170 | cluster_manager=cluster_manager, |
|
171 | 171 | |
|
172 | 172 | # IPython stuff |
|
173 |
nb |
|
|
173 | nbextensions_path = ipython_app.nbextensions_path, | |
|
174 | 174 | mathjax_url=ipython_app.mathjax_url, |
|
175 | 175 | config=ipython_app.config, |
|
176 | 176 | use_less=ipython_app.use_less, |
@@ -194,7 +194,7 b' class NotebookWebApplication(web.Application):' | |||
|
194 | 194 | handlers.extend(load_handlers('services.clusters.handlers')) |
|
195 | 195 | handlers.extend([ |
|
196 | 196 | (r"/files/(.*)", AuthenticatedFileHandler, {'path' : settings['notebook_manager'].notebook_dir}), |
|
197 |
(r"/nb |
|
|
197 | (r"/nbextensions/(.*)", FileFindHandler, {'path' : settings['nbextensions_path']}), | |
|
198 | 198 | ]) |
|
199 | 199 | # prepend base_project_url onto the patterns that we match |
|
200 | 200 | new_handlers = [] |
@@ -435,11 +435,11 b' class NotebookApp(BaseIPythonApplication):' | |||
|
435 | 435 | """return extra paths + the default location""" |
|
436 | 436 | return self.extra_static_paths + [DEFAULT_STATIC_FILES_PATH] |
|
437 | 437 | |
|
438 |
nb |
|
|
439 |
help="""paths for Javascript extensions. By default, this is just IPYTHONDIR/nb |
|
|
438 | nbextensions_path = List(Unicode, config=True, | |
|
439 | help="""paths for Javascript extensions. By default, this is just IPYTHONDIR/nbextensions""" | |
|
440 | 440 | ) |
|
441 |
def _nb |
|
|
442 |
return [os.path.join(get_ipython_dir(), 'nb |
|
|
441 | def _nbextensions_path_default(self): | |
|
442 | return [os.path.join(get_ipython_dir(), 'nbextensions')] | |
|
443 | 443 | |
|
444 | 444 | mathjax_url = Unicode("", config=True, |
|
445 | 445 | help="""The url for MathJax.js.""" |
@@ -451,9 +451,9 b' class NotebookApp(BaseIPythonApplication):' | |||
|
451 | 451 | url_path_join(self.base_project_url, "static") |
|
452 | 452 | ) |
|
453 | 453 | |
|
454 |
# try local mathjax, either in nb |
|
|
454 | # try local mathjax, either in nbextensions/mathjax or static/mathjax | |
|
455 | 455 | for (url_prefix, search_path) in [ |
|
456 |
(url_path_join(self.base_project_url, "extensions"), self.nb |
|
|
456 | (url_path_join(self.base_project_url, "nbextensions"), self.nbextensions_path), | |
|
457 | 457 | (static_url_prefix, self.static_file_path), |
|
458 | 458 | ]: |
|
459 | 459 | self.log.debug("searching for local mathjax in %s", search_path) |
General Comments 0
You need to be logged in to leave comments.
Login now