diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v2/shared_txt.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sisu/v2/shared_txt.rb b/lib/sisu/v2/shared_txt.rb index 9d35743b..1e77acb7 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,17 @@ 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="\n" + ' '*@n_indent + line=line elsif word =~/\n\n/ word="\n" @n_char_max_extend = @n_char_max + out[line].length |