- made post markup flexible
This commit is contained in:
parent
8895f9aca5
commit
cf354d939e
1
Gemfile
1
Gemfile
|
@ -11,3 +11,4 @@ gem 'dm-postgres-adapter'
|
||||||
|
|
||||||
# the different markups
|
# the different markups
|
||||||
gem 'RedCloth'
|
gem 'RedCloth'
|
||||||
|
gem 'rdiscount'
|
||||||
|
|
|
@ -61,6 +61,7 @@ GEM
|
||||||
rack (1.3.0)
|
rack (1.3.0)
|
||||||
rack-flash (0.1.1)
|
rack-flash (0.1.1)
|
||||||
rack
|
rack
|
||||||
|
rdiscount (1.6.8)
|
||||||
sass (3.1.3)
|
sass (3.1.3)
|
||||||
sinatra (1.2.6)
|
sinatra (1.2.6)
|
||||||
rack (~> 1.1)
|
rack (~> 1.1)
|
||||||
|
@ -81,6 +82,7 @@ DEPENDENCIES
|
||||||
dm-postgres-adapter
|
dm-postgres-adapter
|
||||||
haml
|
haml
|
||||||
rack-flash
|
rack-flash
|
||||||
|
rdiscount
|
||||||
sass
|
sass
|
||||||
sinatra
|
sinatra
|
||||||
sinatra-support
|
sinatra-support
|
||||||
|
|
1
libs.rb
1
libs.rb
|
@ -12,6 +12,7 @@ require 'rack-flash'
|
||||||
|
|
||||||
# markups
|
# markups
|
||||||
require 'redcloth'
|
require 'redcloth'
|
||||||
|
require 'rdiscount'
|
||||||
|
|
||||||
require 'settings'
|
require 'settings'
|
||||||
|
|
||||||
|
|
9
page.rb
9
page.rb
|
@ -30,4 +30,13 @@ class Blog < Sinatra::Base
|
||||||
def link_to display, link
|
def link_to display, link
|
||||||
"<a href=\"${link}\">#{display}</a>"
|
"<a href=\"${link}\">#{display}</a>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def markup content, markup
|
||||||
|
markup= markup.to_sym
|
||||||
|
if respond_to? markup
|
||||||
|
send markup, content
|
||||||
|
else
|
||||||
|
content
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
%article
|
%article
|
||||||
%header
|
%header
|
||||||
%h1=post.title
|
%h1=post.title
|
||||||
%section.content=textile(post.content)
|
%section.content=markup(post.content, post.markup)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user