Sha256: 10cd7e1aab4300612361bdce951f5bc6f4b4a2a1bbf08f9b1c3e465fea8065da
Contents?: true
Size: 904 Bytes
Versions: 2
Compression:
Stored size: 904 Bytes
Contents
module Gollum class Macro class Navigation < Gollum::Macro def render(title = "Navigate this directory", toc_root_path = ::File.dirname(@page.url_path), full_path = false) pages = @wiki.pages if pages.size > 0 prepath=@wiki.base_path.sub(/\/$/, '') list_items = pages.map do |page| if toc_root_path == '.' || page.url_path =~ /^#{toc_root_path}\// path_display = (full_path || toc_root_path == '.') ? page.url_path : page.url_path.sub(/^#{toc_root_path}\//,"").sub(/^\//,'') "<li><a href=\"#{CGI::escapeHTML(prepath + "/" + page.escaped_url_path)}\">#{CGI::escapeHTML(path_display)}</a></li>" end end result = "<ul>#{list_items.join}</ul>" end "<div class=\"toc\"><div class=\"toc-title\">#{CGI::escapeHTML(title)}</div>#{result}</div>" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gollum-lib-5.1.2-java | lib/gollum-lib/macro/navigation.rb |
gollum-lib-5.1.2 | lib/gollum-lib/macro/navigation.rb |