So, um, I took a week off, more or less, from any real, sensible, useful
work to write my own blogging package.
This choice, believe it or not, was not undertaken lightly. Well, that's
not entirely true--the need to resolve the issues I'd been having bit me
in the ass one day, and I just couldn't concentrate on anything else
until it was done. But I'd been thinking about moving for a while,
because there were issues with the software I had been using, but the
software, Blosxom, is basically dead.
Well, perhaps that's overstating the case. It still has a community of
users, and many of them are quite happy--heck, I was mostly happy--but
it has no leader to keep development moving forward, and the prior
leader, Rael Dornfest, released the last alpha
version of the "big new update" nearly a year ago with a restrictive
license that forbids anyone from picking it up and continuing
development.
And the idea of hacking on the prior version, of which I've done a
little, was not attractive.
So I decided to take those aspects of Blosxom that I really
liked--mostly using the filesystem as your database--and build my own.
And I have, and it's not really ready to be released just yet (there's
still a ton of rough edges), but I can talk about the design a little
bit.
The single biggest thing I like about Blosxom is that it uses the
filesystem as its database of articles, which are all just text
files--you type them up, give them silly names, dump them in
directories, and it picks through it all to find stuff. This works great
for me, with my devotion to Emacs, and it allows me to easily and
reliably do all my editing locally, and then push my changes up to the
real server using rsync or sitecopy or what-have-you.
Where my too begins to differ is that Blosxom considers the first line
of your file the title, and the rest is the body. For various reasons, I
got in the habit of separating those with a line, and I decided to
exploit that. So my tool considers anything up to the first blank line
to be a "header", while the rest of the file is the body.
Now, at the moment, I actually prefix this header text with the string
"title: ", and then split the whole thing up on the colons, much like
one would a mail header. This allows you to define arbitrary properties
for a message. You can put:
This is a title
Foo: Fee
author: Jiminy
Etc., etc. The body part of the message gets run through
Textile, which is a very nice,
very smart formatter that takes a lot of the scutwork out of the sort of
text I'm writing. It gives me back xhtml.
From all this, I can produce a chunk of XML to represent the article,
including those arbitrary properties from the header. This all gets
glommed together with some header information for the whole feed into a
big XML document that represents the semantic content I want to produce.
Then, depending on what sort of output you requested (this is the
"flavor" in Blosxom parlance), that XML is cranked through a stylesheet
that will produce well-formed XHTML, or RSS (of any type), or Atom, or
conceivably other things.
Even though this is all written in perl, it's pretty damn fast--all the
XML tomfoolery is done using the XML::LibXML and XML::LibXSLT libraries,
which are wrappers around libxml2 and libxslt1.1, which are
lightning-fast C libraries for doing this stuff.
I also think it's ridiculously flexible, for the usual reasons: it
divorces content from presentation (mostly), so it's easy to support
multiple formats with a fair shot at producing optimal results in them.
I also have ideas for "plugins"--the fundamental thing to realize is
that we can dump as much stuff as we want into our "source document",
and then use XSLT stylesheets to tailor things for presentation. So that
list of days with number of posts can be put in some arbitrary place and
the XSLT (probably plus some CSS) can move it to be a sidebar.
Overall, I think it's going to end up being a nice system--perhaps not
perfect, but close. But for the moment I need to go to bed.