=begin This file can be used to (e.g.): - alter certain inner parts of Gollum, - extend it with your stuff. It is especially useful for customizing supported formats/markups. For more information and examples: - https://github.com/gollum/gollum#config-file =end module Gollum class Macro class ImmediatePages < Gollum::Macro def render(toc_root_path = nil, max_depth = 1, min_depth = 0) if toc_root_path == nil if @page.path == "Home.md" toc_root_path = "" else toc_root_path = @page.path.sub(/\.[a-z]+$/,'/') end end if toc_root_path.start_with?("/") toc_root_path[0] = '' end if toc_root_path != "" and not toc_root_path.end_with?("/") toc_root_path << '/' end if @wiki.pages.size > 0 list_items = @wiki.pages.map do |page| if @page.url_path != page.url_path and page.url_path.start_with?(toc_root_path) path_display = page.url_path_display.sub(toc_root_path.gsub("-", " "), "").sub(/^\//,'') depth = path_display.count("/") if depth.to_i < max_depth.to_i and depth.to_i >= min_depth.to_i "
  • #{path_display}
  • " end end end result = "" end title = toc_root_path "
    #{title}
    #{result}
    " end end class PathSegments < Gollum::Macro def render(append = "") segments = @page.path.split('/') segments = segments.first(segments.size - 1) if append != "" segments << append end full = "" list_items = segments.map do |segment| full = "#{full}/#{segment}" " / #{segment}" end list_items.insert(0, " / Home") list_items << " / " "
    #{list_items.join}
    " end end class DropDown < Gollum::Macro def render(summary, detail) "
    #{summary}
    #{detail}
    #{title}