diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-07-26 20:24:41 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-07-26 20:24:41 -0400 |
commit | 051b32167ddbff4193e7d52d8be434ef3f70470d (patch) | |
tree | 4871fddccad4a9b5b38b2afb4fd21a9cc1c78295 /lib | |
parent | v3: dal, indent, control of first line of indent & rest of paragraph (diff) |
v3: plaintext, indent ...
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/plaintext.rb | 7 | ||||
-rw-r--r-- | lib/sisu/v3/shared_txt.rb | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb index b7ad1680..aee1e56f 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v3/plaintext.rb @@ -225,7 +225,12 @@ WOK wrapped=if dob.is =='para' \ or dob.is=='heading' if dob.is=='para' - if dob.indent =~/[1-9]/ + if dob.hang \ + and dob.hang =~/[0-9]/ \ + and dob.indent != dob.hang + util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2,dob.hang.to_i*2) + #util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.hang.to_i*2,0) + elsif dob.indent =~/[1-9]/ util=if dob.bullet_ SiSU_text_utils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2) else SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2) diff --git a/lib/sisu/v3/shared_txt.rb b/lib/sisu/v3/shared_txt.rb index 6f25a06b..c81e1c37 100644 --- a/lib/sisu/v3/shared_txt.rb +++ b/lib/sisu/v3/shared_txt.rb @@ -84,8 +84,8 @@ module SiSU_text_utils line=line elsif word =~/\n\n/ word="\n" - @n_char_max_extend = @n_char_max + out[line].length - line=line + @n_char_max_extend = @n_char_max + line += 1 elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) \ and out[line] =~/\S+/ @n_char_max_extend = @n_char_max @@ -104,7 +104,7 @@ module SiSU_text_utils end @oldword=word if word =~/\S+/ end - x=out.join(spaces_indent).gsub(/\A\n+/m,'').insert(0,spaces_hang) + spaces_hang + out.join(spaces_indent) end def line_wrap_indent1 @n_indent,@n_hang=2,2 |