diff --git a/IPython/nbconvert/__init__.py b/IPython/nbconvert/__init__.py index d5e7352..464d547 100755 --- a/IPython/nbconvert/__init__.py +++ b/IPython/nbconvert/__init__.py @@ -2,6 +2,6 @@ from .exporters import * import filters -import transformers +import preprocessors import post_processors import writers diff --git a/IPython/nbconvert/exporters/exporter.py b/IPython/nbconvert/exporters/exporter.py index 964b3cc..af9da29 100755 --- a/IPython/nbconvert/exporters/exporter.py +++ b/IPython/nbconvert/exporters/exporter.py @@ -36,7 +36,7 @@ from IPython.utils.importstring import import_item from IPython.utils.text import indent from IPython.utils import py3compat -from IPython.nbconvert import transformers as nbtransformers +from IPython.nbconvert import preprocessors as nbpreprocessors from IPython.nbconvert import filters #----------------------------------------------------------------------------- @@ -83,8 +83,8 @@ class Exporter(LoggingConfigurable): """ Exports notebooks into other file formats. Uses Jinja 2 templating engine to output new formats. Inherit from this class if you are creating a new - template type along with new filters/transformers. If the filters/ - transformers provided by default suffice, there is no need to inherit from + template type along with new filters/preprocessors. If the filters/ + preprocessors provided by default suffice, there is no need to inherit from this class. Instead, override the template_file and file_extension traits via a config file. @@ -138,23 +138,23 @@ class Exporter(LoggingConfigurable): #Extension that the template files use. template_extension = Unicode(".tpl", config=True) - #Configurability, allows the user to easily add filters and transformers. - transformers = List(config=True, - help="""List of transformers, by name or namespace, to enable.""") + #Configurability, allows the user to easily add filters and preprocessors. + preprocessors = List(config=True, + help="""List of preprocessors, by name or namespace, to enable.""") filters = Dict(config=True, help="""Dictionary of filters, by name and namespace, to add to the Jinja environment.""") - default_transformers = List([nbtransformers.coalesce_streams, - nbtransformers.SVG2PDFTransformer, - nbtransformers.ExtractOutputTransformer, - nbtransformers.CSSHTMLHeaderTransformer, - nbtransformers.RevealHelpTransformer, - nbtransformers.LatexTransformer, - nbtransformers.SphinxTransformer], + default_preprocessors = List([nbpreprocessors.coalesce_streams, + nbpreprocessors.SVG2PDFPreprocessor, + nbpreprocessors.ExtractOutputPreprocessor, + nbpreprocessors.CSSHTMLHeaderPreprocessor, + nbpreprocessors.RevealHelpPreprocessor, + nbpreprocessors.LatexPreprocessor, + nbpreprocessors.SphinxPreprocessor], config=True, - help="""List of transformers available by default, by name, namespace, + help="""List of preprocessors available by default, by name, namespace, instance, or type.""") @@ -180,7 +180,7 @@ class Exporter(LoggingConfigurable): #Init self._init_template() self._init_environment(extra_loaders=extra_loaders) - self._init_transformers() + self._init_preprocessors() self._init_filters() @@ -245,13 +245,13 @@ class Exporter(LoggingConfigurable): nb : Notebook node resources : dict (**kw) of additional resources that can be accessed read/write by - transformers and filters. + preprocessors and filters. """ nb_copy = copy.deepcopy(nb) resources = self._init_resources(resources) # Preprocess - nb_copy, resources = self._transform(nb_copy, resources) + nb_copy, resources = self._preprocess(nb_copy, resources) self._load_template() @@ -300,51 +300,51 @@ class Exporter(LoggingConfigurable): return self.from_notebook_node(nbformat.read(file_stream, 'json'), resources=resources, **kw) - def register_transformer(self, transformer, enabled=False): + def register_preprocessor(self, preprocessor, enabled=False): """ - Register a transformer. - Transformers are classes that act upon the notebook before it is - passed into the Jinja templating engine. Transformers are also + Register a preprocessor. + Preprocessors are classes that act upon the notebook before it is + passed into the Jinja templating engine. Preprocessors are also capable of passing additional information to the Jinja templating engine. Parameters ---------- - transformer : transformer + preprocessor : preprocessor """ - if transformer is None: - raise TypeError('transformer') - isclass = isinstance(transformer, type) + if preprocessor is None: + raise TypeError('preprocessor') + isclass = isinstance(preprocessor, type) constructed = not isclass - #Handle transformer's registration based on it's type - if constructed and isinstance(transformer, py3compat.string_types): - #Transformer is a string, import the namespace and recursively call - #this register_transformer method - transformer_cls = import_item(transformer) - return self.register_transformer(transformer_cls, enabled) + #Handle preprocessor's registration based on it's type + if constructed and isinstance(preprocessor, py3compat.string_types): + #Preprocessor is a string, import the namespace and recursively call + #this register_preprocessor method + preprocessor_cls = import_item(preprocessor) + return self.register_preprocessor(preprocessor_cls, enabled) - if constructed and hasattr(transformer, '__call__'): - #Transformer is a function, no need to construct it. - #Register and return the transformer. + if constructed and hasattr(preprocessor, '__call__'): + #Preprocessor is a function, no need to construct it. + #Register and return the preprocessor. if enabled: - transformer.enabled = True - self._transformers.append(transformer) - return transformer + preprocessor.enabled = True + self._preprocessors.append(preprocessor) + return preprocessor - elif isclass and isinstance(transformer, MetaHasTraits): - #Transformer is configurable. Make sure to pass in new default for + elif isclass and isinstance(preprocessor, MetaHasTraits): + #Preprocessor is configurable. Make sure to pass in new default for #the enabled flag if one was specified. - self.register_transformer(transformer(parent=self), enabled) + self.register_preprocessor(preprocessor(parent=self), enabled) elif isclass: - #Transformer is not configurable, construct it - self.register_transformer(transformer(), enabled) + #Preprocessor is not configurable, construct it + self.register_preprocessor(preprocessor(), enabled) else: - #Transformer is an instance of something without a __call__ + #Preprocessor is an instance of something without a __call__ #attribute. - raise TypeError('transformer') + raise TypeError('preprocessor') def register_filter(self, name, jinja_filter): @@ -435,22 +435,22 @@ class Exporter(LoggingConfigurable): self.environment.comment_end_string = self.jinja_comment_block_end - def _init_transformers(self): + def _init_preprocessors(self): """ - Register all of the transformers needed for this exporter, disabled + Register all of the preprocessors needed for this exporter, disabled unless specified explicitly. """ - self._transformers = [] + self._preprocessors = [] - #Load default transformers (not necessarly enabled by default). - if self.default_transformers: - for transformer in self.default_transformers: - self.register_transformer(transformer) + #Load default preprocessors (not necessarly enabled by default). + if self.default_preprocessors: + for preprocessor in self.default_preprocessors: + self.register_preprocessor(preprocessor) - #Load user transformers. Enable by default. - if self.transformers: - for transformer in self.transformers: - self.register_transformer(transformer, enabled=True) + #Load user preprocessors. Enable by default. + if self.preprocessors: + for preprocessor in self.preprocessors: + self.register_preprocessor(preprocessor, enabled=True) def _init_filters(self): @@ -492,7 +492,7 @@ class Exporter(LoggingConfigurable): return resources - def _transform(self, nb, resources): + def _preprocess(self, nb, resources): """ Preprocess the notebook before passing it into the Jinja engine. To preprocess the notebook is to apply all of the @@ -502,17 +502,17 @@ class Exporter(LoggingConfigurable): nb : notebook node notebook that is being exported. resources : a dict of additional resources that - can be accessed read/write by transformers + can be accessed read/write by preprocessors and filters. """ # Do a copy.deepcopy first, - # we are never safe enough with what the transformers could do. + # we are never safe enough with what the preprocessors could do. nbc = copy.deepcopy(nb) resc = copy.deepcopy(resources) - #Run each transformer on the notebook. Carry the output along - #to each transformer - for transformer in self._transformers: - nbc, resc = transformer(nbc, resc) + #Run each preprocessor on the notebook. Carry the output along + #to each preprocessor + for preprocessor in self._preprocessors: + nbc, resc = preprocessor(nbc, resc) return nbc, resc diff --git a/IPython/nbconvert/exporters/html.py b/IPython/nbconvert/exporters/html.py index f79193d..6e1b18f 100644 --- a/IPython/nbconvert/exporters/html.py +++ b/IPython/nbconvert/exporters/html.py @@ -16,7 +16,7 @@ Exporter that exports Basic HTML. from IPython.utils.traitlets import Unicode, List -from IPython.nbconvert import transformers +from IPython.nbconvert import preprocessors from IPython.config import Config from .exporter import Exporter @@ -29,7 +29,7 @@ class HTMLExporter(Exporter): """ Exports a basic HTML document. This exporter assists with the export of HTML. Inherit from it if you are writing your own HTML template and need - custom transformers/filters. If you don't need custom transformers/ + custom preprocessors/filters. If you don't need custom preprocessors/ filters, just change the 'template_file' config option. """ @@ -44,7 +44,7 @@ class HTMLExporter(Exporter): @property def default_config(self): c = Config({ - 'CSSHTMLHeaderTransformer':{ + 'CSSHTMLHeaderPreprocessor':{ 'enabled':True } }) diff --git a/IPython/nbconvert/exporters/latex.py b/IPython/nbconvert/exporters/latex.py index 453f95b..339c6d4 100755 --- a/IPython/nbconvert/exporters/latex.py +++ b/IPython/nbconvert/exporters/latex.py @@ -23,7 +23,7 @@ import os from IPython.utils.traitlets import Unicode, List from IPython.config import Config -from IPython.nbconvert import filters, transformers +from IPython.nbconvert import filters, preprocessors from .exporter import Exporter #----------------------------------------------------------------------------- @@ -74,16 +74,16 @@ class LatexExporter(Exporter): 'NbConvertBase': { 'display_data_priority' : ['latex', 'pdf', 'png', 'jpg', 'svg', 'jpeg', 'text'] }, - 'ExtractOutputTransformer': { + 'ExtractOutputPreprocessor': { 'enabled':True }, - 'SVG2PDFTransformer': { + 'SVG2PDFPreprocessor': { 'enabled':True }, - 'LatexTransformer': { + 'LatexPreprocessor': { 'enabled':True }, - 'SphinxTransformer': { + 'SphinxPreprocessor': { 'enabled':True } }) diff --git a/IPython/nbconvert/exporters/rst.py b/IPython/nbconvert/exporters/rst.py index 0204e13..d22c6af 100644 --- a/IPython/nbconvert/exporters/rst.py +++ b/IPython/nbconvert/exporters/rst.py @@ -33,6 +33,6 @@ class RSTExporter(Exporter): @property def default_config(self): - c = Config({'ExtractOutputTransformer':{'enabled':True}}) + c = Config({'ExtractOutputPreprocessor':{'enabled':True}}) c.merge(super(RSTExporter,self).default_config) return c diff --git a/IPython/nbconvert/exporters/slides.py b/IPython/nbconvert/exporters/slides.py index 50e7f99..9920206 100644 --- a/IPython/nbconvert/exporters/slides.py +++ b/IPython/nbconvert/exporters/slides.py @@ -16,7 +16,7 @@ Contains slide show exporter from IPython.utils.traitlets import Unicode -from IPython.nbconvert import transformers +from IPython.nbconvert import preprocessors from IPython.config import Config from .exporter import Exporter @@ -41,10 +41,10 @@ class SlidesExporter(Exporter): @property def default_config(self): c = Config({ - 'CSSHTMLHeaderTransformer':{ + 'CSSHTMLHeaderPreprocessor':{ 'enabled':True }, - 'RevealHelpTransformer':{ + 'RevealHelpPreprocessor':{ 'enabled':True, }, }) diff --git a/IPython/nbconvert/exporters/tests/cheese.py b/IPython/nbconvert/exporters/tests/cheese.py index beddc7d..f4a42ce 100644 --- a/IPython/nbconvert/exporters/tests/cheese.py +++ b/IPython/nbconvert/exporters/tests/cheese.py @@ -1,5 +1,5 @@ """ -Contains CheeseTransformer +Contains CheesePreprocessor """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. @@ -13,13 +13,13 @@ Contains CheeseTransformer # Imports #----------------------------------------------------------------------------- -from ...transformers.base import Transformer +from ...preprocessors.base import Preprocessor #----------------------------------------------------------------------------- # Classes #----------------------------------------------------------------------------- -class CheeseTransformer(Transformer): +class CheesePreprocessor(Preprocessor): """ Adds a cheese tag to the resources object """ @@ -29,12 +29,12 @@ class CheeseTransformer(Transformer): """ Public constructor """ - super(CheeseTransformer, self).__init__(**kw) + super(CheesePreprocessor, self).__init__(**kw) - def transform(self, nb, resources): + def preprocess(self, nb, resources): """ - Sphinx transformation to apply on each notebook. + Sphinx preprocessing to apply on each notebook. Parameters ---------- @@ -42,7 +42,7 @@ class CheeseTransformer(Transformer): Notebook being converted resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. """ resources['cheese'] = 'real' return nb, resources diff --git a/IPython/nbconvert/exporters/tests/test_exporter.py b/IPython/nbconvert/exporters/tests/test_exporter.py index 2858dad..edaff1c 100644 --- a/IPython/nbconvert/exporters/tests/test_exporter.py +++ b/IPython/nbconvert/exporters/tests/test_exporter.py @@ -17,7 +17,7 @@ Module with tests for exporter.py from IPython.config import Config from .base import ExportersTestsBase -from .cheese import CheeseTransformer +from .cheese import CheesePreprocessor from ..exporter import Exporter @@ -47,9 +47,9 @@ class TestExporter(ExportersTestsBase): def test_extract_outputs(self): """ - If the ExtractOutputTransformer is enabled, are outputs extracted? + If the ExtractOutputPreprocessor is enabled, are outputs extracted? """ - config = Config({'ExtractOutputTransformer': {'enabled': True}}) + config = Config({'ExtractOutputPreprocessor': {'enabled': True}}) exporter = self._make_exporter(config=config) (output, resources) = exporter.from_filename(self._get_notebook()) assert resources is not None @@ -57,45 +57,45 @@ class TestExporter(ExportersTestsBase): assert len(resources['outputs']) > 0 - def test_transformer_class(self): + def test_preprocessor_class(self): """ - Can a transformer be added to the transformers list by class type? + Can a preprocessor be added to the preprocessors list by class type? """ - config = Config({'Exporter': {'transformers': [CheeseTransformer]}}) + config = Config({'Exporter': {'preprocessors': [CheesePreprocessor]}}) exporter = self._make_exporter(config=config) (output, resources) = exporter.from_filename(self._get_notebook()) assert resources is not None assert resources['cheese'] == 'real' - def test_transformer_instance(self): + def test_preprocessor_instance(self): """ - Can a transformer be added to the transformers list by instance? + Can a preprocessor be added to the preprocessors list by instance? """ - config = Config({'Exporter': {'transformers': [CheeseTransformer()]}}) + config = Config({'Exporter': {'preprocessors': [CheesePreprocessor()]}}) exporter = self._make_exporter(config=config) (output, resources) = exporter.from_filename(self._get_notebook()) assert resources is not None assert resources['cheese'] == 'real' - def test_transformer_dottedobjectname(self): + def test_preprocessor_dottedobjectname(self): """ - Can a transformer be added to the transformers list by dotted object name? + Can a preprocessor be added to the preprocessors list by dotted object name? """ - config = Config({'Exporter': {'transformers': ['IPython.nbconvert.exporters.tests.cheese.CheeseTransformer']}}) + config = Config({'Exporter': {'preprocessors': ['IPython.nbconvert.exporters.tests.cheese.CheesePreprocessor']}}) exporter = self._make_exporter(config=config) (output, resources) = exporter.from_filename(self._get_notebook()) assert resources is not None assert resources['cheese'] == 'real' - def test_transformer_via_method(self): + def test_preprocessor_via_method(self): """ - Can a transformer be added via the Exporter convenience method? + Can a preprocessor be added via the Exporter convenience method? """ exporter = self._make_exporter() - exporter.register_transformer(CheeseTransformer, enabled=True) + exporter.register_preprocessor(CheesePreprocessor, enabled=True) (output, resources) = exporter.from_filename(self._get_notebook()) assert resources is not None assert resources['cheese'] == 'real' @@ -105,4 +105,4 @@ class TestExporter(ExportersTestsBase): #Create the exporter instance, make sure to set a template name since #the base Exporter doesn't have a template associated with it. exporter = Exporter(config=config, template_file='python') - return exporter \ No newline at end of file + return exporter diff --git a/IPython/nbconvert/nbconvertapp.py b/IPython/nbconvert/nbconvertapp.py index df8da61..1f3b3b0 100755 --- a/IPython/nbconvert/nbconvertapp.py +++ b/IPython/nbconvert/nbconvertapp.py @@ -33,7 +33,7 @@ from IPython.utils.importstring import import_item from IPython.utils.text import dedent from .exporters.export import get_export_names, exporter_map -from IPython.nbconvert import exporters, transformers, writers, post_processors +from IPython.nbconvert import exporters, preprocessors, writers, post_processors from .utils.base import NbConvertBase from .utils.exceptions import ConversionException @@ -88,7 +88,7 @@ class NbConvertApp(BaseIPythonApplication): def _classes_default(self): classes = [NbConvertBase] - for pkg in (exporters, transformers, writers): + for pkg in (exporters, preprocessors, writers): for name in dir(pkg): cls = getattr(pkg, name) if isinstance(cls, type) and issubclass(cls, Configurable): diff --git a/IPython/nbconvert/transformers/__init__.py b/IPython/nbconvert/transformers/__init__.py index 4626747..4f3e490 100755 --- a/IPython/nbconvert/transformers/__init__.py +++ b/IPython/nbconvert/transformers/__init__.py @@ -1,12 +1,12 @@ -# Class base Transformers -from .base import Transformer -from .convertfigures import ConvertFiguresTransformer -from .svg2pdf import SVG2PDFTransformer -from .extractoutput import ExtractOutputTransformer -from .revealhelp import RevealHelpTransformer -from .latex import LatexTransformer -from .sphinx import SphinxTransformer -from .csshtmlheader import CSSHTMLHeaderTransformer +# Class base Preprocessors +from .base import Preprocessor +from .convertfigures import ConvertFiguresPreprocessor +from .svg2pdf import SVG2PDFPreprocessor +from .extractoutput import ExtractOutputPreprocessor +from .revealhelp import RevealHelpPreprocessor +from .latex import LatexPreprocessor +from .sphinx import SphinxPreprocessor +from .csshtmlheader import CSSHTMLHeaderPreprocessor -# decorated function Transformers +# decorated function Preprocessors from .coalescestreams import coalesce_streams diff --git a/IPython/nbconvert/transformers/base.py b/IPython/nbconvert/transformers/base.py index d38df62..fec1a1d 100755 --- a/IPython/nbconvert/transformers/base.py +++ b/IPython/nbconvert/transformers/base.py @@ -1,5 +1,5 @@ """ -Module that re-groups transformer that would be applied to ipynb files +Module that re-groups preprocessor that would be applied to ipynb files before going through the templating machinery. It exposes a convenient class to inherit from to access configurability. @@ -23,20 +23,20 @@ from IPython.utils.traitlets import Bool # Classes and Functions #----------------------------------------------------------------------------- -class Transformer(NbConvertBase): - """ A configurable transformer +class Preprocessor(NbConvertBase): + """ A configurable preprocessor Inherit from this class if you wish to have configurability for your - transformer. + preprocessor. Any configurable traitlets this class exposed will be configurable in profiles using c.SubClassName.atribute=value - you can overwrite :meth:`transform_cell` to apply a transformation independently on each cell - or :meth:`transform` if you prefer your own logic. See corresponding docstring for informations. + you can overwrite :meth:`preprocess_cell` to apply a preprocessation independently on each cell + or :meth:`preprocess` if you prefer your own logic. See corresponding docstring for informations. Disabled by default and can be enabled via the config by - 'c.YourTransformerName.enabled = True' + 'c.YourPreprocessorName.enabled = True' """ enabled = Bool(False, config=True) @@ -53,23 +53,23 @@ class Transformer(NbConvertBase): Additional arguments """ - super(Transformer, self).__init__(**kw) + super(Preprocessor, self).__init__(**kw) def __call__(self, nb, resources): if self.enabled: - return self.transform(nb,resources) + return self.preprocess(nb,resources) else: return nb, resources - def transform(self, nb, resources): + def preprocess(self, nb, resources): """ - Transformation to apply on each notebook. + preprocessation to apply on each notebook. You should return modified nb, resources. - If you wish to apply your transform on each cell, you might want to - overwrite transform_cell method instead. + If you wish to apply your preprocess on each cell, you might want to + overwrite preprocess_cell method instead. Parameters ---------- @@ -77,21 +77,21 @@ class Transformer(NbConvertBase): Notebook being converted resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. """ - self.log.debug("Applying transform: %s", self.__class__.__name__) + self.log.debug("Applying preprocess: %s", self.__class__.__name__) try : for worksheet in nb.worksheets: for index, cell in enumerate(worksheet.cells): - worksheet.cells[index], resources = self.transform_cell(cell, resources, index) + worksheet.cells[index], resources = self.preprocess_cell(cell, resources, index) return nb, resources except NotImplementedError: raise NotImplementedError('should be implemented by subclass') - def transform_cell(self, cell, resources, index): + def preprocess_cell(self, cell, resources, index): """ - Overwrite if you want to apply a transformation on each cell. You + Overwrite if you want to apply a preprocessation on each cell. You should return modified cell and resource dictionary. Parameters @@ -100,7 +100,7 @@ class Transformer(NbConvertBase): Notebook cell being processed resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. index : int Index of the cell being processed """ diff --git a/IPython/nbconvert/transformers/coalescestreams.py b/IPython/nbconvert/transformers/coalescestreams.py index 73be4c5..5d906a8 100644 --- a/IPython/nbconvert/transformers/coalescestreams.py +++ b/IPython/nbconvert/transformers/coalescestreams.py @@ -24,7 +24,7 @@ def cell_preprocessor(function): Notebook cell being processed resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. index : int Index of the cell being processed """ diff --git a/IPython/nbconvert/transformers/convertfigures.py b/IPython/nbconvert/transformers/convertfigures.py index 25c084a..1c0ddc1 100644 --- a/IPython/nbconvert/transformers/convertfigures.py +++ b/IPython/nbconvert/transformers/convertfigures.py @@ -1,4 +1,4 @@ -"""Module containing a transformer that converts outputs in the notebook from +"""Module containing a preprocessor that converts outputs in the notebook from one format to another. """ #----------------------------------------------------------------------------- @@ -13,14 +13,14 @@ one format to another. # Imports #----------------------------------------------------------------------------- -from .base import Transformer +from .base import Preprocessor from IPython.utils.traitlets import Unicode #----------------------------------------------------------------------------- # Classes #----------------------------------------------------------------------------- -class ConvertFiguresTransformer(Transformer): +class ConvertFiguresPreprocessor(Preprocessor): """ Converts all of the outputs in a notebook from one format to another. """ @@ -32,14 +32,14 @@ class ConvertFiguresTransformer(Transformer): """ Public constructor """ - super(ConvertFiguresTransformer, self).__init__(**kw) + super(ConvertFiguresPreprocessor, self).__init__(**kw) def convert_figure(self, data_format, data): raise NotImplementedError() - def transform_cell(self, cell, resources, cell_index): + def preprocess_cell(self, cell, resources, cell_index): """ Apply a transformation on each cell, diff --git a/IPython/nbconvert/transformers/csshtmlheader.py b/IPython/nbconvert/transformers/csshtmlheader.py index f7762a2..decae7d 100755 --- a/IPython/nbconvert/transformers/csshtmlheader.py +++ b/IPython/nbconvert/transformers/csshtmlheader.py @@ -19,7 +19,7 @@ from pygments.formatters import HtmlFormatter from IPython.utils import path -from .base import Transformer +from .base import Preprocessor from IPython.utils.traitlets import Unicode @@ -27,9 +27,9 @@ from IPython.utils.traitlets import Unicode # Classes and functions #----------------------------------------------------------------------------- -class CSSHTMLHeaderTransformer(Transformer): +class CSSHTMLHeaderPreprocessor(Preprocessor): """ - Transformer used to pre-process notebook for HTML output. Adds IPython notebook + Preprocessor used to pre-process notebook for HTML output. Adds IPython notebook front-end CSS and Pygments CSS to HTML output. """ @@ -50,13 +50,13 @@ class CSSHTMLHeaderTransformer(Transformer): Additional arguments """ - super(CSSHTMLHeaderTransformer, self).__init__(config=config, **kw) + super(CSSHTMLHeaderPreprocessor, self).__init__(config=config, **kw) if self.enabled : self._regen_header() - def transform(self, nb, resources): + def preprocess(self, nb, resources): """Fetch and add CSS to the resource dictionary Fetch CSS from IPython and Pygments to add at the beginning @@ -69,7 +69,7 @@ class CSSHTMLHeaderTransformer(Transformer): Notebook being converted resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. """ resources['inlining'] = {} diff --git a/IPython/nbconvert/transformers/extractoutput.py b/IPython/nbconvert/transformers/extractoutput.py index d6a83ae..961fde0 100755 --- a/IPython/nbconvert/transformers/extractoutput.py +++ b/IPython/nbconvert/transformers/extractoutput.py @@ -1,4 +1,4 @@ -"""Module containing a transformer that extracts all of the outputs from the +"""Module containing a preprocessor that extracts all of the outputs from the notebook file. The extracted outputs are returned in the 'resources' dictionary. """ #----------------------------------------------------------------------------- @@ -18,14 +18,14 @@ import sys import os from IPython.utils.traitlets import Unicode -from .base import Transformer +from .base import Preprocessor from IPython.utils import py3compat #----------------------------------------------------------------------------- # Classes #----------------------------------------------------------------------------- -class ExtractOutputTransformer(Transformer): +class ExtractOutputPreprocessor(Preprocessor): """ Extracts all of the outputs from the notebook file. The extracted outputs are returned in the 'resources' dictionary. @@ -35,7 +35,7 @@ class ExtractOutputTransformer(Transformer): "{unique_key}_{cell_index}_{index}.{extension}", config=True) - def transform_cell(self, cell, resources, cell_index): + def preprocess_cell(self, cell, resources, cell_index): """ Apply a transformation on each cell, @@ -45,7 +45,7 @@ class ExtractOutputTransformer(Transformer): Notebook cell being processed resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. cell_index : int Index of the cell being processed (see base.py) """ diff --git a/IPython/nbconvert/transformers/latex.py b/IPython/nbconvert/transformers/latex.py index 2940d7e..6c04d5e 100755 --- a/IPython/nbconvert/transformers/latex.py +++ b/IPython/nbconvert/transformers/latex.py @@ -16,22 +16,22 @@ they are converted. from __future__ import print_function, absolute_import # Our own imports -# Needed to override transformer -from .base import (Transformer) +# Needed to override preprocessor +from .base import (Preprocessor) from IPython.nbconvert import filters #----------------------------------------------------------------------------- # Classes #----------------------------------------------------------------------------- -class LatexTransformer(Transformer): +class LatexPreprocessor(Preprocessor): """ Converter for latex destined documents. """ - def transform_cell(self, cell, resources, index): + def preprocess_cell(self, cell, resources, index): """ - Apply a transformation on each cell, + Apply a preprocessation on each cell, Parameters ---------- @@ -39,7 +39,7 @@ class LatexTransformer(Transformer): Notebook cell being processed resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. index : int Modified index of the cell being processed (see base.py) """ diff --git a/IPython/nbconvert/transformers/revealhelp.py b/IPython/nbconvert/transformers/revealhelp.py index a07c64f..ae1110e 100755 --- a/IPython/nbconvert/transformers/revealhelp.py +++ b/IPython/nbconvert/transformers/revealhelp.py @@ -15,14 +15,14 @@ import os import urllib2 -from .base import Transformer +from .base import Preprocessor from IPython.utils.traitlets import Unicode, Bool #----------------------------------------------------------------------------- # Classes and functions #----------------------------------------------------------------------------- -class RevealHelpTransformer(Transformer): +class RevealHelpPreprocessor(Preprocessor): url_prefix = Unicode('//cdn.jsdelivr.net/reveal.js/2.4.0', config=True, @@ -34,9 +34,9 @@ class RevealHelpTransformer(Transformer): help="""If you want to use the speaker notes set this to True.""") - def transform(self, nb, resources): + def preprocess(self, nb, resources): """ - Called once to 'transform' contents of the notebook. + Called once to 'preprocess' contents of the notebook. Parameters ---------- @@ -44,7 +44,7 @@ class RevealHelpTransformer(Transformer): Notebook being converted resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. """ for worksheet in nb.worksheets : diff --git a/IPython/nbconvert/transformers/sphinx.py b/IPython/nbconvert/transformers/sphinx.py index 8badb80..6974291 100755 --- a/IPython/nbconvert/transformers/sphinx.py +++ b/IPython/nbconvert/transformers/sphinx.py @@ -30,8 +30,8 @@ from pygments.formatters import LatexFormatter # Configurable traitlets from IPython.utils.traitlets import Unicode, Bool -# Needed to override transformer -from .base import (Transformer) +# Needed to override preprocessor +from .base import (Preprocessor) from IPython.nbconvert.utils import console @@ -39,11 +39,11 @@ from IPython.nbconvert.utils import console # Classes and functions #----------------------------------------------------------------------------- -class SphinxTransformer(Transformer): +class SphinxPreprocessor(Preprocessor): """ - Sphinx utility transformer. + Sphinx utility preprocessor. - This transformer is used to set variables needed by the latex to build + This preprocessor is used to set variables needed by the latex to build Sphinx stylized templates. """ @@ -109,9 +109,9 @@ class SphinxTransformer(Transformer): overridetitle = Unicode("", config=True, help="") - def transform(self, nb, resources): + def preprocess(self, nb, resources): """ - Sphinx transformation to apply on each notebook. + Sphinx preprocessing to apply on each notebook. Parameters ---------- @@ -119,7 +119,7 @@ class SphinxTransformer(Transformer): Notebook being converted resources : dictionary Additional resources used in the conversion process. Allows - transformers to pass variables into the Jinja engine. + preprocessors to pass variables into the Jinja engine. """ # import sphinx here, so that sphinx is not a dependency when it's not used import sphinx diff --git a/IPython/nbconvert/transformers/svg2pdf.py b/IPython/nbconvert/transformers/svg2pdf.py index b76bc8b..2e39c83 100644 --- a/IPython/nbconvert/transformers/svg2pdf.py +++ b/IPython/nbconvert/transformers/svg2pdf.py @@ -1,4 +1,4 @@ -"""Module containing a transformer that converts outputs in the notebook from +"""Module containing a preprocessor that converts outputs in the notebook from one format to another. """ #----------------------------------------------------------------------------- @@ -22,7 +22,7 @@ import subprocess from IPython.utils.tempdir import TemporaryDirectory from IPython.utils.traitlets import Unicode -from .convertfigures import ConvertFiguresTransformer +from .convertfigures import ConvertFiguresPreprocessor #----------------------------------------------------------------------------- @@ -35,7 +35,7 @@ INKSCAPE_APP = '/Applications/Inkscape.app/Contents/Resources/bin/inkscape' # Classes #----------------------------------------------------------------------------- -class SVG2PDFTransformer(ConvertFiguresTransformer): +class SVG2PDFPreprocessor(ConvertFiguresPreprocessor): """ Converts all of the outputs in a notebook from SVG to PDF. """ diff --git a/IPython/nbconvert/transformers/tests/base.py b/IPython/nbconvert/transformers/tests/base.py index 56fb249..8c72e51 100644 --- a/IPython/nbconvert/transformers/tests/base.py +++ b/IPython/nbconvert/transformers/tests/base.py @@ -1,5 +1,5 @@ """ -Module with utility functions for transformer tests +Module with utility functions for preprocessor tests """ #----------------------------------------------------------------------------- @@ -23,12 +23,12 @@ from ...exporters.exporter import ResourcesDict # Class #----------------------------------------------------------------------------- -class TransformerTestsBase(TestsBase): - """Contains test functions transformer tests""" +class PreprocessorTestsBase(TestsBase): + """Contains test functions preprocessor tests""" def build_notebook(self): - """Build a notebook in memory for use with transformer tests""" + """Build a notebook in memory for use with preprocessor tests""" outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a"), nbformat.new_output(output_type="text", output_text="b"), @@ -50,4 +50,4 @@ class TransformerTestsBase(TestsBase): res = ResourcesDict() res['metadata'] = ResourcesDict() - return res \ No newline at end of file + return res diff --git a/IPython/nbconvert/transformers/tests/test_coalescestreams.py b/IPython/nbconvert/transformers/tests/test_coalescestreams.py index 548d48f..ad476d8 100644 --- a/IPython/nbconvert/transformers/tests/test_coalescestreams.py +++ b/IPython/nbconvert/transformers/tests/test_coalescestreams.py @@ -1,5 +1,5 @@ """ -Module with tests for the coalescestreams transformer +Module with tests for the coalescestreams preprocessor """ #----------------------------------------------------------------------------- @@ -14,7 +14,7 @@ Module with tests for the coalescestreams transformer # Imports #----------------------------------------------------------------------------- -from .base import TransformerTestsBase +from .base import PreprocessorTestsBase from ..coalescestreams import coalesce_streams @@ -22,11 +22,11 @@ from ..coalescestreams import coalesce_streams # Class #----------------------------------------------------------------------------- -class TestCoalesceStreams(TransformerTestsBase): +class TestCoalesceStreams(PreprocessorTestsBase): """Contains test functions for coalescestreams.py""" def test_coalesce_streams(self): - """coalesce_streams transformer output test""" + """coalesce_streams preprocessor output test""" nb = self.build_notebook() res = self.build_resources() nb, res = coalesce_streams(nb, res) @@ -35,4 +35,4 @@ class TestCoalesceStreams(TransformerTestsBase): self.assertEqual(outputs[1].output_type, "text") self.assertEqual(outputs[2].text, "cd") self.assertEqual(outputs[3].text, "ef") - \ No newline at end of file + diff --git a/IPython/nbconvert/transformers/tests/test_csshtmlheader.py b/IPython/nbconvert/transformers/tests/test_csshtmlheader.py index 7b41a5e..c259bad 100644 --- a/IPython/nbconvert/transformers/tests/test_csshtmlheader.py +++ b/IPython/nbconvert/transformers/tests/test_csshtmlheader.py @@ -1,5 +1,5 @@ """ -Module with tests for the csshtmlheader transformer +Module with tests for the csshtmlheader preprocessor """ #----------------------------------------------------------------------------- @@ -14,34 +14,34 @@ Module with tests for the csshtmlheader transformer # Imports #----------------------------------------------------------------------------- -from .base import TransformerTestsBase -from ..csshtmlheader import CSSHTMLHeaderTransformer +from .base import PreprocessorTestsBase +from ..csshtmlheader import CSSHTMLHeaderPreprocessor #----------------------------------------------------------------------------- # Class #----------------------------------------------------------------------------- -class TestCSSHTMLHeader(TransformerTestsBase): +class TestCSSHTMLHeader(PreprocessorTestsBase): """Contains test functions for csshtmlheader.py""" - def build_transformer(self): - """Make an instance of a transformer""" - transformer = CSSHTMLHeaderTransformer() - transformer.enabled = True - return transformer + def build_preprocessor(self): + """Make an instance of a preprocessor""" + preprocessor = CSSHTMLHeaderPreprocessor() + preprocessor.enabled = True + return preprocessor def test_constructor(self): - """Can a CSSHTMLHeaderTransformer be constructed?""" - self.build_transformer() + """Can a CSSHTMLHeaderPreprocessor be constructed?""" + self.build_preprocessor() def test_output(self): - """Test the output of the CSSHTMLHeaderTransformer""" + """Test the output of the CSSHTMLHeaderPreprocessor""" nb = self.build_notebook() res = self.build_resources() - transformer = self.build_transformer() - nb, res = transformer(nb, res) - assert 'css' in res['inlining'] \ No newline at end of file + preprocessor = self.build_preprocessor() + nb, res = preprocessor(nb, res) + assert 'css' in res['inlining'] diff --git a/IPython/nbconvert/transformers/tests/test_extractoutput.py b/IPython/nbconvert/transformers/tests/test_extractoutput.py index 1da1988..4a13ebd 100644 --- a/IPython/nbconvert/transformers/tests/test_extractoutput.py +++ b/IPython/nbconvert/transformers/tests/test_extractoutput.py @@ -1,5 +1,5 @@ """ -Module with tests for the extractoutput transformer +Module with tests for the extractoutput preprocessor """ #----------------------------------------------------------------------------- @@ -14,36 +14,36 @@ Module with tests for the extractoutput transformer # Imports #----------------------------------------------------------------------------- -from .base import TransformerTestsBase -from ..extractoutput import ExtractOutputTransformer +from .base import PreprocessorTestsBase +from ..extractoutput import ExtractOutputPreprocessor #----------------------------------------------------------------------------- # Class #----------------------------------------------------------------------------- -class TestExtractOutput(TransformerTestsBase): +class TestExtractOutput(PreprocessorTestsBase): """Contains test functions for extractoutput.py""" - def build_transformer(self): - """Make an instance of a transformer""" - transformer = ExtractOutputTransformer() - transformer.enabled = True - return transformer + def build_preprocessor(self): + """Make an instance of a preprocessor""" + preprocessor = ExtractOutputPreprocessor() + preprocessor.enabled = True + return preprocessor def test_constructor(self): - """Can a ExtractOutputTransformer be constructed?""" - self.build_transformer() + """Can a ExtractOutputPreprocessor be constructed?""" + self.build_preprocessor() def test_output(self): - """Test the output of the ExtractOutputTransformer""" + """Test the output of the ExtractOutputPreprocessor""" nb = self.build_notebook() res = self.build_resources() - transformer = self.build_transformer() - nb, res = transformer(nb, res) + preprocessor = self.build_preprocessor() + nb, res = preprocessor(nb, res) # Check if text was extracted. assert 'text_filename' in nb.worksheets[0].cells[0].outputs[1] diff --git a/IPython/nbconvert/transformers/tests/test_latex.py b/IPython/nbconvert/transformers/tests/test_latex.py index ab0b274..3d46fd9 100644 --- a/IPython/nbconvert/transformers/tests/test_latex.py +++ b/IPython/nbconvert/transformers/tests/test_latex.py @@ -1,5 +1,5 @@ """ -Module with tests for the latex transformer +Module with tests for the latex preprocessor """ #----------------------------------------------------------------------------- @@ -14,35 +14,35 @@ Module with tests for the latex transformer # Imports #----------------------------------------------------------------------------- -from .base import TransformerTestsBase -from ..latex import LatexTransformer +from .base import PreprocessorTestsBase +from ..latex import LatexPreprocessor #----------------------------------------------------------------------------- # Class #----------------------------------------------------------------------------- -class TestLatex(TransformerTestsBase): +class TestLatex(PreprocessorTestsBase): """Contains test functions for latex.py""" - def build_transformer(self): - """Make an instance of a transformer""" - transformer = LatexTransformer() - transformer.enabled = True - return transformer + def build_preprocessor(self): + """Make an instance of a preprocessor""" + preprocessor = LatexPreprocessor() + preprocessor.enabled = True + return preprocessor def test_constructor(self): - """Can a LatexTransformer be constructed?""" - self.build_transformer() + """Can a LatexPreprocessor be constructed?""" + self.build_preprocessor() def test_output(self): - """Test the output of the LatexTransformer""" + """Test the output of the LatexPreprocessor""" nb = self.build_notebook() res = self.build_resources() - transformer = self.build_transformer() - nb, res = transformer(nb, res) + preprocessor = self.build_preprocessor() + nb, res = preprocessor(nb, res) # Make sure the code cell wasn't modified. self.assertEqual(nb.worksheets[0].cells[0].input, '$ e $') diff --git a/IPython/nbconvert/transformers/tests/test_revealhelp.py b/IPython/nbconvert/transformers/tests/test_revealhelp.py index 126564e..690bf09 100644 --- a/IPython/nbconvert/transformers/tests/test_revealhelp.py +++ b/IPython/nbconvert/transformers/tests/test_revealhelp.py @@ -1,5 +1,5 @@ """ -Module with tests for the revealhelp transformer +Module with tests for the revealhelp preprocessor """ #----------------------------------------------------------------------------- @@ -16,20 +16,20 @@ Module with tests for the revealhelp transformer from IPython.nbformat import current as nbformat -from .base import TransformerTestsBase -from ..revealhelp import RevealHelpTransformer +from .base import PreprocessorTestsBase +from ..revealhelp import RevealHelpPreprocessor #----------------------------------------------------------------------------- # Class #----------------------------------------------------------------------------- -class Testrevealhelp(TransformerTestsBase): +class Testrevealhelp(PreprocessorTestsBase): """Contains test functions for revealhelp.py""" def build_notebook(self): """Build a reveal slides notebook in memory for use with tests. - Overrides base in TransformerTestsBase""" + Overrides base in PreprocessorTestsBase""" outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a")] @@ -46,34 +46,34 @@ class Testrevealhelp(TransformerTestsBase): return nbformat.new_notebook(name="notebook1", worksheets=worksheets) - def build_transformer(self): - """Make an instance of a transformer""" - transformer = RevealHelpTransformer() - transformer.enabled = True - return transformer + def build_preprocessor(self): + """Make an instance of a preprocessor""" + preprocessor = RevealHelpPreprocessor() + preprocessor.enabled = True + return preprocessor def test_constructor(self): - """Can a RevealHelpTransformer be constructed?""" - self.build_transformer() + """Can a RevealHelpPreprocessor be constructed?""" + self.build_preprocessor() def test_reveal_attribute(self): """Make sure the reveal url_prefix resources is set""" nb = self.build_notebook() res = self.build_resources() - transformer = self.build_transformer() - nb, res = transformer(nb, res) + preprocessor = self.build_preprocessor() + nb, res = preprocessor(nb, res) assert 'reveal' in res assert 'url_prefix' in res['reveal'] def test_reveal_output(self): - """Make sure that the reveal transformer """ + """Make sure that the reveal preprocessor """ nb = self.build_notebook() res = self.build_resources() - transformer = self.build_transformer() - nb, res = transformer(nb, res) + preprocessor = self.build_preprocessor() + nb, res = preprocessor(nb, res) cells = nb.worksheets[0].cells # Make sure correct metadata tags are available on every cell. diff --git a/IPython/nbconvert/transformers/tests/test_sphinx.py b/IPython/nbconvert/transformers/tests/test_sphinx.py index 6c65578..06346cb 100644 --- a/IPython/nbconvert/transformers/tests/test_sphinx.py +++ b/IPython/nbconvert/transformers/tests/test_sphinx.py @@ -1,5 +1,5 @@ """ -Module with tests for the sphinx transformer +Module with tests for the sphinx preprocessor """ #----------------------------------------------------------------------------- @@ -14,37 +14,37 @@ Module with tests for the sphinx transformer # Imports #----------------------------------------------------------------------------- -from .base import TransformerTestsBase -from ..sphinx import SphinxTransformer +from .base import PreprocessorTestsBase +from ..sphinx import SphinxPreprocessor #----------------------------------------------------------------------------- # Class #----------------------------------------------------------------------------- -class TestSphinx(TransformerTestsBase): +class TestSphinx(PreprocessorTestsBase): """Contains test functions for sphinx.py""" - def build_transformer(self): - """Make an instance of a transformer""" - transformer = SphinxTransformer() - transformer.enabled = True - return transformer + def build_preprocessor(self): + """Make an instance of a preprocessor""" + preprocessor = SphinxPreprocessor() + preprocessor.enabled = True + return preprocessor def test_constructor(self): - """Can a SphinxTransformer be constructed?""" - self.build_transformer() + """Can a SphinxPreprocessor be constructed?""" + self.build_preprocessor() def test_resources(self): - """Make sure the SphinxTransformer adds the appropriate resources to the + """Make sure the SphinxPreprocessor adds the appropriate resources to the resources dict.""" nb = self.build_notebook() res = self.build_resources() - transformer = self.build_transformer() - nb, res = transformer(nb, res) + preprocessor = self.build_preprocessor() + nb, res = preprocessor(nb, res) assert "author" in res['sphinx'] assert "version" in res['sphinx'] assert "release" in res['sphinx'] diff --git a/IPython/nbconvert/transformers/tests/test_svg2pdf.py b/IPython/nbconvert/transformers/tests/test_svg2pdf.py index 3914b54..9e8fb81 100644 --- a/IPython/nbconvert/transformers/tests/test_svg2pdf.py +++ b/IPython/nbconvert/transformers/tests/test_svg2pdf.py @@ -1,5 +1,5 @@ """ -Module with tests for the svg2pdf transformer +Module with tests for the svg2pdf preprocessor """ #----------------------------------------------------------------------------- @@ -17,15 +17,15 @@ Module with tests for the svg2pdf transformer from IPython.testing import decorators as dec from IPython.nbformat import current as nbformat -from .base import TransformerTestsBase -from ..svg2pdf import SVG2PDFTransformer +from .base import PreprocessorTestsBase +from ..svg2pdf import SVG2PDFPreprocessor #----------------------------------------------------------------------------- # Class #----------------------------------------------------------------------------- -class Testsvg2pdf(TransformerTestsBase): +class Testsvg2pdf(PreprocessorTestsBase): """Contains test functions for svg2pdf.py""" simple_svg = """ @@ -55,7 +55,7 @@ class Testsvg2pdf(TransformerTestsBase): def build_notebook(self): """Build a reveal slides notebook in memory for use with tests. - Overrides base in TransformerTestsBase""" + Overrides base in PreprocessorTestsBase""" outputs = [nbformat.new_output(output_type="svg", output_svg=self.simple_svg)] @@ -68,23 +68,23 @@ class Testsvg2pdf(TransformerTestsBase): return nbformat.new_notebook(name="notebook1", worksheets=worksheets) - def build_transformer(self): - """Make an instance of a transformer""" - transformer = SVG2PDFTransformer() - transformer.enabled = True - return transformer + def build_preprocessor(self): + """Make an instance of a preprocessor""" + preprocessor = SVG2PDFPreprocessor() + preprocessor.enabled = True + return preprocessor def test_constructor(self): - """Can a SVG2PDFTransformer be constructed?""" - self.build_transformer() + """Can a SVG2PDFPreprocessor be constructed?""" + self.build_preprocessor() @dec.onlyif_cmds_exist('inkscape') def test_output(self): - """Test the output of the SVG2PDFTransformer""" + """Test the output of the SVG2PDFPreprocessor""" nb = self.build_notebook() res = self.build_resources() - transformer = self.build_transformer() - nb, res = transformer(nb, res) + preprocessor = self.build_preprocessor() + nb, res = preprocessor(nb, res) assert 'svg' in nb.worksheets[0].cells[0].outputs[0] diff --git a/IPython/nbconvert/writers/files.py b/IPython/nbconvert/writers/files.py index 51d8e9c..35aca20 100644 --- a/IPython/nbconvert/writers/files.py +++ b/IPython/nbconvert/writers/files.py @@ -70,7 +70,7 @@ class FilesWriter(WriterBase): # Write all of the extracted resources to the destination directory. # NOTE: WE WRITE EVERYTHING AS-IF IT'S BINARY. THE EXTRACT FIG - # TRANSFORMER SHOULD HANDLE UNIX/WINDOWS LINE ENDINGS... + # PREPROCESSOR SHOULD HANDLE UNIX/WINDOWS LINE ENDINGS... for filename, data in resources.get('outputs', {}).items(): # Determine where to write the file to @@ -112,4 +112,4 @@ class FilesWriter(WriterBase): self.log.info("Writing %i bytes to %s", len(output), dest) with io.open(dest, 'w', encoding='utf-8') as f: f.write(output) - return dest \ No newline at end of file + return dest diff --git a/docs/source/whatsnew/development.rst b/docs/source/whatsnew/development.rst index c919fbb..9455fe8 100644 --- a/docs/source/whatsnew/development.rst +++ b/docs/source/whatsnew/development.rst @@ -10,7 +10,7 @@ Backwards incompatible changes * Python 2.6 and 3.2 are no longer supported: the minimum required Python versions are now 2.7 and 3.3. -* The `call` methods for nbconvert transformers has been renamed to - `transform`. +* The Transformer classes have been renamed to Preprocessor in nbconvert and + their `call` methods for them have been renamed to `preprocess`. * The `call` methods of nbconvert post-processsors have been renamed to `postprocess`.