Tomas "Jethro" Pokorny
9 years ago
4 changed files with 1738 additions and 4 deletions
File diff suppressed because it is too large
@ -0,0 +1,78 @@ |
|||||
|
\input czech.sty |
||||
|
\input epsf |
||||
|
\special{landscape} |
||||
|
\nopagenumbers |
||||
|
\hoffset=-1in |
||||
|
\voffset=-1in |
||||
|
\advance\voffset by 0.9cm |
||||
|
%nove pridano, aby to fungovalo... |
||||
|
\advance\hoffset by 6.5cm |
||||
|
\hsize=22cm |
||||
|
\vsize=16cm |
||||
|
|
||||
|
\font\adrfonta=csssbx10 at 14pt |
||||
|
\font\adrfontb=csssbx10 at 12pt |
||||
|
\font\adrfontc=csss12 |
||||
|
\font\tofont=csr12 at 16pt |
||||
|
|
||||
|
\newdimen\fromskip |
||||
|
\newdimen\toskip |
||||
|
\fromskip=4.35cm |
||||
|
\toskip=13.2cm |
||||
|
|
||||
|
\def\first{\relax} |
||||
|
|
||||
|
\catcode`_=13 |
||||
|
%\catcode`_=12 |
||||
|
|
||||
|
\def_{$\_$} |
||||
|
|
||||
|
\advance\voffset by 2.5cm |
||||
|
|
||||
|
|
||||
|
\def\obalka#1#2#3#4#5#6#7{ |
||||
|
|
||||
|
\def\jmeno{#1} |
||||
|
\def\prijm{#2} |
||||
|
\def\skola{#3} |
||||
|
\def\popis{} |
||||
|
\def\first{} |
||||
|
\def\ulice{#4} |
||||
|
\def\PSC{#5} |
||||
|
\def\mesto{#6} |
||||
|
\def\stat{#7} |
||||
|
\vskip-4mm\vbox to 0pt{\hbox to 0pt{\hskip1.4cm\epsfysize=2.55cm\epsfbox{lisak.eps}\hss}\vss} |
||||
|
|
||||
|
\baselineskip=13pt |
||||
|
\parindent=\fromskip |
||||
|
\line{\indent\adrfonta Časopis M\&M,\hfil} |
||||
|
\vskip3pt |
||||
|
\line{\indent\adrfontb OVVP UK MFF\hfil} |
||||
|
\vskip3pt |
||||
|
\line{\indent\adrfontc Ke Karlovu 3, 121 16 Praha 2\hfil} |
||||
|
\line{\indent\adrfontc Tel.: +420 221 911 235\hss} |
||||
|
\line{\indent\adrfontc mam@atrey.karlin.mff.cuni.cz\hfil} |
||||
|
|
||||
|
\vskip6.15cm |
||||
|
\vbox to 0pt{\parindent=1.4cm\hsize=\toskip\advance\hsize by -1cm |
||||
|
\vbox to 60pt{\vfil} \popis\vss} |
||||
|
\parindent=\toskip |
||||
|
\baselineskip=18pt |
||||
|
\line{\indent\tofont\first\hfil} |
||||
|
\line{\indent\tofont\jmeno\ \prijm\hfil} |
||||
|
\ifx \skola \empty |
||||
|
{} |
||||
|
\else |
||||
|
\line{\indent\tofont\skola\hfil} |
||||
|
\fi |
||||
|
\line{\indent\tofont\ulice\hfil} |
||||
|
\line{\tofont\item{\PSC} \mesto\hfil} |
||||
|
\vskip5pt |
||||
|
\line{\indent\tofont\stat\hfil} |
||||
|
|
||||
|
\vfil\eject |
||||
|
} |
||||
|
|
||||
|
%\obalka{Lenka}{Kopfová}{Leknínová 10}{746 01}{Opava} |
||||
|
|
||||
|
|
@ -0,0 +1,52 @@ |
|||||
|
#!/usr/bin/python |
||||
|
|
||||
|
import psycopg2 |
||||
|
import sys |
||||
|
import subprocess |
||||
|
import re |
||||
|
|
||||
|
dbname="mam-prod" |
||||
|
user="mam" |
||||
|
|
||||
|
conn = psycopg2.connect("dbname={0} user={1}".format(dbname,user)) |
||||
|
cur = conn.cursor() |
||||
|
|
||||
|
names = [] |
||||
|
|
||||
|
with open("obalky.sql") as qfile, open("obalky-template.tex") as texheader, open("obalky.tex","w") as texout : |
||||
|
texout.write(texheader.read()) |
||||
|
cur.execute(qfile.read()) |
||||
|
for row in cur.fetchall(): |
||||
|
(muz,jmeno,prijmeni,skola,ulice,mesto,psc,stat)=row |
||||
|
if (stat=='CZ'): |
||||
|
stat = "" |
||||
|
elif (stat=='SK'): |
||||
|
stat = "Slovenská republika" |
||||
|
else: |
||||
|
print("Neznamy stat: {}\n".format(stat)) |
||||
|
if (skola==None): |
||||
|
skola="" |
||||
|
psc = psc.replace(" ","") |
||||
|
psc = psc[0:3]+" "+psc[3:] |
||||
|
|
||||
|
texout.write("\\obalka{{{0}}}{{{1}}}{{{2}}}{{{3}}}{{{4}}}{{{5}}}{{{6}}}\n".format(jmeno,prijmeni,skola,ulice,psc,mesto,stat)) |
||||
|
names.append((jmeno,prijmeni)) |
||||
|
texout.write("\\bye\n") |
||||
|
|
||||
|
cur.close() |
||||
|
conn.close() |
||||
|
|
||||
|
print("Spoustim csplain ...") |
||||
|
output = subprocess.check_output(["csplain","obalky.tex"],stderr=subprocess.STDOUT) |
||||
|
page = 0 |
||||
|
for line in output.decode("utf-8").splitlines(): |
||||
|
pmatch = re.search("\[([0-9]+)\]",line) |
||||
|
if pmatch: |
||||
|
page = int(pmatch.group(1)) |
||||
|
errmatch = re.match("Overfull",line) |
||||
|
if errmatch: |
||||
|
print("Preteceni na strane",page,"u osoby",names[page][0],names[page][1]) |
||||
|
|
||||
|
print("Spoustim dvipdf ...") |
||||
|
subprocess.call(["dvipdf","obalky.dvi"]) |
||||
|
print("Hotovo.") |
Loading…
Reference in new issue