Textile2Twiki: Notes on Textile to Twiki Conversion

Posted by Peter Burkholder Fri, 05 Jan 2007 20:57:00 GMT

Today I wrote a longish paper in Textile before I recalled that I was going to have to post this to a Twiki. Dang. I can’t stand Twiki syntax. Anyhow, I was able to use the following “Find & Replace” commands in Textmate to convert Textile to Twiki syntax.

Links:

Find (regular expression): "([^"]*)":([^\s]*)
Replace: [[$2 $1]]

Headings

Find (regular expression): ^h1.
Replace: ---+
Find (regular expression): ^h2.
Replace: ---++

Lists

Find (regular expression): ^\*\*
Replace: * (six spaces, then *)
Find (regular expression): ^\*
Replace: * (three spaces, then *)

These replacements took care of 95% of the conversion, changing the blockquotes was easier done by hand than by trying to cook up a regexp for the two cases, as was putting in the <nop> by hand so OpenPGP wasn’t interpreted as a page link. Hurrah for Textmate!