Module: Org::ToToc
- Defined in:
- lib/org/to/toc.rb
Constant Summary collapse
- TOC_ENTRIES =
[:header]
Instance Method Summary collapse
Instance Method Details
#to_toc ⇒ Object
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_id ⇒ Object
47 48 49 |
# File 'lib/org/to/toc.rb', line 47 def toc_id values[1].gsub(/\W/, '-').squeeze('-').downcase end |
#toc_link ⇒ Object
43 44 45 |
# File 'lib/org/to/toc.rb', line 43 def toc_link tag(:a, values[1], :href => "##{toc_id}") end |