From: Wakou Aoyama Date: 2002-05-27T06:59:38+09:00 Subject: HTML generation library Hello, I put it at http://www.ruby-lang.org/~wakou/lib/test/ If .new(:check=>true) then check HTML error. for example, HTML::Html3.new(:check=>true){head{p{"bad!"}}} > Exception `NoMethodError' at test.rb:20 - undefined method `p' for # > You can use these elements here. > title, isindex, base, script, style, meta, link require "cgi" cgi = CGI.new require "cgi/session" session = CGI::Session.new(cgi) require "html/xhtml1" html = HTML::XHtml1.new(:cgi=>cgi, :encoding=>"euc-jp", :check=>$DEBUG, :pretty=>$DEBUG) do html("ja") do # == html(:lang=>"ja") do head{ title{"TITLE"} } body("white", "black") do # == body(:bgcolor=>"white", :text=>"black") do h1{"head 1"} p do "some text" end p do pcdata(:escape){" is "} a("http://www.ruby-lang.org/"){"here"} pcdata(:escape){"."} end form do fieldset do textarea("field_name") br submit end end pre do pcdata(:escape){cgi.params.inspect} # auto escape &\"<> end end end end cgi.out{html.to_s} require "html/xhtml1fr" html = HTML::XHtml1Fr.new(:cgi=>cgi, :encoding=>"euc-jp", :check=>$DEBUG, :pretty=>$DEBUG) do html("ja") do # == html(:lang=>"ja") do head{ title{"TITLE"} } frameset(:cols=>"50%,*") do frame("url", "name") # == frame(:src=>"url", :name=>"name") frame(:src=>"url", :name=>"name", :noresize=>true) noframes do body("white", "black") do "body" end end end end end -- Wakou Aoyama