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) --- data/doc/sisu/CHANGELOG_v2 | 4 + data/doc/sisu/CHANGELOG_v3 | 4 + data/sisu/v2/odf/odt.zip | Bin 5577 -> 0 bytes data/sisu/v3/odf/odt.zip | Bin 5577 -> 0 bytes lib/sisu/v2/odf.rb | 159 ++++++++++++++++------------ lib/sisu/v2/odf_format.rb | 251 +++++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v2/sysenv.rb | 33 +++--- lib/sisu/v3/odf.rb | 163 +++++++++++++++++------------ lib/sisu/v3/odf_format.rb | 250 ++++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v3/sysenv.rb | 25 +++-- 10 files changed, 737 insertions(+), 152 deletions(-) delete mode 100644 data/sisu/v2/odf/odt.zip delete mode 100644 data/sisu/v3/odf/odt.zip diff --git a/data/doc/sisu/CHANGELOG_v2 b/data/doc/sisu/CHANGELOG_v2 index 4d8064d4..8291cad0 100644 --- a/data/doc/sisu/CHANGELOG_v2 +++ b/data/doc/sisu/CHANGELOG_v2 @@ -16,6 +16,10 @@ Reverse Chronological: http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.1.1 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.1.1-1 + * odf:odt v1.0 + * make odt header changes easier to track + * get rid of (binary changeset) blob + %% 2.9.9 (2011-10-03:40/1) [see 3.1.0.orig.tar.xz] http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.1.0 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.1.0-1 diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index d7f87570..ba08ca73 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.1.orig.tar.xz sisu_3.1.1-1.dsc sisu_3.1.1-1.debian.tar.gz + * odf:odt v1.0 + * make odt header changes easier to track + * get rid of (binary changeset) blob + * manifest, odt url lnk, fix %% 3.1.0.orig.tar.xz (2011-10-03:40/1) diff --git a/data/sisu/v2/odf/odt.zip b/data/sisu/v2/odf/odt.zip deleted file mode 100644 index 47c6008e..00000000 Binary files a/data/sisu/v2/odf/odt.zip and /dev/null differ diff --git a/data/sisu/v3/odf/odt.zip b/data/sisu/v3/odf/odt.zip deleted file mode 100644 index 81df6e6c..00000000 Binary files a/data/sisu/v3/odf/odt.zip and /dev/null differ diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index b6ec4c1b..2880cdfe 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.rb @@ -81,7 +81,6 @@ module SiSU_ODF def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - @env.odf_structure opendoc=@md.fn[:odf] path=@env.path.output_tell unless @opt.cmd =~/q/ @@ -456,6 +455,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.odf_bld @data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]} @rcdc=false (0..6).each { |x| @cont[x]=@level[x]=false } @@ -550,30 +550,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 \ @@ -581,45 +586,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 @@ -642,6 +652,27 @@ module SiSU_ODF end def odf #%odf output SiSU_Env::SiSU_file.new(@md).mkdir + header=SiSU_ODF_format::ODT_head.new(@md) + filename="#{@env.path.odf}/META-INF/manifest.xml" + od=File.new(filename,'w+') + od << header.meta_inf_manifest_xml + od.close + filename="#{@env.path.odf}/meta.xml" + od=File.new(filename,'w+') + od << header.meta_xml + od.close + filename="#{@env.path.odf}/settings.xml" + od=File.new(filename,'w+') + od << header.settings_xml + od.close + filename="#{@env.path.odf}/styles.xml" + od=File.new(filename,'w+') + od << header.styles_xml + od.close + filename="#{@env.path.odf}/mimetype" + od=File.new(filename,'w+') + od << header.mimetype + od.close filename="#{@env.path.odf}/content.xml" od=File.new(filename,'w+') @content.each do |para| # this is a hack diff --git a/lib/sisu/v2/odf_format.rb b/lib/sisu/v2/odf_format.rb index 77b5bbbc..1b5f2e9b 100644 --- a/lib/sisu/v2/odf_format.rb +++ b/lib/sisu/v2/odf_format.rb @@ -197,6 +197,257 @@ module SiSU_ODF_format @dob end end + class ODT_head + def initialize(md) + @md=md + @generator="#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" + end + def meta_inf_manifest_xml + x=< + + + + + + + + + + + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x + end + def meta_xml + x=< + + + #{@generator} + #{@md.generated} + #{@md.generated} + en-US + 4 + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x + end + def settings_xml + x=< + + + + 0 + 0 + 21459 + 22068 + true + false + + + view2 + 3002 + 11008 + 0 + 0 + 21458 + 22066 + 0 + 100 + false + + + + + true + false + 1 + false + 0 + false + false + false + false + true + + true + true + true + + 0 + false + true + true + true + true + false + false + false + true + + + + false + true + false + false + true + false + false + true + true + 0 + false + false + high-resolution + false + true + + true + false + + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x + end + def styles_xml + x=< + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x + end + def mimetype + x=<<\-_&!@%~#\]\[*=$| \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} diff --git a/lib/sisu/v3/odf_format.rb b/lib/sisu/v3/odf_format.rb index 8736d7d1..7a9b267d 100644 --- a/lib/sisu/v3/odf_format.rb +++ b/lib/sisu/v3/odf_format.rb @@ -200,6 +200,256 @@ module SiSU_ODF_format @dob end end + class ODT_head_1_0 + def initialize(md) + @md=md + @generator="#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" + end + def meta_inf_manifest_xml + x=< + + + + + + + + + + + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x + end + def meta_xml + x=< + + + #{@generator} + #{@md.generated} + #{@md.generated} + en-US + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x + end + def settings_xml + x=< + + + + 0 + 0 + 21459 + 22068 + true + false + + + view2 + 3002 + 11008 + 0 + 0 + 21458 + 22066 + 0 + 100 + false + + + + + true + false + 1 + false + 0 + false + false + false + false + true + + true + true + true + + 0 + false + true + true + true + true + false + false + false + true + + + + false + true + false + false + true + false + false + true + true + 0 + false + false + high-resolution + false + true + + true + false + + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x + end + def styles_xml + x=< + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +WOK + x.strip! + x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ + x + end + def mimetype + x=<