##// END OF EJS Templates
Removed bash string
Jonathan Frederic -
Show More
@@ -1,52 +1,51 b''
1 #!/usr/bin/env python
2 """
1 """
3 Contains writer for writing nbconvert output to PDF.
2 Contains writer for writing nbconvert output to PDF.
4 """
3 """
5 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
6 #Copyright (c) 2013, the IPython Development Team.
5 #Copyright (c) 2013, the IPython Development Team.
7 #
6 #
8 #Distributed under the terms of the Modified BSD License.
7 #Distributed under the terms of the Modified BSD License.
9 #
8 #
10 #The full license is in the file COPYING.txt, distributed with this software.
9 #The full license is in the file COPYING.txt, distributed with this software.
11 #-----------------------------------------------------------------------------
10 #-----------------------------------------------------------------------------
12
11
13 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
14 # Imports
13 # Imports
15 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
16
15
17 import subprocess
16 import subprocess
18 import os
17 import os
19
18
20 from IPython.utils.traitlets import Integer, Unicode, Bool
19 from IPython.utils.traitlets import Integer, Unicode, Bool
21
20
22 from .base import PostProcessorBase
21 from .base import PostProcessorBase
23
22
24 #-----------------------------------------------------------------------------
23 #-----------------------------------------------------------------------------
25 # Classes
24 # Classes
26 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
27 class PDFPostProcessor(PostProcessorBase):
26 class PDFPostProcessor(PostProcessorBase):
28 """Writer designed to write to PDF files"""
27 """Writer designed to write to PDF files"""
29
28
30 iteration_count = Integer(3, config=True, help="""
29 iteration_count = Integer(3, config=True, help="""
31 How many times pdflatex will be called.
30 How many times pdflatex will be called.
32 """)
31 """)
33
32
34 compiler = Unicode(u'pdflatex {0}', config=True, help="""
33 compiler = Unicode(u'pdflatex {0}', config=True, help="""
35 Shell command used to compile PDF.""")
34 Shell command used to compile PDF.""")
36
35
37 verbose = Bool(False, config=True, help="""
36 verbose = Bool(False, config=True, help="""
38 Whether or not to display the output of the compile call.
37 Whether or not to display the output of the compile call.
39 """)
38 """)
40
39
41 def call(self, input):
40 def call(self, input):
42 """
41 """
43 Consume and write Jinja output a PDF.
42 Consume and write Jinja output a PDF.
44 See files.py for more...
43 See files.py for more...
45 """
44 """
46 command = self.compiler.format(input)
45 command = self.compiler.format(input)
47 for index in range(self.iteration_count):
46 for index in range(self.iteration_count):
48 if self.verbose:
47 if self.verbose:
49 subprocess.Popen(command, shell=True)
48 subprocess.Popen(command, shell=True)
50 else:
49 else:
51 with open(os.devnull, 'wb') as null:
50 with open(os.devnull, 'wb') as null:
52 subprocess.Popen(command, shell=True, stdout=null)
51 subprocess.Popen(command, shell=True, stdout=null)
General Comments 0
You need to be logged in to leave comments. Login now