##// END OF EJS Templates
remove and clean code
Matthias BUSSONNIER -
Show More
@@ -18,17 +18,11 b' a conversion of IPython notebooks to some other format should inherit.'
18 from __future__ import print_function, absolute_import
18 from __future__ import print_function, absolute_import
19
19
20 # Stdlib imports
20 # Stdlib imports
21 import jinja2
22 import codecs
23 import io
21 import io
24 import logging
25 import os
22 import os
26 from IPython.utils import path
23 from IPython.utils import path
27 import pprint
28 import re
29 from types import FunctionType
30
24
31 from jinja2 import Environment, PackageLoader, FileSystemLoader
25 from jinja2 import Environment, FileSystemLoader
32 env = Environment(
26 env = Environment(
33 loader=FileSystemLoader('./templates/'),
27 loader=FileSystemLoader('./templates/'),
34 extensions=['jinja2.ext.loopcontrols']
28 extensions=['jinja2.ext.loopcontrols']
@@ -36,9 +30,8 b' env = Environment('
36
30
37 # IPython imports
31 # IPython imports
38 from IPython.nbformat import current as nbformat
32 from IPython.nbformat import current as nbformat
39 from IPython.config.configurable import Configurable, SingletonConfigurable
33 from IPython.config.configurable import Configurable
40 from IPython.utils.traitlets import (List, Unicode, Type, Bool, Dict, CaselessStrEnum,
34 from IPython.utils.traitlets import ( Unicode, Any)
41 Any)
42
35
43 # Our own imports
36 # Our own imports
44 from IPython.utils.text import indent
37 from IPython.utils.text import indent
@@ -125,12 +118,8 b' class ConverterTemplate(Configurable):'
125
118
126 def __init__(self, tplfile='fullhtml', config=None, **kw):
119 def __init__(self, tplfile='fullhtml', config=None, **kw):
127 self.template = env.get_template(tplfile+'.tpl')
120 self.template = env.get_template(tplfile+'.tpl')
128 super(ConverterTemplate,self).__init__(config=config)
121 self.nb = None
129
122 super(ConverterTemplate, self).__init__(config=config, **kw)
130 def _get_prompt_number(self, cell):
131 return cell.prompt_number if hasattr(cell, 'prompt_number') \
132 else self.blank_symbol
133
134
123
135 def process(self):
124 def process(self):
136 converted_cells = []
125 converted_cells = []
@@ -146,7 +135,7 b' class ConverterTemplate(Configurable):'
146
135
147 return converted_cells
136 return converted_cells
148
137
149 def convert(self, cell_separator='\n'):
138 def convert(self):
150 """ convert the ipynb file
139 """ convert the ipynb file
151
140
152 return both the converted ipynb file and a dict containing potential
141 return both the converted ipynb file and a dict containing potential
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now