Show More
@@ -60,7 +60,7 b' nbconvert_aliases.update({' | |||
|
60 | 60 | 'to' : 'NbConvertApp.export_format', |
|
61 | 61 | 'template' : 'Exporter.template_file', |
|
62 | 62 | 'writer' : 'NbConvertApp.writer_class', |
|
63 |
'post': 'NbConvertApp.post |
|
|
63 | 'post': 'NbConvertApp.postprocessor_class', | |
|
64 | 64 | 'output': 'NbConvertApp.output_base', |
|
65 | 65 | 'offline-slides': 'RevealHelpTransformer.url_prefix', |
|
66 | 66 | 'slide-notes': 'RevealHelpTransformer.speaker_notes' |
@@ -166,22 +166,22 b' class NbConvertApp(BaseIPythonApplication):' | |||
|
166 | 166 | self.writer_factory = import_item(new) |
|
167 | 167 | |
|
168 | 168 | # Post-processor specific variables |
|
169 |
post |
|
|
169 | postprocessor = Instance('IPython.nbconvert.postprocessors.base.PostProcessorBase', | |
|
170 | 170 | help="""Instance of the PostProcessor class used to write the |
|
171 | 171 | results of the conversion.""") |
|
172 | 172 | |
|
173 |
post |
|
|
173 | postprocessor_class = DottedOrNone(config=True, | |
|
174 | 174 | help="""PostProcessor class used to write the |
|
175 | 175 | results of the conversion""") |
|
176 |
post |
|
|
176 | postprocessor_aliases = {'pdf': 'IPython.nbconvert.postprocessors.pdf.PDFPostProcessor', | |
|
177 | 177 | 'serve': 'IPython.nbconvert.postprocessors.serve.ServePostProcessor'} |
|
178 |
post |
|
|
178 | postprocessor_factory = Type() | |
|
179 | 179 | |
|
180 |
def _post |
|
|
181 |
if new.lower() in self.post |
|
|
182 |
new = self.post |
|
|
180 | def _postprocessor_class_changed(self, name, old, new): | |
|
181 | if new.lower() in self.postprocessor_aliases: | |
|
182 | new = self.postprocessor_aliases[new.lower()] | |
|
183 | 183 | if new: |
|
184 |
self.post |
|
|
184 | self.postprocessor_factory = import_item(new) | |
|
185 | 185 | |
|
186 | 186 | |
|
187 | 187 | # Other configurable variables |
@@ -202,7 +202,7 b' class NbConvertApp(BaseIPythonApplication):' | |||
|
202 | 202 | self.init_syspath() |
|
203 | 203 | self.init_notebooks() |
|
204 | 204 | self.init_writer() |
|
205 |
self.init_post |
|
|
205 | self.init_postprocessor() | |
|
206 | 206 | |
|
207 | 207 | |
|
208 | 208 | |
@@ -250,14 +250,14 b' class NbConvertApp(BaseIPythonApplication):' | |||
|
250 | 250 | self._writer_class_changed(None, self.writer_class, self.writer_class) |
|
251 | 251 | self.writer = self.writer_factory(parent=self) |
|
252 | 252 | |
|
253 |
def init_post |
|
|
253 | def init_postprocessor(self): | |
|
254 | 254 | """ |
|
255 |
Initialize the post |
|
|
255 | Initialize the postprocessor (which is stateless) | |
|
256 | 256 | """ |
|
257 |
self._post |
|
|
258 |
self.post |
|
|
259 |
if self.post |
|
|
260 |
self.post |
|
|
257 | self._postprocessor_class_changed(None, self.postprocessor_class, | |
|
258 | self.postprocessor_class) | |
|
259 | if self.postprocessor_factory: | |
|
260 | self.postprocessor = self.postprocessor_factory(parent=self) | |
|
261 | 261 | |
|
262 | 262 | def start(self): |
|
263 | 263 | """ |
@@ -306,8 +306,8 b' class NbConvertApp(BaseIPythonApplication):' | |||
|
306 | 306 | write_resultes = self.writer.write(output, resources, notebook_name=notebook_name) |
|
307 | 307 | |
|
308 | 308 | #Post-process if post processor has been defined. |
|
309 |
if hasattr(self, 'post |
|
|
310 |
self.post |
|
|
309 | if hasattr(self, 'postprocessor') and self.postprocessor: | |
|
310 | self.postprocessor(write_resultes) | |
|
311 | 311 | conversion_success += 1 |
|
312 | 312 | |
|
313 | 313 | # If nothing was converted successfully, help the user. |
General Comments 0
You need to be logged in to leave comments.
Login now