2 # -*- cperl-indent-level: 8; -*-
3 # Ikiwiki pedigree plugin.
4 package IkiWiki::Plugin::pedigree;
11 hook(type => "pagetemplate", id => "pedigree", call => \&pagetemplate);
14 sub pedigree ($) { #{{{
19 my $title=$config{wikiname};
22 my @pagepath=(split("/", $page));
23 my $pagedepth=@pagepath;
24 foreach my $dir (@pagepath) {
25 next if $dir eq 'index';
27 url => urlto($path, $page),
31 is_second_ancestor => ($i eq 1),
32 is_grand_mother => ($i eq ($pagedepth - 2)),
33 is_mother => ($i eq ($pagedepth - 1)),
36 $title=IkiWiki::pagetitle($dir);
42 sub pagetemplate (@) { #{{{
44 my $page=$params{page};
45 my $template=$params{template};
47 if ($template->query(name => "pedigree")) {
48 $template->param(pedigree => [pedigree($page)]);