Using ed(1) as My Static Site Generator By Artyom Bologov I have a long story with bipolar spikes making me re-evaluate my tech choices. You can observe it with multiple of my website setups: I started with Tripod, my Gemtext-oriented OOP Lisp engine. Then I used the DSLs Common Lisp provides to generate HTML from s-expressions. And, finally, I switched to C Preprocessor. And here's a new flare-up, I guess? This time I'm testing the limits of what ed-family editors can do. Including parsing Lisp. And using ed as an everyday scripting environment. I've also tried ex/vi (not Vim!) To the point of making a Lisp programming config for it. But ex/vi are too troublesome, so forget it. Back to ed then! Here's a compiler from high-level Modal system to ed, written in ed itself. Here's a script processing Wisp syntax extension for Lisps. And here's a whole category for ed tasks I solved on RosettaCode. The overarching narrative can be a transformation from one format to the other. Like... what site generators do? So I can use ed as my site generator, and get away with it? Setup: Glorified ed Scripts # So the way ed scripts are ran: ed -s file.html < script.ed Example script run This incantation Opens a file.html, Reads commands from stdin (redirected script.ed.) And saves/writes (w command) file if there are respective commands in the stdin. A huge advantage is that I can swap commands in the script file. Replacing writing commands to printing ones, for example. This way, I can print the content of the post without modifying it. Y'know, for blog debugging (everyone does that?) With that general formula, I can abstract article builds per format with two scripts: a preprocessing (deabbreviation and escaped char expansion) script and the actual conversion. Here's how my Makefile rule for .txt building looks like: %.txt: %.h -cp $^ $@ -ed -s $@ < scripts/preprocess.ed -ed -s $@ < scripts/totxt.ed Makefile implicit rule for conversion from .h to actual output text files Repeat th...
First seen: 2025-05-31 16:28
Last seen: 2025-06-01 03:30