]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/more.pm
fix web reversion when the srcdir is in a subdir of the git repo.
[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                         section => "widget",
21                 },
22 }
24 sub preprocess (@) {
25         my %params=@_;
27         $params{linktext} = $linktext unless defined $params{linktext};
29         if ($params{page} ne $params{destpage}) {
30                 return "\n".
31                         htmllink($params{page}, $params{destpage}, $params{page},
32                                 linktext => $params{linktext},
33                                 anchor => "more");
34         }
35         else {
36                 return "<a name=\"more\"></a>\n\n".
37                         IkiWiki::preprocess($params{page}, $params{destpage},
38                                 $params{text});
39         }
40 }
42 1