Class: Amber::Render::NokogiriTableOfContents

Inherits:
TableOfContents show all
Defined in:
lib/amber/render/table_of_contents.rb

Overview

NOKOGIRI TOC

Instance Method Summary collapse

Methods inherited from TableOfContents

#initialize

Constructor Details

This class inherits a constructor from Amber::Render::TableOfContents

Instance Method Details

#to_htmlObject



138
139
140
141
# File 'lib/amber/render/table_of_contents.rb', line 138

def to_html
  super
  @nokogiri_doc.to_html.gsub(/(<h\d.*?>)\n/, '\1').gsub(/\n(<\/h\d.*?>)/, '\1')
end

#to_tocObject



143
144
145
146
147
148
# File 'lib/amber/render/table_of_contents.rb', line 143

def to_toc
  super
  ul = Nokogiri::XML::Node.new(@options[:tag], Nokogiri::HTML.fragment(""))
  @toc.populate_node(ul, @options)
  ul.to_pretty_html
end