Show More
@@ -29,12 +29,15 b' class ConfigurableTransformers(Configurable):' | |||
|
29 | 29 | raise NotImplementedError('should be implemented by subclass') |
|
30 | 30 | |
|
31 | 31 | |
|
32 |
class |
|
|
33 | message = Unicode('-- nothing', config=True) | |
|
32 | class ActivatableTransformer(ConfigurableTransformers): | |
|
34 | 33 | |
|
34 | active = Bool(False, config=True) | |
|
35 | 35 | |
|
36 |
def |
|
|
37 | return cell, other | |
|
36 | def __call__(self, nb, other): | |
|
37 | if not self.active : | |
|
38 | return nb,other | |
|
39 | else : | |
|
40 | return super(ActivatableTransformer,self).__call__(nb, other) | |
|
38 | 41 | |
|
39 | 42 | |
|
40 | 43 | def cell_preprocessor(function): |
@@ -73,7 +76,7 b' def haspyout_transformer(cell, other, count):' | |||
|
73 | 76 | |
|
74 | 77 | # todo, make the key part configurable. |
|
75 | 78 | |
|
76 |
class ExtractFigureTransformer( |
|
|
79 | class ExtractFigureTransformer(ActivatableTransformer): | |
|
77 | 80 | enabled = Bool(False, |
|
78 | 81 | config=True, |
|
79 | 82 | help=""" If set to false, this transformer will be no-op """ |
@@ -30,7 +30,7 b' from IPython.config.application import Application' | |||
|
30 | 30 | from IPython.config.loader import ConfigFileNotFound |
|
31 | 31 | from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict, CaselessStrEnum |
|
32 | 32 | |
|
33 |
from converters.transformers import (ConfigurableTransformers, |
|
|
33 | from converters.transformers import (ConfigurableTransformers,ExtractFigureTransformer) | |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | class NbconvertApp(Application): |
@@ -58,7 +58,6 b' class NbconvertApp(Application):' | |||
|
58 | 58 | self.classes.insert(0,ConverterTemplate) |
|
59 | 59 | # register class here to have help with help all |
|
60 | 60 | self.classes.insert(0,ExtractFigureTransformer) |
|
61 | self.classes.insert(0,Foobar) | |
|
62 | 61 | # ensure those are registerd |
|
63 | 62 | |
|
64 | 63 | def load_config_file(self, profile_name): |
General Comments 0
You need to be logged in to leave comments.
Login now