From: Joey Hess Date: Wed, 9 Jun 2010 18:33:49 +0000 (-0400) Subject: Fix support for globbing in tagged() pagespecs. X-Git-Tag: 3.20100610~28 X-Git-Url: http://git.tremily.us/?p=ikiwiki.git;a=commitdiff_plain;h=cdf4292846e6fe0fb877809ef0906ff6bddf6bf9 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. --- diff --git a/IkiWiki.pm b/IkiWiki.pm index e2a3d216f..27fa4ca17 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -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) } } diff --git a/debian/changelog b/debian/changelog index a0ea9c156..38beca395 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Mon, 31 May 2010 20:44:17 -0400 diff --git a/doc/bugs/pagespec:_tagged__40____41____44___globbing.mdwn b/doc/bugs/pagespec:_tagged__40____41____44___globbing.mdwn index 9a55c0673..fba332949 100644 --- a/doc/bugs/pagespec:_tagged__40____41____44___globbing.mdwn +++ b/doc/bugs/pagespec:_tagged__40____41____44___globbing.mdwn @@ -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]]