Created
December 4, 2010 11:15
-
-
Save zakuni/728114 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| p こんにちは、#{h params[:name]}さん! | |
| a href='/' 戻る |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| require 'rubygems' | |
| require 'sinatra' | |
| require 'haml' | |
| require 'slim' | |
| module Sinatra | |
| module Templates | |
| def slim(template, options={}, locals={}) | |
| render :slim, template, options, locals | |
| end | |
| end | |
| end | |
| helpers do | |
| include Rack::Utils; alias_method :h, :escape_html | |
| end | |
| get '/' do | |
| slim :index | |
| end | |
| post '/hello' do | |
| slim :hello | |
| end |
This file contains hidden or 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
| p あなたの名前は? | |
| form action="/hello" method="POST" | |
| input type="text" name="name" | |
| input type="submit" value="送信" |
This file contains hidden or 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
| html | |
| body | |
| h1 Hello World | |
| == yield |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment