Wednesday, June 13, 2007

Blogging and Ruby

So I did a recent post on this topic on my other blog but discovered a few more things in the past couple of days that I thought were good. My blog was about source code formatting when posting blog entries. Every time I want to do a post that contains some source code it always seems like it can be a pain. There’s no way that I’d want to post a lot if it took me fifteen minutes to manually format some source code in html format just to get some nice snippets. So just by chance I tried copying my code snippets from Eclipse (using Aptana) and pasting them into Pages and then exporting what I had to html format. The great thing was was that when I copy from Eclipse and paste into Pages it appears exactly how it does in Eclipse (color, indentations etc). It worked great and I found myself using Pages like this to past html into the post that I was currently working on. Well the only problem with this is that Pages will also add a style-sheet and add classes to divs and what not. So this wasn’t a ‘perfect’ solution. So then I figured since I’m getting back into Ruby I should write a quick little Ruby script that would convert my exported html document into exactly what I wanted for my blog. My last post was using a quick test of what I had in the beginnings of this process. It ended up being a very small script and it does exactly what I want and quickly. So now for all my blogging that I do on my Mac I’ll be using Pages to write my whole blog, Eclipse to copy-and-paste code, and my lil’ script to get it ready for blogger. I can spell-check in Pages, insert links(like above) and now do my source code so it’s almost perfect.

So now I can spend more time blogging and less time doing manual html labor.

1 comment:

Владимир said...

Justin, I'm sorry for spamming here (please delete my comment), but it looks like you're using the same template as I use in my blog. However, yours is adjusting content area width when you adjust browser window, while mine is fixed. Could you, please tell me (vkelman at gmail dot com) how to modify that blogger template to make width adjustable? Thanks again.