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:
1. Where would i find the file where the instance method input is defined?
2. Is there an easier way around this than trying to hack the cgi library?
thanks.
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">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>table demo</title>
</head>
<h1 style='sweet'>this is a table </h1><malformed html & open tags if you must
<table height='42' width='42'>
<tr>
<td>0</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
</tr>
</table>
</html>
perhaps i could send you a version offline to test?
-a
ยทยทยท
On Sat, 17 Dec 2005, Larry White wrote:
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:
1. Where would i find the file where the instance method input is defined?
2. Is there an easier way around this than trying to hack the cgi library?
--
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?
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">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>table demo</title>
</head>
<h1 style='sweet'>this is a table </h1><malformed html & open tags if you must
<table height='42' width='42'>
<tr>
<td>0</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
</tr>
</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