copyfiles plugin

Most of my site uses blosxom in static mode. Because of this, I wanted to be able to generate my entire web directory by running blosxom, rather than having to copy files over by hand. So wrote copyfiles while, in static mode only, will look for files called fileslist in each directory, and copy the files or directories specified therein to the appropriate place in blosxom’s destination directory.

I learned a couple of painful lessons while writing this plugin. Don’t call perl’s File::Find re-entrantly. Things go horribly wrong. Also, if you use File::Copy to copy a file to itself, you’ll end up with an empty file.

permalink | computing/web/site/blosxom/plugins | 2007.11.19-22:36.00

prunesort plugin

Controlling depth for static blogs in blosxom is an issue I had a lot of trouble with. For most of my static side, I wanted the equivalent of 0 = 1. However, just setting this in config files (for use by the config plugion) doesn’t work, because blosxom in static mode doesn’t work like it does in dynamic mode.

In dynamic mode, when you load a directory via blosxom.cgi, blosxom trawls through that directory and its children (consulting 0), building its list of entries. Any plugins that implement per-load calls (like entries or filter) get run, and can change the list of entries. Then generate() is called, which does sorting, and then, for each entry, calls the per-story plugin subroutines (like head and sort).

So far so good. In dynamic mode, we’re all fine.

But in static mode, things work a little differently. Blosxom still only calls entries and filter once, this time for the entire site. It’s too early to play with 0, because if you do, blosxom will ignore half your pages. generate() is called for each directory that you want HTML files for. It is only from subroutines called from within generate() that we get a chance to control depth on a per-directory basis.

This is why prunesort exists: it override the default sort subroutine, and does something evil; it prunes the list of files being sorted according to the current depth, and returns the remainder sorted in the default manner.

Having plugins that mess with sorting is annoying, since only one plugin gets to do the final sort; blosxom will call upon the first-found plugin that implements sort. Others will be ignored (obviously, since you can’t sensibly chain sorts).

permalink | computing/web/site/blosxom/plugins | 2007.11.19-22:36.00

bottomupconfig plugin

The config plugin by Rael Dornfest is cool, in that it allows you to replace or define settings for sub-hierarchies of your blog. However, it didn’t really work the way I wanted to for a static blog.

config reads config files from the directory being loaded towards the root (i.e. from the top down, if your directory tree is growing upwards). It was more useful to me to allow config files in subdirectories to override those in their parent, so I wrote bottomupconfig which does just that.

permalink | computing/web/site/blosxom/plugins | 2007.11.19-22:36.00

absolutize plugin

Rael’s absolute plugin didn’t work for me when fixing up relative image links when the images lived in a directory that was relative to the blog entry, so I hacked on it. I probably broke RSS-related stuff.

permalink | computing/web/site/blosxom/plugins | 2007.11.19-22:36.00