The New Utovsky Bolshevik Show

Thu, 03 Nov 2011

reStructuredText Preview for PyBlosxom

This blog runs on blogging software called PyBlosxom, running on my VPS. I have never really used it as much as I could have, partly because my blog writing is sporadic at the best of times, and partly because I find the software itself somewhat difficult to work with. My main qualm is that, out of the box, you have to write plain HTML for your posts. This is moderately painful when it comes to writing free-form text, but truly terrible if you want to write technical posts including code.

So I started looking around at various platforms, most of which provided a rich-text editor. I've never found rich-text editors particularly useful, partly because I love me some semantic markup [1] but mostly because they tend to be designed, again, for free-form writing with occasional formatting.

At work, we've started using Sphinx for all of our documentation, which uses reStructuredText, of which I am a great fan. So I was thinking to myself, wouldn't it be great if I could use a blogging platform which allowed me to write in reST.

It transpires that PyBlosxom is just such a platform [2], so I'm sticking with it.

One of the advantages of writing my posts in HTML is that I could easily see what they were going to look like whilst writing them, by pointing a browser at the file on my local machine. With reST, this wasn't immediately possible, which posed something of a problem.

To solve this, I've written a little Python script which takes a file as its first argument, processes it, writes the HTML output (with the title included) on stdout and the metadata for the post on stderr. I've been using it to preview this post like so:

python preview_rest.py pyblosxom-rest-preview.rst > preview.html

You'll need to have docutils installed (python-docutils on Debian) for it to work. Enjoy!

[1]If I could easily write my blog posts in LaTeX, I probably would.
[2]Come back, PyBlosxom, all is forgiven. See http://pyblosxom.bluesock.org/registry/text/rst.html.

Posted: Thu, 03 Nov 2011 21:11 | Tags: , , | Comments: 0 |

Comments

Name:


E-mail:


URL:


Comment: