move userlink to IkiWiki.pm
[ikiwiki.git] / IkiWiki / Plugin / more.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::more;
3
4 use warnings;
5 use strict;
6 use IkiWiki 2.00;
7
8 my $linktext = gettext("more");
9
10 sub import { #{{{
11         hook(type => "preprocess",  id => "more", call => \&preprocess);
12 } # }}}
13
14 sub preprocess (@) { #{{{
15         my %params=@_;
16
17         $params{linktext} = $linktext unless defined $params{linktext};
18
19         if ($params{page} ne $params{destpage}) {
20                 return "\n".
21                         htmllink($params{page}, $params{destpage}, $params{page},
22                                 linktext => $params{linktext},
23                                 anchor => "more");
24         }
25         else {
26                 $params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
27                         IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
28                 return "<a name=\"more\"></a>\n\n".$params{text};
29         }
30 }
31
32 1