aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/img.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index abc7e099a..c4e0fdd89 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -23,12 +23,14 @@ sub preprocess (@) { #{{{
my $size = $params{size} || $imgdefaults{$params{page}}->{size} || 'full';
my $alt = $params{alt} || $imgdefaults{$params{page}}->{alt} || '';
my $title = $params{title} || $imgdefaults{$params{page}}->{title} || '';
+ my $caption = $params{caption} || $imgdefaults{$params{page}}->{caption} || '';
if ($image eq 'defaults') {
$imgdefaults{$params{page}} = {
size => $size,
alt => $alt,
title => $title,
+ caption => $caption,
};
return '';
}
@@ -112,17 +114,24 @@ sub preprocess (@) { #{{{
' />';
if (! defined $params{link} || lc($params{link}) eq 'yes') {
- return '<a href="'.$fileurl.'">'.$imgtag.'</a>';
+ $imgtag='<a href="'.$fileurl.'">'.$imgtag.'</a>';
}
elsif ($params{link} =~ /^\w+:\/\//) {
- return '<a href="'.$params{link}.'">'.$imgtag.'</a>';
+ $imgtag='<a href="'.$params{link}.'">'.$imgtag.'</a>';
}
elsif (length bestlink($params{page}, $params{link})) {
add_depends($params{page}, $params{link});
- return htmllink($params{page}, $params{destpage},
+ $imgtag=htmllink($params{page}, $params{destpage},
$params{link}, linktext => $imgtag,
noimageinline => 1);
}
+
+ if (defined $caption) {
+ return '<table class="img">'.
+ '<caption>'.$caption.'</caption>'.
+ '<tr><td>'.$imgtag.'</td></tr>'.
+ '</table>';
+ }
else {
return $imgtag;
}