diff options
Diffstat (limited to 'lib/sisu/v0/odf_format.rb')
-rw-r--r-- | lib/sisu/v0/odf_format.rb | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/lib/sisu/v0/odf_format.rb b/lib/sisu/v0/odf_format.rb index 3a6d0d94..05e4a918 100644 --- a/lib/sisu/v0/odf_format.rb +++ b/lib/sisu/v0/odf_format.rb @@ -81,10 +81,10 @@ module SiSU_ODF_format def initialize(one,two,three) one.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ @one,@two,@three=one,two,three - rgx=/^[1-6-]~/ + rgx=/^#{Mx[:lv_o]}[1-6-]:/ @one.gsub!(rgx,'') if @one =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - rgx=/~\{\d+\s+(.+?)<#@dp>\}~/ + rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/ @one.gsub!(rgx,'\1') if @one =~rgx @link,@linkname=one,two @vz=SiSU_Env::Get_init.instance.skin @@ -178,45 +178,45 @@ module SiSU_ODF_format end def table @parablock='' if @parablock =~/^<!$/ - @parablock.gsub!(/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,'') + @parablock.gsub!(/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/u - @@table_counter+=1 if @parablock =~/<!Th?¡/u - if @parablock =~/<!Th¡\s+c(\d+).+?!~\d+;\w\d+;\w\d+>/u; @parablock=table_head(@@table_counter,$1,true) - elsif @parablock =~/<!T¡\s+c(\d+).+?!~\d+;\w\d+;\w\d+>/u; @parablock=table_head(@@table_counter,$1) + @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + @@table_counter+=1 if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head(@@table_counter,$1,true) + elsif @parablock =~/#{Mx[:gr_o]}T#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head(@@table_counter,$1) end - if @parablock =~/<!TZ!>/ + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~/<!TZ!>/; @parablock=table_end + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end end end if @@tablehead == 1 - if @parablock =~/¡¡/u - if @parablock =~/<!¡¡(\d+?)¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1,true)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true)) end - if @parablock =~/¡¡(\d+?)¡/u - @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1,true)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true)) end - if @parablock =~/!>/ - @parablock.gsub!(/!>/,table_row_close(true)) + if @parablock =~/#{Mx[:tc_c]}/ + @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true)) end @@tablehead=0 end @parablock else - if @parablock =~/<!¡¡(\d+?)¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u,table_row($1)) + if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1)) end - if @parablock =~/¡¡(\d+?)¡/u - @parablock.gsub!(/¡¡(\d+?)¡/u,table_cell($1)) + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1)) end - if @parablock =~/!>/ - @parablock.gsub!(/!>/,table_row_close) + if @parablock =~/#{Mx[:tc_c]}/ + @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close) end @parablock end @@ -224,8 +224,12 @@ module SiSU_ODF_format end def table_split @new_content=[] - @one.split(/\s*<!/).each do |parablock| - table=Table.new(@md,"<!#{parablock}") + @one.split(/\s*#{Mx[:tc_o]}/).each do |parablock| + table=if parablock =~/#{Mx[:gr_o]}/ + Table.new(@md,"#{parablock}") + else + Table.new(@md,"#{Mx[:tc_o]}#{parablock}") + end @new_content << table.table end @new_content.join |