Commit d2837f28 authored by Lorenz Steinert's avatar Lorenz Steinert

fixed umlaute bug

parent 37d08e6c
......@@ -11,6 +11,7 @@ import os
import shutil
import time
import ldap3 as ldap
import codecs
try:
import pwd
......@@ -32,7 +33,7 @@ class Protokollskript:
def __init__(self):
""" Hier Sprecher und Protokollant setzen """
self.sprecher = "Silvia Hiebel"
self.protokollant = u"Markus Ühlein"
self.protokollant = "Markus Ühlein"
self.num_cols = 4
self.num_cols_ext = 1
self.editor = "vim"
......@@ -191,16 +192,16 @@ class Protokollskript:
outfile = outdir + "/fsr_physik_protokoll_" + self.year + "-" \
+ self.mon + "-" + self.day + ".tex"
with open('name.tex', 'r') as fobj_name:
with codecs.open('name.tex', 'r', 'utf-8') as fobj_name:
f_name = fobj_name.read()
with open('acroname.tex', 'r') as fobj_acroname:
with codecs.open('acroname.tex', 'r', 'utf-8') as fobj_acroname:
f_acroname = fobj_acroname.read()
with open('acro.tex', 'r') as fobj_acro:
with codecs.open('acro.tex', 'r', 'utf-8') as fobj_acro:
f_acro = fobj_acro.read()
with open('head.tex', 'r') as fobj_head:
with codecs.open('head.tex', 'r', 'utf-8') as fobj_head:
f_head = fobj_head.read()
f_head = self.reg_fsrname.sub(f_name, f_head)
......@@ -210,75 +211,102 @@ class Protokollskript:
f_head = self.reg_prot.sub(self.protokollant, f_head)
f_head = self.reg_date.sub(self.date, f_head)
with open('foot.tex', 'r') as fobj_foot:
with codecs.open('foot.tex', 'r', 'utf-8') as fobj_foot:
f_foot = fobj_foot.read()
f_foot = self.reg_spr.sub(self.sprecher, f_foot)
f_foot = self.reg_prot.sub(self.protokollant, f_foot)
f_foot = self.reg_date.sub(self.date, f_foot)
with open(outfile, 'w') as fobj_out:
fobj_out.write(f_head)
fobj_out.write("~\\newline\n")
tabdef = "||"
for i in range(self.num_cols):
tabdef += "c|l||"
fobj_out.write("FSR-Mitglieder\\\\\n\\\\\n\\scriptsize{\\begin{tabular}{"
+ tabdef + "}\n\\hline\n")
for i in zip(self.fsr, range(len(self.fsr))):
if i[1] % self.num_cols == 0:
fobj_out.write(" ")
else:
fobj_out.write("&")
if "Sarah" in i[0]:
fobj_out.write(r" &Sarah Anna Kova\v{c}")
else:
fobj_out.write(" &" + i[0])
if i[1] % self.num_cols == self.num_cols - 1:
fobj_out.write("\\\\\\hline\n")
else:
fobj_out.write("\n")
if not len(self.fsr)%self.num_cols==0:
for i in range(self.num_cols - len(self.fsr)%self.num_cols):
fobj_out.write("& &\n")
fobj_out.write("\\\\\\hline\n")
msg = ""
msg += f_head
#fobj_out.write(f_head)
msg += "~\\newline\n"
#fobj_out.write("~\\newline\n")
tabdef = "||"
for i in range(self.num_cols):
tabdef += "c|l||"
msg += "FSR-Mitglieder\\\\\n\\\\\n\\scriptsize{\\begin{tabular}{" \
+ tabdef + "}\n\\hline\n"
#fobj_out.write("FSR-Mitglieder\\\\\n\\\\\n\\scriptsize{\\begin{tabular}{"
#+ tabdef + "}\n\\hline\n")
for i in zip(self.fsr, range(len(self.fsr))):
if i[1] % self.num_cols == 0:
msg += " "
#fobj_out.write(" ")
else:
msg += "&"
#fobj_out.write("&")
if "Sarah" in i[0]:
msg += r" &Sarah Anna Kova\v{c}"
#fobj_out.write(r" &Sarah Anna Kova\v{c}")
else:
msg += " &" + i[0]
#fobj_out.write(" &" + i[0])
if i[1] % self.num_cols == self.num_cols - 1:
msg += "\\\\\\hline\n"
#fobj_out.write("\\\\\\hline\n")
else:
msg += "\n"
#fobj_out.write("\n")
if not len(self.fsr)%self.num_cols==0:
for i in range(self.num_cols - len(self.fsr)%self.num_cols):
msg += "& &\n"
#fobj_out.write("& &\n")
msg += "\\\\\\hline\n"
#fobj_out.write("\\\\\\hline\n")
fobj_out.write(r"\end{tabular}}\normalsize\vspace{1em}")
fobj_out.write("\n\\newline\n")
tabdef = "||"
for i in range(self.num_cols_ext):
tabdef += "c|l||"
fobj_out.write("Externe Referenten\\\\\n\\\\\n"
+ r"\scriptsize{\begin{tabular}{"
+ tabdef + "}\n\\hline\n")
for i in zip(self.fsr_extern, range(len(self.fsr_extern))):
if i[1] % self.num_cols_ext == 0:
fobj_out.write(" ")
else:
fobj_out.write("&")
if "Sarah" in i[0]:
fobj_out.write(r" &Sarah Anna Kova\v{c}")
else:
fobj_out.write(" &" + i[0])
if i[1] % self.num_cols_ext == self.num_cols_ext - 1:
fobj_out.write("\\\\\\hline\n")
else:
fobj_out.write("\n")
fobj_out.write("\\end{tabular}}\\normalsize")
fobj_out.write(f_foot)
msg += r"\end{tabular}}\normalsize\vspace{1em}"
msg += "\n\\newline\n"
#fobj_out.write(r"\end{tabular}}\normalsize\vspace{1em}")
#fobj_out.write("\n\\newline\n")
tabdef = "||"
for i in range(self.num_cols_ext):
tabdef += "c|l||"
msg += "Externe Referenten\\\\\n\\\\\n" \
+ r"\scriptsize{\begin{tabular}{" \
+ tabdef + "}\n\\hline\n"
#fobj_out.write("Externe Referenten\\\\\n\\\\\n"
#+ r"\scriptsize{\begin{tabular}{"
#+ tabdef + "}\n\\hline\n")
for i in zip(self.fsr_extern, range(len(self.fsr_extern))):
if i[1] % self.num_cols_ext == 0:
msg += " "
#fobj_out.write(" ")
else:
msg += "&"
#fobj_out.write("&")
if "Sarah" in i[0]:
msg += r" &Sarah Anna Kova\v{c}"
#fobj_out.write(r" &Sarah Anna Kova\v{c}")
else:
msg += " &" +i[0]
#fobj_out.write(" &" + i[0])
if i[1] % self.num_cols_ext == self.num_cols_ext - 1:
msg += "\\\\\\hline\n"
#fobj_out.write("\\\\\\hline\n")
else:
msg += "\n"
#fobj_out.write("\n")
msg += "\\end{tabular}}\\normalsize"
#fobj_out.write("\\end{tabular}}\\normalsize")
msg += f_foot
#fobj_out.write(f_foot)
with codecs.open(outfile, 'w', 'utf-8') as fobj_out:
fobj_out.write(msg)
if __name__ == "__main__":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment