# 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 files preparation
1. Template script generation
2. Template population

### Template and files preparation
As an example a file [fedizine_template_example.html](fedizine_template_example.html) is provided. For now there's nothing fancy, it is just a modified index.html page.

The template expects a folder named "contestants" in the same directory as itself. Contestants folder would hold a bunch of other directories, one per contestant. Names of those folders are not used in templating, but  imagine you'd want something readable.

Every contestant folder should contain a `bio.txt` file. File's full name would be `contestants\%some_folder%\bio.txt`.

Such file should have following lines in following order:
1. Contestant name
2. Contestant bio written in a single line (no line breaks allowed); sorry it is scuffed for the first version
3. A line describing an artwork
4. A line describing an artwork
5. A line describint an artwork
6. ....

An amount of artworks isn't actually limited to just two.
`A line describing an artwork` would be broken up by `"` delimiter. Which means it sould look somewhat like this: `"ref1.webp" "Short description" "Alt text"`
1. First entry is file name. **Note that the file not listed in bio.txt will not be displayed in the final html**
2. Second entry is short visible description. It will be written next to the file.
3. Third entry is the image alt text.

### Template script generation
Once template file is sufficiently prepared, you can create a generation script with this command:
```
./bash-tpl fedizie_template.html > fedizine_generate.sh && chmod +x fedizine_generate.sh
```
This script doesn't require `bash-tpl` or template file and can be transferred elsewhere at will.

### Template population
Once folder structure and data are prepared and template script is generated, put template script in the same directory where `contestants` folder would be and execute command:
```
./fedizine_generate.sh > generated.html
```

This will create `generated.html` file which should be served to the end user.