diff options
Diffstat (limited to 'lib/sisu/v2/shared_txt.rb')
-rw-r--r-- | lib/sisu/v2/shared_txt.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sisu/v2/shared_txt.rb b/lib/sisu/v2/shared_txt.rb index 9d35743b..abf5e035 100644 --- a/lib/sisu/v2/shared_txt.rb +++ b/lib/sisu/v2/shared_txt.rb @@ -62,9 +62,7 @@ module SiSU_text_utils @para,@n_char_max,@n_indent=para,n_char_max,n_indent @n_char_max_extend = n_char_max @br="\n" - @n_hang=unless n_hang; @n_hang=@n_indent - else n_hang - end + @n_hang=n_hang ? n_hang : @n_indent end def line_wrap space=' ' @@ -72,13 +70,18 @@ module SiSU_text_utils line=0 out=[] out[line]='' + @para.gsub!(/<br>/,' <br> ') @para.gsub!(/#{Mx[:br_nl]}/,"\n\n") - words=@para.scan(/\n\n|\S+/m) + words=@para.scan(/\n\n|<br>|\S+/m) while words != '' word=words.shift if not word out[line] unless out[line].empty? #check break + elsif word =~/<br>/ + word=nil + out[line]=out[line].gsub(/<br>/,'') + line=line elsif word =~/\n\n/ word="\n" @n_char_max_extend = @n_char_max + out[line].length |