]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
po: inject custom isselflink to fix selflink detection on translation pages
authorintrigeri <intrigeri@boum.org>
Sat, 9 Jan 2010 21:54:34 +0000 (22:54 +0100)
committerintrigeri <intrigeri@boum.org>
Sat, 9 Jan 2010 21:54:34 +0000 (22:54 +0100)
IkiWiki/Plugin/po.pm

index 02fc4a89edee391eae291c104d4d3ef113e74e8c..bbbb3b870ad5d31db565349a185174824879d025 100644 (file)
@@ -63,6 +63,8 @@ sub import {
        inject(name => "IkiWiki::cgiurl", call => \&mycgiurl);
        $origsubs{'rootpage'}=\&IkiWiki::rootpage;
        inject(name => "IkiWiki::rootpage", call => \&myrootpage);
+       $origsubs{'isselflink'}=\&IkiWiki::isselflink;
+       inject(name => "IkiWiki::isselflink", call => \&myisselflink);
 }
 
 
@@ -671,6 +673,17 @@ sub myrootpage (@) {
        return $rootpage;
 }
 
+sub myisselflink ($$) {
+       my $page=shift;
+       my $link=shift;
+
+       return 1 if $origsubs{'isselflink'}->($page, $link);
+       if (istranslation($page)) {
+               return $origsubs{'isselflink'}->(masterpage($page), $link);
+        }
+       return;
+}
+
 # ,----
 # | Blackboxes for private data
 # `----