From 486f460132434db1eaff92dcadb265011f394bf1 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 15 Jul 2008 16:09:40 +0200 Subject: pedigree rename to parentlinks: renamed files, to start with Signed-off-by: intrigeri --- IkiWiki/Plugin/parentlinks.pm | 55 +++++++++++++++++++++++++++++++++++++++++++ IkiWiki/Plugin/pedigree.pm | 55 ------------------------------------------- 2 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 IkiWiki/Plugin/parentlinks.pm delete mode 100644 IkiWiki/Plugin/pedigree.pm (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/parentlinks.pm b/IkiWiki/Plugin/parentlinks.pm new file mode 100644 index 000000000..eb8bfa83b --- /dev/null +++ b/IkiWiki/Plugin/parentlinks.pm @@ -0,0 +1,55 @@ +#!/usr/bin/perl +# -*- cperl-indent-level: 8; -*- +# Ikiwiki pedigree plugin. +package IkiWiki::Plugin::pedigree; + +use warnings; +use strict; +use IkiWiki 2.00; + +sub import { #{{{ + hook(type => "pagetemplate", id => "pedigree", call => \&pagetemplate); +} # }}} + +sub pedigree ($) { #{{{ + my $page=shift; + + my @ret; + my $path=""; + my $title=$config{wikiname}; + my $i=0; + my $depth=0; + my $height=0; + + my @pagepath=(split("/", $page)); + my $pagedepth=@pagepath; + foreach my $dir (@pagepath) { + next if $dir eq 'index'; + $depth=$i; + $height=($pagedepth - $depth); + push @ret, { + url => urlto($path, $page), + page => $title, + depth => $depth, + height => $height, + "depth_$depth" => 1, + "height_$height" => 1, + }; + $path.="/".$dir; + $title=IkiWiki::pagetitle($dir); + $i++; + } + return @ret; +} #}}} + +sub pagetemplate (@) { #{{{ + my %params=@_; + my $page=$params{page}; + my $template=$params{template}; + + if ($template->query(name => "pedigree")) { + $template->param(pedigree => [pedigree($page)]); + } +} # }}} + +1 diff --git a/IkiWiki/Plugin/pedigree.pm b/IkiWiki/Plugin/pedigree.pm deleted file mode 100644 index eb8bfa83b..000000000 --- a/IkiWiki/Plugin/pedigree.pm +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -# -*- cperl-indent-level: 8; -*- -# Ikiwiki pedigree plugin. -package IkiWiki::Plugin::pedigree; - -use warnings; -use strict; -use IkiWiki 2.00; - -sub import { #{{{ - hook(type => "pagetemplate", id => "pedigree", call => \&pagetemplate); -} # }}} - -sub pedigree ($) { #{{{ - my $page=shift; - - my @ret; - my $path=""; - my $title=$config{wikiname}; - my $i=0; - my $depth=0; - my $height=0; - - my @pagepath=(split("/", $page)); - my $pagedepth=@pagepath; - foreach my $dir (@pagepath) { - next if $dir eq 'index'; - $depth=$i; - $height=($pagedepth - $depth); - push @ret, { - url => urlto($path, $page), - page => $title, - depth => $depth, - height => $height, - "depth_$depth" => 1, - "height_$height" => 1, - }; - $path.="/".$dir; - $title=IkiWiki::pagetitle($dir); - $i++; - } - return @ret; -} #}}} - -sub pagetemplate (@) { #{{{ - my %params=@_; - my $page=$params{page}; - my $template=$params{template}; - - if ($template->query(name => "pedigree")) { - $template->param(pedigree => [pedigree($page)]); - } -} # }}} - -1 -- cgit v1.2.3