diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-11-09 15:31:57 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-11-09 15:31:57 -0500 |
commit | 7f80e52543891690e3136855bc29917e6b431aba (patch) | |
tree | 6c041065f96d607803f9d1f4a17f12cfa61e5312 /IkiWiki.pm | |
parent | d552b2843020283b019729caf588f2e60b3a5396 (diff) |
Fix the link() pagespec to match links that are internally recorded as absolute.
This fixes a problem exposed by the recent change to tags
(a2839de9362187b67b0e3a564461e272e64fd9b4). That recorded tag links as
absolute by including a leading slash in the link. The same could also be
done with an absolute wikilink.
In either case, link() would not match such links, unless the leading slash
was included in the link to match. But that's not right, because pagespecs
match absolute by default. So strip the leading slash.
Note that to keep any existing `link(/foo)` pagespecs working after this
change, the leading slash is removed from there, too.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 1aaa4d33c..dc9b66344 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1901,6 +1901,10 @@ sub match_link ($$;@) { #{{{ else { return IkiWiki::SuccessReason->new("$page links to page $p matching $link") if match_glob($p, $link, %params); + $p=~s/^\///; + $link=~s/^\///; + return IkiWiki::SuccessReason->new("$page links to page $p matching $link") + if match_glob($p, $link, %params); } } return IkiWiki::FailReason->new("$page does not link to $link"); |