One of the things I used to love about doing all of my writing in TextMate was publishing directly to this site using the “blogging” bundle. iA Writer is a better writing app than TextMate, so the tradeoff when I switched seemed fair, but I still get annoyed every time I copy and paste the latest post into MarsEdit.
This is further complicated by linked-list style posting: When I did Daring Fireball style linked lists, with one-line comments, it was easy to quickly post a link with a pull-quote by hitting
CMD+1. That shortcut dumped all the data I grabbed into MarsEdit. But it sucks for my Kottke-style links where I try to write a bit more — often not in the same sitting.
Bottom line: My most irritating workflow problem used to be the amount of copying and pasting going on just to post something to this site.
That’s now changed.
The biggest stumbling block was getting the text to WordPress from Writer. I found ways to do it via PHP, Python, and a command line interface — but none of these were solutions that I could figure out, or wanted use. Additionally these solutions require detailed documentation to reinstall, should I start on a fresh computer.1
I wanted something easier. Actually I wanted an AppleScript that would send the post, but I’ve yet to figure that out.
MarsEdit was out of the running due to it having categories under check boxes that I can’t easily set using the keyboard.
Welcome back TextMate, old friend.
You can see the macro on the side there. It’s not overly complicated, just lots of actions.
Here’s what the macro does (simplified):
- Grabs the title, which it places at the top of the post, prefixed with a
#and followed by a carriage return.
- Grabs the body text.
- Asks me for metadata.
- Opens a new TextMate document and dumps all that information in, formatted for the TextMate blogging bundle.
- Waits for me to publish the post (so I can check everything looks correct).
- When I hit the shortcut to publish in TextMate, the post publishes. The changes to the Writer file are reverted and saved, then the windows for all the programs used are closed.
Another thing I wanted was to set the scheduled publish date, which meant adding a field in TextMate containing a correctly formatted date string. I used a TextExpander snippet to speed things up (
Now I can publish from iA Writer via a series of simple actions, triggered by a single keystroke.
Because I install this macro’s only dependencies — Writer and TextMate — on every Mac I own, the solution is simple to reinstall and portable.
You can download the macro here.
This is something I have recently done, so I’m a bit sensitive to it. ↩