Sha256: 161b43930935f70bf8ed3a21b24a69bbd2e7850fb79288028cc3b311eef806d7

Contents?: true

Size: 345 Bytes

Versions: 42

Compression:

Stored size: 345 Bytes

Contents

module Govspeak
  Header = Struct.new(:text, :level, :id)

  class HeaderExtractor < Kramdown::Converter::Base
    def convert(doc)
      doc.root.children.map do |el|
        if el.type == :header
          Header.new(el.options[:raw_text], el.options[:level], generate_id(el.options[:raw_text]))
        end
      end.compact
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
govspeak-0.8.6 lib/govspeak/header_extractor.rb
govspeak-0.8.5 lib/govspeak/header_extractor.rb