kittv
/
prezgen
Archived
1
0
Fork 0

Add README

master
Emil Miler 3 years ago
parent f0cb8e9dca
commit be7ab35c95

@ -0,0 +1,63 @@
# prezgen
A software for automatic generation of attendance lists for use at school. Our faculty/department uses physical attendance lists for logging every class and all the attendees.
This program is written in Rust in order to run as a single binary.
## Installation
Install rust/cargo, clone this repository and run `cargo build --release`. The binary will be saved to `target/build/release`.
## Usage
In order to generate a full set of lists (PDF files), you need to have a TOML source file and a template written in HTML. The program reads the input file, checks all relevant variables and tries to find them in the template. If a variable is found, it gets filled with data from the source file variable of the same name. In case the variable is not found in the template, it gets ignored and the program continues to the next variable.
### Template
The template has two sides, front and back. Both are static HTML files (with styles) ready for clean printing (`@media print` query). The template should contain variables, which would be later replaced by the generator. The format, in which a variable should be written, is `{{ variable_name }}` anywhere in the HTML document, for example:
```html
<h2>{{ title }}</h2>
<p>Taught in the year {{ year }}.</p>
<table>
<tr>
<td>Teacher:</td>
<td>{{ techer }}</td>
</tr>
<tr>
<td>IS code:</td>
<td>{{ code }}</td>
</tr>
</table>
```
### Source file
The source file is written in [TOML format](https://toml.io). It should contain a *global* section and other sections (pages), which would later turn into individual PDF files.
```toml
year = "2021/2022"
[[page]]
title = "Unix-based operating systems"
teacher = "Theo de Raadt"
code = "BSD1"
[[page]]
title = "The C Programming Language"
teacher = "Brian Kernighan, Dennis Ritchie"
code = "C1978"
year = "2022/2023"
```
In case the same global and page variable is set, the page variable takes priority. In this particular case, the value `2022/2023` would be used for the variable `year` in the second page, whereas the first page would use `2021/2022` from the global variable.
### Building PDF outputs
Simply run the program and specify the input file.
```
prezgen sample_input.toml
```
All the PDF files will be saved into `output/`.