Show More
@@ -450,21 +450,32 b' class NotebookApp(BaseIPythonApplication):' | |||||
450 | static_url_prefix = self.webapp_settings.get("static_url_prefix", |
|
450 | static_url_prefix = self.webapp_settings.get("static_url_prefix", | |
451 | url_path_join(self.base_project_url, "static") |
|
451 | url_path_join(self.base_project_url, "static") | |
452 | ) |
|
452 | ) | |
|
453 | ||||
|
454 | # try local mathjax, either in nb_extensions/mathjax or static/mathjax | |||
|
455 | for (url_prefix, search_path) in [ | |||
|
456 | (url_path_join(self.base_project_url, "extensions"), self.nb_extensions_path), | |||
|
457 | (static_url_prefix, self.static_file_path), | |||
|
458 | ]: | |||
|
459 | self.log.debug("searching for local mathjax in %s", search_path) | |||
453 | try: |
|
460 | try: | |
454 |
mathjax = filefind(os.path.join('mathjax', 'MathJax.js'), se |
|
461 | mathjax = filefind(os.path.join('mathjax', 'MathJax.js'), search_path) | |
455 | except IOError: |
|
462 | except IOError: | |
|
463 | continue | |||
|
464 | else: | |||
|
465 | url = url_path_join(url_prefix, u"mathjax/MathJax.js") | |||
|
466 | self.log.info("Serving local MathJax from %s at %s", mathjax, url) | |||
|
467 | return url | |||
|
468 | ||||
|
469 | # no local mathjax, serve from CDN | |||
456 |
|
|
470 | if self.certfile: | |
457 |
|
|
471 | # HTTPS: load from Rackspace CDN, because SSL certificate requires it | |
458 |
|
|
472 | host = u"https://c328740.ssl.cf1.rackcdn.com" | |
459 |
|
|
473 | else: | |
460 |
|
|
474 | host = u"http://cdn.mathjax.org" | |
461 |
|
|
475 | ||
462 |
|
|
476 | url = host + u"/mathjax/latest/MathJax.js" | |
463 |
|
|
477 | self.log.info("Using MathJax from CDN: %s", url) | |
464 |
|
|
478 | return url | |
465 | else: |
|
|||
466 | self.log.info("Using local MathJax from %s" % mathjax) |
|
|||
467 | return url_path_join(static_url_prefix, u"mathjax/MathJax.js") |
|
|||
468 |
|
479 | |||
469 | def _mathjax_url_changed(self, name, old, new): |
|
480 | def _mathjax_url_changed(self, name, old, new): | |
470 | if new and not self.enable_mathjax: |
|
481 | if new and not self.enable_mathjax: |
General Comments 0
You need to be logged in to leave comments.
Login now