lib/review/textutils.rb in review-0.6.0 vs lib/review/textutils.rb in review-0.9.0
- old
+ new
@@ -12,8 +12,30 @@
add += len - 1
' ' * len
}
end
+ def split_paragraph(lines)
+ pre = pre_paragraph
+ post = post_paragraph
+
+ blocked_lines = [[]]
+ lines.each {|element|
+ if element == ""
+ if blocked_lines.last != []
+ blocked_lines << []
+ end
+ else
+ blocked_lines.last << element
+ end
+ }
+
+ if !pre.nil? and !post.nil?
+ blocked_lines.map!{|i| [pre] + i + [post] }
+ end
+
+ blocked_lines.map{|l| l.join("")}
+ end
+
end
end