Show More
@@ -23,6 +23,7 b' from __future__ import print_function, absolute_import' | |||
|
23 | 23 | # Stdlib imports |
|
24 | 24 | import io |
|
25 | 25 | import os |
|
26 | import inspect | |
|
26 | 27 | |
|
27 | 28 | # IPython imports |
|
28 | 29 | from IPython.config.configurable import Configurable |
@@ -151,20 +152,26 b' class Exporter(Configurable):' | |||
|
151 | 152 | |
|
152 | 153 | |
|
153 | 154 | def register_transformer(self, transformer): |
|
154 |
if i |
|
|
155 | if inspect.isfunction(transformer): | |
|
156 | self.preprocessors.append(transformer) | |
|
157 | return transformer | |
|
158 | elif isinstance(transformer, MetaHasTraits): | |
|
155 | 159 | transformer_instance = transformer(config=self.config) |
|
156 | 160 | self.preprocessors.append(transformer_instance) |
|
157 | 161 | return transformer_instance |
|
158 | 162 | else: |
|
159 | self.preprocessors.append(transformer) | |
|
160 |
|
|
|
163 | transformer_instance = transformer() | |
|
164 | self.preprocessors.append(transformer_instance) | |
|
165 | return transformer_instance | |
|
161 | 166 | |
|
162 | 167 | |
|
163 | 168 | def register_filter(self, name, filter): |
|
164 |
if i |
|
|
169 | if inspect.isfunction(filter): | |
|
170 | self.environment.filters[name] = filter | |
|
171 | elif isinstance(filter, MetaHasTraits): | |
|
165 | 172 | self.environment.filters[name] = filter(config=self.config) |
|
166 | 173 | else: |
|
167 | self.environment.filters[name] = filter | |
|
174 | self.environment.filters[name] = filter() | |
|
168 | 175 | return self.environment.filters[name] |
|
169 | 176 | |
|
170 | 177 |
@@ -19,16 +19,7 b' GlobalConfigurable.display_data_priority' | |||
|
19 | 19 | class DataTypeFilter(object): |
|
20 | 20 | """ Returns the preferred display format """ |
|
21 | 21 | |
|
22 | display_data_priority = None | |
|
23 | ||
|
24 | def __init__(self, display_data_priority): | |
|
25 | ||
|
26 | #Make sure that the display data priority variably is not None. | |
|
27 | if display_data_priority is None: | |
|
28 | raise TypeError | |
|
29 | else: | |
|
30 | self.display_data_priority = display_data_priority | |
|
31 | ||
|
22 | display_data_priority = ['html', 'pdf', 'svg', 'latex', 'png', 'jpg', 'jpeg' , 'text'] | |
|
32 | 23 | |
|
33 | 24 | def __call__(self, output): |
|
34 | 25 | """ Return the first available format in the priority """ |
General Comments 0
You need to be logged in to leave comments.
Login now