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