From 622b866f3ee3d3b5fe76f913559a0afae66af001 Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 22 Sep 2007 16:46:27 +0000 Subject: [PATCH] * img: Allow link=somepage to cause the image to link to a given page. Slight overriding of link, as link=no is still used to disable the linking entirely. Unless you have a page named "no".. --- IkiWiki/Plugin/img.pm | 4 ++++ debian/changelog | 5 ++++- doc/plugins/img.mdwn | 4 ++-- doc/plugins/img/discussion.mdwn | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index c4e4a6f22..14a32f635 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -106,6 +106,10 @@ sub preprocess (@) { #{{{ if (! defined $params{link} || lc($params{link}) eq 'yes') { return ''.$imgtag.''; } + elsif (length bestlink($params{page}, $params{link})) { + return htmllink($params{page}, $params{destpage}, + $params{link}, linktext => $imgtag); + } else { return $imgtag; } diff --git a/debian/changelog b/debian/changelog index 377bb41b8..6935ccced 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,8 +9,11 @@ ikiwiki (2.9) UNRELEASED; urgency=low are not included in the map. Include special styling for such pages. * map: Remove common prefixes and don't over-indent. * Add class option to htmllink(). + * img: Allow link=somepage to cause the image to link to a given page. + Slight overriding of link, as link=no is still used to disable the linking + entirely. Unless you have a page named "no".. - -- Joey Hess Sat, 22 Sep 2007 12:31:22 -0400 + -- Joey Hess Sat, 22 Sep 2007 12:36:37 -0400 ikiwiki (2.8) unstable; urgency=low diff --git a/doc/plugins/img.mdwn b/doc/plugins/img.mdwn index 63006443a..5d93e90c5 100644 --- a/doc/plugins/img.mdwn +++ b/doc/plugins/img.mdwn @@ -27,8 +27,8 @@ You can also pass `alt`, `class` and `id` parameters. These are passed through unchanged to the html img tag. The `link` parameter is used to control whether the scaled down image links -to the full size version. By default it does; set "link=no" to disable -this. +to the full size version. By default it does; set "link=somepage" to link +to another page instead, or "link=no" to disable the link. You can also set default values that will be applied to all later images on the page, unless overridden. Useful when including many images on a page. diff --git a/doc/plugins/img/discussion.mdwn b/doc/plugins/img/discussion.mdwn index c6e6d3336..c8a536327 100644 --- a/doc/plugins/img/discussion.mdwn +++ b/doc/plugins/img/discussion.mdwn @@ -4,3 +4,4 @@ on I'd like to have the logo link to \[[hurd/logo]] / instead of linking to the PNG image file. --[[tschwinge]] +> Done, use link=somepage --[[Joey]] -- 2.26.2