shuppy (@delan) [archived]

“let’s make a static site generator in shell scripts”, she said

shell script that uses ripgrep and sed to stitch together html files with the page title in the header and mtime in the footer, but first we have to check if we have gnu or bsd versions of stat(1) + date(1). for gnu we need “date -ud \@$(stat -c \%Y -- "$1") +\%FT\%RZ”, while for bsd we need “date -jr $(stat -f \%m -- "$1") +\%FT\%RZ”.

“it will be fun and lightweight”, she said

shuppy (@delan) [archived]

nabijaczleweli’s blogn_t.h, with a handful of html fragments in #define macros. for example, BLOGN_T_FOOTER() contains the words “[…] Nit-pick? Correction? Improvement? Annoying? Cute? Anything? Don'<!--'-->t hesitate to […]”, while HEADING_S(level, hid, style, ...) expands to “<h##level id=STR(hid) style>HEADING_LINK(hid) __VA_ARGS__</h##level>”.

tbh this fixed-function static site generator pales in comparison to @nabijaczleweli’s blogue, which uses the c preprocessor(!) to stitch together its html.

notice how Don't has to be spelled Don'<!--'-->t :)

shuppy (@delan) [archived]

ended up replacing most of that with soupault

replacing a shell-and-sed-based abomination with “exec soupault”

soupault is a pretty neat static site generator that works with html trees instead of the usual markup-plus-yaml-front-matter.

shuppy (@delan) [archived]

ok i fibbed a little

“mtime.sh”, a 48-line shell script where almost half of that is detecting whether you have the gnu or bsd version of stat(1) and date(1)

i still have a shell script for the “last modified” line on each page, which continues to be unlucky enough to rely on two (2) commands that are completely incompatible between gnu and bsd.