Module: Org::ToToc

Defined in:
lib/org/to/toc.rb

Constant Summary collapse

TOC_ENTRIES =
[:header]

Instance Method Summary collapse

Instance Method Details

#to_tocObject



34
35
36
37
38
39
40
41
# File 'lib/org/to/toc.rb', line 34

def to_toc
  case @name
  when *TOC_ENTRIES
    self
  else
    @childs.map{|child| child.to_toc }
  end
end

#toc_idObject



47
48
49
# File 'lib/org/to/toc.rb', line 47

def toc_id
  values[1].gsub(/\W/, '-').squeeze('-').downcase
end


43
44
45
# File 'lib/org/to/toc.rb', line 43

def toc_link
  tag(:a, values[1], :href => "##{toc_id}")
end