From e1ec4bd2dad2bd22ad97cea398ae1cfcfae183a2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 15 Oct 2007 19:27:16 +0100 Subject: mostly the arrangement of conditionals --- lib/sisu/v0/odf.rb | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'lib/sisu/v0/odf.rb') diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index feea7cde..78099d16 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -211,12 +211,16 @@ module SiSU_ODF para.gsub!(/^([1-6])~\S*\s/,'') m=/#{$1}/ breakpage='' - if @md.fns and @md.fns != '' and @md.fns !=@@fns + if @md.fns \ + and @md.fns != '' \ + and @md.fns !=@@fns @@docstart=true @@fns=@md.fns end unless @@docstart - breakpage=if (@md.pagenew or @md.pagebreak) and (@md.pagenew =~ m or @md.pagebreak =~m); ' ' + breakpage=if (@md.pagenew or @md.pagebreak) \ + and (@md.pagenew =~ m or @md.pagebreak =~m) + ' ' else '' end end @@ -224,9 +228,11 @@ module SiSU_ODF %{#{breakpage}#{para}} end def image_src(i) - image_source=if @md.fns =~/\.ss[tm]$/ and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") #review + image_source=if @md.fns =~/\.ss[tm]$/ \ + and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") #review @env.path.image_source_local_tex - elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}") + elsif @md.fns =~/\.-ss[tm]$/ \ + and FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}") @env.path.image_source_remote_tex elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}") @env.path.image_source_tex @@ -251,7 +257,9 @@ module SiSU_ODF image_source=image_src(i) pwd=Dir.pwd cp("#{image_source}/#{i}","#{@env.path.odf}/Pictures/#{i}") if image_source - img=if i.to_s =~/jpg|png|gif/ and h.to_s =~/\d/ and w.to_s =~/\d/ + img=if i.to_s =~/jpg|png|gif/ \ + and h.to_s =~/\d/ \ + and w.to_s =~/\d/ @@img_count +=1 %{#{c}} #anchor-type: as-char or paragraph or char or ... else %{[image omitted]} @@ -465,7 +473,9 @@ module SiSU_ODF word.each do |w| # _ - / # | : ! ^ ~ unless para =~/^(?:0~|%+ )/m w.gsub!(/&#(?:126|152);/,'~') #126 usual - if w !~/&\S{1,7};/ or w =~/ /; w.gsub!(/&/,'&') #watch   + if w !~/&\S{1,7};/ \ + or w =~/ / + w.gsub!(/&/,'&') #watch   end end para_array << w @@ -522,7 +532,8 @@ module SiSU_ODF if d_meta; odf_metadata(d_meta) end end - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) + @rcdc=true if @rcdc==false \ + and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) if para !~/(^0~||)/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] @@ -533,7 +544,8 @@ module SiSU_ODF ### problem in scroll, it appears tables are getting paragraph numbers unless @rcdc m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if para =~m and para=~/\S+/ + if para =~m \ + and para=~/\S+/ para=case @sto.format when /^(1)~(?:(\S+))?/; odf_structure(para,$1,@sto.ocn,$2) para @@ -576,7 +588,10 @@ module SiSU_ODF format_text=OD_format::Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote + if para =~// \ + and para =~/^(-\{{2}~\d+|)/ # -endnote + para='' + end if (para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/) # i don't get the condition for no paranum end @@ -627,7 +642,9 @@ module SiSU_ODF %{#@br} else '' end - breakpage=if @md.pagenew or @md.pagebreak; ' fo:break-before="page"' + breakpage=if @md.pagenew \ + or @md.pagebreak + ' fo:break-before="page"' else '' end @@odf[:head]<<%{#@br} + -- cgit v1.2.3