|
@@ -51,21 +51,26 @@ class LabHandler(IPythonHandler):
|
|
|
|
|
|
@web.authenticated
|
|
@web.authenticated
|
|
def get(self):
|
|
def get(self):
|
|
- static_prefix = ujoin(self.base_url, PREFIX)
|
|
|
|
- labextensions = self.labextensions
|
|
|
|
- data = get_labextension_manifest_data_by_folder(BUILT_FILES)
|
|
|
|
- if 'main' not in data:
|
|
|
|
- msg = ('JupyterLab build artifacts not detected, please see ' +
|
|
|
|
|
|
+ manifest = get_labextension_manifest_data_by_folder(BUILT_FILES)
|
|
|
|
+ if 'main' not in manifest:
|
|
|
|
+ msg = ('JupyterLab build artifacts not detected, please see ' +
|
|
'CONTRIBUTING.md for build instructions.')
|
|
'CONTRIBUTING.md for build instructions.')
|
|
self.log.error(msg)
|
|
self.log.error(msg)
|
|
- self.write(self.render_template('error.html',
|
|
|
|
- status_code=500,
|
|
|
|
|
|
+ self.write(self.render_template('error.html',
|
|
|
|
+ status_code=500,
|
|
status_message='JupyterLab Error',
|
|
status_message='JupyterLab Error',
|
|
page_title='JupyterLab Error',
|
|
page_title='JupyterLab Error',
|
|
message=msg))
|
|
message=msg))
|
|
return
|
|
return
|
|
|
|
|
|
- main = data['main']['entry']
|
|
|
|
|
|
+ config = self._get_lab_config(manifest)
|
|
|
|
+ self.write(self.render_template('lab.html', **config))
|
|
|
|
+
|
|
|
|
+ def _get_lab_config(self, manifest):
|
|
|
|
+ """Get the config data for the page template."""
|
|
|
|
+ static_prefix = ujoin(self.base_url, PREFIX)
|
|
|
|
+ labextensions = self.labextensions
|
|
|
|
+ main = manifest['main']['entry']
|
|
bundles = [ujoin(static_prefix, name + '.bundle.js') for name in
|
|
bundles = [ujoin(static_prefix, name + '.bundle.js') for name in
|
|
['loader', 'main']]
|
|
['loader', 'main']]
|
|
entries = []
|
|
entries = []
|
|
@@ -103,19 +108,20 @@ class LabHandler(IPythonHandler):
|
|
except Exception as e:
|
|
except Exception as e:
|
|
self.log.error(e)
|
|
self.log.error(e)
|
|
|
|
|
|
|
|
+ mathjax_config = self.settings.get('mathjax_config',
|
|
|
|
+ 'TeX-AMS_HTML-full,Safe')
|
|
config = dict(
|
|
config = dict(
|
|
static_prefix=static_prefix,
|
|
static_prefix=static_prefix,
|
|
page_title='JupyterLab Alpha Preview',
|
|
page_title='JupyterLab Alpha Preview',
|
|
mathjax_url=self.mathjax_url,
|
|
mathjax_url=self.mathjax_url,
|
|
|
|
+ mathjax_config=mathjax_config,
|
|
jupyterlab_main=main,
|
|
jupyterlab_main=main,
|
|
jupyterlab_css=css_files,
|
|
jupyterlab_css=css_files,
|
|
jupyterlab_bundles=bundles,
|
|
jupyterlab_bundles=bundles,
|
|
plugin_entries=entries,
|
|
plugin_entries=entries,
|
|
- mathjax_config='TeX-AMS_HTML-full,Safe',
|
|
|
|
- #mathjax_config=self.mathjax_config # for the next release of the notebook
|
|
|
|
)
|
|
)
|
|
config['jupyterlab_config'] = configData
|
|
config['jupyterlab_config'] = configData
|
|
- self.write(self.render_template('lab.html', **config))
|
|
|
|
|
|
+ return config
|
|
|
|
|
|
def get_template(self, name):
|
|
def get_template(self, name):
|
|
return FILE_LOADER.load(self.settings['jinja2_env'], name)
|
|
return FILE_LOADER.load(self.settings['jinja2_env'], name)
|