summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-06-18 15:34:48 +0100
committerJoey Hess <joey@gnu.kitenet.net>2009-08-15 13:50:34 -0400
commite0bb9675ce349c02fce1e835b5aaa6601d4254d2 (patch)
tree32a1ec5a94ec211e2de8d5463cbf943bf41c9f81 /IkiWiki/Plugin
parent3e086c84a2f826c77322a5dabdff1277eeb7152c (diff)
img: depend on absolute page name, not relative
Previously, [[!img bar.jpg]] on foo, where foo/bar.jpg exists, would get a dependency equivalent to "glob(bar.jpg)" (which might not match anything), rather than the correct "glob(foo/bar.jpg)". (cherry picked from commit 85b2ec49ecd12dd23e5c432933457a72744ce7cb)
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/img.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index 68b001671..5f97e3810 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -135,11 +135,15 @@ sub preprocess (@) {
elsif ($params{link} =~ /^\w+:\/\//) {
$imgtag='<a href="'.$params{link}.'">'.$imgtag.'</a>';
}
- elsif (length bestlink($params{page}, $params{link})) {
- add_depends($params{page}, $params{link});
- $imgtag=htmllink($params{page}, $params{destpage},
- $params{link}, linktext => $imgtag,
- noimageinline => 1);
+ else {
+ my $b = bestlink($params{page}, $params{link});
+
+ if (length $b) {
+ add_depends($params{page}, $b);
+ $imgtag=htmllink($params{page}, $params{destpage},
+ $params{link}, linktext => $imgtag,
+ noimageinline => 1);
+ }
}
if (exists $params{caption}) {