##// END OF EJS Templates
Fixed extract figure, rename from count to index
Jonathan Frederic -
Show More
@@ -96,7 +96,12 b' class NbConvertApp(Application):'
96 ipynb_file = (self.extra_args)[2]
96 ipynb_file = (self.extra_args)[2]
97
97
98 #Export
98 #Export
99 output, resources, exporter = export_by_name(ipynb_file, export_type)
99 return_value = export_by_name(ipynb_file, export_type)
100 if return_value is None:
101 print("Error: '%s' template not found." % export_type)
102 return
103 else:
104 (output, resources, exporter) = return_value
100
105
101 #TODO: Allow user to set output directory and file.
106 #TODO: Allow user to set output directory and file.
102 destination_filename = None
107 destination_filename = None
@@ -108,7 +113,7 b' class NbConvertApp(Application):'
108 #be used to create the directory that the files will be exported
113 #be used to create the directory that the files will be exported
109 #into.
114 #into.
110 out_root = ipynb_file[:-6].replace('.', '_').replace(' ', '_')
115 out_root = ipynb_file[:-6].replace('.', '_').replace(' ', '_')
111 destination_filename = os.path.join(out_root+'.'+exporter.fileext)
116 destination_filename = os.path.join(out_root+'.'+exporter.file_extension)
112
117
113 destination_directory = out_root+'_files'
118 destination_directory = out_root+'_files'
114 if not os.path.exists(destination_directory):
119 if not os.path.exists(destination_directory):
@@ -29,7 +29,7 b' class BasicHtmlExporter(exporter.Exporter):'
29 """
29 """
30 Exports a basic HTML document. This exporter assists with the export of
30 Exports a basic HTML document. This exporter assists with the export of
31 HTML. Inherit from it if you are writing your own HTML template and need
31 HTML. Inherit from it if you are writing your own HTML template and need
32 custom tranformers/filters. If you don't need custom tranformers/
32 custom transformers/filters. If you don't need custom transformers/
33 filters, just change the 'template_file' config option.
33 filters, just change the 'template_file' config option.
34 """
34 """
35
35
@@ -46,7 +46,7 b' class ExtractFigureTransformer(ActivatableTransformer):'
46 display_data_priority = List(['svg', 'png', 'latex', 'jpg', 'jpeg','text'])
46 display_data_priority = List(['svg', 'png', 'latex', 'jpg', 'jpeg','text'])
47
47
48 #TODO: Change this to .format {} syntax
48 #TODO: Change this to .format {} syntax
49 default_key_template = Unicode('_fig_{count:02d}.{ext}', config=True)
49 default_key_template = Unicode('_fig_{index:02d}.{ext}', config=True)
50
50
51 def cell_transform(self, cell, resources, index):
51 def cell_transform(self, cell, resources, index):
52 """
52 """
@@ -104,9 +104,8 b' class ExtractFigureTransformer(ActivatableTransformer):'
104 ----------
104 ----------
105 data : str
105 data : str
106 Cell data (from Notebook node cell)
106 Cell data (from Notebook node cell)
107 resources : dictionary
107 format : str
108 Additional resources used in the conversion process. Allows
108 Figure format
109 transformers to pass variables into the Jinja engine.
110 index : int
109 index : int
111 Modified index of the cell being processed (see base.py)
110 Modified index of the cell being processed (see base.py)
112 """
111 """
General Comments 0
You need to be logged in to leave comments. Login now