Fix pdf export , make it python3 compatible, Fix markmin2latex import
This commit is contained in:
1 parent
0d8dc294e9
commit
68284be7b0
3 files changed
+9
-10
No files matched your search
@@ -25,7 +25,7 @@ def wrapper(f):
|
||||
|
||||
def latex_from_html(html):
|
||||
markmin = TAG(html).element('body').flatten(markmin_serializer)
|
||||
return XML(markmin2latex(markmin))
|
||||
return markmin2latex(markmin)
|
||||
|
||||
|
||||
def pdflatex_from_html(html):
|
||||
@@ -39,7 +39,7 @@ def pdflatex_from_html(html):
|
||||
H1('warnings'),
|
||||
UL(*warnings))).xml())
|
||||
else:
|
||||
return XML(out)
|
||||
return out
|
||||
|
||||
|
||||
def pyfpdf_from_html(html):
|
||||
|
||||
@@ -58,7 +58,7 @@ def latex2pdf(latex, pdflatex='pdflatex', passes=3):
|
||||
|
||||
# setup the envoriment
|
||||
tmpdir = mkdtemp()
|
||||
texfile = open(tmpdir + '/test.tex', 'wb')
|
||||
texfile = open(tmpdir + '/test.tex', 'wt',encoding="utf-8")
|
||||
texfile.write(latex)
|
||||
texfile.seek(0)
|
||||
texfile.close()
|
||||
@@ -90,15 +90,14 @@ def latex2pdf(latex, pdflatex='pdflatex', passes=3):
|
||||
os.unlink(logname)
|
||||
|
||||
pdffile = texfile.rsplit('.', 1)[0] + '.pdf'
|
||||
data = None
|
||||
|
||||
if os.path.isfile(pdffile):
|
||||
fpdf = open(pdffile, 'rb')
|
||||
try:
|
||||
with open(pdffile,'rb') as fpdf :
|
||||
data = fpdf.read()
|
||||
finally:
|
||||
fpdf.close()
|
||||
else:
|
||||
data = None
|
||||
|
||||
removeall(tmpdir)
|
||||
|
||||
return data, warnings, errors
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user