From d9086481c3a42a2bcbe6f6ae5ec0bb82a9eb16cc Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 4 Oct 2010 14:42:47 -0400 Subject: [PATCH] Updated linktoimgonly.pm to use htmllink(). Following Joey's suggestion in doc/forum/link_to_an_image_inside_the_wiki_without_inlining_it.mdwn I also altered the directive syntax: [[!ltio img="image1.jpg"]] is now [[!ltio image1.jpg]] --- IkiWiki/Plugin/linktoimgonly.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/linktoimgonly.pm b/IkiWiki/Plugin/linktoimgonly.pm index 02dcb4a68..a5c7d7f33 100644 --- a/IkiWiki/Plugin/linktoimgonly.pm +++ b/IkiWiki/Plugin/linktoimgonly.pm @@ -11,8 +11,16 @@ sub import { } sub preprocess { - my %params = @_; - return "" . $params{"text"} . ""; + my ($image) = $_[0] =~ /$config{wiki_file_regexp}/; # untaint + my %params=@_; + + if (! defined $image) { + error("bad image filename"); + } + + return htmllink($params{page}, $params{destpage}, $image, + linktext => $params{text}, + noimageinline => 1); } 1 -- 2.26.2