Fix issues.

This commit is contained in:
Mikael Capelle
2018-05-09 11:05:01 +02:00
parent 1d180cdf88
commit 0caa2ba3f2
8 changed files with 73 additions and 21 deletions

View File

@@ -90,7 +90,8 @@ class documentclass(element):
'content': super().content()
})
def compile(self, outfile, infile='auto', outlog=None):
def compile(self, outfile, infile='auto', outlog=None,
compile_twice=False):
""" Compile the given document into a PDF file.
If infile is not None, and infile already exists, the document
@@ -105,7 +106,8 @@ class documentclass(element):
written. If None, a temporary file will be created
and then erased. If 'auto', file will be saved in
an automatic folder for future use.
- outlog
- outlog Output loging stream (default stdout).
- compile_twice Set to true to compile the document twice.
"""
outdir = os.path.dirname(outfile)
@@ -155,7 +157,10 @@ class documentclass(element):
call = ['pdflatex', '-halt-on-error',
'-output-directory', output_aux_folder,
'-jobname', outfile, infile]
if subprocess.call(call, stdout=outlog) == 0:
res = subprocess.call(call, stdout=outlog)
if compile_twice:
res = subprocess.call(call, stdout=outlog)
if res == 0:
os.rename(
os.path.join(
output_aux_folder, outfile + '.pdf'),