Hi --

On Sat, 23 Aug 2003, Andreas Schwarz wrote:

> Andreas Schwarz wrote:
> > It doesn't work correctly, I have to think about it again...

See if this comes close....

  def wrap(s,len)
    s.gsub(/^[^>|].*?(?=^[>|]|\Z)/m) do |x|
      x.squeeze(" ").split(/\s+/).join(" ").
      gsub(/(\S.{1,#{len}}( |\Z))/) { |s| "#{s}\n" }
    end
  end


David

-- 
David Alan Black
home: dblack / superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav