💾 Archived View for l-3.space › log-210421-1.gmi captured on 2024-02-05 at 09:33:18. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
Time-stamp: <2021-04-21 18h50 UTC>
Using a combination of git hooks, a python script, and some shell glue it is now possible to view an HTML version of l-3.space over the web⁰.
This is a short post to detail how i implemented it, and lament the things that didn't work.
I would have liked to have been able to set up a gemini-to-http server and proxied it in. The first thing i found was ddevault's Kineto.
It's written in Go, about which i have some reservations, but one of it's modules has a hard version requirement *on Go itself*! Debian does not package a ``new enough'' version, so i can't use this code. To me this is frankly unbelievable, and i'm still not sure i even understand what a version of a ``programming language'' could mean. If this is a question of libraries or something, then perhaps call it such, but the compiler gleefully reports ``Go version 1.15 required'' ...
There's also tslocum's Xenia.
Unfortunately i couldn't quite work out what this is supposed to be, or how it works, so i ended up doing this the wrong way.
I came across a gemtext-to-html converter and decided that i could reasonably modify it to generate usable HTML output directly. As l-3.space exists as a repository on the hosting machine, i opted to add the following snippet to `.git/hooks/post-update' to (re)generate the HTML every time i pushed a change to the capsule.
echo Generating HTML site for g in /var/gemini/l-3.space/content/*.gmi; do html_out="/var/www/l-3.space/$(basename $g .gmi).html" gmi2html.py /home/$USER/gemini-capsules/l-3.space/html_header.html \ /home/$USER/gemini-capsules/l-3.space/html_footer.html \ "$g" "$html_out"; chmod 644 "$html_out" done
Here gmi2html.py is the name of the script. You can find the original version and my modified version using the below links.
hunterb's original version, convert_gemtext_file.py
my modified version, gmi2htmly.py
Originally hunterb had made the code available, but had forgotten to include a license. Fortunately, there was a listed contact email address. I wrote to hunterb, explaining that i want to make use of the script, change it, share my changes, and allow others to do the same. I asked whether they would be willing to release the code under a license which afforded me these freedoms ...
they said yes!
The code is now available under the terms of the GNU GPL v3!
---
⁰ though of course, why would you