hpricot:An Hpricot Showcase:Hpricot Challenge:Putting embedded script in attributes
>> require "hpricot" => true >> a = Hpricot('<a href="http://w.w.w/">Hello</a>') => #<Hpricot::Doc {elem <a href="http://w.w.w/"> "Hello" </a>}> >> (a/"a").first[:href] = "<? echo 'boo' ?>" => "<? echo 'boo' ?>" >> a.to_html => "<a href=\"<? echo 'boo' ?>\">Hello</a>" >> a = Hpricot('<a href="http://w.w.w/">Hello</a>') => #<Hpricot::Doc {elem <a href="http://w.w.w/"> "Hello" </a>}> >> (a/"a").first.raw_attributes => {"href"=>"http://w.w.w/"} >> (a/"a").first => {elem <a href="http://w.w.w/"> "Hello" </a>} >> (a/"a").first.raw_attributes[:href] = "<? echo 'boo' ?>" => "<? echo 'boo' ?>" >> a.to_html => "<a href=\"http://w.w.w/\" href=\"<? echo 'boo' ?>\">Hello</a>"
?