diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-05-30 19:54:08 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-05-30 19:54:08 +0000 |
commit | 66cb6baf4e205886bfbac8d90d1adc2b791102a2 (patch) | |
tree | 6e31c5bb419eb56c487fa89839835f94860e2625 /IkiWiki.pm | |
parent | 866cdd7c4a4e268f9e4528a8df80b44950c7adb3 (diff) | |
download | ikiwiki-66cb6baf4e205886bfbac8d90d1adc2b791102a2.tar ikiwiki-66cb6baf4e205886bfbac8d90d1adc2b791102a2.tar.gz |
* Apply a patch from Carl Worth adding support for using globs in link()
in a PageSpec.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 761160eca..8143f5256 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -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"); } #}}} |