Show More
@@ -121,13 +121,15 b' class ExtractFigureTransformer(ConfigurableTransformers):' | |||||
121 | def cell_transform(self, cell, other, count): |
|
121 | def cell_transform(self, cell, other, count): | |
122 | if not self.enabled: |
|
122 | if not self.enabled: | |
123 | return cell, other |
|
123 | return cell, other | |
|
124 | if other.get('figures',None) is None : | |||
|
125 | other['figures']={} | |||
124 | for i, out in enumerate(cell.get('outputs', [])): |
|
126 | for i, out in enumerate(cell.get('outputs', [])): | |
125 | for type in self.display_data_priority: |
|
127 | for type in self.display_data_priority: | |
126 | if out.hasattr(type): |
|
128 | if out.hasattr(type): | |
127 | figname, key, data = self._new_figure(out[type], type, count) |
|
129 | figname, key, data = self._new_figure(out[type], type, count) | |
128 | cell.outputs[i][type] = figname |
|
130 | cell.outputs[i][type] = figname | |
129 | out['key_'+type] = figname |
|
131 | out['key_'+type] = figname | |
130 | other[key] = data |
|
132 | other['figures'][key] = data | |
131 | count = count+1 |
|
133 | count = count+1 | |
132 | return cell, other |
|
134 | return cell, other | |
133 |
|
135 |
@@ -98,7 +98,7 b' class NbconvertApp(Application):' | |||||
98 |
|
98 | |||
99 | out_root = ipynb_file[:-6].replace('.','_').replace(' ','_') |
|
99 | out_root = ipynb_file[:-6].replace('.','_').replace(' ','_') | |
100 |
|
100 | |||
101 | keys = resources.keys() |
|
101 | keys = resources.get('figures',{}).keys() | |
102 | if self.write : |
|
102 | if self.write : | |
103 | with io.open(os.path.join(out_root+'.'+self.fileext),'w') as f: |
|
103 | with io.open(os.path.join(out_root+'.'+self.fileext),'w') as f: | |
104 | f.write(output) |
|
104 | f.write(output) | |
@@ -109,12 +109,12 b' class NbconvertApp(Application):' | |||||
109 | if self.write: |
|
109 | if self.write: | |
110 | with io.open(os.path.join(out_root+'_files',key),'wb') as f: |
|
110 | with io.open(os.path.join(out_root+'_files',key),'wb') as f: | |
111 | print(' writing to ',os.path.join(out_root,key)) |
|
111 | print(' writing to ',os.path.join(out_root,key)) | |
112 | f.write(resources[key]) |
|
112 | f.write(resources['figures'][key]) | |
113 | if self.stdout: |
|
113 | if self.stdout: | |
114 | print(''' |
|
114 | print(''' | |
115 | ====================== Keys in Resources ================================== |
|
115 | ====================== Keys in Resources ================================== | |
116 | ''') |
|
116 | ''') | |
117 | print(resources.keys()) |
|
117 | print(resources['figures'].keys()) | |
118 | print(""" |
|
118 | print(""" | |
119 | =========================================================================== |
|
119 | =========================================================================== | |
120 | you are responsible from writing those data do a file in the right place if |
|
120 | you are responsible from writing those data do a file in the right place if |
General Comments 0
You need to be logged in to leave comments.
Login now