Sha256: 9e471390196b57df9b171d04139cffbb73468de0424c3beae96aeeae5a6b89f5

Contents?: true

Size: 579 Bytes

Versions: 6

Compression:

Stored size: 579 Bytes

Contents

#!/usr/bin/ruby -w


require 'cgi'
require 'erb'

$: << File.dirname(__FILE__)+'/../../lib'
require 'pinyin'

cgi=CGI.new("xhtml1")

params=cgi.params
begin
  if params['pinyin'] && params['pinyin'] != '' && params['pinyin'] != []
    @converted = Pinyin::Writer.new(params['to'], params['to_tone']) << (Pinyin::Reader.new(params['from'],params['from_tone']) << params['pinyin'].first)
  end
rescue
  cgi.out{$!.to_s}
  cgi.out{params['pinyin'].inspect}
end

cgi.out("text/html; charset=utf-8") do
  ERB.new(IO.read('template.rhtml')).result(binding)
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
arnebrasseur-pinyin-0.1.5 examples/cgiform/cgiform.rb
ting-0.3.0 examples/cgiform/cgiform.rb
ting-0.2.1 examples/cgiform/cgiform.rb
ting-0.2.0 examples/cgiform/cgiform.rb
pinyin-0.0.1 examples/cgiform/cgiform.rb
pinyin-0.1.4 examples/cgiform/cgiform.rb