Sha256: 9f3b1a4cad22441c97a7bb528bd56fa34d3e6a21cdc1a9137b7f03f8ba7bb541
Contents?: true
Size: 634 Bytes
Versions: 5
Compression:
Stored size: 634 Bytes
Contents
require 'sinatra' require 'rdiscount' def Documentinator! dir = File.dirname(File.expand_path(caller.first.split(':').first)) set :dir, dir set :styles, dir + '/styles.sass' run Sinatra::Application end set :haml, {:format => :html5} set :views, lambda { root } helpers do def md source RDiscount.new(source).to_html. # uses newline entity in pre tags gsub(/<code>.*?<\/code>/m) do |match| match.gsub(/\n/m,"
") end end def styles sass File.read(settings.styles) if File.exist? settings.styles end end get '/' do @doc = md File.read(settings.dir + '/index.md') haml :doc end
Version data entries
5 entries across 5 versions & 1 rubygems