Sha256: 0fcd160e9835c748ae6c48dc9435319d84d46142536c6fdddb0e1c7368f9485f
Contents?: true
Size: 649 Bytes
Versions: 5
Compression:
Stored size: 649 Bytes
Contents
# frozen_string_literal: true module Kitabu module TOC class HTML class Stream attr_accessor :listener, :content attr_reader :html def initialize(content, listener) @content = content @listener = listener @html = Nokogiri::HTML.parse(content) end def parse traverse(html) end def traverse(node) node.children.each do |child| emit(child) traverse(child) end end def emit(node) listener.tag(node) if /h[1-6]/.match?(node.name) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems