Stundenplan
A small JavaScript project to generate beautiful PDF schedules and actually working Calendar Files. Takes information from public/config.yaml
.
"But why would anyone want this? UnivIS already does that!"
In short: This does it better. You have precise control over how the end product looks, what it displays (on a very granular level) and technically even what format it should have. Though you would need to edit the source at src/pdf.js
for that.
Example PDF Result (default look)
Usage
Requires the npm tool. I also suggest you read the entire page before giving it a go.
Preparation
I will assume that you have successfully cloned this git repository and opened a terminal in that directory. Next you have to install the needed packages (dependencies) of this project. To do so, just type
npm i
Generate a PDF file
You can now use the following command to generate a PDF from the current configuration.
npm run pdf
Optional: Generate ICS file
You have the option to generate a calendar file, which you should be able to import into most calendar software. Also works with moodle (but it gets painfully slow).
npm run ics
Optional: Parse UnivIS XML
You have the option to parse a full public/data.xml
UnivIS export to get 80% of the way to a working configuration. You still have to manually clean up and refactor the information to yaml. But you dont have to write all those characters out.
If you use vim, it then should be only a matter of seconds until you have your .pdf
.
npm run parse
Configuration Structure
Generally, you may edit anything in the public
directory. The default are how I like it.
To configure the actual displayed information you should edit the .yaml
file. It should look something like the following, where things like <THIS>
should be replaced by your text. An example is preconfigured at public/config.yaml
.
Comments (things that are ignored by the software) is everything after a #
sign. More information on the file format and syntax can be found here.
# General Information
student: <YOUR NAME>
semester: <SEMESTER>
filename: <RESULT FILENAME> # i.e. Stundenplan_SS24
# Is only needed for ICS export
vorlesungszeit:
- <LECTURES START>
- <LECTURES END>
# Each of these lines will be listed at the bottom of the PDF
hinweise:
- <YOUR INFO> # i.e. "Mensabetrieb: 11:15 - 14:15 Uhr + 00:15 min"
# Time definitions
eintraege:
- <MODULE NAME>:
<LECTURE TYPE>:
- [<WEEKDAY>, <START TIME>, <END TIME>, <ROOM>]
Please note the following
-
START TIME
andEND TIME
should be given in the formatHHhMM
so to say "1:02 PM", you would actually write13h02
. -
LECTURES START
andLECTURES END
are given in the formatYYYY-MM-DD
so to say "Apr. 23rd, 2024", you would actually write2024-04-23
. -
LECTURES START
has to be a (the first) Monday. -
LECTURES END
has to be a the day after the last day of lectures. -
RESULT FILENAME
does not need an extension, as that is determined upon file creation. -
WEEKDAY
should be given in abbreviated form without a dot. I.e. "Wednesday" becomesMi
. -
The Module
STYLECLASS
is reserved for special stylized cases.
So for example writing
# ...
- STYLECLASS:
BLOCK:
# ...
would put a blocked area in the pdf, instead of putting an actual entry with the text "STYLECLASS / BLOCK".
Under the hood it just takes the word "BLOCK" (which can really be any other) and assigns it to the coresponding times.
This is then picked up by public/style.css
(were I have defined what .block
should look like) and styled accordingly.
Known issues
-
Doesnt work if not all days are set (null checks in general)
-
Have to use the exact yaml structure
-
Margin on the left not easily configurable
-
Mensa times are not actually displayed
-
Most config.yaml items are required (no defaults)
-
Code is german spaghetti