From 7be59c0abb04ae2d4cb5ecc6eb73391dc51e91b7 2013-07-23 06:12:43 From: Jonathan Frederic Date: 2013-07-23 06:12:43 Subject: [PATCH] Rename ExtractFigureTransformer to ExtractOutputTransformer --- diff --git a/IPython/nbconvert/exporters/exporter.py b/IPython/nbconvert/exporters/exporter.py index bbcc35f..5b86441 100755 --- a/IPython/nbconvert/exporters/exporter.py +++ b/IPython/nbconvert/exporters/exporter.py @@ -131,7 +131,7 @@ class Exporter(Configurable): default_transformers = List([nbtransformers.coalesce_streams, nbtransformers.SVG2PDFTransformer, - nbtransformers.ExtractFigureTransformer, + nbtransformers.ExtractOutputTransformer, nbtransformers.CSSHTMLHeaderTransformer, nbtransformers.RevealHelpTransformer, nbtransformers.LatexTransformer, diff --git a/IPython/nbconvert/exporters/latex.py b/IPython/nbconvert/exporters/latex.py index bc73162..9d0381e 100755 --- a/IPython/nbconvert/exporters/latex.py +++ b/IPython/nbconvert/exporters/latex.py @@ -88,7 +88,7 @@ class LatexExporter(Exporter): 'NbConvertBase': { 'display_data_priority' : ['latex', 'pdf', 'png', 'jpg', 'svg', 'jpeg', 'text'] }, - 'ExtractFigureTransformer': { + 'ExtractOutputTransformer': { 'enabled':True }, 'SVG2PDFTransformer': { diff --git a/IPython/nbconvert/exporters/rst.py b/IPython/nbconvert/exporters/rst.py index 7b84a76..1388a63 100644 --- a/IPython/nbconvert/exporters/rst.py +++ b/IPython/nbconvert/exporters/rst.py @@ -37,6 +37,6 @@ class RSTExporter(Exporter): @property def default_config(self): - c = Config({'ExtractFigureTransformer':{'enabled':True}}) + c = Config({'ExtractOutputTransformer':{'enabled':True}}) c.merge(super(RSTExporter,self).default_config) return c diff --git a/IPython/nbconvert/exporters/tests/test_exporter.py b/IPython/nbconvert/exporters/tests/test_exporter.py index 66f7e1f..60bd872 100644 --- a/IPython/nbconvert/exporters/tests/test_exporter.py +++ b/IPython/nbconvert/exporters/tests/test_exporter.py @@ -47,9 +47,9 @@ class TestExporter(ExportersTestsBase): def test_extract_figures(self): """ - If the ExtractFigureTransformer is enabled, are figures extracted? + If the ExtractOutputTransformer is enabled, are figures extracted? """ - config = Config({'ExtractFigureTransformer': {'enabled': True}}) + config = Config({'ExtractOutputTransformer': {'enabled': True}}) exporter = self._make_exporter(config=config) (output, resources) = exporter.from_filename(self._get_notebook()) assert resources is not None diff --git a/IPython/nbconvert/transformers/__init__.py b/IPython/nbconvert/transformers/__init__.py index e47b24c..4626747 100755 --- a/IPython/nbconvert/transformers/__init__.py +++ b/IPython/nbconvert/transformers/__init__.py @@ -2,7 +2,7 @@ from .base import Transformer from .convertfigures import ConvertFiguresTransformer from .svg2pdf import SVG2PDFTransformer -from .extractfigure import ExtractFigureTransformer +from .extractoutput import ExtractOutputTransformer from .revealhelp import RevealHelpTransformer from .latex import LatexTransformer from .sphinx import SphinxTransformer diff --git a/IPython/nbconvert/transformers/extractoutput.py b/IPython/nbconvert/transformers/extractoutput.py index 6abde79..b888c1b 100755 --- a/IPython/nbconvert/transformers/extractoutput.py +++ b/IPython/nbconvert/transformers/extractoutput.py @@ -1,5 +1,5 @@ -"""Module containing a transformer that extracts all of the figures from the -notebook file. The extracted figures are returned in the 'resources' dictionary. +"""Module containing a transformer that extracts all of the outputs from the +notebook file. The extracted outputs are returned in the 'resources' dictionary. """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. @@ -25,10 +25,10 @@ from IPython.utils import py3compat # Classes #----------------------------------------------------------------------------- -class ExtractFigureTransformer(Transformer): +class ExtractOutputTransformer(Transformer): """ - Extracts all of the figures from the notebook file. The extracted - figures are returned in the 'resources' dictionary. + Extracts all of the outputs from the notebook file. The extracted + outputs are returned in the 'resources' dictionary. """ figure_filename_template = Unicode( @@ -56,9 +56,9 @@ class ExtractFigureTransformer(Transformer): unique_key = resources.get('unique_key', 'figure') output_files_dir = resources.get('output_files_dir', None) - #Make sure figures key exists - if not 'figures' in resources: - resources['figures'] = {} + #Make sure outputs key exists + if not 'outputs' in resources: + resources['outputs'] = {} #Loop through all of the outputs in the cell for index, out in enumerate(cell.get('outputs', [])): @@ -95,7 +95,7 @@ class ExtractFigureTransformer(Transformer): out[out_type + '_filename'] = filename #In the resources, make the figure available via - # resources['figures']['filename'] = data - resources['figures'][filename] = data + # resources['outputs']['filename'] = data + resources['outputs'][filename] = data return cell, resources