New Website and RSS Build System
2025-05-08 - [52] 2:19
About a month and a half ago, I wrote about a bug I accidentally introduced to my static HTML page generator that made blank lines appear in situations I didn't want them to. The post is linked below.
Another Website Redesign - CSS Naked Day Prep
Well, I did something about it, although it took a while. While trying to fix the code I already wrote, I ended up just making things worse due to how complex my code ended up getting. The solution was staring me in the face this entire time though... Write software with the Unix Philosophy in mind! Specifically, take advantage of pipes. STDIN and STDOUT have always been my friends, so I decided to treat them so!
Writing this post, I am reminded of the the painting "La Trahison des images" (The Treachery of Images), which shows a pipe and underneath it, the statement "Ceci n'est pas une pipe." The statement translates to "This is not a pipe." After finishing up the paradigm shift of programming, all I can think is "It's all pipes."
As far as I know, I'm the only one that uses the software I write for myself. That's good, because dang I broke a lot of things in the process of changing things over! There is still more work to be done, especially with muninn, my git forge program, and the code I use to generate a ZIP file offline backup of my site/capsule.
Huginn and rodor-logbook both had a lot of reused code and both did way too much. Initially, I used huginn to find every Gemtext file path that has been modified and generate an HTML file from those Gemtext files. Rodor-logbook would take a Gemtext file path and read through every subscription link to create RSS feeds. Instead of having both programs do a lot of things and get too complicated and tangled, I decided to use the 3 steps provided by Peter H. Salus in A Quarter Century of Unix (1994) to heart. Those 3 steps are:
- Write programs that do one thing and do it well.
- Write programs to work together.
- Write programs to handle text streams, because that is a universal interface.
Now instead of 2 programs with a lot of reused code, I am using 5 considerably simpler programs and stringing them together in a bash script. The 5 programs are:
- norn - Finds and prints which files have changed (whether the files have been added, removed, or modified) to STDOUT as CSV data
- hemodr - Takes Gemtext content as input via STDIN and prints out Gemtext data to STDOUT with local links replaced with either absolute or relative links
- frosti - Replaces specified {LABEL} data in template files with specified data, and replaces {MAIN_CONTENT} with STDIN's data
- huginn - (Completely changed) Takes Gemtext content as input via STDIN, converts it to HTML content and prints that out to STDOUT
- rodor-logbook - (Completely changed) Takes Gemtext content as input via STDIN and prints out Gemtext subscription formatted dates and links to STDOUT in reverse chronological order
With any luck, I will be able to stop programming my website and Gemini capsule soon enough and just focus on writing words!
Contact/Reply
If you would like to reply to this post, feel free to send me an email.
PGP Public Key [515F AD67 F931 0A2B 9B93 CE19 814F ECB1 A398 63CE]
Source