##// END OF EJS Templates
Provide a list of the command and argument to subprocess for PDF post-processor, which is a better way to avoid issues if there are spaces in the filename.
Thomas Robitaille -
Show More
@@ -15,9 +15,8 b' Contains writer for writing nbconvert output to PDF.'
15
15
16 import subprocess
16 import subprocess
17 import os
17 import os
18 import shlex
19
18
20 from IPython.utils.traitlets import Integer, Unicode, Bool
19 from IPython.utils.traitlets import Integer, List, Bool
21
20
22 from .base import PostProcessorBase
21 from .base import PostProcessorBase
23
22
@@ -31,7 +30,7 b' class PDFPostProcessor(PostProcessorBase):'
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 = List(["pdflatex", "{filename}"], 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="""
@@ -43,8 +42,8 b' class PDFPostProcessor(PostProcessorBase):'
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(shlex.quote(input))
45 command = [c.format(filename=input) for c in self.compiler]
47 self.log.info("Building PDF: `%s`", command)
46 self.log.info("Building PDF: `%s`", ' '.join(command))
48 for index in range(self.iteration_count):
47 for index in range(self.iteration_count):
49 if self.verbose:
48 if self.verbose:
50 subprocess.Popen(command, shell=True)
49 subprocess.Popen(command, shell=True)
General Comments 0
You need to be logged in to leave comments. Login now