333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
|
# File 'lib/ribit/contentparser.rb', line 333
def parse( text, contentDoc )
newContainers = Array.new
urls = text.scan( /http:\/\/[^ \n]+/ )
str = text
urls.each do |url|
firstIndex = str.index( url )
newContainers.push( TextContainer.new( text[0, firstIndex] ) )
newContainers.push( DirectLinkContainer.new( url ) )
str = str[ firstIndex + url.size, str.size]
end
if ( str != nil and str.size() > 0 )
newContainers.push( TextContainer.new( str ) )
end
if ( newContainers.size == 0 )
return [TextContainer.new( text )]
end
return newContainers
end
|