From d613c9786784d6ff948d11dc248564ccca6ed469 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:34:37 -0400 Subject: v3: po4a, indent (check for breakage) --- lib/sisu/v3/po4a.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb index dd2aff7a..c87da346 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v3/po4a.rb @@ -498,8 +498,8 @@ GSUB #puts z unless z.empty? end end - def pot_structure(desc,orig,trans,indent=0) - SiSU_po4a_utils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent) + def pot_structure(desc,orig,trans,indent=0,hang=0) + SiSU_po4a_utils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent,hang) end def pot_structure_heading(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document lv=n=n3=nil @@ -533,7 +533,8 @@ GSUB end def pot_structure_para(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document util=nil - wrapped=if dob_src.indent =~/[1-9]/ + wrapped=if dob_src.indent =~/[1-9]/ \ + and dob_src.indent == dob_src.hang s_mark=desc=orig=trans='' if dob_src.bullet_ mark="_#{dob_src.indent}* " @@ -557,6 +558,20 @@ GSUB orig="#{s_mark}#{dob_src.obj}" trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}" util=pot_structure(desc,orig,trans) + elsif dob_src.hang =~/[0-9]/ \ + and dob_src.indent != dob_src.hang + s_mark=desc=orig=trans='' + mark="_#{dob_src.hang}_#{dob_src.indent} " + d="#{dob_src.is}: hang #{dob_src.hang} indent #{dob_src.indent}" + instruct=s_mark='' + if @md.opt.cmd=~/M/ + instruct=%{\n# markup for indented text with a first line indented to a different level from the rest of the paragraph, is at the start of the line/object, an underscore and the first indent level a second underscore and the indent level for the rest of the paragraph, "#{mark1}"} + s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"} + end + desc="#{d}#{s_mark}#{instruct}" + orig="#{s_mark}#{dob_src.obj}" + trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}" + util=pot_structure(desc,orig,trans) else s_mark=desc=orig=trans='' if dob_src.bullet_ -- cgit v1.2.3