Show More
@@ -47,18 +47,12 b' class ConvertFiguresPreprocessor(Preprocessor):' | |||
|
47 | 47 | """ |
|
48 | 48 | |
|
49 | 49 | # Loop through all of the datatypes of the outputs in the cell. |
|
50 |
for |
|
|
51 | for data_type, data in list(cell_out.items()): | |
|
52 | # this must run *before* extract outputs, | |
|
53 | # so figure_name and filename do not exist | |
|
54 | self._convert_figure(cell_out, resources, data_type, data) | |
|
55 | return cell, resources | |
|
50 | for output in cell.get('outputs', []): | |
|
51 | if output.output_type in {'execute_result', 'display_data'} \ | |
|
52 | and self.from_format in output.data \ | |
|
53 | and self.to_format not in output.data: | |
|
56 | 54 | |
|
55 | output.data[self.to_format] = self.convert_figure( | |
|
56 | self.from_format, output.data[self.from_format]) | |
|
57 | 57 | |
|
58 | def _convert_figure(self, cell_out, resources, data_type, data): | |
|
59 | """ | |
|
60 | Convert a figure and output the results to the cell output | |
|
61 | """ | |
|
62 | if not self.to_format in cell_out and data_type == self.from_format: | |
|
63 | data = self.convert_figure(data_type, data) | |
|
64 | cell_out[self.to_format] = data | |
|
58 | return cell, resources |
@@ -61,7 +61,7 b' class SVG2PDFPreprocessor(ConvertFiguresPreprocessor):' | |||
|
61 | 61 | with TemporaryDirectory() as tmpdir: |
|
62 | 62 | |
|
63 | 63 | #Write fig to temp file |
|
64 |
input_filename = os.path.join(tmpdir, 'figure.' |
|
|
64 | input_filename = os.path.join(tmpdir, 'figure.svg') | |
|
65 | 65 | # SVG data is unicode text |
|
66 | 66 | with io.open(input_filename, 'w', encoding='utf8') as f: |
|
67 | 67 | f.write(data) |
General Comments 0
You need to be logged in to leave comments.
Login now