Posts tagged as "xmlrpc":
Posting from the Text Editor
As much as I like Wordpress because of how easy it is to install and configure I really dislike composing posts in the textarea provided; even in Safari where the textarea can be expanded. I think it’s mostly a mental block, inside a web browser does not seem the proper place to compose. In fact the browser writing is a significant contributor to why I haven’t written for a while. Then fairly recently I stumbled upon the blogging bundle for TextMate.
The bundle interacts well with Wordpress through xmlrpc. Through the use of meta data at the top of a document the post is created along with tags and categories, the post slug can also be defined. This is peachy, TextMate is a much happier place to write… well anything really. However, TextMate is no longer my editor of choice as I’ve moved my text editing almost entirely to MacVim.
I started looking around for a plugin with similar functionality for VIM and found a script called vimblog by pedro mg. After downloading the plugin I noticed a couple of things I wasn’t too fond of in it. The first thing I noticed was the lack of documentation which meant looking into the script to figure out usage. The second thing which bothered me was having to put my login credentials in the script which meant I couldn’t keep it in sync between computers via source control nor could I use the script for more accessing more than one blog.
As a result of these limitations I forked pedro’s script source and began hacking away at it. I’m not finished with it by any means in my fork of the vimblog script but I do at least have the login credentials and endpoint information in a separate file. I’m looking forward to continuing to develop this script as it is my first real endeavor into using Ruby during something other than tutorials.
Posting By Committing: An Experiment
After seeing a post on the github blog about David Baldwin using github as his blog I got to thinking about how much easier it would be to create my markdown posts offline and then commit them to some repository and have them show up as blog entries.
The comments for the github entry point out a number of people using various solutions to achieve an effect similar to what I want however I am somewhat loathe to give up on a web interface in general and Wordpress in particular. But this did get me thinking, what about a post-commit hook so after every commit a script examines the changed files and creates or edits posts as necessary. Google didn’t turn up much of anything in the way of making this happen and so I started thinking about how I would write my own solution.
As of right now I’m just in the planning stages but I did realize it would have to be a pre-commit hook on account of wanting to track the post id somewhere and the most logical place seems to be as some meta information at the top of the post. Currently I have the pre-commit hook reading the information I need to send about the post out of the file, the next step will be to figure out creating an XML object to send to the xmlrpc.php file of my Wordpress installation. In addition to dealing with hooks and xmlrpc1 I’m writing the script using Perl in order to get some hands on experience with it.
I’ll admit I’m not 100% sure I can make the script do what I want it to do but I’m certainly going to give it a shot because looking at the solutions eluded to in the comments of the post on github there doesn’t look to be a solution to satisfy me yet.
My initial planning has the username, password and xmlrpc url being stored as config options via git config username|password|xmlrpc while post related information is stored in the actual post file. I think the most likely hang up will be modifying the file which is about to be committed (by adding the post id) because I believe I’d actually have to create the post via xmlrpc, write the response into the file, stop the commit, add the post file back to the index and re-commit. There may also be a problem with the way xmlrpc expects the categories.2 Time will tell.