##// END OF EJS Templates
DEV: Allow supplying jinja vars from python config.
Scott Sanderson -
Show More
@@ -119,6 +119,11 b' class IPythonHandler(AuthenticatedHandler):'
119 return Application.instance().log
119 return Application.instance().log
120 else:
120 else:
121 return app_log
121 return app_log
122
123 @property
124 def jinja_template_vars(self):
125 """User-supplied values to supply to jinja templates."""
126 return self.settings.get('jinja_template_vars', {})
122
127
123 #---------------------------------------------------------------
128 #---------------------------------------------------------------
124 # URLs
129 # URLs
@@ -250,6 +255,7 b' class IPythonHandler(AuthenticatedHandler):'
250 sys_info=sys_info,
255 sys_info=sys_info,
251 contents_js_source=self.contents_js_source,
256 contents_js_source=self.contents_js_source,
252 version_hash=self.version_hash,
257 version_hash=self.version_hash,
258 **self.jinja_template_vars
253 )
259 )
254
260
255 def get_json_body(self):
261 def get_json_body(self):
@@ -200,6 +200,7 b' class NotebookWebApplication(web.Application):'
200 config_manager=config_manager,
200 config_manager=config_manager,
201
201
202 # IPython stuff
202 # IPython stuff
203 jinja_template_vars=ipython_app.jinja_template_vars,
203 nbextensions_path=ipython_app.nbextensions_path,
204 nbextensions_path=ipython_app.nbextensions_path,
204 websocket_url=ipython_app.websocket_url,
205 websocket_url=ipython_app.websocket_url,
205 mathjax_url=ipython_app.mathjax_url,
206 mathjax_url=ipython_app.mathjax_url,
@@ -525,6 +526,11 b' class NotebookApp(BaseIPythonApplication):'
525
526
526 jinja_environment_options = Dict(config=True,
527 jinja_environment_options = Dict(config=True,
527 help="Supply extra arguments that will be passed to Jinja environment.")
528 help="Supply extra arguments that will be passed to Jinja environment.")
529
530 jinja_template_vars = Dict(
531 config=True,
532 help="Extra variables to supply to jinja templates when rendering.",
533 )
528
534
529 enable_mathjax = Bool(True, config=True,
535 enable_mathjax = Bool(True, config=True,
530 help="""Whether to enable MathJax for typesetting math/TeX
536 help="""Whether to enable MathJax for typesetting math/TeX
@@ -25,6 +25,7 b' window.mathjax_url = "{{mathjax_url}}";'
25
25
26 {% block params %}
26 {% block params %}
27
27
28 {{super()}}
28 data-project="{{project}}"
29 data-project="{{project}}"
29 data-base-url="{{base_url}}"
30 data-base-url="{{base_url}}"
30 data-ws-url="{{ws_url}}"
31 data-ws-url="{{ws_url}}"
@@ -4,7 +4,7 b''
4
4
5
5
6 {% block params %}
6 {% block params %}
7
7 {{super()}}
8 data-base-url="{{base_url}}"
8 data-base-url="{{base_url}}"
9 data-notebook-path="{{notebook_path}}"
9 data-notebook-path="{{notebook_path}}"
10 data-terminals-available="{{terminals_available}}"
10 data-terminals-available="{{terminals_available}}"
General Comments 0
You need to be logged in to leave comments. Login now