lib/caboodle/markdown.rb in caboodle-0.2.21 vs lib/caboodle/markdown.rb in caboodle-0.2.22

- old
+ new

@@ -1,9 +1,16 @@ module Sinatra class Base def markdown sym md = File.expand_path(File.join(Caboodle::App.root,"config","#{sym.to_s}.md")) - @content = Maruku.new(open(md).read).to_html_document - haml ".page.about.thin_page= @content" + 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 end end \ No newline at end of file