summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-06-07 23:45:40 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-06-07 23:45:40 -0400
commitf6b47b0d1c67228f13242864a50827b40abb320c (patch)
treeb825d44967a245c6fc03bfacb882ed1a18769e61
parentd258793c3f56dd71a5f39d87145b5c198ba8af4f (diff)
img: Support captions.
-rw-r--r--IkiWiki/Plugin/img.pm15
-rw-r--r--debian/changelog6
-rw-r--r--doc/plugins/img.mdwn3
-rw-r--r--doc/style.css6
-rw-r--r--po/ikiwiki.pot29
5 files changed, 43 insertions, 16 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;
}
diff --git a/debian/changelog b/debian/changelog
index 0bfec3b67..8b777bf95 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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.
diff --git a/doc/plugins/img.mdwn b/doc/plugins/img.mdwn
index b5eef148f..a4661f1a8 100644
--- a/doc/plugins/img.mdwn
+++ b/doc/plugins/img.mdwn
@@ -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
diff --git a/doc/style.css b/doc/style.css
index f9a69c4f1..b98507991 100644
--- a/doc/style.css
+++ b/doc/style.css
@@ -53,6 +53,12 @@ div.tags {
text-decoration: none;
}
+.img caption {
+ font-size: 80%;
+ caption-side: bottom;
+ text-align: center;
+}
+
#backlinks {
margin-top: 1em;
}
diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot
index e4bb7b6f5..2660729e3 100644
--- a/po/ikiwiki.pot
+++ b/po/ikiwiki.pot
@@ -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 ""