Bug #489

cgi.rbのCGI#blockquoteとCGI#captionがエラー

Added by Takeyuki FUJIOKA over 6 years ago. Updated almost 4 years ago.

[ruby-dev:35946]
Status:Closed
Priority:Normal
Assignee:-
ruby -v: Backport:

Description

=begin
String#collectが使えなくなった影響で
2つのタグ生成メソッドがエラーになります。
html3、html4、html4trで全てチェックしましたが、
以上の2つだけでした。
Index: lib/cgi.rb
===================================================================
--- lib/cgi.rb (revision 18827)
+++ lib/cgi.rb (working copy)
@@ -1389,11 +1389,11 @@
#
# blockquote("http://www.example.com/quotes/foo.html") { "Foo!" }
# #=> "Foo!
- def blockquote(cite = nil) # :yield:
+ def blockquote(cite = {}) # :yield:
attributes = if cite.kind_of?(String)
{ "CITE" => cite }
else
- cite or ""
+ cite
end
if block_given?
super(attributes){ yield }
@@ -1413,11 +1413,11 @@
#
# caption("left") { "Capital Cities" }
# # => Capital Cities
- def caption(align = nil) # :yield:
+ def caption(align = {}) # :yield:
attributes = if align.kind_of?(String)
{ "ALIGN" => align }
else
- align or ""
+ align
end
if block_given?
super(attributes){ yield }
=end

test_cgi_tag_helper.diff Magnifier (11.8 KB) Takeyuki FUJIOKA, 08/26/2008 12:04 AM

History

#1 Updated by Takeyuki FUJIOKA over 6 years ago

=begin
引数を取らないタグ生成メソッド(CGI#ttなど)をCGI.new("html3").tt("foo")などとやるとエラーになるので
パッチを追加します。
Index: lib/cgi.rb
===================================================================
--- lib/cgi.rb (revision 18827)
+++ lib/cgi.rb (working copy)
@@ -1283,6 +1283,7 @@
# - O EMPTY
def nOE_element_def(element, append = nil)
s = <<-END
+ attributes={attributes=>nil} if attributes.kind_of?(String)
"<#{element.upcase}" + attributes.collect{|name, value|
next unless value
" " + CGI::escapeHTML(name) +

=end

#2 Updated by Takeyuki FUJIOKA over 6 years ago

=begin
html3の分だけテストを書きましたのでdiffの形式で添付します。
=end

#3 Updated by Yui NARUSE over 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r18860.
=end

Also available in: Atom PDF