Project

General

Profile

Bug #7465 ยป rdoc_cgi_html_example.patch

stomar (Marcus Stollsteimer), 11/29/2012 04:04 PM

View differences:

lib/cgi.rb (Arbeitskopie)
234 234
# === Print http header and html string to $DEFAULT_OUTPUT ($>)
235 235
#
236 236
#   require "cgi"
237
#   cgi = CGI.new("html3")  # add HTML generation methods
238
#   cgi.out() do
239
#     cgi.html() do
240
#       cgi.head{ cgi.title{"TITLE"} } +
241
#       cgi.body() do
242
#         cgi.form() do
243
#           cgi.textarea("get_text") +
244
#           cgi.br +
245
#           cgi.submit
237
#   cgi = CGI.new("html4")  # add HTML generation methods
238
#   cgi.out do
239
#     cgi.html do
240
#       cgi.head do
241
#         cgi.title { "TITLE" }
242
#       end +
243
#       cgi.body do
244
#         cgi.form("ACTION" => "uri") do
245
#           cgi.p do
246
#             cgi.textarea("get_text") +
247
#             cgi.br +
248
#             cgi.submit
249
#           end
246 250
#         end +
247
#         cgi.pre() do
251
#         cgi.pre do
248 252
#           CGI::escapeHTML(
249
#             "params: " + cgi.params.inspect + "\n" +
250
#             "cookies: " + cgi.cookies.inspect + "\n" +
251
#             ENV.collect() do |key, value|
252
#               key + " --> " + value + "\n"
253
#             "params: #{cgi.params.inspect}\n" +
254
#             "cookies: #{cgi.cookies.inspect}\n" +
255
#             ENV.collect do |key, value|
256
#               "#{key} --> #{value}\n"
253 257
#             end.join("")
254 258
#           )
255 259
#         end