@@ -23,9 +23,7 @@ class LaTeXFile(TextFile):
|
|||||||
|
|
||||||
def __init__(self, theProject, theParent):
|
def __init__(self, theProject, theParent):
|
||||||
TextFile.__init__(self, theProject, theParent)
|
TextFile.__init__(self, theProject, theParent)
|
||||||
|
|
||||||
self.theConv = ToLaTeX(self.theProject, self.theParent)
|
self.theConv = ToLaTeX(self.theProject, self.theParent)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -36,9 +34,10 @@ class LaTeXFile(TextFile):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.outFile = open(filePath,mode="wt+")
|
self.outFile = open(filePath,mode="wt+")
|
||||||
self.outFile.write(r"\documentclass[12pt]{report}\n")
|
self.outFile.write("\\documentclass[12pt]{report}\n")
|
||||||
self.outFile.write(r"\usepackage[utf8]{inputenc}\n")
|
self.outFile.write("\\usepackage[utf8]{inputenc}\n")
|
||||||
self.outFile.write(r"\begin{document}\n")
|
self.outFile.write("\n")
|
||||||
|
self.outFile.write("\\begin{document}\n")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.makeAlert(["Failed to open file.",str(e)], nwAlert.ERROR)
|
self.makeAlert(["Failed to open file.",str(e)], nwAlert.ERROR)
|
||||||
return False
|
return False
|
||||||
@@ -48,7 +47,7 @@ class LaTeXFile(TextFile):
|
|||||||
def _doCloseFile(self):
|
def _doCloseFile(self):
|
||||||
|
|
||||||
if self.outFile is not None:
|
if self.outFile is not None:
|
||||||
self.outFile.write(r"\end{document}\n")
|
self.outFile.write("\\end{document}\n")
|
||||||
self.outFile.close()
|
self.outFile.close()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -110,12 +110,13 @@ class ToLaTeX(Tokenizer):
|
|||||||
tText = tWrap.fill(tText)
|
tText = tWrap.fill(tText)
|
||||||
|
|
||||||
# Then the text can receive final formatting before we append it to the results.
|
# Then the text can receive final formatting before we append it to the results.
|
||||||
# We also store text lines in a buffer and merge them only when we find an empty line,
|
# We also store text lines in a buffer and merge them only when we find an empty line
|
||||||
# indicating a new paragraph.
|
# indicating a new paragraph.
|
||||||
if tType == self.T_EMPTY:
|
if tType == self.T_EMPTY:
|
||||||
if len(thisPar) > 0:
|
if len(thisPar) > 0:
|
||||||
self.theResult += begText
|
self.theResult += begText
|
||||||
self.theResult += "%s\n" % tWrap.fill(" ".join(thisPar))
|
for tTemp in thisPar:
|
||||||
|
self.theResult += "%s\n" % tTemp
|
||||||
self.theResult += endText
|
self.theResult += endText
|
||||||
thisPar = []
|
thisPar = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user