658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
|
# File 'lib/ribit/contentparser.rb', line 658
def parse( text, contentDoc )
newContainers = Array.new
sections = text.scan( /\n----[^\n]*/ )
str = text
sections.each do |section|
firstIndex = str.index( section )
newContainers.push( SectionContainer.new( str[0, firstIndex] ) )
str = str[ firstIndex + section.size, str.size]
end
if ( str != nil and str.size() > 0 and newContainers.size > 0 )
newContainers.push( SectionContainer.new( str ) )
elsif ( newContainers.size == 0 )
return [TextContainer.new( text )]
end
return newContainers
end
|