From 08c69d074001507d64cd5960c8679ec91a5a8353 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 23 Aug 2008 12:01:59 -0400 Subject: pass Hash to Format classes; some match tuning in dal --- lib/sisu/v0/shared_structure.rb | 43 ++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'lib/sisu/v0/shared_structure.rb') diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb index cdfe9bf3..47b8ff0d 100644 --- a/lib/sisu/v0/shared_structure.rb +++ b/lib/sisu/v0/shared_structure.rb @@ -70,6 +70,7 @@ module SiSU_Structure @format,@ocn='ordinary','ordinary' #@format,@ocn=nil,nil @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern + @id_block="#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" end def lev_segname_para_ocn if @para =~/^#{Mx[:lv_o]}\d:.+?#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -94,7 +95,7 @@ module SiSU_Structure if @para !~/#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06 @text=@para[/(.+?)/m,1] end - if @para[/^#{Mx[:lv_o]}(\d):\S*?#{Mx[:lv_c]}\s+(.+)/m] + if @para[/^#{Mx[:lv_o]}(\d):\S*?#{Mx[:lv_c]}\s*(.+)/m] @format,@text=$1,$2 end end @@ -104,14 +105,16 @@ module SiSU_Structure def html_seg lev_segname_para_ocn @seg_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] - SiSU_HTML_Format::Format_seg.new(@md,@format,@text,@ocn) + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_HTML_Format::Format_seg.new(@md,txt_obj) end self end def html_scroll lev_segname_para_ocn @scroll_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] - SiSU_HTML_Format::Format_scroll.new(@md,@format,@text,@ocn) + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_HTML_Format::Format_scroll.new(@md,txt_obj) end self end @@ -119,18 +122,24 @@ module SiSU_Structure require "#{SiSU_lib}/shared_xml" lev_segname_para_ocn @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - SiSU_XML_format::Format_scroll.new(@md,@format,@text,"x#@ocn") + txt_obj={:txt =>@text,:format =>@format,:ocn =>"x#@ocn"} + SiSU_XML_format::Format_scroll.new(@md,txt_obj) else - SiSU_XML_format::Format_scroll.new(@md,@format,@text,"#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + id_block="#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" + txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block} + SiSU_XML_format::Format_scroll.new(@md,txt_obj) end self end def odt lev_segname_para_ocn @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - SiSU_ODF_format::Format_text_object.new(format,@text,@ocn) + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_ODF_format::Format_text_object.new(@md,txt_obj) else - SiSU_ODF_format::Format_text_object.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + id_block="#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" + txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block} + SiSU_ODF_format::Format_text_object.new(@md,txt_obj) end self @@ -139,9 +148,25 @@ module SiSU_Structure lev_segname_para_ocn #format=@format.dup @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - Format::Format_text_object.new(@format,@text,@ocn) + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_Plaintext_format::Format_text_object.new(@md,txt_obj) else - Format::Format_text_object.new(@format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + id_block="#{Mx[:id_o]}~\d+;[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" + txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block} + SiSU_Plaintext_format::Format_text_object.new(@md,txt_obj) + end + self + end + def manpage #check + lev_segname_para_ocn + #format=@format.dup + @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_Manpage_format::Format_text_object.new(@md,txt_obj) + else + id_block="#{Mx[:id_o]}~\d+;[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" + txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block} + SiSU_Manpage_format::Format_text_object.new(@md,txt_obj) end self end -- cgit v1.2.3