Added Javier Rojas' linktoimgonly.pm plugin.
authorJavier Rojas <jerojasro@devnull.li>
Mon, 4 Oct 2010 18:20:09 +0000 (14:20 -0400)
committerW. Trevor King <wking@tremily.us>
Sun, 13 Jan 2013 12:08:52 +0000 (07:08 -0500)
From
  http://devnull.li/~jerojasro/files/linktoimgonly.pm

IkiWiki/Plugin/linktoimgonly.pm [new file with mode: 0644]

diff --git a/IkiWiki/Plugin/linktoimgonly.pm b/IkiWiki/Plugin/linktoimgonly.pm
new file mode 100644 (file)
index 0000000..02dcb4a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+
+package IkiWiki::Plugin::linktoimgonly;
+
+use warnings;
+use strict;
+use IkiWiki 3.00;
+
+sub import {
+    hook(type => "preprocess", id => "ltio", call => \&preprocess);
+}
+
+sub preprocess {
+    my %params = @_;
+    return "<a href='" . bestlink($params{"page"}, $params{"img"}) . "'>" . $params{"text"} . "</a>";
+}
+
+1