require "gollum/descendant_tree/version" require "gollum/descendant_tree/tree_builder" require "gollum/descendant_tree/tree_renderer" module Gollum module DescendantTree def self.included(base) base.class_eval do alias_method :render_without_descendant_tree, :render alias_method :render, :render_with_descendant_tree end end def render_with_descendant_tree (no_follow = false, encoding = nil) data = render_without_descendant_tree(no_follow, encoding) tree_builder = Gollum::DescendantTree::TreeBuilder.new(@wiki, @name, @dir) tree = tree_builder.tree tree_renderer = Gollum::DescendantTree::TreeRenderer.new #[[_TREE_]] is already rendered from Markup.render data.gsub(rendered_tree_link, tree_renderer.render(tree)) end private def rendered_tree_link '_TREE_' end end end