Class: Govspeak::HeaderExtractor

Inherits:
Kramdown::Converter::Base
  • Object
show all
Defined in:
lib/govspeak/header_extractor.rb

Instance Method Summary collapse

Instance Method Details

#convert(doc) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/govspeak/header_extractor.rb', line 5

def convert(doc)
  headers = []

  doc.root.children.each do |el|
    if el.type == :header
      headers << build_header(el)
      next
    end

    headers << find_headers(el) if el.type == :html_element
  end

  headers.flatten.compact
end