Permalink
Browse files

migrating textile content to markdown

  • Loading branch information...
1 parent 8eeeca8 commit c86987964a2f5ff67bbaf1c44e98847d279412c5 @mokolabs mokolabs committed Jul 20, 2009
@@ -56,7 +56,3 @@
= link_to("freenode.net", "http://freenode.net/") + "."
= render :partial => "sponsors"
-
-
-
-
@@ -4,6 +4,6 @@
.details
%h3
= link_to "Episode 0#{podcast.id}: #{podcast.name}", podcast_path(podcast.id)
- %p= truncate(strip_tags(RedCloth.new(podcast.description).to_html).squish, {:length => 180})
+ %p= truncate(strip_tags(markdown(podcast.description)).squish, {:length => 180})
.watch
= link_to "Watch", podcast.movie_link
@@ -4,7 +4,7 @@ atom_feed({:root_url => podcasts_url, :schema_date => 2006}) do |feed|
@podcasts.each do |podcast|
feed.entry(podcast) do |entry|
entry.title "#{podcast.episode_number}: #{podcast.name}"
- entry.content textilize(("!#{request_host}#{podcast.screenshot.url}!\n\n#{podcast.description}\n\n#{link_to podcast.movie_link, podcast.movie_link}")), :type => 'html'
+ entry.content markdown(("!#{request_host}#{podcast.screenshot.url}!\n\n#{podcast.description}\n\n#{link_to podcast.movie_link, podcast.movie_link}")), :type => 'html'
entry.author do |author|
author.name "pcrowley"
end
@@ -7,7 +7,7 @@
%h2= "Episode 0#{@podcast.id}: #{@podcast.name}"
- %p= RedCloth.new(@podcast.description).to_html
+ %p= markdown(@podcast.description)
.watch_now
= link_to "Watch now", @podcast.movie_link if @podcast
@@ -32,7 +32,7 @@ xml.rss "xmlns:itunes" => "http://www.itunes.com/dtds/podcast-1.0.dtd", "xmlns:
@podcasts.each do |podcast|
xml.item do
xml.title "#{podcast.episode_number}: #{podcast.name}"
- xml.description textilize(("!#{request_host}#{podcast.screenshot.url}!\n\n#{podcast.description}")), :type => 'html'
+ xml.description markdown(("!#{request_host}#{podcast.screenshot.url}!\n\n#{podcast.description}")), :type => 'html'
xml.pubDate podcast.created_at.to_s(:rfc822)
xml.enclosure :url => podcast.movie_link, :type => podcast.movie_type, :length => podcast.movie_size
xml.link podcast_url(podcast)
@@ -6,7 +6,7 @@
#number= "Episode #{@podcast.id}"
%h1= h(@podcast.name)
- = RedCloth.new(@podcast.description).to_html
+ = markdown(@podcast.description)
.watch_now
= link_to "Watch now", @podcast.movie_link
View
@@ -1,9 +1,5 @@
# Be sure to restart your server when you modify this file
-# Redcloth is loaded by actioncontroller which f's up everything if
-# you have a different version in rubygems than is frozen
-require 'open-uri'
-
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
@@ -83,3 +79,14 @@
# Please note that observers generated using script/generate observer need to have an _observer suffix
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
end
+
+# We need open-uri to grab GitHub projects
+require 'open-uri'
+
+# Markdown support
+begin
+ require 'rdiscount'
+ BlueCloth = RDiscount
+rescue LoadError
+ require 'bluecloth'
+end
@@ -0,0 +1,17 @@
+class ConvertPodcastToMarkdown < ActiveRecord::Migration
+ # Convert Textile links to Markdown links
+ def self.up
+ Podcast.find(:all).each do |podcast|
+ podcast.description = podcast.description.gsub(/\"([\w ]*)\"\:(\S+)/, ('[\1](\2)'))
+ podcast.save
+ end
+ end
+
+ def self.down
+ # Convert Markdown links to Textile links
+ Podcast.find(:all).each do |podcast|
+ podcast.description = podcast.description.gsub(/\[([\w ]*)\]\((\S+)\)/, ('"\1":\2'))
+ podcast.save
+ end
+ end
+end
View
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20090711193504) do
+ActiveRecord::Schema.define(:version => 20090720192407) do
create_table "events", :force => true do |t|
t.string "name"

0 comments on commit c869879

Please sign in to comment.