Rubyful_soup.rb - error and warning message

Hello Group,

version: ruby 1.9.1p378

source:

$ cat kitty.rb

#!/usr/bin/ruby -w
require ‘rubyful_soup’

When I run the source code, it gave me the following error:

$ ./kitty.rb
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/rubyful_soup-1.0.4/lib/rubyful_soup.rb:238:
warning: mismatched indentations at ‘end’ with ‘if’ at 233
./kitty.rb:3:in require': /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rubyful_soup-1.0.4/lib/rubyful_soup.rb:233: syntax error, unexpected ':', expecting keyword_then or ';' or '\n' (SyntaxError) /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rubyful_soup-1.0.4/lib/rubyful_soup.rb:426: syntax error, unexpected keyword_end, expecting $end from ./kitty.rb:3:in

232: @attrs = @attr_list.inject({}) do |m,v|
233: if v[1][0] == ?" and v[1][-1] == ?":
234: v[1] = v[1][1…-2]
235: end
236: m[v[0]] = v[1]
237: m
238: end

I removed the extra colon at the end of line 233 then I get a warning
message:

$ ./kitty.rb
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/rubyful_soup-1.0.4/lib/rubyful_soup.rb:18:
warning: variable $KCODE is no longer effective; ignored
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/rubyful_soup-1.0.4/lib/rubyful_soup.rb:230:
warning: method redefined; discarding old attrs

I heard that we need to use --charset option to fix this problem
however, I did not find this option in ruby -h or man ruby.
Any guidance will be greatly appreciated.

Regards,
Ashita

Hi, I’m afraid I can’t help you with your problem. But please, read on!

Rubyful Soup is a name I have not heard of since about 2006. If you go
to
the Rubyful Soup homepage the author notes: “Rubyful Soup is no longer
being
maintained. I recommend you use hpricot instead.”

That very statement shows the project’s age. Hpricot itself has not
been
maintained by its original author _why, who has gone AWOL.

Nowadays you should probably be using Nokogiri:

Hello Tony,

Thank you for your advise. I will try nokogiri.

Regards,
Ashita

Tony A. wrote:

Hi, I’m afraid I can’t help you with your problem. But please, read on!

Rubyful Soup is a name I have not heard of since about 2006. If you go
to
the Rubyful Soup homepage the author notes: “Rubyful Soup is no longer
being
maintained. I recommend you use hpricot instead.”

That very statement shows the project’s age. Hpricot itself has not
been
maintained by its original author _why, who has gone AWOL.

Nowadays you should probably be using Nokogiri:

http://nokogiri.org/