Class: DocParser::HTMLOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/docparser/output/html_output.rb

Overview

The XLSXOutput class generates an HTML file containing a table

See Also:

Instance Attribute Summary

Attributes inherited from Output

#filename, #rowcount

Instance Method Summary collapse

Methods inherited from Output

#add_row, #close, #header=, #initialize

Constructor Details

This class inherits a constructor from DocParser::Output

Instance Method Details


79
80
81
# File 'lib/docparser/output/html_output.rb', line 79

def footer
  @file << HTMLFOOTER.gsub('#COUNT#', @rowcount.to_s)
end

#headerObject


61
62
63
64
65
66
67
# File 'lib/docparser/output/html_output.rb', line 61

def header
  return if @header.nil? || @header.empty?
  @file << '<thead><tr>'
  @file << @header.map { |f| '<th>' + f + '</th>' }.join
  @file << "</tr></thead>\n<tbody>\n"
  @tbody = true
end

#open_fileObject


57
58
59
# File 'lib/docparser/output/html_output.rb', line 57

def open_file
  @file << HTMLHEADER.gsub('#FILENAME#', @filename)
end

#write_row(row) ⇒ Object


69
70
71
72
73
74
75
76
77
# File 'lib/docparser/output/html_output.rb', line 69

def write_row(row)
  unless @tbody
    @file << "<tbody>\n"
    @tbody = true
  end
  @file << '<tr>'
  @file << row.map { |f| '<td>' + CGI.escapeHTML(f.to_s) + '</td>' }.join
  @file << "</tr>\n"
end