Sha256: 384de07ce7c0661093076f290ce6d219ef380d3f7e2888e0296cd6a9920c4414
Contents?: true
Size: 717 Bytes
Versions: 11
Compression:
Stored size: 717 Bytes
Contents
module Gollum class Macro class Navigation < Gollum::Macro def render(title = "Navigate in the TOC", toc_root_path = ::File.dirname(@page.path), full_path = false) if @wiki.pages.size > 0 list_items = @wiki.pages.map do |page| if page.url_path.start_with?(toc_root_path) path_display = full_path ? page.url_path_display : page.url_path_display.sub(toc_root_path,"").sub(/^\//,'') "<li><a href=\"/#{page.url_path}\">#{path_display}</a></li>" end end result = "<ul>#{list_items.join}</ul>" end "<div class=\"toc\"><div class=\"toc-title\">#{title}</div>#{result}</div>" end end end end
Version data entries
11 entries across 11 versions & 1 rubygems