Class: Gollum::Macro::GlobalTOC

Inherits:
Gollum::Macro show all
Defined in:
lib/gollum-lib/macro/global_toc.rb

Instance Method Summary collapse

Methods inherited from Gollum::Macro

#initialize, instance

Constructor Details

This class inherits a constructor from Gollum::Macro

Instance Method Details

#render(title = "Global Table of Contents") ⇒ Object



4
5
6
7
8
9
# File 'lib/gollum-lib/macro/global_toc.rb', line 4

def render(title = "Global Table of Contents")
  if @wiki.pages.size > 0
    result = '<ul>' + @wiki.pages.map { |p| "<li><a href=\"/#{p.url_path}\">#{p.url_path_display}</a></li>" }.join + '</ul>'
  end
  "<div class=\"toc\"><div class=\"toc-title\">#{title}</div>#{result}</div>"
end