Skip to content

Commit c3d5a4e

Browse files
committedJun 4, 2015
add needs_ipython_css to global context
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent 1870328 commit c3d5a4e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎nikola/nikola.py

+10
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,16 @@ def __init__(self, **config):
796796
self._GLOBAL_CONTEXT['hidden_categories'] = self.config.get('HIDDEN_CATEGORIES')
797797
self._GLOBAL_CONTEXT['url_replacer'] = self.url_replacer
798798

799+
# IPython theme configuration. If a website can potentially have ipynb
800+
# posts (as determined by checking POSTS/PAGES against ipynb
801+
# extensions), we should enable the IPython CSS (leaving that up to the
802+
# theme itself).
803+
804+
self._GLOBAL_CONTEXT['needs_ipython_css'] = False
805+
for i in self.config['post_pages']:
806+
if os.path.splitext(i[0])[0] in self.config['COMPILERS'].get('ipynb', []):
807+
self._GLOBAL_CONTEXT['needs_ipython_css'] = True
808+
799809
self._GLOBAL_CONTEXT.update(self.config.get('GLOBAL_CONTEXT', {}))
800810

801811
# Load compiler plugins

0 commit comments

Comments
 (0)
Failed to load comments.