aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcli.js32
-rw-r--r--zeitung/main.tex2
-rw-r--r--zeitung/parts/studenttemplate.tex158
3 files changed, 95 insertions, 97 deletions
diff --git a/cli.js b/cli.js
index 1eeb19d..4090197 100755
--- a/cli.js
+++ b/cli.js
@@ -77,17 +77,27 @@ if ((idx = params.indexOf("-r")) > -1) {
db.dump().then((data) => {
data.users.forEach((user) => {
hay = data.profile.filter((e) => e.user_id === user.id);
- const name = `${user.name} ${user.middlename || ""} ${user.surname}`;
- const birthday = answer("Geburtsdatum");
- const favsub = answer("Lieblingsfach");
- const hatesub = answer("Hassfach");
- const hobbies = answer("Hobbies");
- const music = answer("Lieblingsbands/-musiker/-genre");
- const missing = answer("Am meisten werde ich vermissen");
- const motivation = answer("Ohne das hätte ich die Oberstufe nicht geschafft");
- const quote = answer("Lebensmotto/Seniorquote");
- const future = answer("Zukunftspläne");
- let textex = `\\student\\studentimages{${user.id}}\\studentprofile{${name}}{${birthday}}{${favsub}}{${hatesub}}{${hobbies}}{${music}}{${missing}}{${motivation}}{${quote}}\\studenttable{TODO?}{${future}}\\studentcomments{}`;
+ const obj = {
+ userid: user.id,
+ name: `${user.name} ${user.middlename || ""} ${user.surname}`,
+ birthday: answer("Geburtsdatum"),
+ favsub: answer("Lieblingsfach"),
+ hatesub: answer("Hassfach"),
+ hobbies: answer("Hobbies"),
+ music: answer("Lieblingsbands/-musiker/-genre"),
+ missing: answer("Am meisten werde ich vermissen"),
+ motivation: answer("Ohne das hätte ich die Oberstufe nicht geschafft"),
+ quote: answer("Lebensmotto/Seniorquote"),
+ future: answer("Zukunftspläne"),
+ };
+
+ // 5head
+ let textex = "";
+ Object.keys(obj).forEach((elem) => {
+ textex += `\\def\\std${elem}{${obj[elem]}}`;
+ });
+ textex += "\\student";
+
textex = textex.replace(/(\r\n|\n|\r)/gm, "").replace(/&/g, "\\&");
fs.writeFile(
__dirname + "/zeitung/parts/students/" + user.class + "/" + user.username + ".tex",
diff --git a/zeitung/main.tex b/zeitung/main.tex
index 6f6cc74..f447f3f 100644
--- a/zeitung/main.tex
+++ b/zeitung/main.tex
@@ -44,7 +44,7 @@
\fancyfootoffset{2.5cm}
\fancyhf{}
\fancyhead[L]{\hspace*{1cm}\vspace*{0.3cm}\Huge{\rightmark}}
-\fancyfoot[R]{\vspace*{-50pt}\oddflip[keepaspectratio=true, width=\paperwidth]{welle.png}}
+\fancyfoot[R]{\vspace*{-15pt}\oddflip[keepaspectratio=true, width=\paperwidth]{welle.png}}
\fancyfoot[L]{\checkoddpage\vspace*{-1.3cm}\hspace*{\ifoddpage 3cm \else 17.5cm \fi}\Huge{\thepage}}
% Custom title command for header
diff --git a/zeitung/parts/studenttemplate.tex b/zeitung/parts/studenttemplate.tex
index 83d1101..072d493 100644
--- a/zeitung/parts/studenttemplate.tex
+++ b/zeitung/parts/studenttemplate.tex
@@ -1,6 +1,7 @@
% Student template
\clearpage
+\checkoddpage
% Returns a default file if not found
\providecommand\dfincludegraphics[2][]{
@@ -13,99 +14,86 @@
}
}
-\providecommand\studentimages[1]{%
- \checkoddpage
-
- % Ring
- \def\ringx{50pt}
- \def\ringy{250pt}
- \def\ringwidth{250pt}
- \def\ringimgwidth{180pt}
- \def\ringoffset{(\ringwidth - \ringimgwidth) / 2}
- \ifoddpage\else
- \def\ringx{-\paperwidth - 350pt} % ringwidth + 2 * ringx
- \fi
- \AddToShipoutPictureBG*{
- \AtTextUpperLeft{
- \put(-\ringx + \ringoffset, -\ringy + \ringoffset){
- \dfincludegraphics[keepaspectratio=true, width=\ringimgwidth]{parts/students/figures/bornerma.jpg}
- }
- \put(-\ringx, -\ringy){
- \oddflip[keepaspectratio=true, width=\ringwidth]{ring.png}
- }
+% Ring
+\def\ringx{50pt}
+\def\ringy{250pt}
+\def\ringwidth{250pt}
+\def\ringimgwidth{180pt}
+\def\ringoffset{(\ringwidth - \ringimgwidth) / 2}
+\ifoddpage\else
+ \def\ringx{-\paperwidth - 350pt} % ringwidth + 2 * ringx
+\fi
+\AddToShipoutPictureBG*{
+ \AtTextUpperLeft{
+ \put(-\ringx + \ringoffset, -\ringy + \ringoffset){
+ \dfincludegraphics[keepaspectratio=true, width=\ringimgwidth]{parts/students/figures/bornerma.jpg}
+ }
+ \put(-\ringx, -\ringy){
+ \oddflip[keepaspectratio=true, width=\ringwidth]{ring.png}
}
}
+}
- % Frame
- \def\framex{130pt}
- \def\framey{40pt}
- \def\framewidth{180pt}
- \def\frameimgwidth{160pt}
- \def\frameoffset{(\framewidth - \frameimgwidth) / 2}
- \ifoddpage\else
- \def\framex{518pt} % paperwidth - framewidth / 2
- \fi
- \AddToShipoutPictureBG*{
- \AtTextLowerLeft{
- \put(\textwidth - \framex + \frameoffset, \framey + \frameoffset + 8pt){
- \dfincludegraphics[keepaspectratio=true, width=\frameimgwidth]{parts/students/figures/child_#1.jpg}
- }
- \put(\textwidth - \framex, \framey){
- \oddflip[keepaspectratio=true, width=\framewidth]{rahmen.png}
- }
+% Frame
+\def\framex{130pt}
+\def\framey{40pt}
+\def\framewidth{180pt}
+\def\frameimgwidth{160pt}
+\def\frameoffset{(\framewidth - \frameimgwidth) / 2}
+\ifoddpage\else
+ \def\framex{518pt} % paperwidth - framewidth / 2
+\fi
+\AddToShipoutPictureBG*{
+ \AtTextLowerLeft{
+ \put(\textwidth - \framex + \frameoffset, \framey + \frameoffset + 8pt){
+ \dfincludegraphics[keepaspectratio=true, width=\frameimgwidth]{parts/students/figures/child_\stdid.jpg}
+ }
+ \put(\textwidth - \framex, \framey){
+ \oddflip[keepaspectratio=true, width=\framewidth]{rahmen.png}
}
}
}
-\providecommand\studentprofile[9]{%
- \sectionmark{Steckbrief - #1}
- \checkoddpage
+\sectionmark{Steckbrief - \stdname}
- % Steckbrief Tabelle
- \ifoddpage
- \def\tablex{12}
- \else
- \def\tablex{3}
- \fi
- \def\tabley{-5}
- \def\tablewidth{6cm}
- \begin{tikzpicture}[overlay]
- \node[text width=250pt, align=left] at (\tablex, \tabley) {
- \Large{\begin{tabular}{@{}ll@{}}
- \textbf{Name:} & \multicolumn{1}{p{\tablewidth}}{#1} \\
- \textbf{Geburtstag:} & \multicolumn{1}{p{\tablewidth}}{#2} \\
- \textbf{Lieblingsfach:} & \multicolumn{1}{p{\tablewidth}}{#3} \\
- \textbf{Hassfach:} & \multicolumn{1}{p{\tablewidth}}{#4} \\
- \textbf{Hobbies:} & \multicolumn{1}{p{\tablewidth}}{#5} \\
- \textbf{Lieblingsgenre:} & \multicolumn{1}{p{\tablewidth}}{#6} \\
- \end{tabular}}\\~\\
- \textbf{Das werde ich am meisten vermissen:}\\#7\\~\\
- \textbf{Ohne das hätte ich die Oberstufe nicht geschafft:}\\#8\\~\\
- \textbf{Lebensmotto:}\\#9\\~\\
- };
- \end{tikzpicture}
-}
-
-\providecommand\studenttable[2]{%
- \checkoddpage
+% Steckbrief Tabelle
+\ifoddpage
+ \def\tablex{12}
+\else
+ \def\tablex{3}
+\fi
+\def\tabley{-5}
+\def\tablewidth{6cm}
+\begin{tikzpicture}[overlay]
+ \node[text width=250pt, align=left] at (\tablex, \tabley) {
+ \Large{\begin{tabular}{@{}ll@{}}
+ \textbf{Name:} & \stdname \\
+ \textbf{Geburtstag:} & \multicolumn{1}{p{\tablewidth}}{\stdbirthday} \\
+ \textbf{Lieblingsfach:} & \multicolumn{1}{p{\tablewidth}}{\stdfavsub} \\
+ \textbf{Hassfach:} & \multicolumn{1}{p{\tablewidth}}{\stdhatesub} \\
+ \textbf{Hobbies:} & \multicolumn{1}{p{\tablewidth}}{\stdhobbies} \\
+ \textbf{Musik:} & \multicolumn{1}{p{\tablewidth}}{\stdmusic} \\
+ \end{tabular}}\\~\\
+ \textbf{Das werde ich am meisten vermissen:}\\\stdmissing\\~\\
+ \textbf{Ohne das hätte ich die Oberstufe nicht geschafft:}\\\stdmotivation\\~\\
+ \textbf{Lebensmotto:}\\\stdquote\\~\\
+ };
+\end{tikzpicture}
- \ifoddpage
- \def\tablex{-1.25cm}
- \else
- \def\tablex{5cm}
- \fi
- \def\tablewidth{\textwidth}
+\ifoddpage
+ \def\tablex{-1.25cm}
+\else
+ \def\tablex{5cm}
+\fi
+\def\tablewidth{\textwidth}
- \vskip 10cm
- \hspace*{\tablex}
- \Large{\begin{tabular}{@{}ll@{}}
- %\textbf{Erkennungsmerkmale:} & \multicolumn{1}{p{\tablewidth}}{#1} \\
- \textbf{Zukunftspläne:} & \multicolumn{1}{p{\tablewidth}}{#2} \\
- \end{tabular}}
-}
+\vskip 10cm
+\hspace*{\tablex}
+\Large{\begin{tabular}{@{}ll@{}}
+ %\textbf{Erkennungsmerkmale:} & \multicolumn{1}{p{\tablewidth}}{\stdidk} \\
+ \textbf{Zukunftspläne:} & \multicolumn{1}{p{\tablewidth}}{\stdfuture} \\
+ \end{tabular}}
-\providecommand\studentcomments[1]{%
- \begin{figure}[H]
- \hspace*{-2.5cm}\includegraphics[keepaspectratio=true, width=\paperwidth]{mittelwelle.png}
- \end{figure}
-}
+\begin{figure}[H]
+ \hspace*{-2.5cm}\includegraphics[keepaspectratio=true, width=\paperwidth]{mittelwelle.png}
+\end{figure}