I've seen the light, I'm converting my site over to RedCloth to use the wonderful textile markup.
Problem is, I have a couple years worth of html content in my database that is not textile markup. How do I convert that into textile? Is there a non-manual way?
If no, when outputting content, should I check for html, if present then don't use RedCloth?
example:
// not sure of best way to check if a string has html
if (@content.description has html)
<%= @content.description.html_safe %>
else
<%= RedCloth.new(@content.description).to_html %>
end
What is the ruby way on this? Help a newb! :-)
Found this: http://clothred.rubyforge.org/
And this: https://github.com/jystewart/html2textile
And this: https://github.com/mattt/pricetag
edit
I went with html2textile. I installed it using the instruction from this SO question I asked.
I then created a task in /lib/tasks/app.rake called textile_ize. It looks like so:
I could then run
rake db:textile_ize
and poof, done. I actually added an additional column to store the textile and create html from the textile with:before_save
. That looked like this (in my model):Hope this helps someone out there!