I’m trying to use the cgi library to generate some html that will later
get
run through erb.
The problem i’m having is that if i try to use the cgi.text_field method
it
automatically escapes anything passed in as the value. That means an erb
instruction like “<%= get_a_value_ here %>” gets escaped and erb ignores
it.
I looked at the cgi source, but the method that does the work, input(),
isn’t defined in the main file.
I have two questions:
- Where would i find the file where the instance method input is
defined?
- Is there an easier way around this than trying to hack the cgi
library?
thanks.
On Sat, 17 Dec 2005, Larry W. wrote:
I have two questions:
- Where would i find the file where the instance method input is defined?
- Is there an easier way around this than trying to hack the cgi library?
eparklabs will be releasing this in the next few days:
[ahoward@localhost xx-0.0.0]$ cat a.rb
require "xx"
class Table < ::Array
include XX::XHTML
def to_xhtml
xhtml_{
html_{
head_{ title_{ "table demo" } }
h1_(:style => :sweet){ "this is a table " }
h_{ "<malformed html & open tags if you must" }
table_(:width => 42, :height => 42){
each{|row|
tr_{ row.each{|cell| td_ cell } }
}
}
}
}
end
end
table = Table[ %w( 0 1 2 ), %w( a b c ) ]
puts table.to_xhtml
[ahoward@localhost xx-0.0.0]$ ruby -I./lib a.rb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
table demo
this is a table
<malformed html & open
tags if you must
perhaps i could send you a version offline to test?
-a
===============================================================================
| email : ara [dot] t [dot] howard [at] eparklabs [dot] com
| uri : eparklabs.com
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| – bodhicaryavatara
there an easier way around this than trying to hack the cgi library?
xhtml_{
}
<table height='42' width='42'>
</table>
</html>
perhaps i could send you a version offline to test?
-a
Ara-
I like the looks of that a lot. Can you send me a copy of list? I
will test and give feedback.
Cheers-
-Ezra