diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-04-20 21:10:04 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-04-20 21:10:04 -0400 |
commit | 0f740e9c185b6aaed05e193828545ce7664fdbec (patch) | |
tree | d27e2672ad3a816c743ad65ac3de85e1eb237f46 /lib/sisu/v3/odf.rb | |
parent | debian/changelog (3.0.6-1) (diff) | |
parent | v2 v3: sisu-mode.el, header notes copyright assignment to FSF (GNU EMACS) (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v3/odf.rb')
-rw-r--r-- | lib/sisu/v3/odf.rb | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index c14a6c91..81344d4c 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -82,8 +82,6 @@ module SiSU_ODF begin @md,@env,@dal_array=@particulars.md,@particulars.env,@particulars.dal_array @env.odf_structure - opendoc=@md.fn[:odf] - path=@env.path.output_tell unless @opt.cmd =~/q/ tool=(@opt.cmd =~/[MVv]/) \ ? "#{@env.program.odf_viewer} file://#{@md.file.output_path.odt}/#{@md.file.base_filename.odt}" \ @@ -112,14 +110,24 @@ module SiSU_ODF @vz=SiSU_Env::Get_init.instance.skin @tab="\t" @brace_url=SiSU_Viz::Skin.new.url_decoration - @br=(@md.cmd =~/M/) ? '' : '' - #@br=(@md.cmd =~/M/) ? "\n" : '' + @br=(@md.opt.cmd =~/M/) ? '' : '' + #@br=(@md.opt.cmd =~/M/) ? "\n" : '' end def songsheet - pre - @data=markup(@dal_array) - post - publish + begin + pre + @data=markup(@dal_array) + post + publish + ensure + unless @md.opt.cmd =~/[MV]/ #check maintenance flag + if @env.processing_path.odt =~/od[ft]/ + #p "rm -r #{@env.processing_path.odt}" if @md.opt.cmd =~/v/ + system("rm -r #{@env.processing_path.odf_pth}") + #system("rm -r #{@env.processing_path.odt}") + end + end + end end # Used for extraction of endnotes from paragraphs def extract_endnotes(dob='') @@ -190,7 +198,7 @@ module SiSU_ODF and FileTest.file?("#{@env.path.image_source_include_remote}/#{i}") @env.path.image_source_include_remote else - SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ nil end end @@ -207,7 +215,9 @@ module SiSU_ODF w=/([0-9]+\.\d{0,3})/.match(w).captures.join image_source=image_src(i) pwd=Dir.pwd - cp("#{image_source}/#{i}","#{@env.processing_path.odf}/Pictures/#{i}") if image_source + if image_source + cp("#{image_source}/#{i}","#{@env.processing_path.odt}/Pictures/#{i}") + end img=if i.to_s =~/jpg|png|gif/ \ and h.to_s =~/\d/ \ and w.to_s =~/\d/ @@ -506,10 +516,12 @@ module SiSU_ODF odf_tail #($1,$2) fix=[] bullet=image_src('bullet_09.png') - cp("#{bullet}/bullet_09.png","#{@env.processing_path.odf}/Pictures/.") #if image_src('bullet_09.png') + if bullet + cp("#{bullet}/bullet_09.png","#{@env.processing_path.odt}/Pictures/.") + end odf_metadata data.each do |dob| - #p dob.obj if dob.obj =~safe_characters and @md.cmd =~/V/ #KEEP + #p dob.obj if dob.obj =~safe_characters and @md.opt.cmd =~/V/ #KEEP dob.obj='' if dob.obj =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ #fix Mx[:lv_o] para_array=[] dob.obj.gsub!(/</,'<'); dob.obj.gsub!(/>/,'>') @@ -686,9 +698,9 @@ module SiSU_ODF def odf #%odf output env=SiSU_Env::SiSU_file.new(@md) env.mkdir - env.make_path(@env.processing_path.odf) + env.make_path(@env.processing_path.odt) env.make_path(@md.file.output_path.odt) - filename="#{@env.processing_path.odf}/content.xml" + filename="#{@env.processing_path.odt}/content.xml" od=File.new(filename,'w+') @content.each do |para| # this is a hack od.puts para unless para =~/\A\s*\Z/ @@ -730,9 +742,9 @@ page break notes?? [you could add a note number for every object/paragraph!] - cd(@env.processing_path.odf) + cd(@env.processing_path.odt) structure=[] - Find.find(@env.processing_path.odf) do |f| + Find.find(@env.processing_path.odt) do |f| structure << puts f end open(opendoc,'wb') do |f| |