Show More
@@ -82,8 +82,7 b' def coalesce_streams(cell, other, count):' | |||||
82 |
|
82 | |||
83 | TODO: handle \r deletion |
|
83 | TODO: handle \r deletion | |
84 | """ |
|
84 | """ | |
85 |
|
85 | outputs = cell.get('outputs', []) | ||
86 | outputs = cell.get('outputs', None) |
|
|||
87 | if not outputs: |
|
86 | if not outputs: | |
88 | return cell, other |
|
87 | return cell, other | |
89 | new_outputs = [] |
|
88 | new_outputs = [] | |
@@ -102,7 +101,6 b' def coalesce_streams(cell, other, count):' | |||||
102 | return cell, other |
|
101 | return cell, other | |
103 |
|
102 | |||
104 |
|
103 | |||
105 | # todo, make the key part configurable. |
|
|||
106 |
|
104 | |||
107 | class ExtractFigureTransformer(ActivatableTransformer): |
|
105 | class ExtractFigureTransformer(ActivatableTransformer): | |
108 |
|
106 | |||
@@ -125,9 +123,12 b' class ExtractFigureTransformer(ActivatableTransformer):' | |||||
125 | config=True, |
|
123 | config=True, | |
126 | ) |
|
124 | ) | |
127 |
|
125 | |||
|
126 | figname_format_map = Dict({}, | |||
|
127 | config=True, | |||
|
128 | ) | |||
128 |
|
129 | |||
129 | #to do change this to .format {} syntax |
|
130 | #to do change this to .format {} syntax | |
130 |
default_key_tpl = Unicode('_fig_ |
|
131 | default_key_tpl = Unicode('_fig_{count:02d}.{ext}', config=True) | |
131 |
|
132 | |||
132 | def _get_ext(self, ext): |
|
133 | def _get_ext(self, ext): | |
133 | if ext in self.extra_ext_map : |
|
134 | if ext in self.extra_ext_map : | |
@@ -137,11 +138,13 b' class ExtractFigureTransformer(ActivatableTransformer):' | |||||
137 | def _new_figure(self, data, fmt, count): |
|
138 | def _new_figure(self, data, fmt, count): | |
138 | """Create a new figure file in the given format. |
|
139 | """Create a new figure file in the given format. | |
139 |
|
140 | |||
140 | Returns a path relative to the input file. |
|
|||
141 | """ |
|
141 | """ | |
142 |
tpl = self. |
|
142 | tplf = self.figname_format_map.get(fmt,self.default_key_tpl) | |
143 | figname = tpl % (count, self._get_ext(fmt)) |
|
143 | tplk = self.key_format_map.get(fmt,self.default_key_tpl) | |
144 | key = tpl % (count, fmt) |
|
144 | ||
|
145 | # option to pass the hash as data ? | |||
|
146 | figname = tplf.format(count=count, ext=self._get_ext(fmt)) | |||
|
147 | key = tplk.format(count=count, ext=self._get_ext(fmt)) | |||
145 |
|
148 | |||
146 | # Binary files are base64-encoded, SVG is already XML |
|
149 | # Binary files are base64-encoded, SVG is already XML | |
147 | if fmt in ('png', 'jpg', 'pdf'): |
|
150 | if fmt in ('png', 'jpg', 'pdf'): |
@@ -1797,42 +1797,7 b' it will automatically invoke a pager at the bottom of the screen:</p>' | |||||
1797 | <div class="hbox output_area"> |
|
1797 | <div class="hbox output_area"> | |
1798 | <div class="prompt"></div> |
|
1798 | <div class="prompt"></div> | |
1799 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
1799 | <div class="box-flex1 output_subarea output_stream output_stdout"> | |
1800 | <pre>0 </pre> |
|
1800 | <pre>0 1 2 3 4 5 6 7 | |
1801 | </div> |
|
|||
1802 | </div><div class="hbox output_area"> |
|
|||
1803 | <div class="prompt"></div> |
|
|||
1804 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
|||
1805 | <pre>1 </pre> |
|
|||
1806 | </div> |
|
|||
1807 | </div><div class="hbox output_area"> |
|
|||
1808 | <div class="prompt"></div> |
|
|||
1809 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
|||
1810 | <pre>2 </pre> |
|
|||
1811 | </div> |
|
|||
1812 | </div><div class="hbox output_area"> |
|
|||
1813 | <div class="prompt"></div> |
|
|||
1814 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
|||
1815 | <pre>3 </pre> |
|
|||
1816 | </div> |
|
|||
1817 | </div><div class="hbox output_area"> |
|
|||
1818 | <div class="prompt"></div> |
|
|||
1819 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
|||
1820 | <pre>4 </pre> |
|
|||
1821 | </div> |
|
|||
1822 | </div><div class="hbox output_area"> |
|
|||
1823 | <div class="prompt"></div> |
|
|||
1824 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
|||
1825 | <pre>5 </pre> |
|
|||
1826 | </div> |
|
|||
1827 | </div><div class="hbox output_area"> |
|
|||
1828 | <div class="prompt"></div> |
|
|||
1829 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
|||
1830 | <pre>6 </pre> |
|
|||
1831 | </div> |
|
|||
1832 | </div><div class="hbox output_area"> |
|
|||
1833 | <div class="prompt"></div> |
|
|||
1834 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
|||
1835 | <pre>7 |
|
|||
1836 | </pre> |
|
1801 | </pre> | |
1837 | </div> |
|
1802 | </div> | |
1838 | </div> |
|
1803 | </div> |
@@ -167,36 +167,7 b' In[19]:' | |||||
167 |
|
167 | |||
168 | .. parsed-literal:: |
|
168 | .. parsed-literal:: | |
169 |
|
169 | |||
170 | 0 |
|
170 | 0 1 2 3 4 5 6 7 | |
171 |
|
||||
172 | .. parsed-literal:: |
|
|||
173 |
|
||||
174 | 1 |
|
|||
175 |
|
||||
176 | .. parsed-literal:: |
|
|||
177 |
|
||||
178 | 2 |
|
|||
179 |
|
||||
180 | .. parsed-literal:: |
|
|||
181 |
|
||||
182 | 3 |
|
|||
183 |
|
||||
184 | .. parsed-literal:: |
|
|||
185 |
|
||||
186 | 4 |
|
|||
187 |
|
||||
188 | .. parsed-literal:: |
|
|||
189 |
|
||||
190 | 5 |
|
|||
191 |
|
||||
192 | .. parsed-literal:: |
|
|||
193 |
|
||||
194 | 6 |
|
|||
195 |
|
||||
196 | .. parsed-literal:: |
|
|||
197 |
|
||||
198 | 7 |
|
|||
199 |
|
||||
200 | Clean crash and restart |
|
171 | Clean crash and restart | |
201 | ----------------------- |
|
172 | ----------------------- | |
202 |
|
173 |
@@ -316,36 +316,7 b' for i in range(8):' | |||||
316 | \begin{codeoutput} |
|
316 | \begin{codeoutput} | |
317 |
|
317 | |||
318 | \begin{verbatim} |
|
318 | \begin{verbatim} | |
319 | 0 |
|
319 | 0 1 2 3 4 5 6 7 | |
320 | \end{verbatim} |
|
|||
321 |
|
||||
322 | \begin{verbatim} |
|
|||
323 | 1 |
|
|||
324 | \end{verbatim} |
|
|||
325 |
|
||||
326 | \begin{verbatim} |
|
|||
327 | 2 |
|
|||
328 | \end{verbatim} |
|
|||
329 |
|
||||
330 | \begin{verbatim} |
|
|||
331 | 3 |
|
|||
332 | \end{verbatim} |
|
|||
333 |
|
||||
334 | \begin{verbatim} |
|
|||
335 | 4 |
|
|||
336 | \end{verbatim} |
|
|||
337 |
|
||||
338 | \begin{verbatim} |
|
|||
339 | 5 |
|
|||
340 | \end{verbatim} |
|
|||
341 |
|
||||
342 | \begin{verbatim} |
|
|||
343 | 6 |
|
|||
344 | \end{verbatim} |
|
|||
345 |
|
||||
346 | \begin{verbatim} |
|
|||
347 | 7 |
|
|||
348 |
|
||||
349 | \end{verbatim} |
|
320 | \end{verbatim} | |
350 |
|
321 | |||
351 | \end{codeoutput} |
|
322 | \end{codeoutput} |
General Comments 0
You need to be logged in to leave comments.
Login now