]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/orphans.pm
revert exposing of %backlinks and $backlinks_calculated
[git.ikiwiki.info.git] / IkiWiki / Plugin / orphans.pm
index 0f96b9397445ea6f15b4b82cd2bded46143f6aaf..605e6e43ada79398afe07d1c7c07393612eeca6d 100644 (file)
@@ -4,13 +4,22 @@ package IkiWiki::Plugin::orphans;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 
 
-sub import { #{{{
+sub import {
+       hook(type => "getsetup", id => "orphans", call => \&getsetup);
        hook(type => "preprocess", id => "orphans", call => \&preprocess);
        hook(type => "preprocess", id => "orphans", call => \&preprocess);
-} # }}}
+}
 
 
-sub preprocess (@) { #{{{
+sub getsetup () {
+       return 
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+}
+
+sub preprocess (@) {
        my %params=@_;
        $params{pages}="*" unless defined $params{pages};
        
        my %params=@_;
        $params{pages}="*" unless defined $params{pages};
        
@@ -34,7 +43,7 @@ sub preprocess (@) { #{{{
                next if grep { 
                        length $_ &&
                        ($_ !~ /\/\Q$discussion\E$/i || ! $config{discussion}) &&
                next if grep { 
                        length $_ &&
                        ($_ !~ /\/\Q$discussion\E$/i || ! $config{discussion}) &&
-                       bestlink($page, $_) !~ /^($page|)$/ 
+                       bestlink($page, $_) !~ /^(\Q$page\E|)$/ 
                } @{$links{$page}};
                push @orphans, $page;
        }
                } @{$links{$page}};
                push @orphans, $page;
        }
@@ -49,6 +58,6 @@ sub preprocess (@) { #{{{
                                "</li>"
                        } sort @orphans).
                "</ul>\n";
                                "</li>"
                        } sort @orphans).
                "</ul>\n";
-} # }}}
+}
 
 1
 
 1