From: W. Trevor King Date: Mon, 4 Oct 2010 18:42:47 +0000 (-0400) Subject: Updated linktoimgonly.pm to use htmllink(). X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d9086481c3a42a2bcbe6f6ae5ec0bb82a9eb16cc;p=ikiwiki.git 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]] --- 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