Class: Sinatra::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/caboodle/markdown.rb

Direct Known Subclasses

Caboodle::App, Caboodle::Kit

Instance Method Summary collapse

Instance Method Details

#markdown(sym) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/caboodle/markdown.rb', line 3

def markdown sym
  md = File.expand_path(File.join(Caboodle::App.root,"config","#{sym.to_s}.md"))
  unless File.exists?(md)
    md = File.expand_path(File.join(Caboodle::App.root,"pages","#{sym.to_s}.md"))
  end
  if File.exists?(md)
    @content = Maruku.new(open(md).read).to_html_document
    haml ".page.#{sym.to_s}.thin_page= @content"
  else
    haml "%h2.#{sym.to_s}= 'Sorry - #{sym.to_s}.md was not found"
  end
end