##// END OF EJS Templates
Added imports
Jonathan Frederic -
Show More
@@ -18,7 +18,24 b' before conversion and jinja filter that would then be available in the templates'
18 18 #-----------------------------------------------------------------------------
19 19 # Imports
20 20 #-----------------------------------------------------------------------------
21
22 # Stdlib imports
23 import io
24 import os
25
26 # IPython imports
27 from IPython.config.configurable import Configurable
28 from IPython.nbformat import current as nbformat
29 from IPython.utils.traitlets import MetaHasTraits, Unicode, List, Bool
30 from IPython.utils.text import indent
31
32 # other libs/dependencies
33 from jinja2 import Environment, FileSystemLoader
34 from markdown import markdown
35
21 36 import base.Exporter as Exporter
37 import filters.latex
38 import filters.pygments
22 39
23 40 #Try to import the Sphinx exporter. If the user doesn't have Sphinx isntalled
24 41 #on his/her machine, fail silently.
@@ -82,10 +99,6 b' class LatexExporter(Exporter):'
82 99 super(Exporter, self).__init__(config=config, **kw)
83 100
84 101 #For compatibility, TODO: remove later.
85 self.preprocessors.append(trans.coalesce_streams)
86 self.preprocessors.append(trans.ExtractFigureTransformer(config=config))
87 self.preprocessors.append(trans.RevealHelpTransformer(config=config))
88 self.preprocessors.append(trans.CSSHtmlHeaderTransformer(config=config))
89 102 self.preprocessors.append(LatexTransformer(config=config))
90 103
91 104 #Only load the sphinx transformer if the file reference worked
@@ -94,8 +107,8 b' class LatexExporter(Exporter):'
94 107 self.preprocessors.append(SphinxTransformer(config=config))
95 108
96 109 #Add filters to the Jinja2 environment
97 self.env.filters['escape_tex'] = filters.latex.escape_tex
98 self.env.filters['highlight'] = filters.pygments.highlight2latex
110 self.register_filter('escape_tex', filters.latex.escape_tex)
111 self.register_filter('highlight', filters.pygments.highlight2latex)
99 112
100 113 #Load user filters. Overwrite existing filters if need be.
101 114 for key, user_filter in jinja_filters.iteritems():
General Comments 0
You need to be logged in to leave comments. Login now