aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/odf.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-04-19 21:29:58 -0400
committerRalph Amissah <ralph@amissah.com>2011-04-19 21:29:58 -0400
commitf330953381476d47deaecfdd209fed0264ace190 (patch)
tree00b5d064057fd0cba8ce07de5342589df82e2dcd /lib/sisu/v3/odf.rb
parentv2 v3: options, -M / --maintenance, new alias --keep-processing-files (diff)
v3: odf:odt processing in separate subdirectories
* processing in separate subdirectories that can be kept for maintenance * odt.zip (bin) directory renamed odt from odf * sysenv, odf:odt paths adjusted for changes in maintenance & odt.zip
Diffstat (limited to 'lib/sisu/v3/odf.rb')
-rw-r--r--lib/sisu/v3/odf.rb36
1 files changed, 24 insertions, 12 deletions
diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb
index c14a6c91..894052d6 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}" \
@@ -116,10 +114,20 @@ module SiSU_ODF
#@br=(@md.cmd =~/M/) ? "\n" : ''
end
def songsheet
- pre
- @data=markup(@dal_array)
- post
- publish
+ begin
+ pre
+ @data=markup(@dal_array)
+ post
+ publish
+ ensure
+ unless @md.cmd =~/[MV]/ #check maintenance flag
+ if @env.processing_path.odt =~/od[ft]/
+ #p "rm -r #{@env.processing_path.odt}" if @md.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='')
@@ -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,7 +516,9 @@ 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
@@ -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|