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