The Big Rewrite is Here

When I first started this blog, it was my very first Rails project. I was young. I was naive. I didn't do automated testing.

Fast forward back to September, and I wanted to start adding some new features. I wanted to do it right though, with tests, and all. To my dismay, I found the way I had implemented things weren't so easy to test.

This, along with Rails 2.0 coming along, and some other new libraries/plugins I wanted to learn, led me to starting a complete rewrite.

So, here's a laundry list of what I've been using so far:

I think I'm mostly feature complete, but the most significant missing piece is...

Comments! I mostly need to find a good way of spam filtering. The original version was using simple_captcha, but I've been noticing spam has still been getting through. I'm considering trying akismet, which does have a few Rails plugins.

But yeah, that's it for now. I hope to pump out a few posts about this new stuff I'm using.

December 09, 2007 at 01:24 Permalink Edit Destroy

Switched templating engine to BlueCloth

Originally, I had implemented the main data entry using TinyMCE. TinyMCE itself is a pretty cool piece of software. I mean, it gives you a full WYSIWYG (mostly) form, and the output is actual HTML. But in the end, it felt like a bit too much

So, the issues I had were:

  • It was more like WYSISWYG (what you see is sort of what you get)
  • Icky markup
  • A bit of overhead from the extra javascript files loading
  • Not any way to do code highlighting. This was the breaking point, since I plan on having lots of these

After deciding to ditch TinyMCE, the next step was to figure out what to replace it with. There are a few out there for rails:

Sometimes, I hate how developers name stuff :) Here's a break down of much comparison:

  • Pretty equivalent as far as support/ease of use in rails goes.
  • Both support straight-up HTML, so old posts will still work, and you can also drop down to HTML when a particular tricky display issue comes up.
  • Markdown seems a bit more straight forward syntax, but I suspect it's because it's very similar to the syntax used for Trac's syntax, which I'm particularly fond of

So I went with BlueCloth.

Changes to my code were pretty trivial. I added this to my BlogPost model:

      def to_html
        BlueCloth.new(self.body).to_html
      end

And in my view, I changed the following bit:

      <div class="blogbody">
        <%= blog_post.body %>
      </div>

to...

      <div class="blogbody">
        <%= blog_post.to_html %>
      </div>

Easy peezy.

Now, I can use nifty code snippets as you can see. Unfortunately, it's not quite as nifty as it could be, as it, it could use some nice syntax highlighting.

My idea is to use Ultraviolet to do that. So, I could add bits to BlogPost#to_html, to parse out the contents of <code> blocks, run it through Ultraviolet, and return that. I'll save that for another day though.

June 18, 2007 at 23:20 Permalink Edit Destroy