# fedizine

Fediverse Fanzine

## Using the template engine

For template engine [bash-tpl](https://github.com/TekWizely/bash-tpl) is used. Bash-tpl template engine allows for bash injections into templates. I hope that most of options required are displayed in the example, since I have no idea what kind of design is coveted for fedizine.

Templating is split into 3 stages.
0. Template and structure preparation
1. Data population
2. Template population

### 0. Template and structure preparation
Curently there are two monthly templates: [fedizine_monthly_template.html](fedizine_monthly_template.html) and [fedizine_monthly_template.md](fedizine_monthly_template.md). Those desribe a montly edition of fedizine.

First action to be done is to call `generate_templates.sh`.

```
generate_templates.sh april 6
```
`generate_templates.sh` expects two arguments: folder name and amount of contestants.
After calling the script folder `april` will be created with proper folder structure inside. There would be two template scripts and a `template_data` folder.

**Note that running generate_templates.sh on an already created folder structure whould not destroy edits in generated files**

### 1. Data population
After folder structure is created, head to `template_data` and edit `title.txt`. It contains overall data for this months edition of fedizine.
Next step is to descend into `contestants` folder. It contains folders named `contestant_1...n`. Each describes one of the fedizine authors. Note that you can rename those folders however you like.
Descend into `contestant_...` folder. It would contain a `bio.txt` which holds contestant name and small one liner description. Then it also contains two folders: `wholesome` and `lewd`. Wholesome folder should contain **SFW** works while lewd is designated for **NSFW**.

Do not hesitate to leave folders open or delete them. I left checks in place.

### Template population
Once all data put in it's respective places, run `generate_files.sh`.

```
generate_files.sh april
```

This will parse `april` folder and create 4 files in `april`:
- fedizine.html
- fedizine.md
- fedizine-html.pdf
- fedizine-md.pdf

fedizine.html - contains html template presumable for a web server
fedizine.md - contains markdown, used mainly for pdf generation
fedizine-html.pdf - a pdf file generated from fedizine.html
fedizine-md.pdf - a pdf file generated from fedizine.md

**Note! Pandoc does not crunch .webp format. If any of the images are .webp, pdf generation WILL fail.**