]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
use err facility when logging errors to syslog
[ikiwiki.git] / IkiWiki.pm
index c272a294e9e912e6be2b7d6e5093795b069118bc..b56c628014944f6b06783621d668c7e394964bda 100644 (file)
@@ -152,7 +152,7 @@ sub error ($;$) { #{{{
                print misctemplate(gettext("Error"),
                        "<p>".gettext("Error").": $message</p>");
        }
-       log_message(debug => $message) if $config{syslog};
+       log_message('err' => $message) if $config{syslog};
        if (defined $cleaner) {
                $cleaner->();
        }
@@ -177,7 +177,7 @@ sub log_message ($$) { #{{{
                }
                eval {
                        Sys::Syslog::syslog($type, "%s", join(" ", @_));
-               }
+               };
        }
        elsif (! $config{cgi}) {
                print "@_\n";
@@ -549,8 +549,14 @@ sub linkify ($$$) { #{{{
 
        $content =~ s{(\\?)$config{wiki_link_regexp}}{
                defined $2
-                       ? ( $1 ? "[[$2|$3]]" : htmllink($lpage, $page, linkpage($3), anchor => $4, linktext => pagetitle($2)))
-                       : ( $1 ? "[[$3]]"    : htmllink($lpage, $page, linkpage($3), anchor => $4))
+                       ? ( $1 
+                               ? "[[$2|$3".($4 ? "#$4" : "")."]]" 
+                               : htmllink($lpage, $page, linkpage($3),
+                                       anchor => $4, linktext => pagetitle($2)))
+                       : ( $1 
+                               ? "[[$3".($4 ? "#$4" : "")."]]"
+                               : htmllink($lpage, $page, linkpage($3),
+                                       anchor => $4))
        }eg;
        
        return $content;
@@ -1027,6 +1033,7 @@ sub match_link ($$$) { #{{{
        my $links = $IkiWiki::links{$page} or return undef;
        return 0 unless @$links;
        my $bestlink = IkiWiki::bestlink($from, $link);
+       return 0 unless length $bestlink;
        foreach my $p (@$links) {
                return 1 if $bestlink eq IkiWiki::bestlink($page, $p);
        }