Hi all, i'm relative new to ruby. I've been using CGI class to make a
simple
script, but what i found when using cgi.font the next error:
./pass.cgi:28: undefined method `font' for #<CGI:0x40308180>
(NoMethodError)
Isn't font implemented?
If you want to use the font tag, you must use html3, not html4; W3C
either deprecated or removed it in the html4 spec.
irb(main):040:0> c=CGI.new('html4')
[...]
irb(main):041:0> c.font{"test"}
NoMethodError: undefined method `font' for #<CGI:0x59978c>
from (irb):41
irb(main):042:0> c=CGI.new('html3')
[...]
irb(main):043:0> c.font{"test"}
=> "<FONT>test</FONT>"
But it would be a better choice to use styles, since the font tag is
considered somewhat of a no-no these days. You might want to try this
instead:
irb(main):044:0> c=CGI.new('html4')
[...]
irb(main):045:0> c.span('style'=>"font-family:Garamond,Georgia,'Times
New Roman',serif"){"text goes here"}
=> "<SPAN style=\"font-family:Garamond,Georgia,'Times New
Roman',serif\">text goes here</SPAN>"
cheers,
--Mark