aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcli.js45
-rw-r--r--zeitung/main.tex2
-rw-r--r--zeitung/parts/citations.tex2
-rw-r--r--zeitung/parts/quotetemplate.tex6
-rw-r--r--zeitung/parts/studentprofiles.tex15
5 files changed, 44 insertions, 26 deletions
diff --git a/cli.js b/cli.js
index e2f02e7..bc2fad7 100755
--- a/cli.js
+++ b/cli.js
@@ -71,6 +71,7 @@ if ((idx = params.indexOf("-r")) > -1) {
text
.replace(/(\r\n|\n|\r)/gm, "")
.replace(/\\/g, "\\\\")
+ .replace(/%/g, "\\%")
.replace(/&/g, "\\&")
.replace(/_/g, "\\_")
.replace(/\^/g, "\\^")
@@ -88,8 +89,8 @@ if ((idx = params.indexOf("-r")) > -1) {
};
// Be aware, I'm a longtime rhyme primer
- db.dump().then((data) => {
- data.users.forEach(async (user) => {
+ db.dump().then(async (data) => {
+ await data.users.forEach(async (user) => {
const curr = data.profile.filter((e) => e.user_id === user.id);
const next = data.profile.filter((e) => e.user_id === user.id - 1);
const comments = user.comments;
@@ -154,9 +155,11 @@ if ((idx = params.indexOf("-r")) > -1) {
__dirname + "/zeitung/parts/generated/students/" + user.class + "/" + user.username + ".tex",
textex,
);
+ });
+ await (async () => {
// Stats chats hats cats rats
- textex = "";
+ let textex = "";
const questions = [...new Set(data.questions.map((a) => a[0].id))];
const statrad = 2.5;
const statxinc = 8,
@@ -188,7 +191,7 @@ if ((idx = params.indexOf("-r")) > -1) {
const rankingEnd = "\\end{tabularx}\n";
textex = "\\ranking" + rankingStart;
const teacher_ranking = data.ranking.filter((e) => e.type === "teacher");
- teacher_ranking.forEach((e, ind) => {
+ await teacher_ranking.forEach((e, ind) => {
textex += `\\rankingquestion{${e.question}}\n`;
textex += "\\begin{enumerate}\n";
const a = e.answers;
@@ -209,22 +212,26 @@ if ((idx = params.indexOf("-r")) > -1) {
await fs.writeFile(__dirname + "/zeitung/parts/generated/ranking/teacher.tex", textex);
- // Quotes boats coats floats goats oats
- textex = "";
- textex += `\\subsection*{${data.quotes[0].class}}\n`;
- data.quotes.forEach((quote, i) => {
- if (i > 1 && quote.class !== data.quotes[i - 1].class) textex += `\\subsection*{${quote.class}}\n`;
- textex += `\\textbf{${quote.name} ${quote.middlename || ""} ${quote.surname}}: ${
- quote.quote
- }\\newline \n`
- .replace(/ +/, " ")
- .replace(/%/g, "\\%");
- });
- await fs.writeFile(__dirname + "/zeitung/parts/generated/quotes/quotes.tex", textex);
- });
+ // Quotes boats coats floats goats oats // TODO: Fix teacher quotes
+ textex = `\\def\\quoteclass{TGI13.1}\n\\quotepage`;
+ let i = 0;
+ for (const quote of data.quotes) {
+ if (i > 1 && quote.class !== data.quotes[i - 1].class) {
+ await fs.writeFile(
+ __dirname + `/zeitung/parts/generated/quotes/${data.quotes[i - 1].class}.tex`,
+ textex,
+ );
+ textex = `\\def\\quoteclass{${quote.class}}\n\\quotepage`;
+ }
+ textex += `\\quoteadd{${quote.name} ${quote.middlename || ""} ${quote.surname}}{${sanitize(
+ quote.quote,
+ )}}\n`;
+ i++;
+ }
+ })();
+
+ console.log("Probably finished?");
});
- console.log("Probably finished?");
- // process.exit(0);
} else if ((idx = params.indexOf("-U")) > -1) {
// Update management (e.g.: add new poll options)
const param = params[idx + 1];
diff --git a/zeitung/main.tex b/zeitung/main.tex
index 6e0b0e0..a0a5681 100644
--- a/zeitung/main.tex
+++ b/zeitung/main.tex
@@ -82,6 +82,7 @@
\def\part#1{\input{parts/#1.tex}\newpage}
\def\student{\input{parts/studenttemplate.tex}}
+\def\quotepage{\input{parts/quotetemplate.tex}}
\def\ranking{\input{parts/rankingtemplate.tex}}
\def\generated#1{\input{parts/generated/#1.tex}}
@@ -100,7 +101,6 @@
\part{classoverview}
\part{studentprofiles}
\part{studentranking}
-\part{citations}
\part{photos}
\part{trips}
\part{courseoverview}
diff --git a/zeitung/parts/citations.tex b/zeitung/parts/citations.tex
deleted file mode 100644
index a05185c..0000000
--- a/zeitung/parts/citations.tex
+++ /dev/null
@@ -1,2 +0,0 @@
-\title{Zitate}
-\generated{quotes/quotes} \ No newline at end of file
diff --git a/zeitung/parts/quotetemplate.tex b/zeitung/parts/quotetemplate.tex
new file mode 100644
index 0000000..a8b704f
--- /dev/null
+++ b/zeitung/parts/quotetemplate.tex
@@ -0,0 +1,6 @@
+\clearpage
+\title{Zitate - \quoteclass}
+
+\providecommand\quoteadd[2]{
+ \textbf{#1: }#2\newline
+}
diff --git a/zeitung/parts/studentprofiles.tex b/zeitung/parts/studentprofiles.tex
index 05da565..de14c4a 100644
--- a/zeitung/parts/studentprofiles.tex
+++ b/zeitung/parts/studentprofiles.tex
@@ -3,7 +3,14 @@
\newpage
\inputall{parts/generated/students/TGI13.1}
-%\inputall{parts/generated/students/TGI13.2}
-%\inputall{parts/generated/students/TGM13.1}
-%\inputall{parts/generated/students/TGM13.2}
-%\inputall{parts/generated/students/TGTM13.1}
+\generated{quotes/TGI13.1}
+\inputall{parts/generated/students/TGI13.2}
+\generated{quotes/TGI13.2}
+\inputall{parts/generated/students/TGM13.1}
+\generated{quotes/TGM13.1}
+\inputall{parts/generated/students/TGM13.2}
+\generated{quotes/TGM13.2}
+\inputall{parts/generated/students/TGTM13.1}
+\generated{quotes/TGTM13.1}
+
+%\generated{quotes/teacher}