Merge branch 'test' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into test

This commit is contained in:
Tomas "Jethro" Pokorny 2018-09-14 19:05:02 +02:00
commit b1cc6df91e
2 changed files with 75 additions and 61 deletions

View file

@ -1,79 +1,94 @@
{% autoescape off %} {% autoescape off %}
{% load staticfiles %} {% load staticfiles %}
{% load tex %} {% load tex %}
\input czech.sty \documentclass[11pt,a4paper,landscape]{article}
\input epsf \usepackage[top=3.75cm,left=8cm]{geometry}
\special{landscape} \usepackage[T1]{fontenc}
\nopagenumbers \usepackage[utf8]{inputenc}
\hoffset=-1in \usepackage[czech]{babel}
\voffset=-1in \usepackage{graphicx}
\advance\voffset by 0.9cm \begin{document}
%nove pridano, aby to fungovalo...
\advance\hoffset by 6.5cm
\hsize=22cm
\vsize=16cm
\font\adrfonta=csssbx10 at 14pt % Nechceme číslování stránek
\font\adrfontb=csssbx10 at 12pt \pagenumbering{gobble}
\font\adrfontc=csss12
\font\tofont=csr12 at 16pt
\newdimen\fromskip % Různé fonty na obálce
\newdimen\toskip \def\adrfonta#1{%
\fromskip=4.35cm \fontsize{14pt}{14.5pt}\selectfont \textbf{\textsf{#1}}%Časopis M&M
\toskip=13.2cm }
\def\adrfontb#1{%
\def\first{\relax} \fontsize{12pt}{13pt}\selectfont \textbf{\textsf{#1}}%OPMK UK MFF
}
\def\adrfontc#1{%
\fontsize{12pt}{13pt}\selectfont \textsf{#1}%Adresa, telefon, e-mail
}
\def\tofont#1{%
\fontsize{16pt}{18pt}\selectfont #1%Adresa řešitele
}
%Podtržítko je znak
\catcode`_=13 \catcode`_=13
%\catcode`_=12
\def_{$\_$} \def_{$\_$}
\advance\voffset by 2.5cm % Odsazení různých adres
\parindent=0pt
%\newdimen\fromskip
\newdimen\toskip
%\fromskip=4.35cm
\toskip=11.7cm
% Předsunutí -- na PSČ
\def\predsunout#1{%
\setbox0=\hbox{#1\,}%
\hskip -\wd0\relax%
\box0
}
\def\obalka#1#2#3#4#5#6#7{ % Makro na TeXáni naší adresy
\def\adresaMaM{%
\hbox{\adrfonta{Časopis M\&M,}}
\vskip 3 pt
\hbox{\adrfontb{OPMK UK MFF}}
\vskip 3 pt
\hbox{\adrfontc{Ke Karlovu 3, 121 16 Praha 2}}
\hbox{\adrfontc{Tel.: +420 221 911 235}}
\hbox{\adrfontc{mam@matfyz.cz}}
}
\def\jmeno{#1} % Makro na TeXání adresátovy adresy
\def\prijm{#2} \def\adresat#1#2#3#4#5#6#7{%
\def\skola{#3} \def\jmeno{#1}%
\def\popis{} \def\prijm{#2}%
\def\first{} \def\skola{#3}%
\def\ulice{#4} %\def\popis{}
\def\PSC{#5} %\def\first{}
\def\mesto{#6} \def\ulice{#4}%
\def\stat{#7} \def\PSC{#5}%
\vskip-4mm\vbox to 0pt{\hbox to 0pt{\hskip1.4cm\epsfysize=2.55cm\epsfbox{lisak.eps}\hss}\vss} \def\mesto{#6}%
\def\stat{#7}%
\baselineskip=13pt \hbox{\tofont{\jmeno\ \prijm}}
\parindent=\fromskip
\line{\indent\adrfonta Časopis M\&M,\hfil}
\vskip3pt
\line{\indent\adrfontb OPMK 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 \ifx \skola \empty
{} {}
\else \else
\line{\indent\tofont\skola\hfil} \hbox{\tofont{\skola}}
\fi \fi
\line{\indent\tofont\ulice\hfil} \hbox{\tofont{\ulice}}
\line{\tofont\item{\PSC} \mesto\hfil}
\vskip5pt
\line{\indent\tofont\stat\hfil}
\vfil\eject \hbox to 18pt{\tofont{\predsunout{\PSC\ }\mesto}}
\vskip 5 pt
\tofont{\stat}
}
% Tohle makro vysází samotnou obálku
\def\obalka#1#2#3#4#5#6#7{
% Horní a pravý okraj je zároveň okraj stránky, resetujeme odsazení
\includegraphics[height=2.55cm]{lisak.eps}\hskip 1 em\vbox{%
\adresaMaM}
\vskip 7.3 cm % Od oka
\hskip\toskip%
\vbox{\adresat{#1}{#2}{#3}{#4}{#5}{#6}{#7}}
\vfill\eject
} }
@ -98,6 +113,6 @@
{% endif %} {% endif %}
{% endspaceless %} {% endspaceless %}
{% endfor %} {% endfor %}
\bye \end{document}
{% endautoescape %} {% endautoescape %}

View file

@ -568,8 +568,7 @@ def obalkyView(request,resitele):
with open(tempdir+"/obalky.tex","w") as texfile: with open(tempdir+"/obalky.tex","w") as texfile:
texfile.write(tex) texfile.write(tex)
shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/lisak.eps'),tempdir) shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/lisak.eps'),tempdir)
subprocess.call(["csplain","obalky.tex"],cwd = tempdir) subprocess.call(["pdflatex","obalky.tex"],cwd = tempdir)
subprocess.call(["dvipdf","obalky.dvi"],cwd = tempdir)
with open(tempdir+"/obalky.pdf","rb") as pdffile: with open(tempdir+"/obalky.pdf","rb") as pdffile:
response = HttpResponse(pdffile.read(),content_type='application/pdf') response = HttpResponse(pdffile.read(),content_type='application/pdf')