From 051b32167ddbff4193e7d52d8be434ef3f70470d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:24:41 -0400 Subject: v3: plaintext, indent ... --- data/doc/sisu/CHANGELOG_v3 | 5 ++--- lib/sisu/v3/plaintext.rb | 7 ++++++- lib/sisu/v3/shared_txt.rb | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 56e737bc..7db34c34 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -26,9 +26,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.14.orig.tar.gz _[0-9]?_[1-9] initial indent; paragraph text indent - * done: dal; - not done: , plaintext, html, xhtml, xml sax, xml dom, epub, pdf, odf, - man, info + * done: dal, plaintext; + not done: html, xhtml, xml sax, xml dom, epub, pdf, odf, man, info check: po4a, html_lite (used in sql search results) * syntax highlighting done: vim (sisu.vim), emacs (sisu-mode.el) 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 -- cgit v1.2.3