aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidpkj <davidpenkow1@gmail.com>2024-04-16 15:33:32 +0200
committerdavidpkj <davidpenkow1@gmail.com>2024-04-16 15:33:32 +0200
commit0f2e4ff987cb4c9fe446a4118d45c59d51c37437 (patch)
tree9911c58162959fa1cba477c0c74334f1d8ae492a
parent59b700299f860f0854c37906eaa5a5850cc45f59 (diff)
styleclass & fixes
-rw-r--r--README.adoc20
-rw-r--r--public/config.yaml28
-rw-r--r--public/style.css13
-rw-r--r--src/main.js5
4 files changed, 45 insertions, 21 deletions
diff --git a/README.adoc b/README.adoc
index 86ff908..5181aa9 100644
--- a/README.adoc
+++ b/README.adoc
@@ -1,6 +1,6 @@
= Stundenplan
-A small JavaScript project to generate beautiful PDF schedules. Takes information from `src/variables.js`.
+A small JavaScript project to generate beautiful PDF schedules. Takes information from `public/config.yaml`.
== Usage
@@ -43,20 +43,26 @@ hinweise:
eintraege:
- <MODULE NAME>:
<LECTURE TYPE>:
- - [<GERMAN ABBREVIATION FOR THE WEEKDAY>, <START TIME>, <END TIME>, <ROOM>]
+ - [<WEEKDAY>, <START TIME>, <END TIME>, <ROOM>]
```
-Please note that times should be given in the format `HHhMM` so to say 9:19 AM, you would actually write 09h19. Also the Module and Lecture `BLOCKED` is reserved for a cross hatched block.
+[NOTE]
+.Please note the following exceptions:
+====
+* `START TIME` and `END TIME` should be given in the format `HHhMM` so to say "1:02 PM", you would actually write `13h02`.
+* `WEEKDAY` should be given in abbreviated form without a dot. I.e. "Wednesday" becomes `Mi`.
+* The Module `STYLECLASS` is reserved for special stylized cases.
-So writing
+So for example writing
```yaml
...
- - BLOCKED:
+ - STYLECLASS:
BLOCKED:
...
```
-would put a blocked area in the pdf, instead of putting an actual block with the text "BLOCKED / BLOCKED".
+would put a blocked area in the pdf, instead of putting an actual block with the text "STYLECLASS / BLOCKED".
+====
== Known issues
@@ -65,4 +71,4 @@ would put a blocked area in the pdf, instead of putting an actual block with the
- Margin on the left not easily configurable
- Mensa times are not actually displayed
- All config.yaml items are required
-- Code is german spaghetti \ No newline at end of file
+- Code is german spaghetti
diff --git a/public/config.yaml b/public/config.yaml
index c9bece2..8285dcb 100644
--- a/public/config.yaml
+++ b/public/config.yaml
@@ -6,18 +6,28 @@ filename: Stundenplan_SS24.pdf
# Jeder hinweis wird unter dem Stundenplan aufgelistet
hinweise:
- "Mensabetrieb: 11:15 - 14:15 Uhr + 00:15 min"
- - "GET 2 / V am 23.05. & 04.07. im V1"
- - "GET 2 / Ü am 24.05. im T S2"
- - "FuQ / V am 24.05. im T S1"
+ - "GET 2 / V am <mark>23.05.</mark> & <mark>04.07.</mark> im V1"
+ - "GET 2 / Ü am <mark>24.05.</mark> im T S2"
+ - "FuQ / V am <mark>24.05.</mark> im T S1"
# Modul- und Veranstaltungsdefinitionen
eintraege:
+ - STYLECLASS:
+ BLOCK:
+ - [Mo, 13h00, 19h00, ""]
+ - [Do, 10h00, 15h00, ""]
+ MENSA:
+ - [Di, 12h00, 12h30, ""]
+ - [Di, 14h00, 14h30, ""]
+ - [Mi, 13h00, 14h00, ""]
- GET 2:
- U:
+ Helpdesk:
- [Mo, 12h00, 13h00, AM S4]
- - [Fr, 11h30, 13h00, AM S4]
+ Sprechstunde:
+ - [Di, 08h45, 09h45, H 1]
+ U:
+ - [Fr, 12h00, 13h00, AM S4]
V:
- - [Di, 08h30, 10h00, H 1]
- [Do, 08h30, 10h00, Z 1/2]
- TGI 1:
V:
@@ -46,10 +56,6 @@ eintraege:
- [Mi, 16h00, 17h00, H 1]
- FuQ:
V:
- - [Fr, 10h00, 11h30, AM 4]
+ - [Fr, 10h15, 11h45, AM 4]
U:
- [Di, 11h00, 12h00, SI 4 (Minsky)]
- - BLOCKED:
- BLOCKED:
- - [Mo, 13h00, 19h00, BLOCKED]
- - [Do, 10h00, 15h00, BLOCKED] \ No newline at end of file
diff --git a/public/style.css b/public/style.css
index acc57b4..e197769 100644
--- a/public/style.css
+++ b/public/style.css
@@ -10,7 +10,9 @@
--headers-b: #333;
--headers-f: #fff;
+ --mark: #ccc;
--block: #ccc;
+ --mensa: #777;
}
em {
@@ -18,6 +20,10 @@ em {
text-decoration: underline;
}
+mark {
+ background-color: var(--mark);
+}
+
table {
width: 100%;
}
@@ -54,6 +60,11 @@ table td.block {
background-size: 99.9999999% 99.9999999%; /* because 100% gives wrong scaling for some reason */
border: 2px solid var(--block);
}
+table td.mensa {
+ background-image: repeating-linear-gradient(45deg, var(--mensa), var(--mensa) 10px, transparent 10px, transparent 20px);
+ background-size: 99.9999999% 99.9999999%; /* because 100% gives wrong scaling for some reason */
+ border: 2px solid var(--mensa);
+}
div {
position: absolute;
@@ -63,4 +74,4 @@ div {
left: 0.4em;
width: calc(100% - 0.8em);
justify-content: space-between;
-} \ No newline at end of file
+}
diff --git a/src/main.js b/src/main.js
index c3cbec9..31183b2 100644
--- a/src/main.js
+++ b/src/main.js
@@ -172,8 +172,9 @@ function main() {
let el = tage_runtimes[day][0];
- if (el.name.includes("BLOCKED") && el.raum == "BLOCKED") {
- res += `<td rowspan="${el.runtime}" class="block"></td>`;
+ if (el.name.includes("STYLECLASS")) {
+ let styleclass = el.name.split("/")[1].trim().toLowerCase();
+ res += `<td rowspan="${el.runtime}" class="${styleclass}"></td>`;
} else {
let name = el.name == "BUFFER" ? "" : `<div><span>${el.name}</span>`;
let raum = el.raum == "BUFFER" ? "" : `<span>${el.raum}</span>`;