Class: SiSU_Tables::TableXML
Constant Summary collapse
- @@tablehead =
0
- @@tablefoot =
[]
Instance Method Summary collapse
-
#initialize(one, ocn = '') ⇒ TableXML
constructor
A new instance of TableXML.
- #table ⇒ Object
Methods inherited from Table
Constructor Details
#initialize(one, ocn = '') ⇒ TableXML
Returns a new instance of TableXML.
76 77 78 |
# File 'lib/sisu/xml_tables.rb', line 76 def initialize(one,ocn='') @one,@parablock,@ocn=one,one,ocn end |
Instance Method Details
#table ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/sisu/xml_tables.rb', line 79 def table m=@parablock[/<!f(.+?)!>/,1] @@tablefoot << m if m @parablock=@parablock.gsub(/<!f.+?!>/,'') @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u @parablock=@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 =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] end if @@tablehead==1 if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u @parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{<tr> <td width="\\1%" valign="top"><b>}). gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{</b></td><td width="\\1%" valign="top"><b>}). gsub(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>") @@tablehead=0 end @parablock else @parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{<tr> <td width="\\1%" valign="top">}). gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, %{ </td> <td width="\\1%" valign="top">}). gsub(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n") end @parablock end |