##// END OF EJS Templates
Renamed preprocessors to transformers to maintain consistency
Jonathan Frederic -
Show More
@@ -93,7 +93,7 b' class Exporter(Configurable):'
93
93
94 #Processors that process the input data prior to the export, set in the
94 #Processors that process the input data prior to the export, set in the
95 #constructor for this class.
95 #constructor for this class.
96 preprocessors = []
96 transformers = []
97
97
98
98
99 def __init__(self, transformers=None, filters=None, config=None, **kw):
99 def __init__(self, transformers=None, filters=None, config=None, **kw):
@@ -198,15 +198,15 b' class Exporter(Configurable):'
198 """
198 """
199
199
200 if inspect.isfunction(transformer):
200 if inspect.isfunction(transformer):
201 self.preprocessors.append(transformer)
201 self.transformers.append(transformer)
202 return transformer
202 return transformer
203 elif isinstance(transformer, MetaHasTraits):
203 elif isinstance(transformer, MetaHasTraits):
204 transformer_instance = transformer(config=self.config)
204 transformer_instance = transformer(config=self.config)
205 self.preprocessors.append(transformer_instance)
205 self.transformers.append(transformer_instance)
206 return transformer_instance
206 return transformer_instance
207 else:
207 else:
208 transformer_instance = transformer()
208 transformer_instance = transformer()
209 self.preprocessors.append(transformer_instance)
209 self.transformers.append(transformer_instance)
210 return transformer_instance
210 return transformer_instance
211
211
212
212
@@ -222,7 +222,6 b' class Exporter(Configurable):'
222 name to give the filter in the Jinja engine
222 name to give the filter in the Jinja engine
223 filter : filter
223 filter : filter
224 """
224 """
225
226 if inspect.isfunction(filter):
225 if inspect.isfunction(filter):
227 self.environment.filters[name] = filter
226 self.environment.filters[name] = filter
228 elif isinstance(filter, MetaHasTraits):
227 elif isinstance(filter, MetaHasTraits):
@@ -306,11 +305,11 b' class Exporter(Configurable):'
306 notebook that is being exported.
305 notebook that is being exported.
307 """
306 """
308
307
309 #Dict of 'resources' that can be filled by the preprocessors.
308 #Dict of 'resources' that can be filled by the transformers.
310 resources = {}
309 resources = {}
311
310
312 #Run each transformer on the notebook. Carry the output along
311 #Run each transformer on the notebook. Carry the output along
313 #to each transformer
312 #to each transformer
314 for transformer in self.preprocessors:
313 for transformer in self.transformers:
315 nb, resources = transformer(nb, resources)
314 nb, resources = transformer(nb, resources)
316 return nb, resources
315 return nb, resources
General Comments 0
You need to be logged in to leave comments. Login now