summaryrefslogtreecommitdiff
path: root/lib/cgi.rb
diff options
context:
space:
mode:
authorwakou <wakou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-19 21:18:41 +0000
committerwakou <wakou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-19 21:18:41 +0000
commitca3afdb861c3938d4e59ee44ff7947520e7129a9 (patch)
tree77f89b6ad71fd6107858f2e9b17f2d5cf3f0c3b4 /lib/cgi.rb
parentb8148f45947eee7461986536114949556f4eda40 (diff)
Tue Jun 20 06:14:43 2000 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/cgi.rb: change: version syntax. old: x.yz, now: x.y.z * lib/net/telnet.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi.rb')
-rw-r--r--lib/cgi.rb1097
1 files changed, 524 insertions, 573 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index de237c9fd4..4fc2ca71ea 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -1,119 +1,119 @@
=begin
-$Date$
== CGI SUPPORT LIBRARY
cgi.rb
-Version 1.61
+Version 1.7.0
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
+
Copyright (C) 2000 Information-technology Promotion Agency, Japan
Wakou Aoyama <wakou@fsinet.or.jp>
+
== EXAMPLE
=== GET FORM VALUES
- require "cgi"
- cgi = CGI.new
- values = cgi['field_name'] # <== array of 'field_name'
- # if not 'field_name' included, then return [].
- fields = cgi.keys # <== array of field names
+ require "cgi"
+ cgi = CGI.new
+ values = cgi['field_name'] # <== array of 'field_name'
+ # if not 'field_name' included, then return [].
+ fields = cgi.keys # <== array of field names
- # returns true if form has 'field_name'
- cgi.has_key?('field_name')
- cgi.has_key?('field_name')
- cgi.include?('field_name')
+ # returns true if form has 'field_name'
+ cgi.has_key?('field_name')
+ cgi.has_key?('field_name')
+ cgi.include?('field_name')
=== GET FORM VALUES AS HASH
- require "cgi"
- cgi = CGI.new
- params = cgi.params
+ require "cgi"
+ cgi = CGI.new
+ params = cgi.params
cgi.params is a hash.
- cgi.params['new_field_name'] = ["value"] # add new param
- cgi.params['field_name'] = ["new_value"] # change value
- cgi.params.delete('field_name') # delete param
- cgi.params.clear # delete all params
+ cgi.params['new_field_name'] = ["value"] # add new param
+ cgi.params['field_name'] = ["new_value"] # change value
+ cgi.params.delete('field_name') # delete param
+ cgi.params.clear # delete all params
=== SAVE FORM VALUES TO FILE
- require "pstore"
- db = PStore.new("query.db")
- db.transaction do
- db["params"] = cgi.params
- end
+ require "pstore"
+ db = PStore.new("query.db")
+ db.transaction do
+ db["params"] = cgi.params
+ end
=== RESTORE FORM VALUES FROM FILE
- require "pstore"
- db = PStore.new("query.db")
- db.transaction do
- cgi.params = db["params"]
- end
+ require "pstore"
+ db = PStore.new("query.db")
+ db.transaction do
+ cgi.params = db["params"]
+ end
=== GET MULTIPART FORM VALUES
- require "cgi"
- cgi = CGI.new
- values = cgi['field_name'] # <== array of 'field_name'
- values[0].read # <== body of values[0]
- values[0].local_path # <== path to local file of values[0]
- values[0].original_filename # <== original filename of values[0]
- values[0].content_type # <== content_type of values[0]
+ require "cgi"
+ cgi = CGI.new
+ values = cgi['field_name'] # <== array of 'field_name'
+ values[0].read # <== body of values[0]
+ values[0].local_path # <== path to local file of values[0]
+ values[0].original_filename # <== original filename of values[0]
+ values[0].content_type # <== content_type of values[0]
and values[0] has Tempfile class methods.
-
(Tempfile class object has File class methods)
=== GET COOKIE VALUES
- require "cgi"
- cgi = CGI.new
- values = cgi.cookies['name'] # <== array of 'name'
- # if not 'name' included, then return [].
- names = cgi.cookies.keys # <== array of cookie names
+ require "cgi"
+ cgi = CGI.new
+ values = cgi.cookies['name'] # <== array of 'name'
+ # if not 'name' included, then return [].
+ names = cgi.cookies.keys # <== array of cookie names
and cgi.cookies is a hash.
=== GET COOKIE OBJECTS
- require "cgi"
- cgi = CGI.new
- for name, cookie in cgi.cookies
- cookie.expires = Time.now + 30
- end
- cgi.out("cookie" => cgi.cookies){"string"}
+ require "cgi"
+ cgi = CGI.new
+ for name, cookie in cgi.cookies
+ cookie.expires = Time.now + 30
+ end
+ cgi.out("cookie" => cgi.cookies){"string"}
- cgi.cookies # { "name1" => cookie1, "name2" => cookie2, ... }
+ cgi.cookies # { "name1" => cookie1, "name2" => cookie2, ... }
- require "cgi"
- cgi = CGI.new
- cgi.cookies['name'].expires = Time.now + 30
- cgi.out("cookie" => cgi.cookies['name']){"string"}
+ require "cgi"
+ cgi = CGI.new
+ cgi.cookies['name'].expires = Time.now + 30
+ cgi.out("cookie" => cgi.cookies['name']){"string"}
and see MAKE COOKIE OBJECT.
=== GET ENVIRONMENT VALUE
- require "cgi"
- cgi = CGI.new
- value = cgi.auth_type
- # ENV["AUTH_TYPE"]
+ require "cgi"
+ cgi = CGI.new
+ value = cgi.auth_type
+ # ENV["AUTH_TYPE"]
-http://www.w3.org/CGI/
+see http://www.w3.org/CGI/
AUTH_TYPE CONTENT_LENGTH CONTENT_TYPE GATEWAY_INTERFACE PATH_INFO
PATH_TRANSLATED QUERY_STRING REMOTE_ADDR REMOTE_HOST REMOTE_IDENT
@@ -124,17 +124,17 @@ content_length and server_port return Integer. and the others return String.
and HTTP_COOKIE, HTTP_COOKIE2
- value = cgi.raw_cookie
- # ENV["HTTP_COOKIE"]
- value = cgi.raw_cookie2
- # ENV["HTTP_COOKIE2"]
+ value = cgi.raw_cookie
+ # ENV["HTTP_COOKIE"]
+ value = cgi.raw_cookie2
+ # ENV["HTTP_COOKIE2"]
and other HTTP_*
- value = cgi.accept
- # ENV["HTTP_ACCEPT"]
- value = cgi.accept_charset
- # ENV["HTTP_ACCEPT_CHARSET"]
+ value = cgi.accept
+ # ENV["HTTP_ACCEPT"]
+ value = cgi.accept_charset
+ # ENV["HTTP_ACCEPT_CHARSET"]
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING HTTP_ACCEPT_LANGUAGE
HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST HTTP_NEGOTIATE HTTP_PRAGMA
@@ -143,35 +143,36 @@ HTTP_REFERER HTTP_USER_AGENT
=== PRINT HTTP HEADER AND HTML STRING TO $DEFAULT_OUTPUT ($>)
- require "cgi"
- cgi = CGI.new("html3") # add HTML generation methods
- cgi.out() do
- cgi.html() do
- cgi.head{ cgi.title{"TITLE"} } +
- cgi.body() do
- cgi.form() do
- cgi.textarea("get_text") +
- cgi.br +
- cgi.submit
- end +
- cgi.pre() do
- CGI::escapeHTML(
- "params: " + cgi.params.inspect + "\n" +
- "cookies: " + cgi.cookies.inspect + "\n" +
- ENV.collect() do |key, value|
- key + " --> " + value + "\n"
- end.join("")
- )
- end
- end
- end
+ require "cgi"
+ cgi = CGI.new("html3") # add HTML generation methods
+ cgi.out() do
+ cgi.html() do
+ cgi.head{ cgi.title{"TITLE"} } +
+ cgi.body() do
+ cgi.form() do
+ cgi.textarea("get_text") +
+ cgi.br +
+ cgi.submit
+ end +
+ cgi.pre() do
+ CGI::escapeHTML(
+ "params: " + cgi.params.inspect + "\n" +
+ "cookies: " + cgi.cookies.inspect + "\n" +
+ ENV.collect() do |key, value|
+ key + " --> " + value + "\n"
+ end.join("")
+ )
end
+ end
+ end
+ end
+
+ # add HTML generation methods
+ CGI.new("html3") # html3.2
+ CGI.new("html4") # html4.0 (Strict)
+ CGI.new("html4Tr") # html4.0 Transitional
+ CGI.new("html4Fr") # html4.0 Frameset
- # add HTML generation methods
- CGI.new("html3") # html3.2
- CGI.new("html4") # html4.0 (Strict)
- CGI.new("html4Tr") # html4.0 Transitional
- CGI.new("html4Fr") # html4.0 Frameset
=end
@@ -183,11 +184,10 @@ class CGI
CR = "\015"
LF = "\012"
EOL = CR + LF
-v = $-v
-$-v = false
- VERSION = "1.61"
- RELEASE_DATE = "$Date$"
-$-v = v
+ VERSION = "1.7.0"
+ RELEASE_DATE = "2000-06-19"
+ VERSION_CODE = 170
+ RELEASE_CODE = 20000619
NEEDS_BINMODE = true if /WIN/ni === RUBY_PLATFORM
PATH_SEPARATOR = {'UNIX'=>'/', 'WINDOWS'=>'\\', 'MACINTOSH'=>':'}
@@ -236,7 +236,7 @@ $-v = v
=begin
=== ESCAPE URL ENCODE
- url_encoded_string = CGI::escape("string")
+ url_encoded_string = CGI::escape("string")
=end
def CGI::escape(string)
string.gsub(/([^a-zA-Z0-9_.-])/n) do
@@ -251,7 +251,7 @@ $-v = v
=begin
=== UNESCAPE URL ENCODED
- string = CGI::unescape("url encoded string")
+ string = CGI::unescape("url encoded string")
=end
def CGI::unescape(string)
string.gsub(/\+/n, ' ').gsub(/%([0-9a-fA-F]{2})/n) do
@@ -262,7 +262,7 @@ $-v = v
=begin
=== ESCAPE HTML &"<>
- CGI::escapeHTML("string")
+ CGI::escapeHTML("string")
=end
def CGI::escapeHTML(string)
string.gsub(/&/n, '&amp;').gsub(/\"/n, '&quot;').gsub(/>/n, '&gt;').gsub(/</n, '&lt;')
@@ -271,7 +271,7 @@ $-v = v
=begin
=== UNESCAPE HTML
- CGI::unescapeHTML("HTML escaped string")
+ CGI::unescapeHTML("HTML escaped string")
=end
def CGI::unescapeHTML(string)
string.gsub(/&(.*?);/n) do
@@ -299,11 +299,11 @@ $-v = v
=begin
=== ESCAPE ELEMENT
- print CGI::escapeElement("<BR><A HREF="url"></A>", "A", "IMG")
- # "<BR>&lt;A HREF="url"&gt;&lt;/A&gt"
+ print CGI::escapeElement("<BR><A HREF="url"></A>", "A", "IMG")
+ # "<BR>&lt;A HREF="url"&gt;&lt;/A&gt"
- print CGI::escapeElement("<BR><A HREF="url"></A>", ["A", "IMG"])
- # "<BR>&lt;A HREF="url"&gt;&lt;/A&gt"
+ print CGI::escapeElement("<BR><A HREF="url"></A>", ["A", "IMG"])
+ # "<BR>&lt;A HREF="url"&gt;&lt;/A&gt"
=end
def CGI::escapeElement(string, *element)
string.gsub(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni) do
@@ -314,13 +314,13 @@ $-v = v
=begin
=== UNESCAPE ELEMENT
- print CGI::unescapeElement(
- CGI::escapeHTML("<BR><A HREF="url"></A>"), "A", "IMG")
- # "&lt;BR&gt;<A HREF="url"></A>"
+ print CGI::unescapeElement(
+ CGI::escapeHTML("<BR><A HREF="url"></A>"), "A", "IMG")
+ # "&lt;BR&gt;<A HREF="url"></A>"
- print CGI::unescapeElement(
- CGI::escapeHTML("<BR><A HREF="url"></A>"), ["A", "IMG"])
- # "&lt;BR&gt;<A HREF="url"></A>"
+ print CGI::unescapeElement(
+ CGI::escapeHTML("<BR><A HREF="url"></A>"), ["A", "IMG"])
+ # "&lt;BR&gt;<A HREF="url"></A>"
=end
def CGI::unescapeElement(string, *element)
string.gsub(/&lt;\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?&gt;/ni) do
@@ -331,8 +331,8 @@ $-v = v
=begin
=== MAKE RFC1123 DATE STRING
- CGI::rfc1123_date(Time.now)
- # Sut, 1 Jan 2000 00:00:00 GMT
+ CGI::rfc1123_date(Time.now)
+ # Sut, 1 Jan 2000 00:00:00 GMT
=end
def CGI::rfc1123_date(time)
t = time.clone.gmtime
@@ -344,47 +344,48 @@ $-v = v
=begin
=== MAKE HTTP HEADER STRING
- header
- # Content-Type: text/html
-
- header("text/plain")
- # Content-Type: text/plain
-
- header({"nph" => true,
- "status" => "OK", # == "200 OK"
- # "status" => "200 GOOD",
- "server" => ENV['SERVER_SOFTWARE'],
- "connection" => "close",
- "type" => "text/html",
- "charset" => "iso-2022-jp",
- # Content-Type: text/html; charset=iso-2022-jp
- "language" => "ja",
- "expires" => Time.now + 30,
- "cookie" => [cookie1, cookie2],
- "my_header1" => "my_value"
- "my_header2" => "my_value"})
+ header
+ # Content-Type: text/html
+
+ header("text/plain")
+ # Content-Type: text/plain
+
+ header({"nph" => true,
+ "status" => "OK", # == "200 OK"
+ # "status" => "200 GOOD",
+ "server" => ENV['SERVER_SOFTWARE'],
+ "connection" => "close",
+ "type" => "text/html",
+ "charset" => "iso-2022-jp",
+ # Content-Type: text/html; charset=iso-2022-jp
+ "language" => "ja",
+ "expires" => Time.now + 30,
+ "cookie" => [cookie1, cookie2],
+ "my_header1" => "my_value"
+ "my_header2" => "my_value"})
header will not convert charset.
status:
- "OK" --> "200 OK"
- "PARTIAL_CONTENT" --> "206 Partial Content"
- "MULTIPLE_CHOICES" --> "300 Multiple Choices"
- "MOVED" --> "301 Moved Permanently"
- "REDIRECT" --> "302 Found"
- "NOT_MODIFIED" --> "304 Not Modified"
- "BAD_REQUEST" --> "400 Bad Request"
- "AUTH_REQUIRED" --> "401 Authorization Required"
- "FORBIDDEN" --> "403 Forbidden"
- "NOT_FOUND" --> "404 Not Found"
- "METHOD_NOT_ALLOWED" --> "405 Method Not Allowed"
- "NOT_ACCEPTABLE" --> "406 Not Acceptable"
- "LENGTH_REQUIRED" --> "411 Length Required"
- "PRECONDITION_FAILED" --> "412 Rrecondition Failed"
- "SERVER_ERROR" --> "500 Internal Server Error"
- "NOT_IMPLEMENTED" --> "501 Method Not Implemented"
- "BAD_GATEWAY" --> "502 Bad Gateway"
- "VARIANT_ALSO_VARIES" --> "506 Variant Also Negotiates"
+
+ "OK" --> "200 OK"
+ "PARTIAL_CONTENT" --> "206 Partial Content"
+ "MULTIPLE_CHOICES" --> "300 Multiple Choices"
+ "MOVED" --> "301 Moved Permanently"
+ "REDIRECT" --> "302 Found"
+ "NOT_MODIFIED" --> "304 Not Modified"
+ "BAD_REQUEST" --> "400 Bad Request"
+ "AUTH_REQUIRED" --> "401 Authorization Required"
+ "FORBIDDEN" --> "403 Forbidden"
+ "NOT_FOUND" --> "404 Not Found"
+ "METHOD_NOT_ALLOWED" --> "405 Method Not Allowed"
+ "NOT_ACCEPTABLE" --> "406 Not Acceptable"
+ "LENGTH_REQUIRED" --> "411 Length Required"
+ "PRECONDITION_FAILED" --> "412 Rrecondition Failed"
+ "SERVER_ERROR" --> "500 Internal Server Error"
+ "NOT_IMPLEMENTED" --> "501 Method Not Implemented"
+ "BAD_GATEWAY" --> "502 Bad Gateway"
+ "VARIANT_ALSO_VARIES" --> "506 Variant Also Negotiates"
=end
def header(options = "text/html")
@@ -487,31 +488,31 @@ status:
=begin
=== PRINT HTTP HEADER AND STRING TO $DEFAULT_OUTPUT ($>)
- cgi = CGI.new
- cgi.out{ "string" }
- # Content-Type: text/html
- # Content-Length: 6
- #
- # string
-
- cgi.out("text/plain"){ "string" }
- # Content-Type: text/plain
- # Content-Length: 6
- #
- # string
-
- cgi.out({"nph" => true,
- "status" => "OK", # == "200 OK"
- "server" => ENV['SERVER_SOFTWARE'],
- "connection" => "close",
- "type" => "text/html",
- "charset" => "iso-2022-jp",
- # Content-Type: text/html; charset=iso-2022-jp
- "language" => "ja",
- "expires" => Time.now + (3600 * 24 * 30),
- "cookie" => [cookie1, cookie2],
- "my_header1" => "my_value",
- "my_header2" => "my_value"}){ "string" }
+ cgi = CGI.new
+ cgi.out{ "string" }
+ # Content-Type: text/html
+ # Content-Length: 6
+ #
+ # string
+
+ cgi.out("text/plain"){ "string" }
+ # Content-Type: text/plain
+ # Content-Length: 6
+ #
+ # string
+
+ cgi.out({"nph" => true,
+ "status" => "OK", # == "200 OK"
+ "server" => ENV['SERVER_SOFTWARE'],
+ "connection" => "close",
+ "type" => "text/html",
+ "charset" => "iso-2022-jp",
+ # Content-Type: text/html; charset=iso-2022-jp
+ "language" => "ja",
+ "expires" => Time.now + (3600 * 24 * 30),
+ "cookie" => [cookie1, cookie2],
+ "my_header1" => "my_value",
+ "my_header2" => "my_value"}){ "string" }
if "HEAD" == REQUEST_METHOD then output only HTTP header.
@@ -549,8 +550,8 @@ convert string charset, and set language to "ja".
=begin
=== PRINT
- cgi = CGI.new
- cgi.print # default: cgi.print == $DEFAULT_OUTPUT.print
+ cgi = CGI.new
+ cgi.print # default: cgi.print == $DEFAULT_OUTPUT.print
=end
def print(*options)
stdoutput.print(*options)
@@ -559,31 +560,31 @@ convert string charset, and set language to "ja".
=begin
=== MAKE COOKIE OBJECT
- cookie1 = CGI::Cookie::new("name", "value1", "value2", ...)
- cookie1 = CGI::Cookie::new({"name" => "name", "value" => "value"})
- cookie1 = CGI::Cookie::new({'name' => 'name',
- 'value' => ['value1', 'value2', ...],
- 'path' => 'path', # optional
- 'domain' => 'domain', # optional
- 'expires' => Time.now, # optional
- 'secure' => true # optional
- })
-
- cgi.out({"cookie" => [cookie1, cookie2]}){ "string" }
-
- name = cookie1.name
- values = cookie1.value
- path = cookie1.path
- domain = cookie1.domain
- expires = cookie1.expires
- secure = cookie1.secure
-
- cookie1.name = 'name'
- cookie1.value = ['value1', 'value2', ...]
- cookie1.path = 'path'
- cookie1.domain = 'domain'
- cookie1.expires = Time.now + 30
- cookie1.secure = true
+ cookie1 = CGI::Cookie::new("name", "value1", "value2", ...)
+ cookie1 = CGI::Cookie::new({"name" => "name", "value" => "value"})
+ cookie1 = CGI::Cookie::new({'name' => 'name',
+ 'value' => ['value1', 'value2', ...],
+ 'path' => 'path', # optional
+ 'domain' => 'domain', # optional
+ 'expires' => Time.now, # optional
+ 'secure' => true # optional
+ })
+
+ cgi.out({"cookie" => [cookie1, cookie2]}){ "string" }
+
+ name = cookie1.name
+ values = cookie1.value
+ path = cookie1.path
+ domain = cookie1.domain
+ expires = cookie1.expires
+ secure = cookie1.secure
+
+ cookie1.name = 'name'
+ cookie1.value = ['value1', 'value2', ...]
+ cookie1.path = 'path'
+ cookie1.domain = 'domain'
+ cookie1.expires = Time.now + 30
+ cookie1.secure = true
=end
require "delegate"
class Cookie < SimpleDelegator
@@ -659,8 +660,8 @@ convert string charset, and set language to "ja".
=begin
=== PARSE RAW COOKIE STRING
- cookies = CGI::Cookie::parse("raw_cookie_string")
- # { "name1" => cookie1, "name2" => cookie2, ... }
+ cookies = CGI::Cookie::parse("raw_cookie_string")
+ # { "name1" => cookie1, "name2" => cookie2, ... }
=end
def Cookie::parse(raw_cookie)
cookies = Hash.new([])
@@ -684,9 +685,9 @@ convert string charset, and set language to "ja".
=begin
=== PARSE QUERY STRING
- params = CGI::parse("query_string")
- # {"name1" => ["value1", "value2", ...],
- # "name2" => ["value1", "value2", ...], ... }
+ params = CGI::parse("query_string")
+ # {"name1" => ["value1", "value2", ...],
+ # "name2" => ["value1", "value2", ...], ... }
=end
def CGI::parse(query)
params = Hash.new([])
@@ -918,17 +919,17 @@ convert string charset, and set language to "ja".
=begin
=== HTML PRETTY FORMAT
- print CGI::pretty("<HTML><BODY></BODY></HTML>")
- # <HTML>
- # <BODY>
- # </BODY>
- # </HTML>
-
- print CGI::pretty("<HTML><BODY></BODY></HTML>", "\t")
- # <HTML>
- # <BODY>
- # </BODY>
- # </HTML>
+ print CGI::pretty("<HTML><BODY></BODY></HTML>")
+ # <HTML>
+ # <BODY>
+ # </BODY>
+ # </HTML>
+
+ print CGI::pretty("<HTML><BODY></BODY></HTML>", "\t")
+ # <HTML>
+ # <BODY>
+ # </BODY>
+ # </HTML>
=end
def CGI::pretty(string, shift = " ")
lines = string.gsub(/(?!\A)<(?:.|\n)*?>/n, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/n, "\\0\n")
@@ -945,17 +946,17 @@ convert string charset, and set language to "ja".
=begin
== HTML ELEMENTS
- cgi = CGI.new("html3") # add HTML generation methods
- cgi.element
- cgi.element{ "string" }
- cgi.element({ "ATTRILUTE1" => "value1", "ATTRIBUTE2" => "value2" })
- cgi.element({ "ATTRILUTE1" => "value1", "ATTRIBUTE2" => "value2" }){ "string" }
+ cgi = CGI.new("html3") # add HTML generation methods
+ cgi.element
+ cgi.element{ "string" }
+ cgi.element({ "ATTRILUTE1" => "value1", "ATTRIBUTE2" => "value2" })
+ cgi.element({ "ATTRILUTE1" => "value1", "ATTRIBUTE2" => "value2" }){ "string" }
- # add HTML generation methods
- CGI.new("html3") # html3.2
- CGI.new("html4") # html4.0 (Strict)
- CGI.new("html4Tr") # html4.0 Transitional
- CGI.new("html4Fr") # html4.0 Frameset
+ # add HTML generation methods
+ CGI.new("html3") # html3.2
+ CGI.new("html4") # html4.0 (Strict)
+ CGI.new("html4Tr") # html4.0 Transitional
+ CGI.new("html4Fr") # html4.0 Frameset
=end
@@ -1026,8 +1027,8 @@ convert string charset, and set language to "ja".
=begin
=== A ELEMENT
- a("url")
- # = a({ "HREF" => "url" })
+ a("url")
+ # = a({ "HREF" => "url" })
=end
def a(href = "")
attributes = if href.kind_of?(String)
@@ -1045,8 +1046,8 @@ convert string charset, and set language to "ja".
=begin
=== BASE ELEMENT
- base("url")
- # = base({ "HREF" => "url" })
+ base("url")
+ # = base({ "HREF" => "url" })
=end
def base(href = "")
attributes = if href.kind_of?(String)
@@ -1064,8 +1065,8 @@ convert string charset, and set language to "ja".
=begin
=== BLOCKQUOTE ELEMENT
- blockquote("url"){ "string" }
- # = blockquote({ "CITE" => "url" }){ "string" }
+ blockquote("url"){ "string" }
+ # = blockquote({ "CITE" => "url" }){ "string" }
=end
def blockquote(cite = nil)
attributes = if cite.kind_of?(String)
@@ -1083,8 +1084,8 @@ convert string charset, and set language to "ja".
=begin
=== CAPTION ELEMENT
- caption("align"){ "string" }
- # = caption({ "ALIGN" => "align" }){ "string" }
+ caption("align"){ "string" }
+ # = caption({ "ALIGN" => "align" }){ "string" }
=end
def caption(align = nil)
attributes = if align.kind_of?(String)
@@ -1102,14 +1103,14 @@ convert string charset, and set language to "ja".
=begin
=== CHECKBOX
- checkbox("name")
- # = checkbox({ "NAME" => "name" })
+ checkbox("name")
+ # = checkbox({ "NAME" => "name" })
- checkbox("name", "value")
- # = checkbox({ "NAME" => "name", "VALUE" => "value" })
+ checkbox("name", "value")
+ # = checkbox({ "NAME" => "name", "VALUE" => "value" })
- checkbox("name", "value", true)
- # = checkbox({ "NAME" => "name", "VALUE" => "value", "CHECKED" => true })
+ checkbox("name", "value", true)
+ # = checkbox({ "NAME" => "name", "VALUE" => "value", "CHECKED" => true })
=end
def checkbox(name = "", value = nil, checked = nil)
attributes = if name.kind_of?(String)
@@ -1125,29 +1126,29 @@ convert string charset, and set language to "ja".
=begin
=== CHECKBOX_GROUP
- checkbox_group("name", "foo", "bar", "baz")
- # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
- # <INPUT TYPE="checkbox" NAME="name" VALUE="bar">bar
- # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
+ checkbox_group("name", "foo", "bar", "baz")
+ # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
+ # <INPUT TYPE="checkbox" NAME="name" VALUE="bar">bar
+ # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
- checkbox_group("name", ["foo"], ["bar", true], "baz")
- # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
- # <INPUT TYPE="checkbox" SELECTED NAME="name" VALUE="bar">bar
- # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
+ checkbox_group("name", ["foo"], ["bar", true], "baz")
+ # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
+ # <INPUT TYPE="checkbox" SELECTED NAME="name" VALUE="bar">bar
+ # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
- checkbox_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
- # <INPUT TYPE="checkbox" NAME="name" VALUE="1">Foo
- # <INPUT TYPE="checkbox" SELECTED NAME="name" VALUE="2">Bar
- # <INPUT TYPE="checkbox" NAME="name" VALUE="Baz">Baz
+ checkbox_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
+ # <INPUT TYPE="checkbox" NAME="name" VALUE="1">Foo
+ # <INPUT TYPE="checkbox" SELECTED NAME="name" VALUE="2">Bar
+ # <INPUT TYPE="checkbox" NAME="name" VALUE="Baz">Baz
- checkbox_group({ "NAME" => "name",
- "VALUES" => ["foo", "bar", "baz"] })
+ checkbox_group({ "NAME" => "name",
+ "VALUES" => ["foo", "bar", "baz"] })
- checkbox_group({ "NAME" => "name",
- "VALUES" => [["foo"], ["bar", true], "baz"] })
+ checkbox_group({ "NAME" => "name",
+ "VALUES" => [["foo"], ["bar", true], "baz"] })
- checkbox_group({ "NAME" => "name",
- "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"] })
+ checkbox_group({ "NAME" => "name",
+ "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"] })
=end
def checkbox_group(name = "", *values)
if name.kind_of?(Hash)
@@ -1172,17 +1173,17 @@ convert string charset, and set language to "ja".
=begin
=== FILE_FIELD
- file_field("name")
- # <INPUT TYPE="file" NAME="name" SIZE="20">
+ file_field("name")
+ # <INPUT TYPE="file" NAME="name" SIZE="20">
- file_field("name", 40)
- # <INPUT TYPE="file" NAME="name" SIZE="40">
+ file_field("name", 40)
+ # <INPUT TYPE="file" NAME="name" SIZE="40">
- file_field("name", 40, 100)
- # <INPUT TYPE="file" NAME="name" SIZE="40", MAXLENGTH="100">
+ file_field("name", 40, 100)
+ # <INPUT TYPE="file" NAME="name" SIZE="40", MAXLENGTH="100">
- file_field({ "NAME" => "name", "SIZE" => 40 })
- # <INPUT TYPE="file" NAME="name" SIZE="40">
+ file_field({ "NAME" => "name", "SIZE" => 40 })
+ # <INPUT TYPE="file" NAME="name" SIZE="40">
=end
def file_field(name = "", size = 20, maxlength = nil)
attributes = if name.kind_of?(String)
@@ -1199,17 +1200,17 @@ convert string charset, and set language to "ja".
=begin
=== FORM ELEMENT
- form{ "string" }
- # <FORM METHOD="post" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
+ form{ "string" }
+ # <FORM METHOD="post" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
- form("get"){ "string" }
- # <FORM METHOD="get" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
+ form("get"){ "string" }
+ # <FORM METHOD="get" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
- form("get", "url"){ "string" }
- # <FORM METHOD="get" ACTION="url" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
+ form("get", "url"){ "string" }
+ # <FORM METHOD="get" ACTION="url" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
- form({"METHOD" => "post", ENCTYPE => "enctype"}){ "string" }
- # <FORM METHOD="post" ENCTYPE="enctype">string</FORM>
+ form({"METHOD" => "post", ENCTYPE => "enctype"}){ "string" }
+ # <FORM METHOD="post" ENCTYPE="enctype">string</FORM>
=end
def form(method = "post", action = nil, enctype = "application/x-www-form-urlencoded")
attributes = if method.kind_of?(String)
@@ -1240,14 +1241,14 @@ convert string charset, and set language to "ja".
=begin
=== HIDDEN FIELD
- hidden("name")
- # <INPUT TYPE="hidden" NAME="name">
+ hidden("name")
+ # <INPUT TYPE="hidden" NAME="name">
- hidden("name", "value")
- # <INPUT TYPE="hidden" NAME="name" VALUE="value">
+ hidden("name", "value")
+ # <INPUT TYPE="hidden" NAME="name" VALUE="value">
- hidden({ "NAME" => "name", "VALUE" => "reset", "ID" => "foo" })
- # <INPUT TYPE="hidden" NAME="name" VALUE="value" ID="foo">
+ hidden({ "NAME" => "name", "VALUE" => "reset", "ID" => "foo" })
+ # <INPUT TYPE="hidden" NAME="name" VALUE="value" ID="foo">
=end
def hidden(name = "", value = nil)
attributes = if name.kind_of?(String)
@@ -1263,36 +1264,36 @@ convert string charset, and set language to "ja".
=begin
=== HTML ELEMENT
- html{ "string" }
- # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML>string</HTML>
+ html{ "string" }
+ # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML>string</HTML>
- html({ "LANG" => "ja" }){ "string" }
- # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML LANG="ja">string</HTML>
+ html({ "LANG" => "ja" }){ "string" }
+ # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML LANG="ja">string</HTML>
- html({ "DOCTYPE" => false }){ "string" }
- # <HTML>string</HTML>
+ html({ "DOCTYPE" => false }){ "string" }
+ # <HTML>string</HTML>
- html({ "DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' }){ "string" }
- # <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>string</HTML>
+ html({ "DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' }){ "string" }
+ # <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>string</HTML>
- html({ "PRETTY" => " " }){ "<BODY></BODY>" }
- # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
- # <HTML>
- # <BODY>
- # </BODY>
- # </HTML>
+ html({ "PRETTY" => " " }){ "<BODY></BODY>" }
+ # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+ # <HTML>
+ # <BODY>
+ # </BODY>
+ # </HTML>
- html({ "PRETTY" => "\t" }){ "<BODY></BODY>" }
- # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
- # <HTML>
- # <BODY>
- # </BODY>
- # </HTML>
+ html({ "PRETTY" => "\t" }){ "<BODY></BODY>" }
+ # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+ # <HTML>
+ # <BODY>
+ # </BODY>
+ # </HTML>
- html("PRETTY"){ "<BODY></BODY>" }
- # = html({ "PRETTY" => " " }){ "<BODY></BODY>" }
+ html("PRETTY"){ "<BODY></BODY>" }
+ # = html({ "PRETTY" => " " }){ "<BODY></BODY>" }
- html(if $VERBOSE then "PRETTY" end){ "HTML string" }
+ html(if $VERBOSE then "PRETTY" end){ "HTML string" }
=end
def html(attributes = {})
@@ -1331,14 +1332,14 @@ convert string charset, and set language to "ja".
=begin
=== IMAGE_BUTTON
- image_button("url")
- # <INPUT TYPE="image" SRC="url">
+ image_button("url")
+ # <INPUT TYPE="image" SRC="url">
- image_button("url", "name", "string")
- # <INPUT TYPE="image" SRC="url" NAME="name", ALT="string">
+ image_button("url", "name", "string")
+ # <INPUT TYPE="image" SRC="url" NAME="name", ALT="string">
- image_button({ "SRC" => "url", "ATL" => "strng" })
- # <INPUT TYPE="image" SRC="url" ALT="string">
+ image_button({ "SRC" => "url", "ATL" => "strng" })
+ # <INPUT TYPE="image" SRC="url" ALT="string">
=end
def image_button(src = "", name = nil, alt = nil)
attributes = if src.kind_of?(String)
@@ -1355,11 +1356,11 @@ convert string charset, and set language to "ja".
=begin
=== IMG ELEMENT
- img("src", "alt", 100, 50)
- # <IMG SRC="src" ALT="alt" WIDTH="100", HEIGHT="50">
+ img("src", "alt", 100, 50)
+ # <IMG SRC="src" ALT="alt" WIDTH="100", HEIGHT="50">
- img({ "SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50 })
- # <IMG SRC="src" ALT="alt" WIDTH="100", HEIGHT="50">
+ img({ "SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50 })
+ # <IMG SRC="src" ALT="alt" WIDTH="100", HEIGHT="50">
=end
def img(src = "", alt = "", width = nil, height = nil)
attributes = if src.kind_of?(String)
@@ -1375,11 +1376,11 @@ convert string charset, and set language to "ja".
=begin
=== MULTIPART FORM
- multipart_form{ "string" }
- # <FORM METHOD="post" ENCTYPE="multipart/form-data">string</FORM>
+ multipart_form{ "string" }
+ # <FORM METHOD="post" ENCTYPE="multipart/form-data">string</FORM>
- multipart_form("url"){ "string" }
- # <FORM METHOD="post" ACTION="url" ENCTYPE="multipart/form-data">string</FORM>
+ multipart_form("url"){ "string" }
+ # <FORM METHOD="post" ACTION="url" ENCTYPE="multipart/form-data">string</FORM>
=end
def multipart_form(action = nil, enctype = "multipart/form-data")
attributes = if action == nil
@@ -1406,17 +1407,17 @@ convert string charset, and set language to "ja".
=begin
=== PASSWORD_FIELD
- password_field("name")
- # <INPUT TYPE="password" NAME="name" SIZE="40">
+ password_field("name")
+ # <INPUT TYPE="password" NAME="name" SIZE="40">
- password_field("name", "value")
- # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="40">
+ password_field("name", "value")
+ # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="40">
- password_field("password", "value", 80, 200)
- # <INPUT TYPE="password" NAME="name" VALUE="value", SIZE="80", MAXLENGTH="200">
+ password_field("password", "value", 80, 200)
+ # <INPUT TYPE="password" NAME="name" VALUE="value", SIZE="80", MAXLENGTH="200">
- password_field({ "NAME" => "name", "VALUE" => "value" })
- # <INPUT TYPE="password" NAME="name" VALUE="value">
+ password_field({ "NAME" => "name", "VALUE" => "value" })
+ # <INPUT TYPE="password" NAME="name" VALUE="value">
=end
def password_field(name = "", value = nil, size = 40, maxlength = nil)
attributes = if name.kind_of?(String)
@@ -1433,34 +1434,34 @@ convert string charset, and set language to "ja".
=begin
=== POPUP_MENU
- popup_menu("name", "foo", "bar", "baz")
- # <SELECT NAME="name">
- # <OPTION VALUE="foo">foo</OPTION>
- # <OPTION VALUE="bar">bar</OPTION>
- # <OPTION VALUE="baz">baz</OPTION>
- # </SELECT>
-
- popup_menu("name", ["foo"], ["bar", true], "baz")
- # <SELECT NAME="name">
- # <OPTION VALUE="foo">foo</OPTION>
- # <OPTION VALUE="bar" SELECTED>bar</OPTION>
- # <OPTION VALUE="baz">baz</OPTION>
- # </SELECT>
-
- popup_menu("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
- # <SELECT NAME="name">
- # <OPTION VALUE="1">Foo</OPTION>
- # <OPTION SELECTED VALUE="2">Bar</OPTION>
- # <OPTION VALUE="Baz">Baz</OPTION>
- # </SELECT>
-
- popup_menu({"NAME" => "name", "SIZE" => 2, "MULTIPLE" => true,
- "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"] })
- # <SELECT NAME="name" MULTIPLE SIZE="2">
- # <OPTION VALUE="1">Foo</OPTION>
- # <OPTION SELECTED VALUE="2">Bar</OPTION>
- # <OPTION VALUE="Baz">Baz</OPTION>
- # </SELECT>
+ popup_menu("name", "foo", "bar", "baz")
+ # <SELECT NAME="name">
+ # <OPTION VALUE="foo">foo</OPTION>
+ # <OPTION VALUE="bar">bar</OPTION>
+ # <OPTION VALUE="baz">baz</OPTION>
+ # </SELECT>
+
+ popup_menu("name", ["foo"], ["bar", true], "baz")
+ # <SELECT NAME="name">
+ # <OPTION VALUE="foo">foo</OPTION>
+ # <OPTION VALUE="bar" SELECTED>bar</OPTION>
+ # <OPTION VALUE="baz">baz</OPTION>
+ # </SELECT>
+
+ popup_menu("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
+ # <SELECT NAME="name">
+ # <OPTION VALUE="1">Foo</OPTION>
+ # <OPTION SELECTED VALUE="2">Bar</OPTION>
+ # <OPTION VALUE="Baz">Baz</OPTION>
+ # </SELECT>
+
+ popup_menu({"NAME" => "name", "SIZE" => 2, "MULTIPLE" => true,
+ "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"] })
+ # <SELECT NAME="name" MULTIPLE SIZE="2">
+ # <OPTION VALUE="1">Foo</OPTION>
+ # <OPTION SELECTED VALUE="2">Bar</OPTION>
+ # <OPTION VALUE="Baz">Baz</OPTION>
+ # </SELECT>
=end
def popup_menu(name = "", *values)
@@ -1498,14 +1499,14 @@ convert string charset, and set language to "ja".
=begin
=== RADIO_BUTTON
- radio_button("name", "value")
- # <INPUT TYPE="radio" NAME="name", VALUE="value">
+ radio_button("name", "value")
+ # <INPUT TYPE="radio" NAME="name", VALUE="value">
- radio_button("name", "value", true)
- # <INPUT TYPE="radio" NAME="name", VALUE="value", CHECKED>
+ radio_button("name", "value", true)
+ # <INPUT TYPE="radio" NAME="name", VALUE="value", CHECKED>
- radio_button({ "NAME" => "name", "VALUE" => "value", "ID" => "foo" })
- # <INPUT TYPE="radio" NAME="name" VALUE="value" ID="foo">
+ radio_button({ "NAME" => "name", "VALUE" => "value", "ID" => "foo" })
+ # <INPUT TYPE="radio" NAME="name" VALUE="value" ID="foo">
=end
def radio_button(name = "", value = nil, checked = nil)
attributes = if name.kind_of?(String)
@@ -1521,29 +1522,29 @@ convert string charset, and set language to "ja".
=begin
=== RADIO_GROUP
- radio_group("name", "foo", "bar", "baz")
- # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
- # <INPUT TYPE="radio" NAME="name" VALUE="bar">bar
- # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
+ radio_group("name", "foo", "bar", "baz")
+ # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
+ # <INPUT TYPE="radio" NAME="name" VALUE="bar">bar
+ # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
- radio_group("name", ["foo"], ["bar", true], "baz")
- # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
- # <INPUT TYPE="radio" SELECTED NAME="name" VALUE="bar">bar
- # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
+ radio_group("name", ["foo"], ["bar", true], "baz")
+ # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
+ # <INPUT TYPE="radio" SELECTED NAME="name" VALUE="bar">bar
+ # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
- radio_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
- # <INPUT TYPE="radio" NAME="name" VALUE="1">Foo
- # <INPUT TYPE="radio" SELECTED NAME="name" VALUE="2">Bar
- # <INPUT TYPE="radio" NAME="name" VALUE="Baz">Baz
+ radio_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
+ # <INPUT TYPE="radio" NAME="name" VALUE="1">Foo
+ # <INPUT TYPE="radio" SELECTED NAME="name" VALUE="2">Bar
+ # <INPUT TYPE="radio" NAME="name" VALUE="Baz">Baz
- radio_group({ "NAME" => "name",
- "VALUES" => ["foo", "bar", "baz"] })
+ radio_group({ "NAME" => "name",
+ "VALUES" => ["foo", "bar", "baz"] })
- radio_group({ "NAME" => "name",
- "VALUES" => [["foo"], ["bar", true], "baz"] })
+ radio_group({ "NAME" => "name",
+ "VALUES" => [["foo"], ["bar", true], "baz"] })
- radio_group({ "NAME" => "name",
- "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"] })
+ radio_group({ "NAME" => "name",
+ "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"] })
=end
def radio_group(name = "", *values)
if name.kind_of?(Hash)
@@ -1568,14 +1569,14 @@ convert string charset, and set language to "ja".
=begin
=== RESET BUTTON
- reset
- # <INPUT TYPE="reset">
+ reset
+ # <INPUT TYPE="reset">
- reset("reset")
- # <INPUT TYPE="reset" VALUE="reset">
+ reset("reset")
+ # <INPUT TYPE="reset" VALUE="reset">
- reset({ "VALUE" => "reset", "ID" => "foo" })
- # <INPUT TYPE="reset" VALUE="reset" ID="foo">
+ reset({ "VALUE" => "reset", "ID" => "foo" })
+ # <INPUT TYPE="reset" VALUE="reset" ID="foo">
=end
def reset(value = nil, name = nil)
attributes = if (not value) or value.kind_of?(String)
@@ -1590,30 +1591,30 @@ convert string charset, and set language to "ja".
=begin
=== SCROLLING_LIST
- scrolling_list({"NAME" => "name", "SIZE" => 2, "MULTIPLE" => true,
- "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"] })
- # <SELECT NAME="name" MULTIPLE SIZE="2">
- # <OPTION VALUE="1">Foo</OPTION>
- # <OPTION SELECTED VALUE="2">Bar</OPTION>
- # <OPTION VALUE="Baz">Baz</OPTION>
- # </SELECT>
+ scrolling_list({"NAME" => "name", "SIZE" => 2, "MULTIPLE" => true,
+ "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"] })
+ # <SELECT NAME="name" MULTIPLE SIZE="2">
+ # <OPTION VALUE="1">Foo</OPTION>
+ # <OPTION SELECTED VALUE="2">Bar</OPTION>
+ # <OPTION VALUE="Baz">Baz</OPTION>
+ # </SELECT>
=end
alias scrolling_list popup_menu
=begin
=== SUBMIT BUTTON
- submit
- # <INPUT TYPE="submit">
+ submit
+ # <INPUT TYPE="submit">
- submit("ok")
- # <INPUT TYPE="submit" VALUE="ok">
+ submit("ok")
+ # <INPUT TYPE="submit" VALUE="ok">
- submit("ok", "button1")
- # <INPUT TYPE="submit" VALUE="ok" NAME="button1">
+ submit("ok", "button1")
+ # <INPUT TYPE="submit" VALUE="ok" NAME="button1">
- submit({ "VALUE" => "ok", "NAME" => "button1", "ID" => "foo" })
- # <INPUT TYPE="submit" VALUE="ok" NAME="button1" ID="foo">
+ submit({ "VALUE" => "ok", "NAME" => "button1", "ID" => "foo" })
+ # <INPUT TYPE="submit" VALUE="ok" NAME="button1" ID="foo">
=end
def submit(value = nil, name = nil)
attributes = if (not value) or value.kind_of?(String)
@@ -1628,20 +1629,20 @@ convert string charset, and set language to "ja".
=begin
=== TEXT_FIELD
- text_field("name")
- # <INPUT TYPE="text" NAME="name" SIZE="40">
+ text_field("name")
+ # <INPUT TYPE="text" NAME="name" SIZE="40">
- text_field("name", "value")
- # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="40">
+ text_field("name", "value")
+ # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="40">
- text_field("name", "value", 80)
- # <INPUT TYPE="text" NAME="name" VALUE="value", SIZE="80">
+ text_field("name", "value", 80)
+ # <INPUT TYPE="text" NAME="name" VALUE="value", SIZE="80">
- text_field("name", "value", 80, 200)
- # <INPUT TYPE="text" NAME="name" VALUE="value", SIZE="80", MAXLENGTH="200">
+ text_field("name", "value", 80, 200)
+ # <INPUT TYPE="text" NAME="name" VALUE="value", SIZE="80", MAXLENGTH="200">
- text_field({ "NAME" => "name", "VALUE" => "value" })
- # <INPUT TYPE="text" NAME="name" VALUE="value">
+ text_field({ "NAME" => "name", "VALUE" => "value" })
+ # <INPUT TYPE="text" NAME="name" VALUE="value">
=end
def text_field(name = "", value = nil, size = 40, maxlength = nil)
attributes = if name.kind_of?(String)
@@ -1658,12 +1659,11 @@ convert string charset, and set language to "ja".
=begin
=== TEXTAREA ELEMENT
+ textarea("name")
+ # = textarea({ "NAME" => "name", "COLS" => 70, "ROWS" => 10 })
- textarea("name")
- # = textarea({ "NAME" => "name", "COLS" => 70, "ROWS" => 10 })
-
- textarea("name", 40, 5)
- # = textarea({ "NAME" => "name", "COLS" => 40, "ROWS" => 5 })
+ textarea("name", 40, 5)
+ # = textarea({ "NAME" => "name", "COLS" => 40, "ROWS" => 5 })
=end
def textarea(name = "", cols = 70, rows = 10)
attributes = if name.kind_of?(String)
@@ -1908,163 +1908,114 @@ end
== HISTORY
-=== Version 1.61 - wakou
-
-2000/06/13 15:49:27
-
-- read_multipart(): if no content body then raise EOFError.
-
-=== Version 1.60 - wakou
-
-2000/06/03 18:16:17
-
-- improve: CGI::pretty()
-
-=== Version 1.50 - wakou
-
-2000/05/30 19:04:08
-
-- CGI#out()
- if "HEAD" == REQUEST_METHOD then output only HTTP header.
-
-=== Version 1.40 - wakou
-
-2000/05/24 06:58:51
-
-- typo: CGI::Cookie::new()
-- bug fix: CGI::escape()
- bad: " " --> "%2B" true: " " --> "+"
- thanks to Ryunosuke Ohshima <ryu@jaist.ac.jp>
-
-=== Version 1.31 - wakou
-
-2000/05/08 21:51:30
-
-- improvement of time forming new CGI object accompanied with HTML generation methods.
-
-=== Version 1.30 - wakou
-
-2000/05/07 21:51:14
-
-- require English.rb
-- improvement of load time.
-
-=== Version 1.21 - wakou
-
-2000/05/02 21:44:12
-
-- support for ruby 1.5.3 (2000-05-01) (Array#filter --> Array#collect!)
-
-=== Version 1.20 - wakou
-
-2000/04/03 18:31:42
-
-- bug fix: CGI#image_button() can't get Hash option
- thanks to Takashi Ikeda <ikeda@auc.co.jp>
-- CGI::unescapeHTML()
- simple support for "&#12345;"
-- CGI::Cookie::new()
- simple support for IE
-- CGI::escape()
- ' ' replaced by '+'
-
-=== Version 1.10 - wakou
-
-1999/12/06 20:16:34
-
-- can make many CGI objects.
-- if use mod_ruby, then require ruby1.4.3 or later.
-
-=== Version 1.01 - wakou
-
-1999/11/29 21:35:58
-
-- support for ruby 1.5.0 (1999-11-20)
-
-=== Version 1.00 - wakou
-
-1999/09/13 23:00:58
-
-- COUTION! name change. CGI.rb --> cgi.rb
-
-- CGI#auth_type, CGI#content_length, CGI#content_type, ...
-if not ENV included it, then return nil.
-
-- CGI#content_length and CGI#server_port return Integer.
-
-- if not CGI#params.include?('name'), then CGI#params['name'] return [].
-
-- if not CGI#cookies.include?('name'), then CGI#cookies['name'] return [].
-
-=== Version 0.41 - wakou
-
-1999/08/05 18:04:59
-
-- typo. thanks to MJ Ray <markj@altern.org>
- HTTP_STATUS["NOT_INPLEMENTED"] --> HTTP_STATUS["NOT_IMPLEMENTED"]
-
-=== Version 0.40 - wakou
-
-1999/07/20 20:44:31
-
-- COUTION! incompatible change.
- sorry, but probably this change is last big incompatible change.
-
-- CGI::print --> CGI#out
-
- cgi = CGI.new
- cgi.out{"string"} # old: CGI::print{"string"}
-
-- CGI::cookie --> CGI::Cookie::new
-
- cookie1 = CGI::Cookie::new # old: CGI::cookie
-
-- CGI::header --> CGI#header
-
-=== Version 0.30 - wakou
-
-1999/06/29 06:50:21
-
-- COUTION! incompatible change.
- query = CGI.new
- cookies = query.cookies # old: query.cookie
- values = query.cookies[name] # old: query.cookie[name]
-
-=== Version 0.24 - wakou
-
-1999/06/21 21:05:57
-
-- CGI::Cookie::parse() return { name => CGI::Cookie object } pairs.
-
-=== Version 0.23 - wakou
-
-1999/06/20 23:29:12
-
-- modified a bit to clear module separation.
-
-=== Version 0.22 - matz
-
-Mon Jun 14 17:49:32 JST 1999
-
-- Cookies are now CGI::Cookie objects.
-- Cookie modeled after CGI::Cookie.pm.
-
-=== Version 0.21 - matz
-
-Fri Jun 11 11:19:11 JST 1999
-
-- modified a bit to clear module separation.
-
-=== Version 0.20 - wakou
-
-1999/06/03 06:48:15
-
-- support for multipart form.
-
-=== Version 0.10 - wakou
-
-1999/05/24 07:05:41
-
-- first release.
+* Sun Jun 18 23:31:44 JST 2000 - wakou
+ * version 1.7.0
+ * change: version syntax. old: x.yz, now: x.y.z
+
+* 2000/06/13 15:49:27 - wakou
+ * version 1.61
+ * read_multipart(): if no content body then raise EOFError.
+
+* 2000/06/03 18:16:17 - wakou
+ * version 1.60
+ * improve: CGI::pretty()
+
+* 2000/05/30 19:04:08 - wakou
+ * version 1.50
+ * CGI#out(): if "HEAD" == REQUEST_METHOD then output only HTTP header.
+
+* 2000/05/24 06:58:51 - wakou
+ * version 1.40
+ * typo: CGI::Cookie::new()
+ * bug fix: CGI::escape(): bad: " " --> "%2B"; true: " " --> "+";
+ thanks to Ryunosuke Ohshima <ryu@jaist.ac.jp>
+
+* 2000/05/08 21:51:30 - wakou
+ * version 1.31
+ * improvement of time forming new CGI object accompanied with HTML generation methods.
+
+* 2000/05/07 21:51:14 - wakou
+ * version 1.30
+ * require English.rb
+ * improvement of load time.
+
+* 2000/05/02 21:44:12 - wakou
+ * version 1.21
+ * support for ruby 1.5.3 (2000-05-01) (Array#filter --> Array#collect!)
+
+* 2000/04/03 18:31:42 - wakou
+ * version 1.20
+ * bug fix: CGI#image_button() can't get Hash option.
+ thanks to Takashi Ikeda <ikeda@auc.co.jp>
+ * CGI::unescapeHTML(): simple support for "&#12345;"
+ * CGI::Cookie::new(): simple support for IE
+ * CGI::escape(): ' ' replaced by '+'
+
+* 1999/12/06 20:16:34 - wakou
+ * version 1.10
+ * can make many CGI objects.
+ * if use mod_ruby, then require ruby1.4.3 or later.
+
+* 1999/11/29 21:35:58 - wakou
+ * version 1.01
+ * support for ruby 1.5.0 (1999-11-20)
+
+* 1999/09/13 23:00:58 - wakou
+ * version 1.00
+ * COUTION! name change. CGI.rb --> cgi.rb
+ * CGI#auth_type, CGI#content_length, CGI#content_type, ...
+ if not ENV included it, then return nil.
+ * CGI#content_length and CGI#server_port return Integer.
+ * if not CGI#params.include?('name'), then CGI#params['name'] return [].
+ * if not CGI#cookies.include?('name'), then CGI#cookies['name'] return [].
+
+* 1999/08/05 18:04:59 - wakou
+ * version 0.41
+ * typo. thanks to MJ Ray <markj@altern.org>
+ HTTP_STATUS["NOT_INPLEMENTED"] --> HTTP_STATUS["NOT_IMPLEMENTED"]
+
+* 1999/07/20 20:44:31 - wakou
+ * version 0.40
+ * COUTION! incompatible change.
+ sorry, but probably this change is last big incompatible change.
+ * CGI::print --> CGI#out
+ cgi = CGI.new
+ cgi.out{"string"} # old: CGI::print{"string"}
+ * CGI::cookie --> CGI::Cookie::new
+ cookie1 = CGI::Cookie::new # old: CGI::cookie
+ * CGI::header --> CGI#header
+
+* 1999/06/29 06:50:21 - wakou
+ * version 0.30
+ * COUTION! incompatible change.
+ query = CGI.new
+ cookies = query.cookies # old: query.cookie
+ values = query.cookies[name] # old: query.cookie[name]
+
+* 1999/06/21 21:05:57 - wakou
+ * version 0.24
+ * CGI::Cookie::parse() return { name => CGI::Cookie object } pairs.
+
+* 1999/06/20 23:29:12 - wakou
+ * version 0.23
+ * modified a bit to clear module separation.
+
+* Mon Jun 14 17:49:32 JST 1999 - matz
+ * version 0.22
+ * Cookies are now CGI::Cookie objects.
+ * Cookie modeled after CGI::Cookie.pm.
+
+* Fri Jun 11 11:19:11 JST 1999 - matz
+ * version 0.21
+ * modified a bit to clear module separation.
+
+* 1999/06/03 06:48:15 - wakou
+ * version 0.20
+ * support for multipart form.
+
+* 1999/05/24 07:05:41 - wakou
+ * version 0.10
+ * first release.
+$Date$
=end