💾 Archived View for gemini.stjo.hn › squeeze captured on 2021-12-06 at 14:29:53. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

➡️ Next capture (2022-06-03)

-=-=-=-=-=-=-

_____________________________ST JOHN KARP_____________________________

__________________Ramblings of an Ornamental Hermit___________________

<-- Main Menu

Squeeze

A static site generator that can put the toothpaste back in the tube.

2020-02-14

About a year ago I did a very stupid thing. I tried to resize the partitions on my drive, and for some reason the operation failed and took half my data with it. I'm pretty good about backing up so I didn't lose anything irreplaceable, but I did lose the source files I used to generate this website. It's a static site that used Pelican to transform a set of Markdown sources into HTML. Losing the source wasn't the biggest catastrophe in the known universe because I did still have the whole site on my server, but now I had the unpleasant task of having to parse out the contents of each page back into Markdown files, then reconfiguring Pelican to generate my site again.

That was when I realized, "Oh, this is a Prolog problem." Prolog is a programming language that lets you define a set of facts, and rules that operate on those facts. Because Prolog programs are a set of facts and rules, they don't operate the same way as programs written in procedural languages. In fact a Prolog program can run in two directions &mdash; a program that can generate a static website can just as easily "decompile" the same site back into its source files. What has been squeezed can be unsqueezed &mdash; you can put the toothpaste back in the tube!

The program I wound up writing was called Tastic (for no particular reason). I successfully decompiled my website and have been happily using the same program to generate this website for about six months now. It's gone through a few tweaks since its first incarnation. I've made it more compliant with ISO Prolog, I've removed some dependencies, and most recently I've changed the branding to something that makes more sense. At this stage I think I can call it beta quality and, although no-one except me is actually using it, I'm pretty happy about it. It's a nifty solution to a problem, and that sort of thing tickles my potato. Although I hope no-one else loses the sources to their website, if they do I hope they might find something in Squeeze that might help them.

So what's next? There are some features I could add. Squeeze doesn't actually support writing Markdown in the Markdown files &mdash; currently it's just expecting Markdown attributes with HTML content. Writing a few paragraph tags in my blog posts isn't exactly killing me so I'm not in any rush to implement proper Markdown support, but it would be nice to do if anyone else winds up using this.

In the meantime if you want to check it out, you can get the Squeeze source code.