Class: ManBook::HtmlFormatter

Inherits:
Formatter show all
Defined in:
lib/manbook/html_formatter.rb

Instance Method Summary collapse

Methods inherited from Formatter

#initialize

Constructor Details

This class inherits a constructor from ManBook::Formatter

Instance Method Details

#convert(file_name) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/manbook/html_formatter.rb', line 3

def convert(file_name)
  # pipe through gunzip if gzipped
  if man_page_file =~ /\.gz$/
    cmd = "gunzip -c #{man_page_file} | groff -mandoc -T html > #{file_name}"
  else
    cmd = "groff -mandoc #{man_page_file} -T html > #{file_name}"
  end

  ManBook.logger.debug("Executing #{cmd}")
  execute(cmd)
  ManBook.logger.info "Written man page for '#{man_page}' to '#{file_name}'"
end