Class: Amber::Render::NokogiriTableOfContents
- Inherits:
-
TableOfContents
- Object
- TableOfContents
- Amber::Render::NokogiriTableOfContents
- Defined in:
- lib/amber/render/table_of_contents.rb
Overview
NOKOGIRI TOC
Instance Method Summary collapse
Methods inherited from TableOfContents
Constructor Details
This class inherits a constructor from Amber::Render::TableOfContents
Instance Method Details
#to_html ⇒ Object
137 138 139 140 |
# File 'lib/amber/render/table_of_contents.rb', line 137 def to_html super @nokogiri_doc.to_html.gsub(/(<h\d.*?>)\n/, '\1').gsub(/\n(<\/h\d.*?>)/, '\1') end |
#to_toc ⇒ Object
142 143 144 145 146 147 |
# File 'lib/amber/render/table_of_contents.rb', line 142 def to_toc super ul = Nokogiri::XML::Node.new(@options[:tag], Nokogiri::HTML.fragment("")) @toc.populate_node(ul, @options) ul.to_pretty_html end |