New Blog Software

March 15, 2009 | categories: Python, Blog, Programming | View Comments

Update: I just switched from Zine to using Blogofile. That is, I'm using another new blog software now. o_O

I have a new blog now. This one's running Zine. I'm redirecting the old RSS and Atom feeds to Zine's Atom feed. I hope that this doesn't blow up someone's RSS reader. I decided not to import the posts from the old Atom feed (which Zine allows you to), because I'd lose comments. That's why the old blog will just stay online for the time being.

So update your bookmarks and readers and whatnot!

I decided to switch from my old blog running PyBlosxom for a couple of reasons:

  • I'm trying something new
  • PyBlosxom doesn't do tags (or: more than one category)
  • It doesn't do threaded comments
  • PyBlosxom's code is somewhat messy

Now what I really like about PyBlosxom though is its ability to render your blog from a bunch of files on the filesystem. You have a couple of folders, which represent your categories, and a couple of text files in those; your blog posts. Zine uses a technology called SQL database instead (wink), which is alienating in comparison.

The second thing I like about PyBlosxom is that those text files can use the reStructuredText format, which is my favourite markup language. Zine doesn't do this out of the box. There's this rst plugin floating around, but it didn't really work for me. And so I decided that instead of debugging this obscure reST-0.2.plugin file, and to warm up to Zine, I'd write a little reStructuredText plug-in myself.

You can get the plug-in here. If you have trouble like me to install it through Zine's admin interface, try restarting your Zine after installation. Here's the code for those who like code:

import docutils.core
from zine.i18n import _
from zine.parsers import BaseParser
from zine.utils.zeml import parse_html

class RSTParser(BaseParser):
    """A reStructured Text parser."""

    name = _(u'reStructured Text')
    settings = dict(file_insertion_enabled=0,
                    raw_enabled=0,
                    output_encoding='unicode',
                    input_encoding='unicode',
                    initial_header_level=4)

    def parse(self, input_data, reason):
        parts = docutils.core.publish_parts(
            input_data, writer_name='html',
            settings_overrides=self.settings)
        return parse_html(parts['html_body'])

def setup(app, plugin):
    app.add_parser('restructuredtext', RSTParser)

(The clever programmers see that it's still lacking support for Pygments.)

Update: There is Pygments support now, and I've changed the link to point to the updated version.

You can see that it's easy enough to extend Zine with a plug-in like this. (There's only a metadata file that you also need to put into your module.) But, I'm somewhat irritated that Zine's not using setuptools eggs and entry points for distribution and installation. Zine seems to have a general aversion to setuptools; to install Zine itself, one is advised to ./configure && make install.

More comments can be found at the original blog post.

blog comments powered by Disqus