diff --git a/IPython/nbconvert/nbconvertapp.py b/IPython/nbconvert/nbconvertapp.py index 115b645..11c0035 100755 --- a/IPython/nbconvert/nbconvertapp.py +++ b/IPython/nbconvert/nbconvertapp.py @@ -18,7 +18,7 @@ from IPython.core.application import BaseIPythonApplication, base_aliases, base_ from IPython.core.profiledir import ProfileDir from IPython.config import catch_config_error, Configurable from IPython.utils.traitlets import ( - Unicode, List, Instance, DottedObjectName, Type, CaselessStrEnum, + Unicode, List, Instance, DottedObjectName, Type, CaselessStrEnum, Bool, ) from IPython.utils.importstring import import_item @@ -66,6 +66,10 @@ nbconvert_flags.update({ 'stdout' : ( {'NbConvertApp' : {'writer_class' : "StdoutWriter"}}, "Write notebook output to stdout instead of files." + ), + 'no-output-suffix' : ( + {'NbConvertApp' : {'use_output_suffix' : False}}, + "Do not apply a suffix to filenames when converting to notebook format." ) }) @@ -100,6 +104,13 @@ class NbConvertApp(BaseIPythonApplication): can only be used when converting one notebook at a time. ''') + use_output_suffix = Bool( + True, + config=True, + help="""Whether to apply a suffix prior to the extension (only relevant + when converting to notebook format). The suffix is determined by + the exporter, and is usually '.nbconvert'.""") + examples = Unicode(u""" The simplest way to use nbconvert is @@ -303,7 +314,7 @@ class NbConvertApp(BaseIPythonApplication): exc_info=True) self.exit(1) else: - if 'output_suffix' in resources and not self.output_base: + if self.use_output_suffix and 'output_suffix' in resources and not self.output_base: notebook_name += resources['output_suffix'] write_results = self.writer.write(output, resources, notebook_name=notebook_name)