##// END OF EJS Templates
Move the pygments definition importing logic from the...
Jonathan Frederic -
Show More
@@ -15,8 +15,10 b' they are converted.'
15
15
16 from __future__ import print_function, absolute_import
16 from __future__ import print_function, absolute_import
17
17
18 # Our own imports
18 # Third-party import, needed for Pygments latex definitions.
19 # Needed to override preprocessor
19 from pygments.formatters import LatexFormatter
20
21 # ipy imports
20 from .base import (Preprocessor)
22 from .base import (Preprocessor)
21 from IPython.nbconvert import filters
23 from IPython.nbconvert import filters
22
24
@@ -29,6 +31,23 b' class LatexPreprocessor(Preprocessor):'
29 Converter for latex destined documents.
31 Converter for latex destined documents.
30 """
32 """
31
33
34 def preprocess(self, nb, resources):
35 """
36 Preprocessing to apply on each notebook.
37
38 Parameters
39 ----------
40 nb : NotebookNode
41 Notebook being converted
42 resources : dictionary
43 Additional resources used in the conversion process. Allows
44 preprocessors to pass variables into the Jinja engine.
45 """
46 # Generate Pygments definitions for Latex
47 resources["pygment_definitions"] = LatexFormatter().get_style_defs()
48 return super(LatexPreprocessor, self).preprocess(nb, resources)
49
50
32 def preprocess_cell(self, cell, resources, index):
51 def preprocess_cell(self, cell, resources, index):
33 """
52 """
34 Apply a transformation on each cell,
53 Apply a transformation on each cell,
General Comments 0
You need to be logged in to leave comments. Login now