]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
web commit by TaylorKillian
[ikiwiki.git] / IkiWiki.pm
index 1cfa419b6f614762a580f1e5aa702b4f4ae0d08f..8143f5256d8618b9d5da77ff51e27780a845b6f5 100644 (file)
@@ -643,7 +643,7 @@ sub preprocess ($$$;$$) { #{{{
                        return $ret;
                }
                else {
-                       return "[[$command $params]]";
+                       return "\\[[$command $params]]";
                }
        };
        
@@ -746,9 +746,9 @@ sub loadindex () { #{{{
                        $depends{$page}=$items{depends}[0] if exists $items{depends};
                        $destsources{$_}=$page foreach @{$items{dest}};
                        $renderedfiles{$page}=[@{$items{dest}}];
-                       $oldrenderedfiles{$page}=[@{$items{dest}}];
                        $pagecase{lc $page}=$page;
                }
+               $oldrenderedfiles{$page}=[@{$items{dest}}];
                $pagectime{$page}=$items{ctime}[0];
        }
        close IN;
@@ -1056,8 +1056,8 @@ sub match_glob ($$;@) { #{{{
        
        # relative matching
        if ($glob =~ m!^\./!) {
-               $from=~s!/?[^/]+$!!;
-               $glob=~s!^\./!!;
+               $from=~s#/?[^/]+$##;
+               $glob=~s#^\./##;
                $glob="$from/$glob" if length $from;
        }
 
@@ -1083,18 +1083,23 @@ sub match_link ($$;@) { #{{{
 
        # relative matching
        if ($link =~ m!^\.! && defined $from) {
-               $from=~s!/?[^/]+$!!;
-               $link=~s!^\./!!;
+               $from=~s#/?[^/]+$##;
+               $link=~s#^\./##;
                $link="$from/$link" if length $from;
        }
 
        my $links = $IkiWiki::links{$page} or return undef;
        return IkiWiki::FailReason->new("$page has no links") unless @$links;
        my $bestlink = IkiWiki::bestlink($from, $link);
-       return IkiWiki::FailReason->new("no such link") unless length $bestlink;
        foreach my $p (@$links) {
-               return IkiWiki::SuccessReason->new("$page links to $link")
-                       if $bestlink eq IkiWiki::bestlink($page, $p);
+               if (length $bestlink) {
+                       return IkiWiki::SuccessReason->new("$page links to $link")
+                               if $bestlink eq IkiWiki::bestlink($page, $p);
+               }
+               else {
+                       return IkiWiki::SuccessReason->new("$page links to page matching $link")
+                               if match_glob($p, $link, %params);
+               }
        }
        return IkiWiki::FailReason->new("$page does not link to $link");
 } #}}}