lib/amber/render/table_of_contents.rb
def to_html(options={})
      html   = []
      tag    = options[:tag]
      indent = options[:indent] || 0
      str    = options[:indent_str] || "  "
      html << '%s<%s>' % [(str*indent), tag]
      @children.each do |item|
        html << '%s<li>' % (str*(indent+1))
        html << '%s<a href="%s#%s">%s</a>' % [str*(indent+2), options[:href_base], item.anchor, item.text]
        if item.children.any?
          html << item.to_html({
            :indent => indent+2,
            :indent_str => str,
            :tag => tag,
            :href_base => options[:href_base]
          })
        end
        html << '%s</li>' % (str*(indent+1))
      end
      html << '%s</%s>' % [(str*indent), tag]
      html.join("\n")
    end
def to_html(options={})
      html   = []
      tag    = options[:tag]
      indent = options[:indent] || 0
      str    = options[:indent_str] || "  "
      html << '%s<%s>' % [(str*indent), tag]
      @children.each do |item|
        html << '%s<li>' % (str*(indent+1))
        html << '%s<a href="%s#%s">%s</a>' % [str*(indent+2), options[:href_base], item.anchor, item.text]
        if item.children.any?
          html << item.to_html({
            :indent => indent+2,
            :indent_str => str,
            :tag => tag,
            :href_base => options[:href_base]
          })
        end
        html << '%s</li>' % (str*(indent+1))
      end
      html << '%s</%s>' % [(str*indent), tag]
      html.join("\n")
    end
generates html string from this toc