img: Support captions.

master
Joey Hess 2008-06-07 23:45:40 -04:00
parent d258793c3f
commit f6b47b0d1c
5 changed files with 43 additions and 16 deletions

View File

@ -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;
}

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
ikiwiki (2.50) UNRELEASED; urgency=low
* img: Support captions.
-- Joey Hess <joeyh@debian.org> Sat, 07 Jun 2008 23:04:00 -0400
ikiwiki (2.49) unstable; urgency=low
* haiku: Generate valid xhtml.

View File

@ -24,7 +24,8 @@ original image's aspect ratio is always preserved, even if this means
making the image smaller than the specified size.
You can also pass `alt`, `title`, `class` and `id` parameters. These are
passed through unchanged to the html img tag.
passed through unchanged to the html img tag. If you include a `caption`
parameter, the caption will be displayed centered beneath the image.
The `link` parameter is used to control whether the scaled down image links
to the full size version. By default it does; set "link=somepage" to link

View File

@ -53,6 +53,12 @@ div.tags {
text-decoration: none;
}
.img caption {
font-size: 80%;
caption-side: bottom;
text-align: center;
}
#backlinks {
margin-top: 1em;
}

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-06-04 14:36-0400\n"
"POT-Creation-Date: 2008-06-07 23:12-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -148,7 +148,7 @@ msgstr ""
msgid "deleting bucket.."
msgstr ""
#: ../IkiWiki/Plugin/amazon_s3.pm:37 ../IkiWiki/Setup/Standard.pm:86
#: ../IkiWiki/Plugin/amazon_s3.pm:37 ../IkiWiki/Setup/Standard.pm:89
msgid "done"
msgstr ""
@ -216,23 +216,23 @@ msgstr ""
msgid "prog not a valid graphviz program"
msgstr ""
#: ../IkiWiki/Plugin/img.pm:55
#: ../IkiWiki/Plugin/img.pm:57
#, perl-format
msgid "bad size \"%s\""
msgstr ""
#: ../IkiWiki/Plugin/img.pm:65 ../IkiWiki/Plugin/img.pm:69
#: ../IkiWiki/Plugin/img.pm:86
#: ../IkiWiki/Plugin/img.pm:67 ../IkiWiki/Plugin/img.pm:71
#: ../IkiWiki/Plugin/img.pm:88
#, perl-format
msgid "failed to read %s: %s"
msgstr ""
#: ../IkiWiki/Plugin/img.pm:72
#: ../IkiWiki/Plugin/img.pm:74
#, perl-format
msgid "failed to resize: %s"
msgstr ""
#: ../IkiWiki/Plugin/img.pm:103
#: ../IkiWiki/Plugin/img.pm:105
#, perl-format
msgid "failed to determine size of image %s"
msgstr ""
@ -463,11 +463,11 @@ msgstr ""
msgid "at noon on %A"
msgstr ""
#: ../IkiWiki/Plugin/recentchanges.pm:82
#: ../IkiWiki/Plugin/recentchanges.pm:76
msgid "missing page"
msgstr ""
#: ../IkiWiki/Plugin/recentchanges.pm:84
#: ../IkiWiki/Plugin/recentchanges.pm:78
#, perl-format
msgid "The page %s does not exist."
msgstr ""
@ -481,7 +481,12 @@ msgstr ""
msgid "Must specify %s when using the search plugin"
msgstr ""
#: ../IkiWiki/Plugin/search.pm:33
#: ../IkiWiki/Plugin/search.pm:164
#, perl-format
msgid "need Digest::SHA1 to index %s"
msgstr ""
#: ../IkiWiki/Plugin/search.pm:197
msgid "search"
msgstr ""
@ -647,11 +652,11 @@ msgstr ""
msgid "generating wrappers.."
msgstr ""
#: ../IkiWiki/Setup/Standard.pm:76
#: ../IkiWiki/Setup/Standard.pm:79
msgid "rebuilding wiki.."
msgstr ""
#: ../IkiWiki/Setup/Standard.pm:79
#: ../IkiWiki/Setup/Standard.pm:82
msgid "refreshing wiki.."
msgstr ""