aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/more.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-20 03:05:47 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-20 03:05:47 +0000
commitfa52a730ff3b30c7d2cdd8cd5f9c8c25a0c0a2a5 (patch)
tree3a4eadd971ccd69bd4037ad3647b6cce64047833 /IkiWiki/Plugin/more.pm
parent2ce6c23f9485d26d443fb5a1f8c5286a5e668625 (diff)
downloadikiwiki-fa52a730ff3b30c7d2cdd8cd5f9c8c25a0c0a2a5.tar
ikiwiki-fa52a730ff3b30c7d2cdd8cd5f9c8c25a0c0a2a5.tar.gz
* Changed calling convention for httmllink slightly. The first three
parameters remain the same, but additional options are now passed in using named parameters. * Change plugin interface version to 1.02 to reflect this change. * Add a new anchor option to htmllink. Thanks Ben for the idea. * Support anchors in wikilinks. * Add a "more" plugin based on one contributed by Ben to allow implementing those dreaded "Read more" links in blogs.
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