X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/d258793c3f56dd71a5f39d87145b5c198ba8af4f..f6b47b0d1c67228f13242864a50827b40abb320c:/IkiWiki/Plugin/img.pm 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 ''.$imgtag.''; + $imgtag=''.$imgtag.''; } elsif ($params{link} =~ /^\w+:\/\//) { - return ''.$imgtag.''; + $imgtag=''.$imgtag.''; } 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 ''. + ''. + ''. + '
'.$caption.'
'.$imgtag.'
'; + } else { return $imgtag; }