reStructuredText for WordPress

I’ve previously mentioned how Matthew Scott’s reStructuredText for WordPress is a good hack for making wordpress usable. However, revision 5 from the rest-wordpress bazaar repository was broken in a few ways.

The most annoying way was that the options I’d configured up the top of the file weren’t having the desired effect. I wasted the better part of an hour in debugging until I recalled how horrid PHP scoping was. It was a simple fix.

--- rest.php	2008-01-03 00:28:23 +0000
+++ rest.php	2008-02-04 09:20:59 +0000
@@ -95,6 +95,7 @@
  */
 function reST($text) {
   global $rst2html;
+  global $rst2html_options;
   global $cachedir;
   global $usepipes;
   global $tmpdir;

Additionally, the handling of wordpress “more” directives was quite fragile. They broke with the default wordpress theme. Matthew seems to have incorporated some of the suggestions from pupeno, but there are a few problems with that post:

  • I think pupeno forgot to change the $prefix when he wrote he was changing it for debian.
  • The suggested link processing is *way* too broad; it’s only meant to be used for “more” links, and the way it is it will clobber any linky-looking thing regardless of context.

I sent a couple of patches to Matthew Scott; hopefully he’ll apply
them. In the meantime, I started my own rst-wordpress branch on launchpad.

Despite all this, I feel a more robust solution is in order, probably involving driving docutils directly via python, and maybe even using docutil’s XML output with XSLT.

Tags: , ,

Leave a Reply

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>