(sl templates?) [dev] My take at a static site generator

From: Marc Chantreux <eiro_AT_phear.org>
Date: Tue, 10 Dec 2019 16:20:17 +0100

hello people,

we probably should have a wiki or something to share those ideas.
the template systems i use for the moment

* m4: very lightweight and powerful but fragile and hell to debug.
* zpp [1]: no dependency, easy to extend but i didn't benchmarked
  and suppose that isn't really fast. also it assumes zsh.
* pandoc template langage
* tpage (from the Template perl module) the best template system i ever
  used ... sadly require perl.

[1]: zpp for zsh preprocessor (bad name but i used it for many years)
     is this really simple function:

    zpp () print "${(e)"$( cat "$_AT_" )"}"

it just prints the content slurped by cat and interpolate prompt
expansions (%) as well as evaluations (e) so the remplate is basically
the content you can put in a double quote string:

letter.zpp:

    Strasbourg, %D

    hello %n,

    i will disconnected you from %m in You have $[RANDOM %% 60 ]
    seconds. the reason could be one of:

    $( sed 's/^/* /' reasons )

    thanks for your cooperation
    sysop

`zpp letter.zpp` will release

    Strasbourg, 19-12-10

    hello mc,

    i will disconnected you from prometheus in You have 44
    seconds. the reason could be one of:

    * your login shell is bash
    * you claimed to be a javascript user during suckless con
    * we found "emacs" in your shell history

    thanks for your cooperation
    sysop

regards
marc
Received on Tue Dec 10 2019 - 16:20:17 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 10 2019 - 16:24:10 CET