response
[ikiwiki.git] / IkiWiki / Plugin / more.pm
blob6880e366df3ad40b9404d915b04c28e4d3e3bfa4
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::more;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 my $linktext = gettext("more");
10 sub import {
11 hook(type => "getsetup", id => "more", call => \&getsetup);
12 hook(type => "preprocess", id => "more", call => \&preprocess);
15 sub getsetup () {
16 return
17 plugin => {
18 safe => 1,
19 rebuild => undef,
20 section => "widget",
24 sub preprocess (@) {
25 my %params=@_;
27 $params{linktext} = $linktext unless defined $params{linktext};
29 if ($params{page} ne $params{destpage} &&
30 (! exists $params{pages} ||
31 pagespec_match($params{destpage}, $params{pages},
32 location => $params{page}))) {
33 return "\n".
34 htmllink($params{page}, $params{destpage}, $params{page},
35 linktext => $params{linktext},
36 anchor => "more");
38 else {
39 return "<a name=\"more\"></a>\n\n".
40 IkiWiki::preprocess($params{page}, $params{destpage},
41 $params{text});