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