Show More
@@ -29,7 +29,8 b' from types import FunctionType' | |||||
29 | # IPython imports |
|
29 | # IPython imports | |
30 | from IPython.nbformat import current as nbformat |
|
30 | from IPython.nbformat import current as nbformat | |
31 | from IPython.config.configurable import Configurable, SingletonConfigurable |
|
31 | from IPython.config.configurable import Configurable, SingletonConfigurable | |
32 | from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict, CaselessStrEnum |
|
32 | from IPython.utils.traitlets import (List, Unicode, Type, Bool, Dict, CaselessStrEnum, | |
|
33 | Any) | |||
33 |
|
34 | |||
34 | # Our own imports |
|
35 | # Our own imports | |
35 | from .utils import remove_fake_files_url |
|
36 | from .utils import remove_fake_files_url | |
@@ -112,15 +113,16 b' class Converter(Configurable):' | |||||
112 | # Instance-level attributes that are set in the constructor for this |
|
113 | # Instance-level attributes that are set in the constructor for this | |
113 | # class. |
|
114 | # class. | |
114 | #------------------------------------------------------------------------- |
|
115 | #------------------------------------------------------------------------- | |
115 |
infile = |
|
116 | infile = Any() | |
116 |
|
117 | |||
117 | highlight_source = Bool(True, |
|
118 | highlight_source = Bool(True, | |
118 | config=True, |
|
119 | config=True, | |
119 | help="Enable syntax highlighting for code blocks.") |
|
120 | help="Enable syntax highlighting for code blocks.") | |
120 |
|
121 | |||
121 | preamble = Unicode("" , |
|
122 | preamble = Unicode( "" , | |
122 | config=True, |
|
123 | config=True, | |
123 | help="Path to a user-specified preamble file") |
|
124 | help="Path to a user-specified preamble file") | |
|
125 | ||||
124 | extract_figures = Bool( True, |
|
126 | extract_figures = Bool( True, | |
125 | config=True, |
|
127 | config=True, | |
126 | help="""extract base-64 encoded figures of the notebook into separate files, |
|
128 | help="""extract base-64 encoded figures of the notebook into separate files, | |
@@ -154,16 +156,17 b' class Converter(Configurable):' | |||||
154 | # keep in this way for readability's sake. |
|
156 | # keep in this way for readability's sake. | |
155 | self.exclude_cells = exclude |
|
157 | self.exclude_cells = exclude | |
156 | self.infile = infile |
|
158 | self.infile = infile | |
157 | self.infile_dir, infile_root = os.path.split(infile) |
|
159 | if infile: | |
158 |
self.infile_root = os.path.split |
|
160 | self.infile_dir, infile_root = os.path.split(infile) | |
159 | self.clean_name = clean_filename(self.infile_root) |
|
161 | self.infile_root = os.path.splitext(infile_root)[0] | |
160 | # Handle the creation of a directory for ancillary files, for |
|
162 | self.clean_name = clean_filename(self.infile_root) | |
161 | # formats that need one. |
|
163 | # Handle the creation of a directory for ancillary files, for | |
162 | files_dir = os.path.join(self.infile_dir, self.clean_name + '_files') |
|
164 | # formats that need one. | |
163 | if not os.path.isdir(files_dir): |
|
165 | files_dir = os.path.join(self.infile_dir, self.clean_name + '_files') | |
164 |
os. |
|
166 | if not os.path.isdir(files_dir): | |
165 | self.files_dir = files_dir |
|
167 | os.mkdir(files_dir) | |
166 | self.outbase = os.path.join(self.infile_dir, self.infile_root) |
|
168 | self.files_dir = files_dir | |
|
169 | self.outbase = os.path.join(self.infile_dir, self.infile_root) | |||
167 |
|
170 | |||
168 | def __del__(self): |
|
171 | def __del__(self): | |
169 | if os.path.isdir(self.files_dir) and not os.listdir(self.files_dir): |
|
172 | if os.path.isdir(self.files_dir) and not os.listdir(self.files_dir): |
General Comments 0
You need to be logged in to leave comments.
Login now