#!/usr/bin/env ruby -wKU # encoding: utf-8 require "rubygems" require "sinatra" require "erb" require "thin" require "redcarpet" def put_markdown(filename) markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true) result = "" File.open(filename, "r").each_line do |line| result = result << markdown.render(line).to_s end return result end get "/" do erb :index end __END__ @@ index <% start_time = Time.new %> <%=put_markdown("public/index.md") %> <% end_time = Time.new - start_time %> <%="
Execution time %.9f
" % end_time %>