As you may know, mckinley.cc is totally handmade. Outside of the occasional sed command to change headers and such, all changes are made manually in a text editor. While there is a certain charm in having a handmade website, I'm growing tired of updating four files manually to post on my twtxt feed.
Tonight, I managed to make a prototype template for pp that produces an HTML list of twts for a given twtxt file, similar to the way I have it in the twtxt section of my website. It even turns Web URLs into hyperlinks. It definitely needs some work but I think I’ve just about reached the limit of POSIX sh.
I don’t know of any way to compare dates or change the format of a timestamp without GNU date. rev isn’t a POSIX utility so I can’t have reverse chronological order without doing some awk sorcery or something along those lines. I'm already doing some questionable things with grep and sed just because GNU extensions aren't allowed. Avoiding double quotes in my HTML to satisfy pp continues to throw me off. Plus, with no date comparison I can't split the HTML into multiple files. That's crucial for me because I value small page sizes. Perhaps it's for the best. I have absolutely no idea how I would even begin to implement the navigation links at the top.
That being said, I haven't lost hope. It might be doable if I can find a simple, portable C utility that can compare dates and rewrite them in a specific format. I will look at it again tomorrow, with fresh eyes.
Until then, you can download the template here. It's made to be called with pp with the twtxt feed piped to stdin, like this:
./pp twtxt.upphtml < twtxt.txt > twtxt.html
You'll need a copy of pp, either by downloading the mkws bundle and grabbing ws.sh/bin/pp from the tarball or by downloading and compiling the source code
The template assumes that the block of text in stdin is nothing but valid twtxt entries with no comment lines. I used my main feed for testing, it's located at https://mckinley.cc/twtxt.txt.
This is McKinley from McKinley Labs, signing off.
_ __ _ _ _ _ ____ _ _ __ ___ __ | |\/| / /` | |_/ | | | |\ | | | | |_ \ \_/ | | / /\ | |_) ( (` |_| | \_\_, |_| \ |_| |_| \| |_|__ |_|__ |_| |_|__ /_/--\ |_|_) _)_)
Update 2021-10-28: This, like so many of my other projects, has ended up tarred, feathered, gzipped, and deposited into the Folder of Purgatory. It was fun trying to do something complicated like this within the walls of the POSIX standard, but it's just not the tool for the job.
I should also mention that the manually edited website struck again. The listing for this very blog post in the Blog Index has been missing its hyphen for 22 days. I went ahead and fixed it. :)