Show More
@@ -18,7 +18,7 b' from IPython.core.application import BaseIPythonApplication, base_aliases, base_' | |||||
18 | from IPython.core.profiledir import ProfileDir |
|
18 | from IPython.core.profiledir import ProfileDir | |
19 | from IPython.config import catch_config_error, Configurable |
|
19 | from IPython.config import catch_config_error, Configurable | |
20 | from IPython.utils.traitlets import ( |
|
20 | from IPython.utils.traitlets import ( | |
21 | Unicode, List, Instance, DottedObjectName, Type, CaselessStrEnum, |
|
21 | Unicode, List, Instance, DottedObjectName, Type, CaselessStrEnum, Bool, | |
22 | ) |
|
22 | ) | |
23 | from IPython.utils.importstring import import_item |
|
23 | from IPython.utils.importstring import import_item | |
24 |
|
24 | |||
@@ -66,6 +66,10 b' nbconvert_flags.update({' | |||||
66 | 'stdout' : ( |
|
66 | 'stdout' : ( | |
67 | {'NbConvertApp' : {'writer_class' : "StdoutWriter"}}, |
|
67 | {'NbConvertApp' : {'writer_class' : "StdoutWriter"}}, | |
68 | "Write notebook output to stdout instead of files." |
|
68 | "Write notebook output to stdout instead of files." | |
|
69 | ), | |||
|
70 | 'no-output-suffix' : ( | |||
|
71 | {'NbConvertApp' : {'use_output_suffix' : False}}, | |||
|
72 | "Do not apply a suffix to filenames when converting to notebook format." | |||
69 | ) |
|
73 | ) | |
70 | }) |
|
74 | }) | |
71 |
|
75 | |||
@@ -100,6 +104,13 b' class NbConvertApp(BaseIPythonApplication):' | |||||
100 | can only be used when converting one notebook at a time. |
|
104 | can only be used when converting one notebook at a time. | |
101 | ''') |
|
105 | ''') | |
102 |
|
106 | |||
|
107 | use_output_suffix = Bool( | |||
|
108 | True, | |||
|
109 | config=True, | |||
|
110 | help="""Whether to apply a suffix prior to the extension (only relevant | |||
|
111 | when converting to notebook format). The suffix is determined by | |||
|
112 | the exporter, and is usually '.nbconvert'.""") | |||
|
113 | ||||
103 | examples = Unicode(u""" |
|
114 | examples = Unicode(u""" | |
104 | The simplest way to use nbconvert is |
|
115 | The simplest way to use nbconvert is | |
105 |
|
116 | |||
@@ -303,7 +314,7 b' class NbConvertApp(BaseIPythonApplication):' | |||||
303 | exc_info=True) |
|
314 | exc_info=True) | |
304 | self.exit(1) |
|
315 | self.exit(1) | |
305 | else: |
|
316 | else: | |
306 | if 'output_suffix' in resources and not self.output_base: |
|
317 | if self.use_output_suffix and 'output_suffix' in resources and not self.output_base: | |
307 | notebook_name += resources['output_suffix'] |
|
318 | notebook_name += resources['output_suffix'] | |
308 | write_results = self.writer.write(output, resources, notebook_name=notebook_name) |
|
319 | write_results = self.writer.write(output, resources, notebook_name=notebook_name) | |
309 |
|
320 |
General Comments 0
You need to be logged in to leave comments.
Login now