]> sipb.mit.edu Git - ikiwiki.git/commitdiff
img: Support captions.
authorJoey Hess <joey@kodama.kitenet.net>
Sun, 8 Jun 2008 03:45:40 +0000 (23:45 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Sun, 8 Jun 2008 03:45:40 +0000 (23:45 -0400)
IkiWiki/Plugin/img.pm
debian/changelog
doc/plugins/img.mdwn
doc/style.css
po/ikiwiki.pot

index abc7e099ace54d78ef33f919ca1ebf6eaa2ad6ba..c4e0fdd8940341c72f2f4dc81f2b07e914f3750b 100644 (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;
        }
index 0bfec3b6742dd657317a0e39be1f6a348d2fa421..8b777bf95be593cc0a4794d53fc28694e03fa4cb 100644 (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.
index b5eef148ffc6e75d3180c411337cfa9836c6592a..a4661f1a84eafe76233efc5e3a543639fd25d1fd 100644 (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
index f9a69c4f15ef4796c6cbe011839e978a1651ce2a..b985079914f9230163a67283465fc9b71ed2b14f 100644 (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;
 }
index e4bb7b6f591ee7ae1d9cfc327e5541c93b713d3a..2660729e33243e8c56c20b8243f94988922b0632 100644 (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 ""