##// END OF EJS Templates
rename runme2 to runme
Matthias BUSSONNIER -
Show More
@@ -1,22 +1,65 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # coding: utf-8
2 #-----------------------------------------------------------------------------
3
3 # Imports
4 #-----------------------------------------------------------------------------
4 from __future__ import print_function
5 from __future__ import print_function
5 import sys
6 import sys
6 import io
7 import io
8
7 from converters.template import *
9 from converters.template import *
10 from converters.template import ConverterTemplate
11 from converters.html import ConverterHTML
12 # From IPython
13
14 # All the stuff needed for the configurable things
15 from IPython.config.application import Application
16 from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict, CaselessStrEnum
17
18
19 class NbconvertApp(Application):
20
21
22 def __init__(self, **kwargs):
23 super(NbconvertApp, self).__init__(**kwargs)
24 self.classes.insert(0,ConverterTemplate)
25 # ensure those are registerd
26
27
28 def initialize(self, argv=None):
29 self.parse_command_line(argv)
30 cl_config = self.config
31 self.update_config(cl_config)
32
33
34
35 def run(self):
36 """Convert a notebook to html in one step"""
37 template_file = (self.extra_args or [None])[0]
38 ipynb_file = (self.extra_args or [None])[1]
39
40 template_file = sys.argv[1]
8
41
42 if template_file.startswith('latex'):
43 tex_environement=True
44 else:
45 tex_environement=False
9
46
10 template_file = sys.argv[1]
47 C = ConverterTemplate(tplfile=sys.argv[1], tex_environement=tex_environement, config=self.config)
48 C.read(ipynb_file)
11
49
12 if template_file.startswith('latex'):
50 output,rest = C.convert()
13 tex_environement=True
14 else:
15 tex_environement=False
16
51
17 C = ConverterTemplate(tplfile=sys.argv[1], tex_environement=tex_environement)
52 print(output.encode('utf-8'))
18 C.read(sys.argv[2])
19
53
20 output,rest = C.convert()
54 def main():
55 """Convert a notebook to html in one step"""
56 app = NbconvertApp.instance()
57 app.initialize()
58 app.start()
59 app.run()
60 #-----------------------------------------------------------------------------
61 # Script main
62 #-----------------------------------------------------------------------------
21
63
22 print(output.encode('utf-8'))
64 if __name__ == '__main__':
65 main()
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