Show More
@@ -131,7 +131,7 b' class Exporter(Configurable):' | |||
|
131 | 131 | |
|
132 | 132 | default_transformers = List([nbtransformers.coalesce_streams, |
|
133 | 133 | nbtransformers.SVG2PDFTransformer, |
|
134 |
nbtransformers.Extract |
|
|
134 | nbtransformers.ExtractOutputTransformer, | |
|
135 | 135 | nbtransformers.CSSHTMLHeaderTransformer, |
|
136 | 136 | nbtransformers.RevealHelpTransformer, |
|
137 | 137 | nbtransformers.LatexTransformer, |
@@ -88,7 +88,7 b' class LatexExporter(Exporter):' | |||
|
88 | 88 | 'NbConvertBase': { |
|
89 | 89 | 'display_data_priority' : ['latex', 'pdf', 'png', 'jpg', 'svg', 'jpeg', 'text'] |
|
90 | 90 | }, |
|
91 |
'Extract |
|
|
91 | 'ExtractOutputTransformer': { | |
|
92 | 92 | 'enabled':True |
|
93 | 93 | }, |
|
94 | 94 | 'SVG2PDFTransformer': { |
@@ -37,6 +37,6 b' class RSTExporter(Exporter):' | |||
|
37 | 37 | |
|
38 | 38 | @property |
|
39 | 39 | def default_config(self): |
|
40 |
c = Config({'Extract |
|
|
40 | c = Config({'ExtractOutputTransformer':{'enabled':True}}) | |
|
41 | 41 | c.merge(super(RSTExporter,self).default_config) |
|
42 | 42 | return c |
@@ -47,9 +47,9 b' class TestExporter(ExportersTestsBase):' | |||
|
47 | 47 | |
|
48 | 48 | def test_extract_figures(self): |
|
49 | 49 | """ |
|
50 |
If the Extract |
|
|
50 | If the ExtractOutputTransformer is enabled, are figures extracted? | |
|
51 | 51 | """ |
|
52 |
config = Config({'Extract |
|
|
52 | config = Config({'ExtractOutputTransformer': {'enabled': True}}) | |
|
53 | 53 | exporter = self._make_exporter(config=config) |
|
54 | 54 | (output, resources) = exporter.from_filename(self._get_notebook()) |
|
55 | 55 | assert resources is not None |
@@ -2,7 +2,7 b'' | |||
|
2 | 2 | from .base import Transformer |
|
3 | 3 | from .convertfigures import ConvertFiguresTransformer |
|
4 | 4 | from .svg2pdf import SVG2PDFTransformer |
|
5 |
from .extract |
|
|
5 | from .extractoutput import ExtractOutputTransformer | |
|
6 | 6 | from .revealhelp import RevealHelpTransformer |
|
7 | 7 | from .latex import LatexTransformer |
|
8 | 8 | from .sphinx import SphinxTransformer |
@@ -1,5 +1,5 b'' | |||
|
1 |
"""Module containing a transformer that extracts all of the |
|
|
2 |
notebook file. The extracted |
|
|
1 | """Module containing a transformer that extracts all of the outputs from the | |
|
2 | notebook file. The extracted outputs are returned in the 'resources' dictionary. | |
|
3 | 3 | """ |
|
4 | 4 | #----------------------------------------------------------------------------- |
|
5 | 5 | # Copyright (c) 2013, the IPython Development Team. |
@@ -25,10 +25,10 b' from IPython.utils import py3compat' | |||
|
25 | 25 | # Classes |
|
26 | 26 | #----------------------------------------------------------------------------- |
|
27 | 27 | |
|
28 |
class Extract |
|
|
28 | class ExtractOutputTransformer(Transformer): | |
|
29 | 29 | """ |
|
30 |
Extracts all of the |
|
|
31 |
|
|
|
30 | Extracts all of the outputs from the notebook file. The extracted | |
|
31 | outputs are returned in the 'resources' dictionary. | |
|
32 | 32 | """ |
|
33 | 33 | |
|
34 | 34 | figure_filename_template = Unicode( |
@@ -56,9 +56,9 b' class ExtractFigureTransformer(Transformer):' | |||
|
56 | 56 | unique_key = resources.get('unique_key', 'figure') |
|
57 | 57 | output_files_dir = resources.get('output_files_dir', None) |
|
58 | 58 | |
|
59 |
#Make sure |
|
|
60 |
if not ' |
|
|
61 |
resources[' |
|
|
59 | #Make sure outputs key exists | |
|
60 | if not 'outputs' in resources: | |
|
61 | resources['outputs'] = {} | |
|
62 | 62 | |
|
63 | 63 | #Loop through all of the outputs in the cell |
|
64 | 64 | for index, out in enumerate(cell.get('outputs', [])): |
@@ -95,7 +95,7 b' class ExtractFigureTransformer(Transformer):' | |||
|
95 | 95 | out[out_type + '_filename'] = filename |
|
96 | 96 | |
|
97 | 97 | #In the resources, make the figure available via |
|
98 |
# resources[' |
|
|
99 |
resources[' |
|
|
98 | # resources['outputs']['filename'] = data | |
|
99 | resources['outputs'][filename] = data | |
|
100 | 100 | |
|
101 | 101 | return cell, resources |
General Comments 0
You need to be logged in to leave comments.
Login now