templates

source

First part of my site generation stack are templates. Template files are normal .gmi/.html filex except for few extra features.

Template words are custom expressions in two files: simple-template-list complex-template-list

Each template word consist of two parts separated by whitespace: name and ruby expression. Words are separeted by newline and empty lines or lines starting with '#' are ignored. You can continue expression on next line with classical backslash, but for multiple lines in your expression you must use ';'. Expressions are evaluated with 'eval' and their returned value is used.

Words are further separated into simple and complex. Simple words are called using '||WORD||' syntax and evaluate once upon script invocation. Complex words are called using ';;WORD;;arg;;' syntax and are evaluated for every reference seperately. Argument is provided in 'arg' variable.

Due to implementation logic you can reference other words that are defined after referencing word. this is for example used in 'clubsmate of the day'.

After word expansion, files are stored at given location as stated on first line of file.

I mostly use this as macros to insert stuff like html headers, but also for all the randomly generated stuff on homepage.