Sha256: 8e897c0bd31dd737e709addce2199cf3ad1cb1ec8b110babdf378efcb1c90fe2
Contents?: true
Size: 760 Bytes
Versions: 7
Compression:
Stored size: 760 Bytes
Contents
# $Id: textutils.rb 2192 2005-11-13 11:55:42Z aamine $ require 'nkf' module ReVIEW module TextUtils def detab(str, ts = 8) add = 0 len = nil str.gsub(/\t/) { len = ts - ($`.size + add) % ts 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
Version data entries
7 entries across 7 versions & 1 rubygems