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