- elsif (length bestlink($params{page}, $params{link})) {
- return htmllink($params{page}, $params{destpage},
- $params{link}, linktext => $imgtag,
- noimageinline => 1);
+ elsif ($params{link} =~ /^\w+:\/\//) {
+ $link=$params{link};
+ }
+
+ if (defined $link) {
+ $imgtag='<a href="'.$link.'">'.$imgtag.'</a>';
+ }
+ else {
+ my $b = bestlink($params{page}, $params{link});
+
+ if (length $b) {
+ add_depends($params{page}, $b, deptype("presence"));
+ $imgtag=htmllink($params{page}, $params{destpage},
+ $params{link}, linktext => $imgtag,
+ noimageinline => 1,
+ );
+ }
+ }
+
+ if (exists $params{caption}) {
+ return '<table class="img'.
+ (exists $params{align} ? " align-$params{align}" : "").
+ '">'.
+ '<caption>'.$params{caption}.'</caption>'.
+ '<tr><td>'.$imgtag.'</td></tr>'.
+ '</table>';