class Rote::Filters::TOC::Heading
An individual Heading
in the links
array.
Attributes
attrs[RW]
The information held by this link
tag[RW]
The information held by this link
title[RW]
The information held by this link
Public Class Methods
new(tag, title, attrs = {})
click to toggle source
# File lib/rote/filters/toc.rb 29 def initialize(tag, title, attrs = {}) 30 @tag = tag 31 @title = title 32 @attrs = attrs 33 end
Public Instance Methods
anchor()
click to toggle source
# File lib/rote/filters/toc.rb 38 def anchor 39 title.downcase.gsub(/<[^>]+>/,'').gsub(/[^a-z]+/,'_') 40 end
to_s()
click to toggle source
# File lib/rote/filters/toc.rb 42 def to_s 43 %Q[<a #{"#{(attrs.collect { |k,v| "#{k}='#{v}'" }).join(' ')} " unless attrs.empty?}href='##{anchor}'>#{title}</a>] 44 end