diff options
Diffstat (limited to 'lib/sisu/v0/shared_structure.rb')
-rw-r--r-- | lib/sisu/v0/shared_structure.rb | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb index f7b78e0e..47b8ff0d 100644 --- a/lib/sisu/v0/shared_structure.rb +++ b/lib/sisu/v0/shared_structure.rb @@ -9,8 +9,7 @@ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, - 2008 Ralph Amissah All Rights Reserved. + 2007, 2008 Ralph Amissah All Rights Reserved. * License: GPL 3 or later: @@ -63,14 +62,15 @@ module SiSU_Structure class Split_text_object include SiSU_Viz - #include SiSU_HTML_Format_type + #include SiSU_HTML_Format @@dp=nil attr_reader :format,:text,:ocn,:scroll_lev_para_ocn,:seg_lev_para_ocn,:lev_para_ocn def initialize(md,para) @md,@para=md,para - @format,@ocn='null','null' + @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]}$/ @@ -95,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 @@ -105,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_type::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_type::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 @@ -120,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 @@ -140,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 |