The quite cool journey of a hacker trying to find his favourite SSG itch scratching position.
What inspired me to post it is that I cobbled a fun HTML preprocessor using cpp to someone today: https://git.sr.ht/~q3cpma/html-cpp (I use a Common Lisp contraption for myself).
I love how much utility 60+ year old Unix commands have. Very powerful, requiring only a few kB of ram, and even 20+ years later, I’m still discovering new utilities.
I did something similar for https://isgithubipv6.web.app/ . Most static site generators are huge ( I was aiming for < 5mb docker container) . I went with `envsubst` , env vars and a simple HTML template.
Nice! Another tantalizing rabbit hole.
I go full in on ed sporadically. It requires a bit of a brain rewire, but tye UX is closer to pencil and paper, which is hard to beat for encouraging deeper thought, IMHO.
Also, check out edbrowse for a line-oriented browser:
https://en.wikipedia.org/wiki/Edbrowse
It's developed by a blind coder and has a nice core following.
Fantastic. The Unix hackers are alive and well. Keep it real.
I once used m4 to generate my blog. Worked like a charm!
Impressive! Only three leaps away from using butterflies as static site generator!
> It has no file inclusion, for one. So C Preprocessor's #include is no longer accessible. I manage without it
m4 is always there with better macros than CPP.
I really like the idea of ed. I tried using it recently but having to constantly reprint the block of code you are editing was really tedious.
> Should You Use ed As Site Generator?
> No, not at all.
Well, it (totxt.ed) looks pretty inscrutable to me:
H
!# Include proxy title
!# Insert fallback values
?<head>?a
<SUBTITLE></SUBTITLE>
<DESCRIPTION></DESCRIPTION>
<IMAGE></IMAGE>
<IMAGE_ALT></IMAGE_ALT>
.
w
!# Include the template files via script
g/\(<!--\)*[<#]include \(file=\)*"*\([^">]*\)"* *-*\/*>*/s//&\
\/[<#]include\/d\
-1r \3\
wq\
/
g/[<#]include "*\([^">]*\)"*\/*>*/d\
.,+3w !ed %
E
!# Repeat the second time for recursive includes
g/\(<!--\)*[<#]include \(file=\)*"*\([^">]*\)"* *-*\/*>*/s//&\
\/[<#]include\/d\
-1r \3\
wq\
/
> But then, ed is so simple and more or less standard
More or less? ED IS THE STANDARD TEXT EDITOR! [1]
[1] https://www.gnu.org/fun/jokes/ed-msg.html