Fix support for globbing in tagged() pagespecs.

The linktype check was being done on the relativised link target,
but %typedlinks uses the same link targets as %links, so that didn't work.

I think the bug only appeared when tagbase was not set.

This bugfix also let me factor out the common typedlink checking code.
master
Joey Hess 2010-06-09 14:33:49 -04:00
parent ba9b808c89
commit cdf4292846
3 changed files with 7 additions and 3 deletions

View File

@ -2397,18 +2397,20 @@ sub match_link ($$;@) {
unless $links && @{$links};
my $bestlink = IkiWiki::bestlink($from, $link);
foreach my $p (@{$links}) {
next unless (! defined $linktype || exists $IkiWiki::typedlinks{$page}{$linktype}{$p});
if (length $bestlink) {
if ((!defined $linktype || exists $IkiWiki::typedlinks{$page}{$linktype}{$p}) && $bestlink eq IkiWiki::bestlink($page, $p)) {
if ($bestlink eq IkiWiki::bestlink($page, $p)) {
return IkiWiki::SuccessReason->new("$page links to $link$qualifier", $page => $IkiWiki::DEPEND_LINKS, "" => 1)
}
}
else {
if ((!defined $linktype || exists $IkiWiki::typedlinks{$page}{$linktype}{$p}) && match_glob($p, $link, %params)) {
if (match_glob($p, $link, %params)) {
return IkiWiki::SuccessReason->new("$page links to page $p$qualifier, matching $link", $page => $IkiWiki::DEPEND_LINKS, "" => 1)
}
my ($p_rel)=$p=~/^\/?(.*)/;
$link=~s/^\///;
if ((!defined $linktype || exists $IkiWiki::typedlinks{$page}{$linktype}{$p_rel}) && match_glob($p_rel, $link, %params)) {
if (match_glob($p_rel, $link, %params)) {
return IkiWiki::SuccessReason->new("$page links to page $p_rel$qualifier, matching $link", $page => $IkiWiki::DEPEND_LINKS, "" => 1)
}
}

1
debian/changelog vendored
View File

@ -5,6 +5,7 @@ ikiwiki (3.20100518.3) UNRELEASED; urgency=low
* img: Fill in missing height or width when scaling image.
* Remove example blog tag pages; allow autotag creation to create them
when used.
* Fix support for globbing in tagged() pagespecs.
-- Joey Hess <joeyh@debian.org> Mon, 31 May 2010 20:44:17 -0400

View File

@ -29,4 +29,5 @@ I did not yet do any testing to figure out when this broke.
>> --[[tschwinge]]
>>> Only way I can reproduce something like this is if tagbase is not set.
>>> I have fixed a bug there, see if it works for you?
>>> --[[Joey]]