]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Render.pm
IkiWiki::Render: split out backlink_pages() function from backlinks()
[ikiwiki.git] / IkiWiki / Render.pm
index ba1d1eae5705e156fe65baac158170300a3de8c5..6900d5eedc8dc5408e323f4888e8ef8c966965f5 100644 (file)
@@ -24,13 +24,19 @@ sub calculate_backlinks () {
        $backlinks_calculated=1;
 }
 
-sub backlinks ($) {
+sub backlink_pages ($) {
        my $page=shift;
 
        calculate_backlinks();
 
+       return keys %{$backlinks{$page}};
+}
+
+sub backlinks ($) {
+       my $page=shift;
+
        my @links;
-       foreach my $p (keys %{$backlinks{$page}}) {
+       foreach my $p (backlink_pages($page)) {
                my $href=urlto($p, $page);
                 
                # Trim common dir prefixes from both pages.
@@ -65,7 +71,8 @@ sub genpage ($$) {
        if (length $config{cgiurl}) {
                $template->param(editurl => cgiurl(do => "edit", page => $page))
                        if IkiWiki->can("cgi_editpage");
-               $template->param(prefsurl => cgiurl(do => "prefs"));
+               $template->param(prefsurl => cgiurl(do => "prefs"))
+                       if exists $hooks{auth};
                $actions++;
        }
                
@@ -146,7 +153,7 @@ sub scan ($) {
                if ($config{discussion}) {
                        # Discussion links are a special case since they're
                        # not in the text of the page, but on its template.
-                       $links{$page}=[ $page."/".gettext("discussion") ];
+                       $links{$page}=[ $page."/".lc(gettext("Discussion")) ];
                }
                else {
                        $links{$page}=[];