Automatically generated from the Gemini capsule gemini://l-3.space

Time-stamp: <2021-04-21 18h50 UTC>

l-3.space is now automatically compiled to the web

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⁰.

https://l-3.space

This is a short post to detail how i implemented it, and lament the things that didn't work.

I'm not in the best time-line (yet)

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.

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.

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.

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

A fun story about licensing

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