diff options
Diffstat (limited to 'lib/sisu/v0/xml_tables.rb')
-rw-r--r-- | lib/sisu/v0/xml_tables.rb | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/lib/sisu/v0/xml_tables.rb b/lib/sisu/v0/xml_tables.rb index 1e08f3eb..98eab515 100644 --- a/lib/sisu/v0/xml_tables.rb +++ b/lib/sisu/v0/xml_tables.rb @@ -88,43 +88,43 @@ module SiSU_Tables m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/u - if @parablock =~/<!Th?¡/u - @parablock.gsub!(/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/u, + @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u, %{\n<ocn>#@ocn</ocn><table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}) end - if @parablock =~/<!TZ!>/ + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] #bug table footers need rethink, removed for now @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - @parablock.gsub!(/<!TZ!>\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>/,"</table>\n") # + - @parablock.gsub!(/<!TZ!>\s*/,"</table>\n") + @parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,"</table>\n") # + + @parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}\s*/,"</table>\n") end if @@tablehead == 1 - if @parablock =~/¡¡/u - @parablock.gsub!(/<!¡¡(\d+?)¡/u, + if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{<tr> <td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}<b>}) - @parablock.gsub!(/¡¡(\d+?)¡/u, + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{</b></td><td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}<b>}) - @parablock.gsub!(/!>/,"</b>\n</td>\n</tr>") + @parablock.gsub!(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>") @@tablehead=0 end @parablock else - @parablock.gsub!(/<!¡¡(\d+?)¡/u, + @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{<tr> <td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/¡¡(\d+?)¡/u, + @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{ </td> <td width="\\1%" valign="top"> #{@vz.paragraph_table_xml}}) - @parablock.gsub!(/!>/,"\n</td>\n</tr>\n") + @parablock.gsub!(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n") end @parablock end @@ -171,39 +171,39 @@ module SiSU_Tables m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock.gsub!(/<!f.+?!>/,'') - @@tablehead=1 if @parablock =~/<!Th¡/u - if @parablock =~/<!Th?¡.+?!~(\d+);\w\d+;\w\d+>/u; @parablock=table_head($1) + @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($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_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @parablock.gsub!(/^#{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 @@ -211,4 +211,5 @@ module SiSU_Tables end end end +__END__ |