aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/more.pm
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin/more.pm')
-rw-r--r--IkiWiki/Plugin/more.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/more.pm b/IkiWiki/Plugin/more.pm
new file mode 100644
index 000000000..dae3728ba
--- /dev/null
+++ b/IkiWiki/Plugin/more.pm
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+package IkiWiki::Plugin::more;
+
+use warnings;
+use strict;
+use IkiWiki;
+
+my $linktext = gettext("more");
+
+sub import { #{{{
+ hook(type => "preprocess", id => "more", call => \&preprocess);
+} # }}}
+
+sub preprocess (@) { #{{{
+ my %params=@_;
+
+ $params{linktext} = $linktext unless defined $params{linktext};
+
+ if ($params{page} ne $params{destpage}) {
+ return "\n".
+ htmllink($params{page}, $params{destpage}, $params{page},
+ linktext => $params{linktext},
+ anchor => "more");
+ }
+ else {
+ $params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
+ IkiWiki::filter($params{page}, $params{text}));
+ return "<a name=\"more\"></a>\n\n".$params{text};
+ }
+}
+
+1