class SiSU_Tables::TableXMLexp

Public Class Methods

new(one) click to toggle source
# File lib/sisu/xml_tables.rb, line 175
def initialize(one)
  @one,@parablock=one,one
end

Public Instance Methods

margin_numless() click to toggle source
# File lib/sisu/xml_tables.rb, line 182
def margin_numless
  '</td><td width="4%" align="right" valign="top">'
end
table() click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/sisu/xml_tables.rb, line 178
    def table_close
      '</td></tr>
</table>'
    end
table_end(tablefoot='') click to toggle source
# File lib/sisu/xml_tables.rb, line 194
    def table_end(tablefoot='')
      %{</table>#{the_margin_numless}#{the_margin_numless}&nbsp;#{the_table_close}
#{tablefoot}}
    end
table_head(inf) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/sisu/xml_tables.rb, line 209
def table_row_close(h=false)
  bold_close=h ? '<b>' : ''
  "#{bold_close}</td></tr>"
end