]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/more.pm
linkmap, pagestats: avoid using %links to get a list of pages
[git.ikiwiki.info.git] / IkiWiki / Plugin / more.pm
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);
13 }
15 sub getsetup () {
16         return
17                 plugin => {
18                         safe => 1,
19                         rebuild => undef,
20                 },
21 }
23 sub preprocess (@) {
24         my %params=@_;
26         $params{linktext} = $linktext unless defined $params{linktext};
28         if ($params{page} ne $params{destpage}) {
29                 return "\n".
30                         htmllink($params{page}, $params{destpage}, $params{page},
31                                 linktext => $params{linktext},
32                                 anchor => "more");
33         }
34         else {
35                 $params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
36                         IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
37                 return "<a name=\"more\"></a>\n\n".$params{text};
38         }
39 }
41 1