From 9e9e3f26622cfad503e67e22114ff1d162fa43c3 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Thu, 5 Apr 2012 22:30:57 +0200 Subject: [PATCH] Use block helper for markdown blocks --- app/helpers/application_helper.rb | 5 +++++ app/views/asciicasts/_asciicast.html.erb | 3 +-- app/views/home/show.html.erb | 26 +++++++++++------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 416ee57..d6d9e9a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -16,4 +16,9 @@ module ApplicationHelper image_tag user.avatar_url || default_avatar_url, :title => nickname, :alt => nickname, :class => "avatar" end + + def markdown(&block) + markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML) + markdown.render(capture(&block)).html_safe + end end diff --git a/app/views/asciicasts/_asciicast.html.erb b/app/views/asciicasts/_asciicast.html.erb index 4d830be..c44a929 100644 --- a/app/views/asciicasts/_asciicast.html.erb +++ b/app/views/asciicasts/_asciicast.html.erb @@ -6,8 +6,7 @@ <% unless (defined? skip_description) && skip_description %>
- <% markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML) %> - <%= markdown.render(asciicast.description.to_s).html_safe %> + <%= markdown do %><%= asciicast.description.to_s %><% end %>
<% end %> diff --git a/app/views/home/show.html.erb b/app/views/home/show.html.erb index f604f83..e609004 100644 --- a/app/views/home/show.html.erb +++ b/app/views/home/show.html.erb @@ -51,28 +51,26 @@

Use it

- <% markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML) %> - <%= markdown.render(< +To install or upgrade **ascii.io** recorder, open a terminal and run following command: - $ curl -sL get.ascii.io | bash + $ curl -sL get.ascii.io | bash - (when using zsh you may need to run `rehash` after above command) +(when using zsh you may need to run `rehash` after above command) - That's it! Now you can start recording your terminal sessions with: +That's it! Now you can start recording your terminal sessions with: - $ asciiio + $ asciiio - If you want your recordings to be assigned to your ascii.io profile (btw, see mine: [~sickill](/~sickill)) run this - and follow instructions: +If you want your recordings to be assigned to your ascii.io profile (btw, see mine: [~sickill](/~sickill)) run this +and follow instructions: - $ asciiio auth + $ asciiio auth - See available commands and options with: +See available commands and options with: - $ asciiio -h -EOS - %> + $ asciiio -h + <% end %> <%# <%= link_to 'See help', manual_path, :class => "btn btn-large" %1> %>