From 6d46257531b1384a3bff974e039b70f7a45c3ecc Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 15 Oct 2011 13:57:29 -0400 Subject: v2 v3: odf:odt v1.0: make odt header easier to track; remove binary blob * make odt header changes easier to track (this commit maintains rough equivalence to sisu-3.1.0 headers) * sysenv, builds odf:odt directory structure instead of binary blob * get rid of odf:odt (binary changeset) blob zipfile (containing odf:odt directory structure) --- lib/sisu/v3/odf.rb | 163 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 66 deletions(-) (limited to 'lib/sisu/v3/odf.rb') diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index 1919fa08..e268b873 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -81,7 +81,6 @@ module SiSU_ODF def read begin @md,@env,@dal_array=@particulars.md,@particulars.env,@particulars.dal_array - @env.odf_structure unless @opt.cmd =~/q/ tool=(@opt.cmd =~/[MVv]/) \ ? "#{@env.program.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}" @@ -515,6 +514,7 @@ module SiSU_ODF def markup(data) # Used for major markup instructions safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u dir=SiSU_Env::Info_env.new(@md.fns) + dir.path.odt_bld @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]} @rcdc=false (0..6).each { |x| @cont[x]=@level[x]=false } @@ -611,30 +611,35 @@ module SiSU_ODF end def pre table=if @md.flag_tables - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + x=< + + + + + + + + + + + + + + + + + + + + + + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x else '' end breakpage=if @md.pagenew \ @@ -642,45 +647,50 @@ module SiSU_ODF ' fo:break-before="page"' else '' end - @@odf[:head]<<%{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{table}#{@br}} + - %{#{@br}} + - %{#{@br}} + # P1 - %{#{@br}} + # P1 - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + # P1 - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{#{@br}} + - %{} + x=< + + + +#{table} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + @@odf[:head] << x end def post end @@ -704,6 +714,27 @@ module SiSU_ODF def odf #%odf output env=SiSU_Env::SiSU_file.new(@md) env.mkdir + header=SiSU_ODF_format::ODT_head_1_0.new(@md) + filename="#{@env.processing_path.odt}/META-INF/manifest.xml" + od=File.new(filename,'w+') + od << header.meta_inf_manifest_xml + od.close + filename="#{@env.processing_path.odt}/meta.xml" + od=File.new(filename,'w+') + od << header.meta_xml + od.close + filename="#{@env.processing_path.odt}/settings.xml" + od=File.new(filename,'w+') + od << header.settings_xml + od.close + filename="#{@env.processing_path.odt}/styles.xml" + od=File.new(filename,'w+') + od << header.styles_xml + od.close + filename="#{@env.processing_path.odt}/mimetype" + od=File.new(filename,'w+') + od << header.mimetype + od.close env.make_path(@env.processing_path.odt) env.make_path(@md.file.output_path.odt.dir) filename="#{@env.processing_path.odt}/content.xml" @@ -714,9 +745,9 @@ module SiSU_ODF od.close opendoc=@md.fn[:odf] mkdir_p(@md.file.output_path.odt.dir) unless FileTest.directory?(@md.file.output_path.odt.dir) - if FileTest.directory?(@env.processing_path.odf) + if FileTest.directory?(@env.processing_path.odt) pwd=Dir.pwd - Dir.chdir(@env.processing_path.odf) + Dir.chdir(@env.processing_path.odt) system(" zip -qr #{opendoc} * mv #{opendoc} #{@md.file.place_file.odt.dir} -- cgit v1.2.3