##// END OF EJS Templates
Avoid duplicate extension in nbconvert...
MinRK -
Show More
@@ -278,6 +278,11 b' class NbConvertApp(BaseIPythonApplication):'
278 basename = os.path.basename(notebook_filename)
278 basename = os.path.basename(notebook_filename)
279 notebook_name = basename[:basename.rfind('.')]
279 notebook_name = basename[:basename.rfind('.')]
280 if self.output_base:
280 if self.output_base:
281 # strip duplicate extension from output_base, to avoid Basname.ext.ext
282 if getattr(exporter, 'file_extension', False):
283 base, ext = os.path.splitext(self.output_base)
284 if ext == '.' + exporter.file_extension:
285 self.output_base = base
281 notebook_name = self.output_base
286 notebook_name = self.output_base
282 resources = {}
287 resources = {}
283 resources['profile_dir'] = self.profile_dir.location
288 resources['profile_dir'] = self.profile_dir.location
@@ -293,11 +298,11 b' class NbConvertApp(BaseIPythonApplication):'
293 exc_info=True)
298 exc_info=True)
294 self.exit(1)
299 self.exit(1)
295 else:
300 else:
296 write_resultes = self.writer.write(output, resources, notebook_name=notebook_name)
301 write_results = self.writer.write(output, resources, notebook_name=notebook_name)
297
302
298 #Post-process if post processor has been defined.
303 #Post-process if post processor has been defined.
299 if hasattr(self, 'postprocessor') and self.postprocessor:
304 if hasattr(self, 'postprocessor') and self.postprocessor:
300 self.postprocessor(write_resultes)
305 self.postprocessor(write_results)
301 conversion_success += 1
306 conversion_success += 1
302
307
303 # If nothing was converted successfully, help the user.
308 # If nothing was converted successfully, help the user.
General Comments 0
You need to be logged in to leave comments. Login now