Correction : plugin IkiWiki parentlinks_fixed.pm.
authorJulien Moutinho <julm@cyclocoop.org>
Wed, 24 Sep 2014 15:07:49 +0000 (17:07 +0200)
committerJulien Moutinho <julm@cyclocoop.org>
Wed, 24 Sep 2014 15:07:49 +0000 (17:07 +0200)
.ikiwiki/lib/IkiWiki/Plugin/parentlinks.pm [deleted file]
.ikiwiki/lib/IkiWiki/Plugin/parentlinks_fixed.pm [new file with mode: 0644]
ikiwiki.setup

diff --git a/.ikiwiki/lib/IkiWiki/Plugin/parentlinks.pm b/.ikiwiki/lib/IkiWiki/Plugin/parentlinks.pm
deleted file mode 100644 (file)
index 9f16dd0..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/perl
-# Ikiwiki parentlinks plugin.
-package IkiWiki::Plugin::parentlinks;
-
-use warnings;
-use strict;
-use IkiWiki 3.00;
-
-sub import {
-       hook(type => "parentlinks", id => "parentlinks", call => \&parentlinks);
-       hook(type => "pagetemplate", id => "parentlinks", call => \&pagetemplate);
-       hook(type => "getsetup", id => "parentlinks", call => \&getsetup);
-}
-
-sub getsetup () {
-       return 
-               plugin => {
-                       safe => 1,
-                       rebuild => 1,
-                       section => "core",
-               },
-}
-
-sub parentlinks ($) {
-       my $page=shift;
-
-       if (! length $page) {
-               # dynamic page
-               return {
-                       url => IkiWiki::baseurl(undef),
-                       page => $config{wikiname},
-               };
-       }
-
-       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(bestlink($page, $path), $page),
-                       page => $title,
-                       depth => $depth,
-                       height => $height,
-                       "depth_$depth" => 1,
-                       "height_$height" => 1,
-               };
-               $path.="/".$dir;
-               $title=pagetitle($dir);
-               $i++;
-       }
-       return @ret;
-}
-
-sub pagetemplate (@) {
-       my %params=@_;
-        my $template=$params{template};
-
-       if ($template->query(name => "parentlinks") ||
-           $template->query(name => "has_parentlinks")) {
-               my @links=parentlinks($params{page});
-               $template->param(parentlinks => \@links);
-               $template->param(has_parentlinks => (@links > 0));
-       }
-}
-
-1
diff --git a/.ikiwiki/lib/IkiWiki/Plugin/parentlinks_fixed.pm b/.ikiwiki/lib/IkiWiki/Plugin/parentlinks_fixed.pm
new file mode 100644 (file)
index 0000000..e95b259
--- /dev/null
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+# Ikiwiki parentlinks plugin.
+package IkiWiki::Plugin::parentlinks_fixed;
+
+use warnings;
+use strict;
+use IkiWiki 3.00;
+
+sub import {
+       hook(type => "parentlinks", id => "parentlinks_fixed", call => \&parentlinks);
+       hook(type => "pagetemplate", id => "parentlinks_fixed", call => \&pagetemplate);
+       hook(type => "getsetup", id => "parentlinks_fixed", call => \&getsetup);
+}
+
+sub getsetup () {
+       return 
+               plugin => {
+                       safe => 1,
+                       rebuild => 1,
+                       section => "core",
+               },
+}
+
+sub parentlinks ($$) {
+       my $page=shift;
+       my $destpage=shift;
+
+       if (! length $page) {
+               # dynamic page
+               return {
+                       url => IkiWiki::baseurl(undef),
+                       page => $config{wikiname},
+               };
+       }
+
+       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(bestlink($destpage, $path), $destpage),
+                       page => $title,
+                       depth => $depth,
+                       height => $height,
+                       "depth_$depth" => 1,
+                       "height_$height" => 1,
+               };
+               $path.="/".$dir;
+               $title=pagetitle($dir);
+               $i++;
+       }
+       return @ret;
+}
+
+sub pagetemplate (@) {
+       my %params=@_;
+        my $template=$params{template};
+
+       if ($template->query(name => "parentlinks") ||
+           $template->query(name => "has_parentlinks")) {
+               my @links=parentlinks($params{page}, $params{destpage});
+               $template->param(parentlinks => \@links);
+               $template->param(has_parentlinks => (@links > 0));
+       }
+}
+
+1
index a71d4c5..e23d544 100644 (file)
@@ -97,6 +97,7 @@ BEGIN {
        %setup_args =
         ( ENV => {}
         , account_creation_password => $account_creation_password
+        , default_plugins => []
         , add_plugins => [qw{
                 404
                 action
@@ -104,8 +105,10 @@ BEGIN {
                 attachment
                 brokenlinks
                 comments
+                conditional
                 cutpaste
                 editdiff
+                editpage
                 events
                 favicon
                 img
@@ -113,15 +116,19 @@ BEGIN {
                 link
                 linkmap
                 map
+                mdwn
+                meta
                 moderatedcomments
                 orphans
                 pagecount
                 pagestats
                 pagetemplate
+                parentlinks_fixed
                 passwordauth
                 poll
                 progress
                 recentchanges
+                recentchanges
                 recentchangesdiff
                 remove
                 rename
@@ -129,6 +136,7 @@ BEGIN {
                 search
                 sidebar2
                 signinedit
+                signinedit
                 table
                 tag
                 template
@@ -178,6 +186,7 @@ BEGIN {
                        Tania
                        tania
                        Thai
+                       Thomas
                        Thong
                        Tilman
                        tilman
@@ -239,6 +248,7 @@ BEGIN {
                 lockedit
                 more
                 openid
+                parentlinks
                 po
                 prettydate
                 shortcut