nora + Tenjin

次はこれで何か作ってみよう。。。

#!/usr/bin/env ruby
$stdout.binmode
require 'rubygems'
require 'web'
require 'tenjin'

engine = Tenjin::Engine.new()
api = Web::Interface::AUTO.new

api.each {|req|
  rsp = Web::Response.new
  rsp.content_type = 'text/html'
  context = { :name=>'World', :items=>['<AAA>', 'B&B', '"CCC"'] }
  rsp << engine.render('ex.rbhtml', context)
  api.response req,rsp
}
Hello #{@name}!
<ul>
<?rb for item in @items ?>
 <li>${item}</li>
<?rb end ?>
</ul>