lib/wunderbar/cgi-methods.rb in wunderbar-0.8.5 vs lib/wunderbar/cgi-methods.rb in wunderbar-0.8.6

- old
+ new

@@ -81,31 +81,26 @@ end end end # produce html/xhtml -def $cgi.html(&block) +def $cgi.html(*args, &block) return if $XHR_JSON or $TEXT + args.push {} if args.empty? + args.first[:xmlns] ||= 'http://www.w3.org/1999/xhtml' if Hash === args.first + mimetype = ($XHTML ? 'application/xhtml+xml' : 'text/html') x = HtmlMarkup.new - if $XHTML - $cgi.out? 'type' => 'application/xhtml+xml', 'charset' => 'UTF-8' do - x._! "\xEF\xBB\xBF" - x.declare! :DOCTYPE, :html - x.html :xmlns => 'http://www.w3.org/1999/xhtml', &block - end - else - $cgi.out? 'type' => 'text/html', 'charset' => 'UTF-8' do - x._! "\xEF\xBB\xBF" - x.declare! :DOCTYPE, :html - x.html &block - end + $cgi.out? 'type' => mimetype, 'charset' => 'UTF-8' do + x._! "\xEF\xBB\xBF" + x._.declare :DOCTYPE, :html + x.html *args, &block end end # produce html and quit -def $cgi.html! &block +def $cgi.html! *args, &block return if $XHR_JSON or $TEXT - html(&block) + html(*args, &block) Process.exit end # post specific logic (doesn't produce output) def $cgi.post