Skip to content


reSTructured Text articles for wordpress

I'm pretty keen to write more this year, but I'd like to do it in a format that leaves me plenty of options, so the reSTructured format appears to suit my needs.

To avoid wasted effort, I'll need to have wordpress blogs/articles using this format.
To get this installed on site5, was a little bit of a pain.

mkdir ~/bin

download docutils.sf.net
mkdir -p ~/bin
untar in ~/bin

python setup.py install --prefix $HOME #no sudo required

.bashrc, PYTHONPATH=$PYTHONPATH:$HOME # so you can test on cmdline

try a test value, rst2html.py <filename> should work.

solve any problems their first.

Now onto wordpress, install the rest.php plugin at launchpad.net.

Edit settings at the top of the file, for $prefix which needs to be the same value as setup --prefix and $rst2html to rst2html.py

Now I was stuck on the problem with wordpress executing it with environment variables that don't seem to include the PYTHONPATH that I require.

so a cheap hack around that is to just dynamically update the python search path in rst2html.py

sys.path.append('/your/python2.4/site-packages')

Now I have proper results being displayed, except the mode line, which marks the entry for processing by the rest.php filter, is also being processed.
-*- mode: rst -*-

This needs to be filtered out, either during the rst2html process or after,
so I went with just embedding it within a reST comment and all is well.

.. -*- mode: rst -*-

Post to Twitter Tweet This Post

Posted in General. Tagged with .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.


Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.