Class: Raf::Table

Inherits:
Element show all
Defined in:
lib/raf2html_element.rb

Instance Method Summary collapse

Methods inherited from Element

#inline_parse_to_str, #newline_to_br

Instance Method Details

#applyObject



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/raf2html_element.rb', line 116

def apply
  str = %[<table class="table table-hover">]
  @contents.each do |line|
    str += "\n<tr>"
    line.each do |item|
      if item =~ /^\s*\*/
        str += "<th>#{item.sub(/^\s*\*/, "").sub(/\*\s*$/,"")}</th>"
      else
        str += "<td>#{item}</td>"
      end
    end
    str += "\n</tr>"
  end
  str += "\n</table>"
  str
end