Show More
@@ -18,7 +18,7 b' from .utils import highlight, ansi2html' | |||
|
18 | 18 | from .utils import markdown2latex |
|
19 | 19 | |
|
20 | 20 | from IPython.config.configurable import Configurable |
|
21 |
from IPython.utils.traitlets import |
|
|
21 | from IPython.utils.traitlets import List | |
|
22 | 22 | |
|
23 | 23 | #----------------------------------------------------------------------------- |
|
24 | 24 | # Class declarations |
@@ -50,7 +50,7 b' texenv = Environment(' | |||
|
50 | 50 | # IPython imports |
|
51 | 51 | from IPython.nbformat import current as nbformat |
|
52 | 52 | from IPython.config.configurable import Configurable |
|
53 |
from IPython.utils.traitlets import ( Unicode, |
|
|
53 | from IPython.utils.traitlets import ( Unicode, List, Bool) | |
|
54 | 54 | |
|
55 | 55 | #----------------------------------------------------------------------------- |
|
56 | 56 | # Class declarations |
@@ -20,7 +20,7 b' class ConfigurableTransformers(Configurable):' | |||
|
20 | 20 | for index, cell in enumerate(worksheet.cells): |
|
21 | 21 | worksheet.cells[index], other = self.cell_transform(cell, other, index) |
|
22 | 22 | return nb, other |
|
23 |
except NotImplementedError |
|
|
23 | except NotImplementedError: | |
|
24 | 24 | raise NotImplementedError('should be implemented by subclass') |
|
25 | 25 | |
|
26 | 26 | def cell_transform(self, cell, other, index): |
@@ -36,9 +36,9 b' class ActivatableTransformer(ConfigurableTransformers):' | |||
|
36 | 36 | |
|
37 | 37 | def __call__(self, nb, other): |
|
38 | 38 | if not self.enabled : |
|
39 | return nb,other | |
|
39 | return nb, other | |
|
40 | 40 | else : |
|
41 | return super(ActivatableTransformer,self).__call__(nb, other) | |
|
41 | return super(ActivatableTransformer, self).__call__(nb, other) | |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | def cell_preprocessor(function): |
@@ -119,13 +119,13 b' class ExtractFigureTransformer(ActivatableTransformer):' | |||
|
119 | 119 | |
|
120 | 120 | |
|
121 | 121 | def cell_transform(self, cell, other, count): |
|
122 | if other.get('figures',None) is None : | |
|
123 | other['figures']={} | |
|
124 |
for |
|
|
125 | for type in self.display_data_priority: | |
|
126 | if out.hasattr(type): | |
|
127 | figname, key, data = self._new_figure(out[type], type, count) | |
|
128 | out['key_'+type] = figname | |
|
122 | if other.get('figures', None) is None : | |
|
123 | other['figures'] = {} | |
|
124 | for out in cell.get('outputs', []): | |
|
125 | for out_type in self.display_data_priority: | |
|
126 | if out.hasattr(out_type): | |
|
127 | figname, key, data = self._new_figure(out[out_type], out_type, count) | |
|
128 | out['key_'+out_type] = figname | |
|
129 | 129 | other['figures'][key] = data |
|
130 | 130 | count = count+1 |
|
131 | 131 | return cell, other |
@@ -200,8 +200,8 b' class RevealHelpTransformer(ConfigurableTransformers):' | |||
|
200 | 200 | else : |
|
201 | 201 | return False |
|
202 | 202 | |
|
203 | def cell_transform(self, cell, other,count): | |
|
204 | ctype = cell.metadata.get('slideshow',{}).get('slide_type',None) | |
|
203 | def cell_transform(self, cell, other, count): | |
|
204 | ctype = cell.metadata.get('slideshow', {}).get('slide_type', None) | |
|
205 | 205 | if ctype in [None, '-'] : |
|
206 | 206 | cell.metadata.slideshow = {} |
|
207 | 207 | cell.metadata.slideshow['slide_type'] = None |
@@ -230,7 +230,7 b' class RevealHelpTransformer(ConfigurableTransformers):' | |||
|
230 | 230 | cell.metadata.slideshow.open_section = self.open_section() |
|
231 | 231 | cell.metadata.slideshow.open_subsection = self.open_subsection() |
|
232 | 232 | cell.metadata.slideshow.open_fragment = False |
|
233 | return cell,other | |
|
233 | return cell, other | |
|
234 | 234 | |
|
235 | 235 | |
|
236 | 236 | class CSSHtmlHeaderTransformer(ActivatableTransformer): |
@@ -243,14 +243,14 b' class CSSHtmlHeaderTransformer(ActivatableTransformer):' | |||
|
243 | 243 | |
|
244 | 244 | Add this css in resources in the "inlining.css" key |
|
245 | 245 | """ |
|
246 | resources['inlining']= {} | |
|
246 | resources['inlining'] = {} | |
|
247 | 247 | resources['inlining']['css'] = self.header |
|
248 | 248 | return nb, resources |
|
249 | 249 | |
|
250 | header= [] | |
|
250 | header = [] | |
|
251 | 251 | |
|
252 | 252 | def __init__(self, config=None, **kw): |
|
253 | super(CSSHtmlHeaderTransformer,self).__init__(config=config, **kw) | |
|
253 | super(CSSHtmlHeaderTransformer, self).__init__(config=config, **kw) | |
|
254 | 254 | if self.enabled : |
|
255 | 255 | self.regen_header() |
|
256 | 256 |
General Comments 0
You need to be logged in to leave comments.
Login now