Class: Ronn::RoffFilter

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/ronn/roff.rb

Constant Summary

Constants included from Utils

Utils::HTML, Utils::HTML_BLOCK, Utils::HTML_EMPTY, Utils::HTML_INLINE

Instance Method Summary collapse

Methods included from Utils

#block_element?, #child_of?, #empty_element?, #html_element?, #inline_element?

Constructor Details

#initialize(html, name, section, tagline, manual = nil, version = nil, date = nil) ⇒ RoffFilter

Convert Ronn HTML to roff.



9
10
11
12
13
14
15
16
17
# File 'lib/ronn/roff.rb', line 9

def initialize(html, name, section, tagline, manual=nil, version=nil, date=nil)
  @buf = []
  title_heading name, section, tagline, manual, version, date
  doc = Hpricot(html)
  remove_extraneous_elements! doc
  normalize_whitespace! doc
  block_filter doc
  write "\n"
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/ronn/roff.rb', line 19

def to_s
  @buf.join.gsub(/[ \t]+$/, '')
end