aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/odf.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2008-05-10 12:07:29 -0400
committerRalph Amissah <ralph@amissah.com>2008-05-10 12:07:29 -0400
commit34cee0148a445bcee5e97997575b7323df0a02b9 (patch)
tree5f2a1a7618b0484d6a5620ccaa80906412a3e486 /lib/sisu/v0/odf.rb
parentsyenv updates, mostly sql related (diff)
introduced particulars (rename later) for commonly used document and environment details, and cleaned up some requires
Diffstat (limited to 'lib/sisu/v0/odf.rb')
-rw-r--r--lib/sisu/v0/odf.rb42
1 files changed, 19 insertions, 23 deletions
diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb
index 12c84ac3..1883bdba 100644
--- a/lib/sisu/v0/odf.rb
+++ b/lib/sisu/v0/odf.rb
@@ -59,13 +59,14 @@
=end
module SiSU_ODF
+ require "#{SiSU_lib}/particulars"
+ include SiSU_Particulars
require "#{SiSU_lib}/dal"
require "#{SiSU_lib}/sysenv"
include SiSU_Env
- include SiSU_Param
include SiSU_Viz
require "#{SiSU_lib}/odf_format"
- include OD_format
+ include SiSU_ODF_format
require "#{SiSU_lib}/shared_txt"
@@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0
class Source
@@ -75,12 +76,12 @@ module SiSU_ODF
include FileUtils
def initialize(opt)
@opt=opt
+ @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
@@endnotes_para=[]
end
def read
begin
- @md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array
@env.odf_structure
opendoc=@md.fn[:odf]
path=@env.path.output_tell
@@ -92,8 +93,7 @@ module SiSU_ODF
tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{opendoc}")
tell.flow if @opt.cmd =~/[MV]/
my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_ODF::Source::Scroll.new(@dal_array,@md).songsheet
+ SiSU_ODF::Source::Scroll.new(@particulars).songsheet
SiSU_Env::Info_skin.new(@md).select
rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
ensure
@@ -103,7 +103,7 @@ module SiSU_ODF
class Split_text_object <Source
require "#{SiSU_lib}/odf_format"
include SiSU_Viz
- include OD_format
+ include SiSU_ODF_format
@@dp=nil
@@alt_id_count=0
attr_reader :format,:lev,:text,:ocn,:lev_para_ocn
@@ -142,9 +142,9 @@ module SiSU_ODF
end
format=@format.dup
@lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
- OD_format::Format_text_object.new(format,@text,@ocn)
+ SiSU_ODF_format::Format_text_object.new(format,@text,@ocn)
else
- OD_format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>")
+ SiSU_ODF_format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>")
end
self
end
@@ -156,9 +156,8 @@ module SiSU_ODF
@@odf={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] }
@@docstart=true
@@fns,@@dp=nil,nil
- def initialize(data='',md='')
- @data,@md=data,md
- @env=SiSU_Env::Info_env.new(@md.fns)
+ def initialize(particulars)
+ @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
@vz=SiSU_Env::Get_init.instance.skin
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
@regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
@@ -171,7 +170,7 @@ module SiSU_ODF
end
def songsheet
pre
- @data=markup(@data)
+ @data=markup(@dal_array)
post
publish
end
@@ -406,7 +405,7 @@ module SiSU_ODF
end
def table(para) #
if para =~/<!Th?.+/ # tables come as single block
- table=OD_format::Table.new(@md,para)
+ table=SiSU_ODF_format::Table.new(@md,para)
para=table.table_split
end
end
@@ -544,7 +543,7 @@ module SiSU_ODF
if para !~/(^0~|<ENDNOTES>|<EOF>)/
if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change
paranum=para[@regx,3]
- @p_num=OD_format::Paragraph_number.new(paranum)
+ @p_num=SiSU_ODF_format::Paragraph_number.new(paranum)
end
@sto=Split_text_object.new(para).lev_segname_para_ocn
#<office:annotation><dc:date>yyyy-mm-ddT00:00:00</dc:date><text:p>#{ocn}</text:p></office:annotation> #followed immediately by paragraph closure
@@ -592,7 +591,7 @@ module SiSU_ODF
end
elsif para =~/(.*)<!#!>(.*)/
one,two=$1,$2
- format_text=OD_format::Format_text_object.new(one,two)
+ format_text=SiSU_ODF_format::Format_text_object.new(one,two)
para=format_text.seg_no_paranum
end
if para =~/<a name="n\d+">/ \
@@ -604,7 +603,7 @@ module SiSU_ODF
end
if para =~/<:center>/
one,two=/(.*)<:center>(.*)/.match(para)[1,2]
- format_text=OD_format::Format_text_object.new(one,two)
+ format_text=SiSU_ODF_format::Format_text_object.new(one,two)
para=format_text.center
end
else
@@ -706,16 +705,13 @@ module SiSU_ODF
content << @@odf[:metadata]
#content << @@odf[:owner_details] if @md.stmp =~/\w+/ #not used?
content << @@odf[:tail]
- Output.new(content,@md).odf
+ Output.new(content,@md,@env).odf
@@odf[:head],@@odf[:body],@@odf[:tail],@@odf[:metadata]=[],[],[],[]
end
end
class Output <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(content,md)
- @content,@md=content,md
- @env=SiSU_Env::Info_env.new(@md.fns)
+ def initialize(content,md,env)
+ @content,@md,@env=content,md,env
end
def odf #%odf output
SiSU_Env::SiSU_file.new(@md).mkdir