From f31e286f4a73c5c0f355512b0cb45c6c82088516 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 22 Jun 2013 01:13:46 -0400 Subject: v5: general code cleaning * propagate back to v4 after testing --- lib/sisu/v5/odf.rb | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'lib/sisu/v5/odf.rb') diff --git a/lib/sisu/v5/odf.rb b/lib/sisu/v5/odf.rb index 671cc350..281bd7a4 100644 --- a/lib/sisu/v5/odf.rb +++ b/lib/sisu/v5/odf.rb @@ -164,22 +164,13 @@ module SiSU_ODF @@odf[:metadata]=SiSU_Metadata::Summary.new(@md).odf.metadata end def odf_tail - generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] - lastdone="Last Generated on: #{Time.now}" - rubyv="Ruby version: #{@md.ruby_version}" - sc=if @md.sc_info - "Source file: #{@md.sc_filename}\nVersion number: #{@md.sc_number}\nVersion date: #{@md.sc_date}\n" - else '' - end - url=@md.fnb - fn=@md.file.base_filename.manifest manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" @@odf[:tail] << %{Available document outputs:
<#{manifest}>
} @@odf[:tail] << %{\nSiSU: <www.jus.uio.no/sisu> and <www.sisudoc.org>} @@odf[:tail] << "\n" end def set_bookmark_tag(dob) - tags=SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob) + SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob) end def heading(dob,p_num) m=/#{$1}/ @@ -205,7 +196,6 @@ module SiSU_ODF dob end def toc(dob,p_num) - m=/#{$1}/ hardspace=(dob.lv =~/[A-C]/i) \ ? '' : '' @@ -216,7 +206,7 @@ module SiSU_ODF dob end def image_src(i) - image_source=if @md.fns =~/\.ss[tm]$/ \ + if @md.fns =~/\.ss[tm]$/ \ and FileTest.file?("#{@env.path.image_source_include}/#{i}") #review @env.path.image_source_include elsif @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ @@ -245,7 +235,7 @@ module SiSU_ODF def image_odf(img) # copy image to od image directory (unless exists) # divide pixel dimension by 37.79485 and retain 3 decimal places - m,u=img[1],img[2] + m=img[1] i=/^(\S+?\.(?:png|jpg|gif))/.match(m).captures.join if m =~/^(\S+?\.(?:png|jpg|gif))/ c=/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/.match(m).captures.join if m =~/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/ w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/ @@ -254,7 +244,6 @@ module SiSU_ODF h=/([0-9]+\.\d{0,3})/.match(h).captures.join w=/([0-9]+\.\d{0,3})/.match(w).captures.join image_source=image_src(i) - pwd=Dir.pwd if image_source if FileTest.file?("#{image_source}/#{i}") FileUtils::cp("#{image_source}/#{i}","#{@env.processing_path.odt}/Pictures/#{i}") @@ -315,7 +304,7 @@ module SiSU_ODF t end def text_link_odf_bookmark(txt,url,trail) - map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map + SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map %{#{txt.strip}#{trail}} end def text_link(dob) @@ -582,7 +571,7 @@ module SiSU_ODF wordlist end def markup(data) # Used for major markup instructions - safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u + #safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u dir=SiSU_Env::InfoEnv.new(@md.fns) dir.path.odt_bld @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]} @@ -590,7 +579,6 @@ module SiSU_ODF (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @odf_contents_close[x]='' } odf_tail #($1,$2) - fix=[] bullet=image_src('bullet_09.png') if bullet if FileTest.file?("#{bullet}/bullet_09.png") @@ -726,13 +714,6 @@ WOK x else '' end - breakpage=if @md.pagenew \ - or @md.pagebreak - ' fo:break-before="page"' - elsif @md.pageline ##fix - '' - else '' - end x=< @@ -753,10 +734,8 @@ WOK def post end def publish - divider='=' content=[] br_pg=' ' - data=@data content << @@odf[:head] << @@odf[:toc] << -- cgit v1.2.3