Object
# File lib/rt/rtparser.rb, line 91 def blocks [@config_line, @header_line, @body_line] end
# File lib/rt/rtparser.rb, line 185 def calc_span(tbl) return if tbl.empty? cols = tbl[0].length tbl.each do |row| row.each_with_index do |elm, j| case elm when String when RTCell nspan = 1 1.upto(cols-j-1) do |k| break unless row[j+k] == config['colspan'] nspan += 1 end row[j].colspan = nspan else raise "[BUG] invalid cell" end end end rows = tbl.length 0.upto(cols-1) do |j| 0.upto(rows-1) do |i| case tbl[i][j] when String when RTCell nspan = 1 1.upto(rows-i-1) do |k| break unless tbl[i+k][j] == config['rowspan'] nspan += 1 end tbl[i][j].rowspan = nspan else raise "[BUG] invalid cell" end end end end
# File lib/rt/rtparser.rb, line 95 def make_blocks(str = @str) part = str.split(/\n\n/).collect{|x| x.split(/\n/)} case part.length when 0 when 1 @body_line, = part when 2 @config_line, @body_line = part when 3 @config_line, @header_line, @body_line = part else raise "RT: blocks are too many." end self end
# File lib/rt/rtparser.rb, line 75 def normalize_linefeed!(str) str.gsub!("\r\n", "\n") str.gsub!("\r", "\n") end
# File lib/rt/rtparser.rb, line 178 def parse_body(lines = @body_line) @body = parse_table_data(lines) {|x| _make_cell x, nil } self end
Generated with the Darkfish Rdoc Generator 2.