On Wed, Aug 4, 2010 at 6:29 AM, David Ainley <wrinkliez / gmail.com> wrote:
> So I am trying to get some information from a snippet of html
> (http://pastebin.com/iTXyxQ0j), and im using doc.inner_text to get the
> important parts, but when I do so I get an odd amount of spacing
> (http://pastebin.com/6HWDs5dm).  
> all that extra spacing so I can just print the output and it looks
> clean?  
>
> pino
> 0.2.11-ubuntu0~lucid
> troorl
> (2010-07-04)
>
> pino
> 0.2.10-ubuntu0~karmic
> troorl
> (2010-05-27)
>
> that?          
> that while its got all that odd spacing, is that spacing a piece of the
> variable?     
You can remove 2 or more consecutive "\n" like this:

irb(main):001:0> s =<<EOS
irb(main):002:0" test
irb(main):003:0"
irb(main):004:0" test2
irb(main):005:0" sdfsdf
irb(main):006:0" werwer
irb(main):007:0"
irb(main):008:0"
irb(main):009:0"
irb(main):010:0"
irb(main):011:0" sdfsdfsd
irb(main):012:0" sdfer234
irb(main):013:0" EOS
=> "test\n\ntest2\nsdfsdf\nwerwer\n\n\n\n\nsdfsdfsd\nsdfer234\n"
irb(main):019:0> s.gsub /\n\n+/, "\n"
=> "test\ntest2\nsdfsdf\nwerwer\nsdfsdfsd\nsdfer234\n"

or

irb(main):020:0> s.gsub /\n{2,}/, "\n"
=> "test\ntest2\nsdfsdf\nwerwer\nsdfsdfsd\nsdfer234\n"

Hope this helps,

Jesus.