Class: SiSU_Tables::TableXMLexp
Constant Summary collapse
- @@tablehead =
0
- @@tablefoot =
[]
Instance Method Summary collapse
-
#initialize(one) ⇒ TableXMLexp
constructor
A new instance of TableXMLexp.
- #margin_numless ⇒ Object
- #table ⇒ Object
- #table_cell(inf, h = false) ⇒ Object
- #table_close ⇒ Object
- #table_end(tablefoot = '') ⇒ Object
- #table_head(inf) ⇒ Object
- #table_row(inf, h = false) ⇒ Object
- #table_row_close(h = false) ⇒ Object
Methods inherited from Table
Constructor Details
#initialize(one) ⇒ TableXMLexp
Returns a new instance of TableXMLexp.
175 176 177 |
# File 'lib/sisu/xml_tables.rb', line 175 def initialize(one) @one,@parablock=one,one end |
Instance Method Details
#margin_numless ⇒ Object
182 183 184 |
# File 'lib/sisu/xml_tables.rb', line 182 def margin_numless '</td><td width="4%" align="right" valign="top">' end |
#table ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/sisu/xml_tables.rb', line 213 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]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u @parablock=table_head($1) end if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ @parablock=table_end end end if @@tablehead==1 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=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true)) end if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u @parablock=@parablock.gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true)) end if @parablock =~/#{Mx[:tc_c]}/ @parablock=@parablock.gsub(/#{Mx[:tc_c]}/,table_row_close(true)) end @@tablehead=0 end @parablock else if @parablock =~/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u @parablock=@parablock.gsub(/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1)) end if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u @parablock=@parablock.gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1)) end if @parablock =~/#{Mx[:tc_c]}/ @parablock=@parablock.gsub(/#{Mx[:tc_c]}/,table_row_close) end @parablock end @parablock end |
#table_cell(inf, h = false) ⇒ Object
204 205 206 207 208 |
# File 'lib/sisu/xml_tables.rb', line 204 def table_cell(inf,h=false) if h; %{</b></td><td width="#{inf}%" valign="top"><b>} else %{</td><td width="#{inf}%" valign="top">} end end |
#table_close ⇒ Object
178 179 180 181 |
# File 'lib/sisu/xml_tables.rb', line 178 def table_close '</td></tr> </table>' end |
#table_end(tablefoot = '') ⇒ Object
194 195 196 197 |
# File 'lib/sisu/xml_tables.rb', line 194 def table_end(tablefoot='') %{</table>#{the_margin_numless}#{the_margin_numless} #{the_table_close} #{tablefoot}} end |
#table_head(inf) ⇒ Object
185 186 187 188 189 190 191 192 193 |
# File 'lib/sisu/xml_tables.rb', line 185 def table_head(inf) %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> <tr> <td valign="top" align="justify"> <a name="#{inf}"></a> </td> <td> <table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">} end |
#table_row(inf, h = false) ⇒ Object
198 199 200 201 202 203 |
# File 'lib/sisu/xml_tables.rb', line 198 def table_row(inf,h=false) bold=h ? '<b>' : '' %{ <tr> <td width="#{inf}%" valign="top">#{bold}} end |
#table_row_close(h = false) ⇒ Object
209 210 211 212 |
# File 'lib/sisu/xml_tables.rb', line 209 def table_row_close(h=false) bold_close=h ? '<b>' : '' "#{bold_close}</td></tr>" end |