RogerBW's Blog

Augmenting Chronicle 19 May 2014

I've been keeping this blog since the beginning of the year, and it's gradually been accreting ancillary code.

chronicle itself is a blog-orientated template engine plus a comment submission system; I feed it posts written in markdown (textile and HTML are also available, though sadly not org-mode which I'm using for most of my structured writing these days), and it formats them into static HTML (plus RSS) and integrates the comments. It's the sort of software I like: it does one job well. But of course I've now written other bits of software that work with it.

The first was a very simple one: a wrapper script, because I found the pre-build and post-build commands a bit too blunt. Because I prepare posts on a machine at home and then send them up to the public-facing server, this one will bring down any new comments, run the rebuild if necessary, make sure all files are world-readable, and sync them to the server.

The second augmentation was a comment processor: it pulls in any new comments, and classifies them into "good" (using a known email address or coming from a known IP address; not a known username, for obvious reasons), "spam" (containing distinctly spammish words or phrases), or "unknown" (everything else, which might be a new commenter but is probably spam). I could probably use an existing processor such as crm114, and may eventually do so, but I couldn't be bothered in this early phase. The "good" comment directory then gets used by chronicle itself to rebuild the site. (I can manually move comments around between the three categories, of course.) Yeah, I get spam; it probably makes up more than half the total comment submissions here. But because there's no automatic publishing, the spam never makes it to where the audience can read it.

(Incidentally, the Doctor Who series 2 post gets about as much spam as everything else put together, and my review of Mrs Miniver gets the second most spam. Anyone have any idea why that might be?)

The third augmentation decides what to publish next. Each post has a primary category: aeronautics, book, film, etc. This script works out a score for each category: the number of days since the most recent occasion when an article in that category was posted, plus 0.9 × the number of unposted articles in that category (to reduce the weight of that term slightly, and to break ties). The category with the highest score is the one that gets that day's post. Of course it's a little more complicated than that, because I can also cue posts to go up on a specific date (e.g. for bookmonth posts, themselves more or less automatically generated, or when I've been doing something the previous day and want it to be posted straight away).

At some point I'll probably shift most of this onto the server so that daily posts don't rely on the machines at home continuing to run.

I have never read other bloggers writing about tools like this. WordPress lets you hide posts until a specific date, but you still have to set that date manually (which is what I was doing here at first, and Chronicle comes with a tool for that). Various platforms talk about their wonderful editing features (woo, autosave while editing), but really, guys, I already have emacs with markdown-mode; why would I want to use some jumped-up TEXTAREA instead of that?

Oh, free tip. If you are trying to get chronicle set up, be aware that specifying a config file on the command line does not prevent the system from also reading /etc/chroniclerc or ~/.chroniclerc files. Which may, as in the case of debian, contain

no-comments = 1

which could be a bit of a pain if you're wondering why your commenting engine isn't being enabled.

Comments on this post are now closed. If you have particular grounds for adding a late comment, comment on a more recent post quoting the URL of this one.

Search
Archive
Tags 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000s 2010s 3d printing action advent of code aeronautics aikakirja anecdote animation anime army astronomy audio audio tech aviation base commerce battletech beer boardgaming book of the week bookmonth chain of command children chris chronicle church of no redeeming virtues cold war comedy computing contemporary cornish smuggler cosmic encounter coup covid-19 crime cthulhu eternal cycling dead of winter doctor who documentary drama driving drone ecchi economics en garde espionage essen 2015 essen 2016 essen 2017 essen 2018 essen 2019 essen 2022 essen 2023 existential risk falklands war fandom fanfic fantasy feminism film firefly first world war flash point flight simulation food garmin drive gazebo genesys geocaching geodata gin gkp gurps gurps 101 gus harpoon historical history horror hugo 2014 hugo 2015 hugo 2016 hugo 2017 hugo 2018 hugo 2019 hugo 2020 hugo 2022 hugo-nebula reread in brief avoid instrumented life javascript julian simpson julie enfield kickstarter kotlin learn to play leaving earth linux liquor lovecraftiana lua mecha men with beards mpd museum music mystery naval noir non-fiction one for the brow opera parody paul temple perl perl weekly challenge photography podcast politics postscript powers prediction privacy project woolsack pyracantha python quantum rail raku ranting raspberry pi reading reading boardgames social real life restaurant reviews romance rpg a day rpgs ruby rust scala science fiction scythe second world war security shipwreck simutrans smartphone south atlantic war squaddies stationery steampunk stuarts suburbia superheroes suspense television the resistance the weekly challenge thirsty meeples thriller tin soldier torg toys trailers travel type 26 type 31 type 45 vietnam war war wargaming weather wives and sweethearts writing about writing x-wing young adult
Special All book reviews, All film reviews
Produced by aikakirja v0.1