]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
img: depend on absolute page name, not relative
authorsmcv@ <smcv@>
Thu, 18 Jun 2009 14:34:48 +0000 (15:34 +0100)
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sat, 25 Jul 2009 19:53:49 +0000 (20:53 +0100)
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)".

IkiWiki/Plugin/img.pm

index 44d67bd8375057e77d5853ee93cdd7943108ed14..d57c5e4040eafce66ffd3d23b5574c800af998ea 100644 (file)
@@ -134,11 +134,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}) {