Created
August 15, 2012 04:33
-
-
Save siraskalot/3355895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
def convert_title_to_filename string | |
string.gsub(' ','_').downcase + ".md" | |
end | |
get '/' do | |
erb :index | |
end | |
post '/' do | |
file_name = convert_title_to_filename(params[:post_title]) | |
File.open(file_name, 'w') do |f| | |
f.write params[:post_title] | |
f.write "\n---\n\n" | |
f.write params[:post_text] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment