Permalink
Browse files

Post#body_html

  • Loading branch information...
1 parent 0547591 commit 30919e0adc40461babe9b58aa6aa8f1e7d7efaa3 @adamwiggins committed Oct 22, 2008
Showing with 7 additions and 5 deletions.
  1. +3 −0 lib/post.rb
  2. +0 −1 main.rb
  3. +4 −4 views/post.erb
View
@@ -1,2 +1,5 @@
class Post < Sequel::Model
+ def body_html
+ RDiscount.new(body).to_html
+ end
end
View
@@ -74,7 +74,6 @@ def split_content(string)
get '/past/:year/:month/:day/:slug/' do
post = Post.filter(:slug => params[:slug]).first
stop [ 404, "Page not found" ] unless post
- post[:body] = RDiscount.new(post[:body]).to_html
erb :post, :locals => { :post => post }
end
View
@@ -15,11 +15,11 @@
<div id="page">
<div id="content">
<div class="postzoom">
- <h2 class="title"><%= post[:title] %></h2>
- <p class="meta"><small><%= post[:tags] %></small></p>
- <p class="meta"><%= post[:created_at] %></p>
+ <h2 class="title"><%= post.title %></h2>
+ <p class="meta"><small><%= post.tags %></small></p>
+ <p class="meta"><%= post.created_at %></p>
<div class="entry">
- <%= post[:body] %>
+ <%= post.body_html %>
</div>
</div>
</div>

0 comments on commit 30919e0

Please sign in to comment.