A static site generator written in POSIX shell
aashvik.comI wonder what would be a good way to generate a website with minimal software installations, for example in standard github runner image. This example uses comrak tool to process markdown into HTML.
I've come up with using Java and XSLT. Java is installed in Github Runner image and there's built-in XSLT support in Java standard library. You can write HTML and use XSLT to add header, footer and do other processings if necessary.
So basically I want to generate a website in github runner without accessing network to install something else.
I guess one could just `cat header.html content.html footer.html` but that requires a lot of tiny things like extracting title from content and inserting it into header, etc. Nothing that lots of greps and seds couldn't handle, of course...
A good way to do that with anything, I found, is a Makefile which downloads and compiles the few things it needs :D
Love it! My personal sites tend to start hand-written, evolve into a bash script, occasionally advance into python, but mostly just stay in bash, because it's convenient, doesn't need to please anyone else (nor would it!), and is already built for text processing into files. (I write a lot of scrappy shell scripts for my job too. I guess I should start asking an AI to generate whatever I want directly instead. Cobbling together a script is more fun though...)
The title seems to be a bit misleading IMHO because it does not really only use `sh` but heavily `sed` it seems, which is a whole programming language well suited for templating. I've in the old days written a Macromedia Dreamweaver compatible template engine using such a scheme, which I personally used quite a long time actually without Dreamweaver because this WordPress madness was even a thing.
why not perl?
fell out of popularity lately
What is wrong with people.
Please have a moment to read the title of this site again :)
I don't get this kind of indignation against anything shell related.
Care to elaborate? I don’t see anything of issue here, in fact it’s pretty good.