13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/middleman-listpages/extension.rb', line 13
def list_pages(page=nil, opts={})
opts[:depth] ||= -1
opts[:current_depth] ||= 1
if opts[:depth] > -1
return "" if (opts[:current_depth] > opts[:depth])
end
page ||= sitemap.find_resource_by_destination_path('index.html')
children = filter_children(page.children, opts.slice(:extensions))
if children.empty?
""
else
child_html = children.map do |child|
my_opts = opts.dup
my_opts[:current_depth] += 1
sub_list = list_pages(child, my_opts)
li_for(child, sub_list, my_opts)
end
render('_list', binding)
end
end
|