Friday, May 15, 2009

reSTing in Style

Who says you can't teach an old dog a new trick. I'm starting to use reST for all my web markup needs. I want to style it, of course, so I'm reading Docutils Front-End-Tools to find out how to do that.

On Ubuntu systems with the python-docutils package installed, commands like are available from a shell prompt using just rst2html. I've be marking up all the assignments I post on the GCTAA ICT website. This is both much faster than marking them up with straight html, and it provides me with an on-going opportunity to practice my reST skills.

The default style produces pages like this. It looks OK, but I want to be able to customize it. Here is what I did:
  • cp /usr/share/pyshared/docutils/writers/html4css1/html4css1.css . (copied the default style sheet from where the python-docutils debain package for Ubuntu 8.04.02 (hardy) put it to my current working directory).
  • mv html4css1.css rest_style.css
It took me a bit of fiddling to get the format for rst2html to use the new style sheet, but here it is:
  • rst2html --link-stylesheet --stylesheet-path rest_style.css index.rst index.html
This generates index.html from index.rst using rest_style.css in the same directory as the external style sheet.