From: Wakou Aoyama Date: 2002-08-08T05:54:37+09:00 Subject: Re: XHTML output Hi, On Wed, Aug 07, 2002 at 10:14:53PM +0900, Francois GORET wrote: > I would like to have CGI.rb outputs XHTML 1.0 code. Anybody did it already ? I am testing it. http://www.ruby-lang.org/~wakou/lib/test/ require "cgi" cgi = CGI.new require "cgi/session" session = CGI::Session.new(cgi) require "html/xhtml1" html = HTML::XHtml1.new(:check=>$DEBUG, :pretty=>$DEBUG, :cgi=>cgi) do html do head{ title{"TITLE"} } body 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} HTML::XHtml1.new(:check=>true) --> check HTML error $ cat test.rb require "html/xhtml1" HTML::XHtml1.new(:check=>true) do html do p do end end end $ ruby test.rb test.rb:6 undefined method `p' for # You can use these elements here. head, body -- Wakou Aoyama